Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xdb5C9aC6089d6CcA205F54eE19BD151E419cAc63
Balance 0 ETH
Nonce 1
Code Size 11536 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

11536 bytes
0x608060405234801561000f575f80fd5b5060043610610213575f3560e01c8063672434821161011f578063b6774111116100a9578063c87b56dd11610079578063c87b56dd146104b6578063d007af5c146104c9578063e985e9c5146104d1578063f2fde38b146104e4578063fd762d92146104f7575f80fd5b8063b677411114610468578063b88d4fde1461047b578063ba9187ac1461048e578063be537f43146104a1575f80fd5b80638da5cb5b116100ef5780638da5cb5b1461041657806395d89b41146104275780639d645a441461042f578063a22cb46514610442578063a9fc664e14610455575f80fd5b806367243482146103d25780636c3b8699146103e557806370a08231146103ed578063715018a61461040e575f80fd5b806323b872dd116101a0578063495c8bf911610170578063495c8bf9146103645780635944c753146103795780635d4c1d461461038c57806361347162146103ac5780636352211e146103bf575f80fd5b806323b872dd146102f95780632a55205a1461030c5780632e8da8291461033e57806342842e0e14610351575f80fd5b8063081812fc116101e6578063081812fc1461029a578063095ea7b3146102ad578063098144d4146102c05780631b25b077146102d15780631c33b328146102e4575f80fd5b8063014635461461021757806301ffc9a71461024d57806304634d8d1461027057806306fdde0314610285575b5f80fd5b61023071721c310194ccfc01e523fc93c9cccfa2a0ac81565b6040516001600160a01b0390911681526020015b60405180910390f35b61026061025b36600461214d565b61050a565b6040519015158152602001610244565b61028361027e366004612197565b61051a565b005b61028d610530565b604051610244919061220d565b6102306102a836600461221f565b6105bf565b6102836102bb366004612236565b6105e4565b6006546001600160a01b0316610230565b6102606102df366004612260565b6106fd565b6102ec600181565b60405161024491906122c8565b6102836103073660046122d6565b610792565b61031f61031a366004612314565b6107c3565b604080516001600160a01b039093168352602083019190915201610244565b61026061034c366004612334565b61086d565b61028361035f3660046122d6565b610973565b61036c61098d565b604051610244919061234f565b61028361038736600461239b565b610a97565b610394600181565b6040516001600160781b039091168152602001610244565b6102836103ba3660046123f6565b610aaa565b6102306103cd36600461221f565b610c05565b6102836103e0366004612503565b610c64565b610283610da8565b6104006103fb366004612334565b610e97565b604051908152602001610244565b610283610f1b565b6007546001600160a01b0316610230565b61028d610f2e565b61026061043d366004612334565b610f3d565b6102836104503660046125cc565b611002565b610283610463366004612334565b61100d565b610283610476366004612658565b61112c565b61028361048936600461273b565b6111ed565b61028d61049c36600461221f565b61121f565b6104a96112b6565b60405161024491906127b6565b61028d6104c436600461221f565b61136d565b61036c61140c565b6102606104df3660046127f1565b6114c3565b6102836104f2366004612334565b6114f0565b61028361050536600461281d565b61152d565b5f61051482611622565b92915050565b610522611646565b61052c828261164e565b5050565b60605f805461053e90612876565b80601f016020809104026020016040519081016040528092919081815260200182805461056a90612876565b80156105b55780601f1061058c576101008083540402835291602001916105b5565b820191905f5260205f20905b81548152906001019060200180831161059857829003601f168201915b5050505050905090565b5f6105c9826116a3565b505f908152600460205260409020546001600160a01b031690565b5f6105ee82610c05565b9050806001600160a01b0316836001600160a01b0316036106605760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061067c575061067c81336114c3565b6106ee5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610657565b6106f88383611701565b505050565b6006545f906001600160a01b0316156107875760065460405163050bf71960e31b81526001600160a01b038681166004830152858116602483015284811660448301529091169063285fb8c8906064015f6040518083038186803b158015610763575f80fd5b505afa925050508015610774575060015b61077f57505f61078b565b50600161078b565b5060015b9392505050565b61079c338261176e565b6107b85760405162461bcd60e51b8152600401610657906128ae565b6106f88383836117cc565b5f8281526009602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916108375750604080518082019091526008546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f9061271090610855906001600160601b03168761290f565b61085f9190612926565b915196919550909350505050565b6006545f906001600160a01b03161561096c57600654604051635caaa2a960e11b81523060048201526001600160a01b039091169063d72dde5e90829063b955455290602401606060405180830381865afa1580156108ce573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108f29190612945565b602001516040516001600160e01b031960e084901b1681526001600160781b0390911660048201526001600160a01b03851660248201526044015b602060405180830381865afa158015610948573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061051491906129b5565b505f919050565b6106f883838360405180602001604052805f8152506111ed565b6006546060906001600160a01b031615610a8557600654604051635caaa2a960e11b81523060048201526001600160a01b0390911690633fe5df9990829063b955455290602401606060405180830381865afa1580156109ef573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a139190612945565b602001516040516001600160e01b031960e084901b1681526001600160781b0390911660048201526024015b5f60405180830381865afa158015610a59573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610a8091908101906129d0565b905090565b50604080515f81526020810190915290565b610a9f611646565b6106f8838383611943565b610ab2611646565b5f610ac56006546001600160a01b031690565b90506001600160a01b038116610aee57604051631cffe3dd60e11b815260040160405180910390fd5b604051630368065360e61b81526001600160a01b0382169063da0194c090610b1c9030908890600401612a65565b5f604051808303815f87803b158015610b33575f80fd5b505af1158015610b45573d5f803e3d5ffd5b5050604051631182550160e11b81526001600160a01b0384169250632304aa029150610b779030908790600401612a82565b5f604051808303815f87803b158015610b8e575f80fd5b505af1158015610ba0573d5f803e3d5ffd5b505060405163235d10c560e21b81526001600160a01b0384169250638d7443149150610bd29030908690600401612a82565b5f604051808303815f87803b158015610be9575f80fd5b505af1158015610bfb573d5f803e3d5ffd5b5050505050505050565b5f818152600260205260408120546001600160a01b0316806105145760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610657565b610c6c61199d565b81518151808214610cb85760405162461bcd60e51b815260206004820152601660248201527520b93930bc903632b733ba341036b4b9b6b0ba31b41760511b6044820152606401610657565b5f5b82811015610da1575f600a5f868481518110610cd857610cd8612aa4565b602002602001015181526020019081526020015f208054610cf890612876565b905011610d535760405162461bcd60e51b8152602060048201526024808201527f4f6e65206f6620746865204e465473204d65746164617461206973206e6f742060448201526339b2ba1760e11b6064820152608401610657565b610d8f858281518110610d6857610d68612aa4565b6020026020010151858381518110610d8257610d82612aa4565b60200260200101516119ca565b80610d9981612ab8565b915050610cba565b5050505050565b610db0611646565b610dcb71721c310194ccfc01e523fc93c9cccfa2a0ac61100d565b604051630368065360e61b815271721c310194ccfc01e523fc93c9cccfa2a0ac9063da0194c090610e03903090600190600401612a65565b5f604051808303815f87803b158015610e1a575f80fd5b505af1158015610e2c573d5f803e3d5ffd5b5050604051631182550160e11b815271721c310194ccfc01e523fc93c9cccfa2a0ac9250632304aa029150610e68903090600190600401612a82565b5f604051808303815f87803b158015610e7f575f80fd5b505af1158015610e91573d5f803e3d5ffd5b50505050565b5f6001600160a01b038216610f005760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610657565b506001600160a01b03165f9081526003602052604090205490565b610f2361199d565b610f2c5f6119e3565b565b60606001805461053e90612876565b6006545f906001600160a01b03161561096c57600654604051635caaa2a960e11b81523060048201526001600160a01b0390911690639445f53090829063b955455290602401606060405180830381865afa158015610f9e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fc29190612945565b60409081015190516001600160e01b031960e084901b1681526001600160781b0390911660048201526001600160a01b038516602482015260440161092d565b61052c338383611a34565b611015611646565b5f6001600160a01b0382163b1561108e576040516301ffc9a760e01b81525f60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa925050508015611086575060408051601f3d908101601f19168201909252611083918101906129b5565b60015b1561108e5790505b6001600160a01b038216158015906110a4575080155b156110c2576040516332483afb60e01b815260040160405180910390fd5b600654604080516001600160a01b03928316815291841660208301527fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac910160405180910390a150600680546001600160a01b0319166001600160a01b0392909216919091179055565b61113461199d565b815181518082146111805760405162461bcd60e51b815260206004820152601660248201527520b93930bc903632b733ba341036b4b9b6b0ba31b41760511b6044820152606401610657565b5f5b82811015610da15783818151811061119c5761119c612aa4565b6020026020010151600a5f8784815181106111b9576111b9612aa4565b602002602001015181526020019081526020015f2090816111da9190612b1d565b50806111e581612ab8565b915050611182565b6111f7338361176e565b6112135760405162461bcd60e51b8152600401610657906128ae565b610e9184848484611af9565b600a6020525f90815260409020805461123790612876565b80601f016020809104026020016040519081016040528092919081815260200182805461126390612876565b80156112ae5780601f10611285576101008083540402835291602001916112ae565b820191905f5260205f20905b81548152906001019060200180831161129157829003601f168201915b505050505081565b604080516060810182525f80825260208201819052918101919091526006546001600160a01b03161561134d57600654604051635caaa2a960e11b81523060048201526001600160a01b039091169063b955455290602401606060405180830381865afa158015611329573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a809190612945565b50604080516060810182525f808252602082018190529181019190915290565b5f818152600a6020526040902080546060919061138990612876565b80601f01602080910402602001604051908101604052809291908181526020018280546113b590612876565b80156114005780601f106113d757610100808354040283529160200191611400565b820191905f5260205f20905b8154815290600101906020018083116113e357829003601f168201915b50505050509050919050565b6006546060906001600160a01b031615610a8557600654604051635caaa2a960e11b81523060048201526001600160a01b03909116906317e94a6c90829063b955455290602401606060405180830381865afa15801561146e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114929190612945565b60409081015190516001600160e01b031960e084901b1681526001600160781b039091166004820152602401610a3f565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b6114f861199d565b6001600160a01b03811661152157604051631e4fbdf760e01b81525f6004820152602401610657565b61152a816119e3565b50565b611535611646565b61153e8461100d565b604051630368065360e61b81526001600160a01b0385169063da0194c09061156c9030908790600401612a65565b5f604051808303815f87803b158015611583575f80fd5b505af1158015611595573d5f803e3d5ffd5b5050604051631182550160e11b81526001600160a01b0387169250632304aa0291506115c79030908690600401612a82565b5f604051808303815f87803b1580156115de575f80fd5b505af11580156115f0573d5f803e3d5ffd5b505060405163235d10c560e21b81526001600160a01b0387169250638d7443149150610bd29030908590600401612a82565b5f6001600160e01b0319821663152a902d60e11b1480610514575061051482611b2c565b610f2c61199d565b6116588282611b50565b6040516001600160601b03821681526001600160a01b038316907f8a8bae378cb731c5c40b632330c6836c2f916f48edb967699c86736f9a6a76ef9060200160405180910390a25050565b5f818152600260205260409020546001600160a01b031661152a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610657565b5f81815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061173582610c05565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b5f8061177983610c05565b9050806001600160a01b0316846001600160a01b031614806117a057506117a081856114c3565b806117c45750836001600160a01b03166117b9846105bf565b6001600160a01b0316145b949350505050565b826001600160a01b03166117df82610c05565b6001600160a01b0316146118055760405162461bcd60e51b815260040161065790612bd9565b6001600160a01b0382166118675760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610657565b6118748383836001611bf2565b826001600160a01b031661188782610c05565b6001600160a01b0316146118ad5760405162461bcd60e51b815260040161065790612bd9565b5f81815260046020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526003855283862080545f1901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a46106f88383836001611c18565b61194e838383611c3e565b6040516001600160601b03821681526001600160a01b0383169084907f7f5b076c952c0ec86e5425963c1326dd0f03a3595c19f81d765e8ff559a6e33c906020015b60405180910390a3505050565b6007546001600160a01b03163314610f2c5760405163118cdaa760e01b8152336004820152602401610657565b61052c828260405180602001604052805f815250611cfe565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b816001600160a01b0316836001600160a01b031603611a955760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610657565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101611990565b611b048484846117cc565b611b1084848484611d30565b610e915760405162461bcd60e51b815260040161065790612c1e565b5f6001600160e01b031982166310c8aba560e31b1480610514575061051482611e2d565b6127106001600160601b038216811015611b8f57604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401610657565b6001600160a01b038316611bb857604051635b6cc80560e11b81525f6004820152602401610657565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600855565b5f5b81811015610da157611c108585611c0b8487612c70565b611e7c565b600101611bf4565b5f5b81811015610da157611c368585611c318487612c70565b611ed2565b600101611c1a565b6127106001600160601b038216811015611c845760405163dfd1fc1b60e01b8152600481018590526001600160601b038316602482015260448101829052606401610657565b6001600160a01b038316611cb457604051634b4f842960e11b8152600481018590525f6024820152604401610657565b506040805180820182526001600160a01b0393841681526001600160601b0392831660208083019182525f968752600990529190942093519051909116600160a01b029116179055565b611d088383611f19565b611d145f848484611d30565b6106f85760405162461bcd60e51b815260040161065790612c1e565b5f6001600160a01b0384163b15611e2257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611d73903390899088908890600401612c83565b6020604051808303815f875af1925050508015611dad575060408051601f3d908101601f19168201909252611daa91810190612cbf565b60015b611e08573d808015611dda576040519150601f19603f3d011682016040523d82523d5f602084013e611ddf565b606091505b5080515f03611e005760405162461bcd60e51b815260040161065790612c1e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506117c4565b506001949350505050565b5f6001600160e01b031982166380ac58cd60e01b1480611e5d57506001600160e01b03198216635b5e139f60e01b145b8061051457506301ffc9a760e01b6001600160e01b0319831614610514565b6001600160a01b038381161590831615818015611e965750805b15611eb457604051635cbd944160e01b815260040160405180910390fd5b8115611ec0575b610da1565b80611ebb57610da133868686346120b7565b6001600160a01b038381161590831615818015611eec5750805b15611f0a57604051635cbd944160e01b815260040160405180910390fd5b81611ebb5780611ebb57610da1565b6001600160a01b038216611f6f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610657565b5f818152600260205260409020546001600160a01b031615611fd35760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610657565b611fe05f83836001611bf2565b5f818152600260205260409020546001600160a01b0316156120445760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610657565b6001600160a01b0382165f81815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a461052c5f83836001611c18565b6006546001600160a01b031615610da15760065460405163050bf71960e31b81526001600160a01b038781166004830152868116602483015285811660448301529091169063285fb8c8906064015f6040518083038186803b15801561211b575f80fd5b505afa15801561212d573d5f803e3d5ffd5b505050505050505050565b6001600160e01b03198116811461152a575f80fd5b5f6020828403121561215d575f80fd5b813561078b81612138565b6001600160a01b038116811461152a575f80fd5b80356001600160601b0381168114612192575f80fd5b919050565b5f80604083850312156121a8575f80fd5b82356121b381612168565b91506121c16020840161217c565b90509250929050565b5f81518084525f5b818110156121ee576020818501810151868301820152016121d2565b505f602082860101526020601f19601f83011685010191505092915050565b602081525f61078b60208301846121ca565b5f6020828403121561222f575f80fd5b5035919050565b5f8060408385031215612247575f80fd5b823561225281612168565b946020939093013593505050565b5f805f60608486031215612272575f80fd5b833561227d81612168565b9250602084013561228d81612168565b9150604084013561229d81612168565b809150509250925092565b600781106122c457634e487b7160e01b5f52602160045260245ffd5b9052565b6020810161051482846122a8565b5f805f606084860312156122e8575f80fd5b83356122f381612168565b9250602084013561230381612168565b929592945050506040919091013590565b5f8060408385031215612325575f80fd5b50508035926020909101359150565b5f60208284031215612344575f80fd5b813561078b81612168565b602080825282518282018190525f9190848201906040850190845b8181101561238f5783516001600160a01b03168352928401929184019160010161236a565b50909695505050505050565b5f805f606084860312156123ad575f80fd5b8335925060208401356123bf81612168565b91506123cd6040850161217c565b90509250925092565b6007811061152a575f80fd5b6001600160781b038116811461152a575f80fd5b5f805f60608486031215612408575f80fd5b8335612413816123d6565b92506020840135612423816123e2565b9150604084013561229d816123e2565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561247057612470612433565b604052919050565b5f67ffffffffffffffff82111561249157612491612433565b5060051b60200190565b5f82601f8301126124aa575f80fd5b813560206124bf6124ba83612478565b612447565b82815260059290921b840181019181810190868411156124dd575f80fd5b8286015b848110156124f857803583529183019183016124e1565b509695505050505050565b5f8060408385031215612514575f80fd5b823567ffffffffffffffff8082111561252b575f80fd5b818501915085601f83011261253e575f80fd5b8135602061254e6124ba83612478565b82815260059290921b8401810191818101908984111561256c575f80fd5b948201945b8386101561259357853561258481612168565b82529482019490820190612571565b965050860135925050808211156125a8575f80fd5b506125b58582860161249b565b9150509250929050565b801515811461152a575f80fd5b5f80604083850312156125dd575f80fd5b82356125e881612168565b915060208301356125f8816125bf565b809150509250929050565b5f67ffffffffffffffff83111561261c5761261c612433565b61262f601f8401601f1916602001612447565b9050828152838383011115612642575f80fd5b828260208301375f602084830101529392505050565b5f80604080848603121561266a575f80fd5b833567ffffffffffffffff80821115612681575f80fd5b61268d8783880161249b565b94506020915081860135818111156126a3575f80fd5b8601601f810188136126b3575f80fd5b80356126c16124ba82612478565b81815260059190911b8201840190848101908a8311156126df575f80fd5b8584015b83811015612729578035868111156126fa575f8081fd5b8501603f81018d1361270b575f8081fd5b61271b8d898301358b8401612603565b8452509186019186016126e3565b50809750505050505050509250929050565b5f805f806080858703121561274e575f80fd5b843561275981612168565b9350602085013561276981612168565b925060408501359150606085013567ffffffffffffffff81111561278b575f80fd5b8501601f8101871361279b575f80fd5b6127aa87823560208401612603565b91505092959194509250565b5f6060820190506127c88284516122a8565b60208301516001600160781b038082166020850152806040860151166040850152505092915050565b5f8060408385031215612802575f80fd5b823561280d81612168565b915060208301356125f881612168565b5f805f8060808587031215612830575f80fd5b843561283b81612168565b9350602085013561284b816123d6565b9250604085013561285b816123e2565b9150606085013561286b816123e2565b939692955090935050565b600181811c9082168061288a57607f821691505b6020821081036128a857634e487b7160e01b5f52602260045260245ffd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610514576105146128fb565b5f8261294057634e487b7160e01b5f52601260045260245ffd5b500490565b5f60608284031215612955575f80fd5b6040516060810181811067ffffffffffffffff8211171561297857612978612433565b6040528251612986816123d6565b81526020830151612996816123e2565b602082015260408301516129a9816123e2565b60408201529392505050565b5f602082840312156129c5575f80fd5b815161078b816125bf565b5f60208083850312156129e1575f80fd5b825167ffffffffffffffff8111156129f7575f80fd5b8301601f81018513612a07575f80fd5b8051612a156124ba82612478565b81815260059190911b82018301908381019087831115612a33575f80fd5b928401925b82841015612a5a578351612a4b81612168565b82529284019290840190612a38565b979650505050505050565b6001600160a01b03831681526040810161078b60208301846122a8565b6001600160a01b039290921682526001600160781b0316602082015260400190565b634e487b7160e01b5f52603260045260245ffd5b5f60018201612ac957612ac96128fb565b5060010190565b601f8211156106f8575f81815260208120601f850160051c81016020861015612af65750805b601f850160051c820191505b81811015612b1557828155600101612b02565b505050505050565b815167ffffffffffffffff811115612b3757612b37612433565b612b4b81612b458454612876565b84612ad0565b602080601f831160018114612b7e575f8415612b675750858301515b5f19600386901b1c1916600185901b178555612b15565b5f85815260208120601f198616915b82811015612bac57888601518255948401946001909101908401612b8d565b5085821015612bc957878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b80820180821115610514576105146128fb565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90612cb5908301846121ca565b9695505050505050565b5f60208284031215612ccf575f80fd5b815161078b8161213856fea26469706673582212206dcc6f2c1f6cca08dbf608b1961e93a36233b784b245c99a6d927edc38f348b264736f6c63430008140033

Verified Source Code Full Match

Compiler: v0.8.20+commit.a1b79de6 EVM: shanghai Optimization: Yes (200 runs)
CAYCSP.sol 2315 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol


// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;


/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// File: @openzeppelin/contracts/utils/introspection/IERC165.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// File: @openzeppelin/contracts/interfaces/IERC2981.sol


// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.20;


/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) external view returns (address receiver, uint256 royaltyAmount);
}

// File: @openzeppelin/contracts/utils/introspection/ERC165.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;


/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// File: @openzeppelin/contracts/token/common/ERC2981.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.20;



/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo;

    /**
     * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);

    /**
     * @dev The default royalty receiver is invalid.
     */
    error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);

    /**
     * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);

    /**
     * @dev The royalty receiver for `tokenId` is invalid.
     */
    error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
        }

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
        }

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

// File: contracts/ERC721CWITHROYALTY.sol


pragma solidity ^0.8.20;


abstract contract OwnablePermissions is Context {
    function _requireCallerIsContractOwner() internal view virtual;
}


abstract contract OwnableBasic is OwnablePermissions, Ownable {
    function _requireCallerIsContractOwner() internal view virtual override {
        _checkOwner();
    }
}

/**
 * @title AutomaticValidatorTransferApproval
 * @author Limit Break, Inc.
 * @notice Base contract mix-in that provides boilerplate code giving the contract owner the
 *         option to automatically approve a 721-C transfer validator implementation for transfers.
 */
abstract contract AutomaticValidatorTransferApproval is OwnablePermissions {

    /// @dev Emitted when the automatic approval flag is modified by the creator.
    event AutomaticApprovalOfTransferValidatorSet(bool autoApproved);

    /// @dev If true, the collection's transfer validator is automatically approved to transfer holder's tokens.
    bool public autoApproveTransfersFromValidator;

    /**
     * @notice Sets if the transfer validator is automatically approved as an operator for all token owners.
     * 
     * @dev    Throws when the caller is not the contract owner.
     * 
     * @param autoApprove If true, the collection's transfer validator will be automatically approved to
     *                    transfer holder's tokens.
     */
    function setAutomaticApprovalOfTransfersFromValidator(bool autoApprove) external {
        _requireCallerIsContractOwner();
        autoApproveTransfersFromValidator = autoApprove;
        emit AutomaticApprovalOfTransferValidatorSet(autoApprove);
    }
}

enum AllowlistTypes {
    Operators,
    PermittedContractReceivers
}

enum ReceiverConstraints {
    None,
    NoCode,
    EOA
}

enum CallerConstraints {
    None,
    OperatorWhitelistEnableOTC,
    OperatorWhitelistDisableOTC
}

enum StakerConstraints {
    None,
    CallerIsTxOrigin,
    EOA
}

enum TransferSecurityLevels {
    Zero,
    One,
    Two,
    Three,
    Four,
    Five,
    Six
}

struct TransferSecurityPolicy {
    CallerConstraints callerConstraints;
    ReceiverConstraints receiverConstraints;
}

struct CollectionSecurityPolicy {
    TransferSecurityLevels transferSecurityLevel;
    uint120 operatorWhitelistId;
    uint120 permittedContractReceiversId;
}

interface IEOARegistry is IERC165 {
    function isVerifiedEOA(address account) external view returns (bool);
}
interface ITransferSecurityRegistry {
    event AddedToAllowlist(AllowlistTypes indexed kind, uint256 indexed id, address indexed account);
    event CreatedAllowlist(AllowlistTypes indexed kind, uint256 indexed id, string indexed name);
    event ReassignedAllowlistOwnership(AllowlistTypes indexed kind, uint256 indexed id, address indexed newOwner);
    event RemovedFromAllowlist(AllowlistTypes indexed kind, uint256 indexed id, address indexed account);
    event SetAllowlist(AllowlistTypes indexed kind, address indexed collection, uint120 indexed id);
    event SetTransferSecurityLevel(address indexed collection, TransferSecurityLevels level);

    function createOperatorWhitelist(string calldata name) external returns (uint120);
    function createPermittedContractReceiverAllowlist(string calldata name) external returns (uint120);
    function reassignOwnershipOfOperatorWhitelist(uint120 id, address newOwner) external;
    function reassignOwnershipOfPermittedContractReceiverAllowlist(uint120 id, address newOwner) external;
    function renounceOwnershipOfOperatorWhitelist(uint120 id) external;
    function renounceOwnershipOfPermittedContractReceiverAllowlist(uint120 id) external;
    function setTransferSecurityLevelOfCollection(address collection, TransferSecurityLevels level) external;
    function setOperatorWhitelistOfCollection(address collection, uint120 id) external;
    function setPermittedContractReceiverAllowlistOfCollection(address collection, uint120 id) external;
    function addOperatorToWhitelist(uint120 id, address operator) external;
    function addPermittedContractReceiverToAllowlist(uint120 id, address receiver) external;
    function removeOperatorFromWhitelist(uint120 id, address operator) external;
    function removePermittedContractReceiverFromAllowlist(uint120 id, address receiver) external;
    function getCollectionSecurityPolicy(address collection) external view returns (CollectionSecurityPolicy memory);
    function getWhitelistedOperators(uint120 id) external view returns (address[] memory);
    function getPermittedContractReceivers(uint120 id) external view returns (address[] memory);
    function isOperatorWhitelisted(uint120 id, address operator) external view returns (bool);
    function isContractReceiverPermitted(uint120 id, address receiver) external view returns (bool);
}

interface ITransferValidator {
    function applyCollectionTransferPolicy(address caller, address from, address to) external view;
}

interface ICreatorTokenTransferValidator is ITransferSecurityRegistry, ITransferValidator, IEOARegistry {}

interface ICreatorToken {
    event TransferValidatorUpdated(address oldValidator, address newValidator);

    function getTransferValidator() external view returns (ICreatorTokenTransferValidator);
    function getSecurityPolicy() external view returns (CollectionSecurityPolicy memory);
    function getWhitelistedOperators() external view returns (address[] memory);
    function getPermittedContractReceivers() external view returns (address[] memory);
    function isOperatorWhitelisted(address operator) external view returns (bool);
    function isContractReceiverPermitted(address receiver) external view returns (bool);
    function isTransferAllowed(address caller, address from, address to) external view returns (bool);
}
interface ICreatorTokenLegacy {
    event TransferValidatorUpdated(address oldValidator, address newValidator);
    function getTransferValidator() external view returns (address validator);
    function setTransferValidator(address validator) external;
}

/**
 * @title TransferValidation
 * @author Limit Break, Inc.
 * @notice A mix-in that can be combined with ERC-721 contracts to provide more granular hooks.
 * Openzeppelin's ERC721 contract only provides hooks for before and after transfer.  This allows
 * developers to validate or customize transfers within the context of a mint, a burn, or a transfer.
 */
abstract contract TransferValidation is Context {
    
    /// @dev Thrown when the from and to address are both the zero address.
    error ShouldNotMintToBurnAddress();

    /*************************************************************************/
    /*                      Transfers Without Amounts                        */
    /*************************************************************************/

    /// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks.
    function _validateBeforeTransfer(address from, address to, uint256 tokenId) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _preValidateMint(_msgSender(), to, tokenId, msg.value);
        } else if(toZeroAddress) {
            _preValidateBurn(_msgSender(), from, tokenId, msg.value);
        } else {
            _preValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
        }
    }

    /// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks.
    function _validateAfterTransfer(address from, address to, uint256 tokenId) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _postValidateMint(_msgSender(), to, tokenId, msg.value);
        } else if(toZeroAddress) {
            _postValidateBurn(_msgSender(), from, tokenId, msg.value);
        } else {
            _postValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
        }
    }

    /// @dev Optional validation hook that fires before a mint
    function _preValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a mint
    function _postValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a burn
    function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a burn
    function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a transfer
    function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a transfer
    function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}

    /*************************************************************************/
    /*                         Transfers With Amounts                        */
    /*************************************************************************/

    /// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks.
    function _validateBeforeTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _preValidateMint(_msgSender(), to, tokenId, amount, msg.value);
        } else if(toZeroAddress) {
            _preValidateBurn(_msgSender(), from, tokenId, amount, msg.value);
        } else {
            _preValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value);
        }
    }

    /// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks.
    function _validateAfterTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _postValidateMint(_msgSender(), to, tokenId, amount, msg.value);
        } else if(toZeroAddress) {
            _postValidateBurn(_msgSender(), from, tokenId, amount, msg.value);
        } else {
            _postValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value);
        }
    }

    /// @dev Optional validation hook that fires before a mint
    function _preValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a mint
    function _postValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a burn
    function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a burn
    function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a transfer
    function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a transfer
    function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {}
}
interface ITransferValidatorSetTokenType {
    function setTokenTypeOfCollection(address collection, uint16 tokenType) external;
}

/**
 * @title CreatorTokenBase
 * @author Limit Break, Inc.
 * @notice CreatorTokenBase is an abstract contract that provides basic functionality for managing token 
 * transfer policies through an implementation of ICreatorTokenTransferValidator. This contract is intended to be used
 * as a base for creator-specific token contracts, enabling customizable transfer restrictions and security policies.
 *
 * <h4>Features:</h4>
 * <ul>Ownable: This contract can have an owner who can set and update the transfer validator.</ul>
 * <ul>TransferValidation: Implements the basic token transfer validation interface.</ul>
 * <ul>ICreatorToken: Implements the interface for creator tokens, providing view functions for token security policies.</ul>
 *
 * <h4>Benefits:</h4>
 * <ul>Provides a flexible and modular way to implement custom token transfer restrictions and security policies.</ul>
 * <ul>Allows creators to enforce policies such as whitelisted operators and permitted contract receivers.</ul>
 * <ul>Can be easily integrated into other token contracts as a base contract.</ul>
 *
 * <h4>Intended Usage:</h4>
 * <ul>Use as a base contract for creator token implementations that require advanced transfer restrictions and 
 *   security policies.</ul>
 * <ul>Set and update the ICreatorTokenTransferValidator implementation contract to enforce desired policies for the 
 *   creator token.</ul>
 */
abstract contract CreatorTokenBase is OwnablePermissions, TransferValidation, ICreatorToken {
    
    error CreatorTokenBase__InvalidTransferValidatorContract();
    error CreatorTokenBase__SetTransferValidatorFirst();

    address public constant DEFAULT_TRANSFER_VALIDATOR = address(0x0000721C310194CcfC01E523fc93C9cCcFa2A0Ac);
    TransferSecurityLevels public constant DEFAULT_TRANSFER_SECURITY_LEVEL = TransferSecurityLevels.One;
    uint120 public constant DEFAULT_OPERATOR_WHITELIST_ID = uint120(1);

    ICreatorTokenTransferValidator private transferValidator;

    /**
     * @notice Allows the contract owner to set the transfer validator to the official validator contract
     *         and set the security policy to the recommended default settings.
     * @dev    May be overridden to change the default behavior of an individual collection.
     */
    function setToDefaultSecurityPolicy() public virtual {
        _requireCallerIsContractOwner();
        setTransferValidator(DEFAULT_TRANSFER_VALIDATOR);
        ICreatorTokenTransferValidator(DEFAULT_TRANSFER_VALIDATOR).setTransferSecurityLevelOfCollection(address(this), DEFAULT_TRANSFER_SECURITY_LEVEL);
        ICreatorTokenTransferValidator(DEFAULT_TRANSFER_VALIDATOR).setOperatorWhitelistOfCollection(address(this), DEFAULT_OPERATOR_WHITELIST_ID);
    }

    /**
     * @notice Allows the contract owner to set the transfer validator to a custom validator contract
     *         and set the security policy to their own custom settings.
     */
    function setToCustomValidatorAndSecurityPolicy(
        address validator, 
        TransferSecurityLevels level, 
        uint120 operatorWhitelistId, 
        uint120 permittedContractReceiversAllowlistId) public {
        _requireCallerIsContractOwner();

        setTransferValidator(validator);

        ICreatorTokenTransferValidator(validator).
            setTransferSecurityLevelOfCollection(address(this), level);

        ICreatorTokenTransferValidator(validator).
            setOperatorWhitelistOfCollection(address(this), operatorWhitelistId);

        ICreatorTokenTransferValidator(validator).
            setPermittedContractReceiverAllowlistOfCollection(address(this), permittedContractReceiversAllowlistId);
    }

    /**
     * @notice Allows the contract owner to set the security policy to their own custom settings.
     * @dev    Reverts if the transfer validator has not been set.
     */
    function setToCustomSecurityPolicy(
        TransferSecurityLevels level, 
        uint120 operatorWhitelistId, 
        uint120 permittedContractReceiversAllowlistId) public {
        _requireCallerIsContractOwner();

        ICreatorTokenTransferValidator validator = getTransferValidator();
        if (address(validator) == address(0)) {
            revert CreatorTokenBase__SetTransferValidatorFirst();
        }

        validator.setTransferSecurityLevelOfCollection(address(this), level);
        validator.setOperatorWhitelistOfCollection(address(this), operatorWhitelistId);
        validator.setPermittedContractReceiverAllowlistOfCollection(address(this), permittedContractReceiversAllowlistId);
    }

    /**
     * @notice Sets the transfer validator for the token contract.
     *
     * @dev    Throws when provided validator contract is not the zero address and doesn't support 
     *         the ICreatorTokenTransferValidator interface. 
     * @dev    Throws when the caller is not the contract owner.
     *
     * @dev    <h4>Postconditions:</h4>
     *         1. The transferValidator address is updated.
     *         2. The `TransferValidatorUpdated` event is emitted.
     *
     * @param transferValidator_ The address of the transfer validator contract.
     */
    function setTransferValidator(address transferValidator_) public {
        _requireCallerIsContractOwner();

        bool isValidTransferValidator = false;

        if(transferValidator_.code.length > 0) {
            try IERC165(transferValidator_).supportsInterface(type(ICreatorTokenTransferValidator).interfaceId) 
                returns (bool supportsInterface) {
                isValidTransferValidator = supportsInterface;
            } catch {}
        }

        if(transferValidator_ != address(0) && !isValidTransferValidator) {
            revert CreatorTokenBase__InvalidTransferValidatorContract();
        }

        emit TransferValidatorUpdated(address(transferValidator), transferValidator_);

        transferValidator = ICreatorTokenTransferValidator(transferValidator_);
    }

    /**
     * @notice Returns the transfer validator contract address for this token contract.
     */
    function getTransferValidator() public view override returns (ICreatorTokenTransferValidator) {
        return transferValidator;
    }

    /**
     * @notice Returns the security policy for this token contract, which includes:
     *         Transfer security level, operator whitelist id, permitted contract receiver allowlist id.
     */
    function getSecurityPolicy() public view override returns (CollectionSecurityPolicy memory) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.getCollectionSecurityPolicy(address(this));
        }

        return CollectionSecurityPolicy({
            transferSecurityLevel: TransferSecurityLevels.Zero,
            operatorWhitelistId: 0,
            permittedContractReceiversId: 0
        });
    }

    /**
     * @notice Returns the list of all whitelisted operators for this token contract.
     * @dev    This can be an expensive call and should only be used in view-only functions.
     */
    function getWhitelistedOperators() public view override returns (address[] memory) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.getWhitelistedOperators(
                transferValidator.getCollectionSecurityPolicy(address(this)).operatorWhitelistId);
        }

        return new address[](0);
    }

    /**
     * @notice Returns the list of permitted contract receivers for this token contract.
     * @dev    This can be an expensive call and should only be used in view-only functions.
     */
    function getPermittedContractReceivers() public view override returns (address[] memory) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.getPermittedContractReceivers(
                transferValidator.getCollectionSecurityPolicy(address(this)).permittedContractReceiversId);
        }

        return new address[](0);
    }

    /**
     * @notice Checks if an operator is whitelisted for this token contract.
     * @param operator The address of the operator to check.
     */
    function isOperatorWhitelisted(address operator) public view override returns (bool) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.isOperatorWhitelisted(
                transferValidator.getCollectionSecurityPolicy(address(this)).operatorWhitelistId, operator);
        }

        return false;
    }

    /**
     * @notice Checks if a contract receiver is permitted for this token contract.
     * @param receiver The address of the receiver to check.
     */
    function isContractReceiverPermitted(address receiver) public view override returns (bool) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.isContractReceiverPermitted(
                transferValidator.getCollectionSecurityPolicy(address(this)).permittedContractReceiversId, receiver);
        }

        return false;
    }

    /**
     * @notice Determines if a transfer is allowed based on the token contract's security policy.  Use this function
     *         to simulate whether or not a transfer made by the specified `caller` from the `from` address to the `to`
     *         address would be allowed by this token's security policy.
     *
     * @notice This function only checks the security policy restrictions and does not check whether token ownership
     *         or approvals are in place. 
     *
     * @param caller The address of the simulated caller.
     * @param from   The address of the sender.
     * @param to     The address of the receiver.
     * @return       True if the transfer is allowed, false otherwise.
     */
    function isTransferAllowed(address caller, address from, address to) public view override returns (bool) {
        if (address(transferValidator) != address(0)) {
            try transferValidator.applyCollectionTransferPolicy(caller, from, to) {
                return true;
            } catch {
                return false;
            }
        }
        return true;
    }

    /**
     * @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy.
     *      Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent
     *      and calling _validateBeforeTransfer so that checks can be properly applied during token transfers.
     *
     * @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is
     *      set to a non-zero address.
     *
     * @param caller  The address of the caller.
     * @param from    The address of the sender.
     * @param to      The address of the receiver.
     */
    function _preValidateTransfer(
        address caller, 
        address from, 
        address to, 
        uint256 /*tokenId*/, 
        uint256 /*value*/) internal virtual override {
        if (address(transferValidator) != address(0)) {
            transferValidator.applyCollectionTransferPolicy(caller, from, to);
        }
    }
}

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to...

// [truncated — 90902 bytes total]

Read Contract

DEFAULT_OPERATOR_WHITELIST_ID 0x5d4c1d46 → uint120
DEFAULT_TRANSFER_SECURITY_LEVEL 0x1c33b328 → uint8
DEFAULT_TRANSFER_VALIDATOR 0x01463546 → address
_checkTokenURIBeforeMint 0xba9187ac → string
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
getPermittedContractReceivers 0xd007af5c → address[]
getSecurityPolicy 0xbe537f43 → tuple
getTransferValidator 0x098144d4 → address
getWhitelistedOperators 0x495c8bf9 → address[]
isApprovedForAll 0xe985e9c5 → bool
isContractReceiverPermitted 0x9d645a44 → bool
isOperatorWhitelisted 0x2e8da829 → bool
isTransferAllowed 0x1b25b077 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string

Write Contract 15 functions

These functions modify contract state and require a wallet transaction to execute.

airdrop 0x67243482
address[] to
uint256[] tokenId
approve 0x095ea7b3
address to
uint256 tokenId
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setDefaultRoyalty 0x04634d8d
address receiver
uint96 feeNumerator
setNFTMetadata 0xb6774111
uint256[] _tokenIds
string[] _metadataURIs
setToCustomSecurityPolicy 0x61347162
uint8 level
uint120 operatorWhitelistId
uint120 permittedContractReceiversAllowlistId
setToCustomValidatorAndSecurityPolicy 0xfd762d92
address validator
uint8 level
uint120 operatorWhitelistId
uint120 permittedContractReceiversAllowlistId
setToDefaultSecurityPolicy 0x6c3b8699
No parameters
setTokenRoyalty 0x5944c753
uint256 tokenId
address receiver
uint96 feeNumerator
setTransferValidator 0xa9fc664e
address transferValidator_
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address