Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x307849B04C1EdDe559BA9880a592fD3981CB3b10
Balance 0 ETH
Nonce 1
Code Size 14968 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

14968 bytes
0x60806040526004361061026d5760003560e01c8063b012a1d211610153578063ddc4b40f116100cb578063f242432a1161007f578063f2fde38b11610064578063f2fde38b14610681578063f4a0a528146106a1578063f5298aca146106c157600080fd5b8063f242432a14610641578063f26c159f1461066157600080fd5b8063e086e5ec116100b0578063e086e5ec146105c3578063e26f1ca7146105d8578063e985e9c5146105f857600080fd5b8063ddc4b40f1461058d578063df1ed498146105a357600080fd5b8063bb1e12d011610122578063beb9716d11610107578063beb9716d14610541578063c3960a3e14610560578063dd9ffb561461057a57600080fd5b8063bb1e12d01461050b578063be4b17721461052157600080fd5b8063b012a1d2146104a9578063b14a8026146104c3578063b1b9686a146104d6578063b54d2d51146104f657600080fd5b80632eb2c2d6116101e65780636817c76c116101b55780638da5cb5b1161019a5780638da5cb5b1461044c57806395d89b4114610474578063a22cb4651461048957600080fd5b80636817c76c14610421578063715018a61461043757600080fd5b80632eb2c2d61461039e57806338f59742146103be5780634e1273f4146103d457806353cc2fae1461040157600080fd5b80630e89341c1161023d57806318160ddd1161022257806318160ddd1461035f5780632022d8f6146103745780632be095611461038957600080fd5b80630e89341c1461032057806311c75fb31461034057600080fd5b8062fdd58e1461027957806301ffc9a7146102ac57806302fe5305146102dc57806306fdde03146102fe57600080fd5b3661027457005b600080fd5b34801561028557600080fd5b506102996102943660046132f5565b6106e1565b6040519081526020015b60405180910390f35b3480156102b857600080fd5b506102cc6102c73660046134b7565b61078a565b60405190151581526020016102a3565b3480156102e857600080fd5b506102fc6102f73660046134f1565b610827565b005b34801561030a57600080fd5b506103136108f1565b6040516102a391906137ae565b34801561032c57600080fd5b5061031361033b36600461353a565b61097f565b34801561034c57600080fd5b50600b546102cc90610100900460ff1681565b34801561036b57600080fd5b506102996109ba565b34801561038057600080fd5b506102fc6109de565b34801561039557600080fd5b506102fc610a1c565b3480156103aa57600080fd5b506102fc6103b93660046131af565b610a5e565b3480156103ca57600080fd5b50610299600a5481565b3480156103e057600080fd5b506103f46103ef3660046133ac565b610b00565b6040516102a3919061376d565b34801561040d57600080fd5b506102fc61041c366004613161565b610c3e565b34801561042d57600080fd5b5061029960075481565b34801561044357600080fd5b506102fc610c8f565b34801561045857600080fd5b506003546040516001600160a01b0390911681526020016102a3565b34801561048057600080fd5b50610313610ca3565b34801561049557600080fd5b506102fc6104a43660046132be565b610cb0565b3480156104b557600080fd5b50600b546102cc9060ff1681565b6102fc6104d136600461331f565b610cbf565b3480156104e257600080fd5b506102fc6104f136600461347d565b610cd1565b34801561050257600080fd5b506102fc610cec565b34801561051757600080fd5b5061029960085481565b34801561052d57600080fd5b506102fc61053c366004613553565b610d29565b34801561054d57600080fd5b506006546102cc90610100900460ff1681565b34801561056c57600080fd5b506006546102cc9060ff1681565b6102fc610588366004613576565b610d8c565b34801561059957600080fd5b5061029960095481565b3480156105af57600080fd5b506102fc6105be366004613161565b610d9d565b3480156105cf57600080fd5b506102fc610e62565b3480156105e457600080fd5b506102fc6105f33660046135c2565b610ea9565b34801561060457600080fd5b506102cc61061336600461317c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b34801561064d57600080fd5b506102fc61065c366004613259565b61117a565b34801561066d57600080fd5b506102fc61067c366004613161565b611215565b34801561068d57600080fd5b506102fc61069c366004613161565b611269565b3480156106ad57600080fd5b506102fc6106bc36600461353a565b6112f9565b3480156106cd57600080fd5b506102fc6106dc366004613379565b611334565b60006001600160a01b0383166107645760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806107ed57506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061082157507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b61082f6113ef565b600b5460ff166108a75760405162461bcd60e51b815260206004820152602c60248201527f526573657474696e67206f662055524920686173206265656e2072656e6f756e60448201527f6365642062792041646d696e0000000000000000000000000000000000000000606482015260840161075b565b6108b081611449565b806040516108be9190613664565b604051908190038120907f562bf0237fa5139edc73ec903039c3a552e19ae62cc8292da62afeea43024b0a90600090a250565b600480546108fe90613873565b80601f016020809104026020016040519081016040528092919081815260200182805461092a90613873565b80156109775780601f1061094c57610100808354040283529160200191610977565b820191906000526020600020905b81548152906001019060200180831161095a57829003601f168201915b505050505081565b606061098a8261145c565b610993836114f0565b6040516020016109a4929190613680565b6040516020818303038152906040529050919050565b6000600a546009546008546109cf91906137e5565b6109d991906137e5565b905090565b6109e66113ef565b600b805461ff00191690556040517fd6f40bce3da1e057e407469d003fd2eb7f9b058d848d0537c83ae96162dbb2ab90600090a1565b610a246113ef565b6006805461ff0019166101001790556040517f9f402f3b81cd8d17326941e3a09e87466236a430fb9e931fa23f4f8dcd111cac90600090a1565b6001600160a01b038516331480610a7a5750610a7a8533610613565b610aec5760405162461bcd60e51b815260206004820152602f60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206e6f7220617070726f7665640000000000000000000000000000000000606482015260840161075b565b610af9858585858561162a565b5050505050565b60608151835114610b795760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161075b565b6000835167ffffffffffffffff811115610b9557610b95613962565b604051908082528060200260200182016040528015610bbe578160200160208202803683370190505b50905060005b8451811015610c3657610c09858281518110610be257610be261394c565b6020026020010151858381518110610bfc57610bfc61394c565b60200260200101516106e1565b828281518110610c1b57610c1b61394c565b6020908102919091010152610c2f816138db565b9050610bc4565b509392505050565b610c466113ef565b6001600160a01b0381166000818152600d6020526040808220805460ff19169055517f4d97964cfd9c69dbe7ab7fc46220d1c9ccaf2399a2f8cdadb1df7960b0c7dd569190a250565b610c976113ef565b610ca160006118a3565b565b600580546108fe90613873565b610cbb33838361190d565b5050565b610ccb84848484611a02565b50505050565b610cd96113ef565b6006805460ff1916911515919091179055565b610cf46113ef565b600b805460ff191690556040517f3e4fc9b3eb8476b669d6be9a16e4d8d5d8f5d4c545f9dc83fd4d0bf12edaac8c90600090a1565b610d316113ef565b610d456001600160a01b0382163384611cd4565b806001600160a01b03167fbe7426aee8a34d0263892b55ce65ce81d8f4c806eb4719e59015ea49feb92d2283604051610d8091815260200190565b60405180910390a25050565b610d9833848484611a02565b505050565b610da56113ef565b600b54610100900460ff16610e225760405162461bcd60e51b815260206004820152603c60248201527f526573657474696e67206f66204d61644368617261637465724164647265737360448201527f20686173206265656e2072656e6f756e6365642062792041646d696e00000000606482015260840161075b565b600b80546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b610e6a6113ef565b610e743347611d54565b6040514781527f94effa14ea3a1ef396fa2fd829336d1597f1d76b548c26bfa2332869706638af9060200160405180910390a1565b600654610100900460ff16610f005760405162461bcd60e51b815260206004820152601560248201527f4d696e74696e6720646964206e6f742073746172740000000000000000000000604482015260640161075b565b336000908152600c6020526040902054610f1a85826137e5565b336000908152600c60205260409020819055600954909150610f3c86826137e5565b6009819055905085610f905760405162461bcd60e51b815260206004820152601160248201527f4d4144504153533a204e696c206d696e74000000000000000000000000000000604482015260640161075b565b610f9d6000610cf3613830565b8111156110125760405162461bcd60e51b815260206004820152603760248201527f4d4144504153533a20416c6c20746865206e6f726d616c20706173736573206860448201527f61766520616c7265616479206265656e206d696e746564000000000000000000606482015260840161075b565b848211156110705760405162461bcd60e51b815260206004820152602560248201527f4d4144504153533a2055736572204d696e7420416c6c6f77616e636520457863604482015264195959195960da1b606482015260840161075b565b60c88511156110cf5760405162461bcd60e51b815260206004820152602560248201527f4d4144504153533a2055736572204d696e7420416c6c6f77616e636520457863604482015264195959195960da1b606482015260840161075b565b61111484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525033925089915060019050611e6d565b61113c336001886040518060400160405280600381526020016203078360ec1b815250611fc6565b60405186815233907f10ac7dcd8a434bd81cd90aa8dd5834a6693508654bcca6d524e4270e3e1842df906020015b60405180910390a2505050505050565b6001600160a01b03851633148061119657506111968533610613565b6112085760405162461bcd60e51b815260206004820152602f60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206e6f7220617070726f7665640000000000000000000000000000000000606482015260840161075b565b610af985858585856120fc565b61121d6113ef565b6001600160a01b0381166000818152600d6020526040808220805460ff19166001179055517fce0df06b09231a3cc8eb67053f0e84060651d5f6a0f48ae87f7646f120b430c89190a250565b6112716113ef565b6001600160a01b0381166112ed5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161075b565b6112f6816118a3565b50565b6113016113ef565b600781905560405181907f02ebcb79e897ca3a22313ba6de8fc964409964de565fb4bb6a0927871756b88c90600090a250565b6001600160a01b03831633148061135b5750600b546201000090046001600160a01b031633145b6113cd5760405162461bcd60e51b815260206004820152602560248201527f4163636f756e74206973206e656974686572206f776e6572206e6f722061707060448201527f726f766564000000000000000000000000000000000000000000000000000000606482015260840161075b565b610d988383836122b5565b505050505050565b6001600160a01b03163b151590565b6003546001600160a01b03163314610ca15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075b565b8051610cbb906002906020840190612f7a565b60606002805461146b90613873565b80601f016020809104026020016040519081016040528092919081815260200182805461149790613873565b80156114e45780601f106114b9576101008083540402835291602001916114e4565b820191906000526020600020905b8154815290600101906020018083116114c757829003601f168201915b50505050509050919050565b60608161153057505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561155a5780611544816138db565b91506115539050600a836137fd565b9150611534565b60008167ffffffffffffffff81111561157557611575613962565b6040519080825280601f01601f19166020018201604052801561159f576020820181803683370190505b5090505b8415611622576115b4600183613830565b91506115c1600a866138f6565b6115cc9060306137e5565b60f81b8183815181106115e1576115e161394c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061161b600a866137fd565b94506115a3565b949350505050565b81518351146116a15760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161075b565b6001600160a01b0384166117055760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161075b565b33611714818787878787612478565b60005b845181101561183d5760008582815181106117345761173461394c565b6020026020010151905060008583815181106117525761175261394c565b602090810291909101810151600084815280835260408082206001600160a01b038e1683529093529190912054909150818110156117e55760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161075b565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906118229084906137e5565b9250508190555050505080611836906138db565b9050611717565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161188d929190613780565b60405180910390a46113d88187878787876124e2565b600380546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156119955760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161075b565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600654610100900460ff16611a595760405162461bcd60e51b815260206004820152601560248201527f4d696e74696e6720646964206e6f742073746172740000000000000000000000604482015260640161075b565b6001600160a01b0384166000908152600c6020526040902054611a7c84826137e5565b6001600160a01b0386166000908152600c60205260409020819055600854909150611aa785826137e5565b6008819055905084611afb5760405162461bcd60e51b815260206004820152601160248201527f4d4144504153533a204e696c206d696e74000000000000000000000000000000604482015260640161075b565b61116e811115611b735760405162461bcd60e51b815260206004820152603760248201527f4d4144504153533a20416c6c20746865206e6f726d616c20706173736573206860448201527f61766520616c7265616479206265656e206d696e746564000000000000000000606482015260840161075b565b6002821115611bd25760405162461bcd60e51b815260206004820152602560248201527f4d4144504153533a2055736572204d696e7420416c6c6f77616e636520457863604482015264195959195960da1b606482015260840161075b565b84600754611be09190613811565b3414611c2e5760405162461bcd60e51b815260206004820152601360248201527f4d4144504153533a204d696e7420507269636500000000000000000000000000604482015260640161075b565b611c7184848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508b9350600292509050611e6d565b611c99866001876040518060400160405280600381526020016203078360ec1b815250611fc6565b856001600160a01b03167ff495091f4e3d4537b0d61c8a278d6914e891111618936a54504773a772b7ca5d8660405161116a91815260200190565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610d98908490612697565b80471015611da45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161075b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611df1576040519150601f19603f3d011682016040523d82523d6000602084013e611df6565b606091505b5050905080610d985760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161075b565b60408051606085811b6bffffffffffffffffffffffff199081166020808501919091526034840187905260f886901b7fff000000000000000000000000000000000000000000000000000000000000001660548501524660558501523090921b166075830152825180830360690181526089830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060a984015260c58084018290528451808503909101815260e590930190935281519101206000611f3a828861277c565b90507f000000000000000000000000895fe75d025efe41d30e38703ec28fab68545f036001600160a01b0316816001600160a01b031614611fbd5760405162461bcd60e51b815260206004820152601860248201527f5369676e65722061646472657373206d69736d617463682e0000000000000000604482015260640161075b565b50505050505050565b6001600160a01b0384166120425760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161075b565b33600061204e85612798565b9050600061205b85612798565b905061206c83600089858589612478565b6000868152602081815260408083206001600160a01b038b1684529091528120805487929061209c9084906137e5565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611fbd836000898989896127e3565b6001600160a01b0384166121605760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161075b565b33600061216c85612798565b9050600061217985612798565b9050612189838989858589612478565b6000868152602081815260408083206001600160a01b038c1684529091529020548581101561220d5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161075b565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a1682528120805488929061224a9084906137e5565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46122aa848a8a8a8a8a6127e3565b505050505050505050565b6001600160a01b0383166123315760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161075b565b33600061233d84612798565b9050600061234a84612798565b905061236a83876000858560405180602001604052806000815250612478565b6000858152602081815260408083206001600160a01b038a168452909152902054848110156124005760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e636500000000000000000000000000000000000000000000000000000000606482015260840161075b565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4604080516020810190915260009052611fbd565b612481856128ee565b80156124915750612491846128ee565b6124dd5760405162461bcd60e51b815260206004820152600f60248201527f4d4144504153533a2066726f7a656e0000000000000000000000000000000000604482015260640161075b565b6113d8565b6001600160a01b0384163b156113d85760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061252690899089908890889088906004016136d7565b602060405180830381600087803b15801561254057600080fd5b505af1925050508015612570575060408051601f3d908101601f1916820190925261256d918101906134d4565b60015b6126265761257c613978565b806308c379a014156125b65750612591613994565b8061259c57506125b8565b8060405162461bcd60e51b815260040161075b91906137ae565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161075b565b6001600160e01b0319811663bc197c8160e01b14611fbd5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161075b565b60006126ec826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a769092919063ffffffff16565b805190915015610d98578080602001905181019061270a919061349a565b610d985760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161075b565b600080600061278b8585612a8f565b91509150610c3681612aff565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106127d2576127d261394c565b602090810291909101015292915050565b6001600160a01b0384163b156113d85760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906128279089908990889088908890600401613735565b602060405180830381600087803b15801561284157600080fd5b505af1925050508015612871575060408051601f3d908101601f1916820190925261286e918101906134d4565b60015b61287d5761257c613978565b6001600160e01b0319811663f23a6e6160e01b14611fbd5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161075b565b6001600160a01b0381166000908152600d602052604081205460ff161561291757506000919050565b6daaeb6d7670e522a718067333cd4e3b15801590612937575060065460ff165b15612a69576001600160a01b03821633141561295557506001919050565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c61711349060440160206040518083038186803b15801561299f57600080fd5b505afa1580156129b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129d7919061349a565b80156108215750604051633185c44d60e21b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063c61711349060440160206040518083038186803b158015612a3157600080fd5b505afa158015612a45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610821919061349a565b506001919050565b919050565b6060612a858484600085612cba565b90505b9392505050565b600080825160411415612ac65760208301516040840151606085015160001a612aba87828585612e02565b94509450505050612af8565b825160401415612af05760208301516040840151612ae5868383612eef565b935093505050612af8565b506000905060025b9250929050565b6000816004811115612b1357612b13613936565b1415612b1c5750565b6001816004811115612b3057612b30613936565b1415612b7e5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161075b565b6002816004811115612b9257612b92613936565b1415612be05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161075b565b6003816004811115612bf457612bf4613936565b1415612c4d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161075b565b6004816004811115612c6157612c61613936565b14156112f65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161075b565b606082471015612d325760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161075b565b6001600160a01b0385163b612d895760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161075b565b600080866001600160a01b03168587604051612da59190613664565b60006040518083038185875af1925050503d8060008114612de2576040519150601f19603f3d011682016040523d82523d6000602084013e612de7565b606091505b5091509150612df7828286612f41565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612e395750600090506003612ee6565b8460ff16601b14158015612e5157508460ff16601c14155b15612e625750600090506004612ee6565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612eb6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612edf57600060019250925050612ee6565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681612f2560ff86901c601b6137e5565b9050612f3387828885612e02565b935093505050935093915050565b60608315612f50575081612a88565b825115612f605782518084602001fd5b8160405162461bcd60e51b815260040161075b91906137ae565b828054612f8690613873565b90600052602060002090601f016020900481019282612fa85760008555612fee565b82601f10612fc157805160ff1916838001178555612fee565b82800160010185558215612fee579182015b82811115612fee578251825591602001919060010190612fd3565b50612ffa929150612ffe565b5090565b5b80821115612ffa5760008155600101612fff565b600067ffffffffffffffff83111561302d5761302d613962565b604051613044601f8501601f1916602001826138ae565b80915083815284848401111561305957600080fd5b83836020830137600060208583010152509392505050565b80356001600160a01b0381168114612a7157600080fd5b600082601f83011261309957600080fd5b813560206130a6826137c1565b6040516130b382826138ae565b8381528281019150858301600585901b870184018810156130d357600080fd5b60005b858110156130f2578135845292840192908401906001016130d6565b5090979650505050505050565b60008083601f84011261311157600080fd5b50813567ffffffffffffffff81111561312957600080fd5b602083019150836020828501011115612af857600080fd5b600082601f83011261315257600080fd5b612a8883833560208501613013565b60006020828403121561317357600080fd5b612a8882613071565b6000806040838503121561318f57600080fd5b61319883613071565b91506131a660208401613071565b90509250929050565b600080600080600060a086880312156131c757600080fd5b6131d086613071565b94506131de60208701613071565b9350604086013567ffffffffffffffff808211156131fb57600080fd5b61320789838a01613088565b9450606088013591508082111561321d57600080fd5b61322989838a01613088565b9350608088013591508082111561323f57600080fd5b5061324c88828901613141565b9150509295509295909350565b600080600080600060a0868803121561327157600080fd5b61327a86613071565b945061328860208701613071565b93506040860135925060608601359150608086013567ffffffffffffffff8111156132b257600080fd5b61324c88828901613141565b600080604083850312156132d157600080fd5b6132da83613071565b915060208301356132ea81613a1e565b809150509250929050565b6000806040838503121561330857600080fd5b61331183613071565b946020939093013593505050565b6000806000806060858703121561333557600080fd5b61333e85613071565b935060208501359250604085013567ffffffffffffffff81111561336157600080fd5b61336d878288016130ff565b95989497509550505050565b60008060006060848603121561338e57600080fd5b61339784613071565b95602085013595506040909401359392505050565b600080604083850312156133bf57600080fd5b823567ffffffffffffffff808211156133d757600080fd5b818501915085601f8301126133eb57600080fd5b813560206133f8826137c1565b60405161340582826138ae565b8381528281019150858301600585901b870184018b101561342557600080fd5b600096505b8487101561344f5761343b81613071565b83526001969096019591830191830161342a565b509650508601359250508082111561346657600080fd5b5061347385828601613088565b9150509250929050565b60006020828403121561348f57600080fd5b8135612a8881613a1e565b6000602082840312156134ac57600080fd5b8151612a8881613a1e565b6000602082840312156134c957600080fd5b8135612a8881613a2c565b6000602082840312156134e657600080fd5b8151612a8881613a2c565b60006020828403121561350357600080fd5b813567ffffffffffffffff81111561351a57600080fd5b8201601f8101841361352b57600080fd5b61162284823560208401613013565b60006020828403121561354c57600080fd5b5035919050565b6000806040838503121561356657600080fd5b823591506131a660208401613071565b60008060006040848603121561358b57600080fd5b83359250602084013567ffffffffffffffff8111156135a957600080fd5b6135b5868287016130ff565b9497909650939450505050565b600080600080606085870312156135d857600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561336157600080fd5b600081518084526020808501945080840160005b8381101561362d57815187529582019590820190600101613611565b509495945050505050565b60008151808452613650816020860160208601613847565b601f01601f19169290920160200192915050565b60008251613676818460208701613847565b9190910192915050565b60008351613692818460208801613847565b8351908301906136a6818360208801613847565b7f2e6a736f6e0000000000000000000000000000000000000000000000000000009101908152600501949350505050565b60006001600160a01b03808816835280871660208401525060a0604083015261370360a08301866135fd565b828103606084015261371581866135fd565b905082810360808401526137298185613638565b98975050505050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152612df760a0830184613638565b602081526000612a8860208301846135fd565b60408152600061379360408301856135fd565b82810360208401526137a581856135fd565b95945050505050565b602081526000612a886020830184613638565b600067ffffffffffffffff8211156137db576137db613962565b5060051b60200190565b600082198211156137f8576137f861390a565b500190565b60008261380c5761380c613920565b500490565b600081600019048311821515161561382b5761382b61390a565b500290565b6000828210156138425761384261390a565b500390565b60005b8381101561386257818101518382015260200161384a565b83811115610ccb5750506000910152565b600181811c9082168061388757607f821691505b602082108114156138a857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8201601f1916810167ffffffffffffffff811182821017156138d4576138d4613962565b6040525050565b60006000198214156138ef576138ef61390a565b5060010190565b60008261390557613905613920565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d11156139915760046000803e5060005160e01c5b90565b600060443d10156139a25790565b6040516003193d81016004833e81513d67ffffffffffffffff81602484011181841117156139d257505050505090565b82850191508151818111156139ea5750505050505090565b843d8701016020828501011115613a045750505050505090565b613a13602082860101876138ae565b509095945050505050565b80151581146112f657600080fd5b6001600160e01b0319811681146112f657600080fdfea26469706673582212202364dcb536cea53a6f906166083708ed163337c14123c7104a3b5a52b6e9216c64736f6c63430008070033

Verified Source Code Full Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: Yes (1000 runs)
Strings.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}
IOperatorFilterRegistry.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);
    function register(address registrant) external;
    function registerAndSubscribe(address registrant, address subscription) external;
    function registerAndCopyEntries(address registrant, address registrantToCopy) external;
    function updateOperator(address registrant, address operator, bool filtered) external;
    function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
    function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
    function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
    function subscribe(address registrant, address registrantToSubscribe) external;
    function unsubscribe(address registrant, bool copyExistingEntries) external;
    function subscriptionOf(address addr) external returns (address registrant);
    function subscribers(address registrant) external returns (address[] memory);
    function subscriberAt(address registrant, uint256 index) external returns (address);
    function copyEntriesOf(address registrant, address registrantToCopy) external;
    function isOperatorFiltered(address registrant, address operator) external returns (bool);
    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
    function filteredOperators(address addr) external returns (address[] memory);
    function filteredCodeHashes(address addr) external returns (bytes32[] memory);
    function filteredOperatorAt(address registrant, uint256 index) external returns (address);
    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
    function isRegistered(address addr) external returns (bool);
    function codeHashOf(address addr) external returns (bytes32);
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @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.
 *
 * By default, the owner account will be the one that deploys the contract. 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;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @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 {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing 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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _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);
    }
}
IERC1155MetadataURI.sol 22 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @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);
}
ECDSA.sol 232 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}
SafeERC20.sol 116 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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;
    }
}
draft-IERC20Permit.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
MadPass.sol 413 lines
// SPDX-License-Identifier: MIT
//
//  ███████████  █████         █████████     █████████  █████   ████ █████       ██████████ ██████   ██████    ███████    ██████   █████
// ░░███░░░░░███░░███         ███░░░░░███   ███░░░░░███░░███   ███░ ░░███       ░░███░░░░░█░░██████ ██████   ███░░░░░███ ░░██████ ░░███
//  ░███    ░███ ░███        ░███    ░███  ███     ░░░  ░███  ███    ░███        ░███  █ ░  ░███░█████░███  ███     ░░███ ░███░███ ░███
//  ░██████████  ░███        ░███████████ ░███          ░███████     ░███        ░██████    ░███░░███ ░███ ░███      ░███ ░███░░███░███
//  ░███░░░░░███ ░███        ░███░░░░░███ ░███          ░███░░███    ░███        ░███░░█    ░███ ░░░  ░███ ░███      ░███ ░███ ░░██████
//  ░███    ░███ ░███      █ ░███    ░███ ░░███     ███ ░███ ░░███   ░███      █ ░███ ░   █ ░███      ░███ ░░███     ███  ░███  ░░█████
//  ███████████  ███████████ █████   █████ ░░█████████  █████ ░░████ ███████████ ██████████ █████     █████ ░░░███████░   █████  ░░█████
// ░░░░░░░░░░░  ░░░░░░░░░░░ ░░░░░   ░░░░░   ░░░░░░░░░  ░░░░░   ░░░░ ░░░░░░░░░░░ ░░░░░░░░░░ ░░░░░     ░░░░░    ░░░░░░░    ░░░░░    ░░░░░
//
// BLACKLEMON: https://github.com/BlackLemon-wtf
// =======================================================================================================================================
//
//    █████████    █████████   ██████████   ██████   ██████    ███████     █████████     █████    ███████
//   ███░░░░░███  ███░░░░░███ ░░███░░░░███ ░░██████ ██████   ███░░░░░███  ███░░░░░███   ░░███   ███░░░░░███
//  ███     ░░░  ░███    ░███  ░███   ░░███ ░███░█████░███  ███     ░░███░███    ░░░     ░███  ███     ░░███
// ░███          ░███████████  ░███    ░███ ░███░░███ ░███ ░███      ░███░░█████████     ░███ ░███      ░███
// ░███          ░███░░░░░███  ░███    ░███ ░███ ░░░  ░███ ░███      ░███ ░░░░░░░░███    ░███ ░███      ░███
// ░░███     ███ ░███    ░███  ░███    ███  ░███      ░███ ░░███     ███  ███    ░███    ░███ ░░███     ███
//  ░░█████████  █████   █████ ██████████   █████     █████ ░░░███████░  ░░█████████  ██ █████ ░░░███████░
//   ░░░░░░░░░  ░░░░░   ░░░░░ ░░░░░░░░░░   ░░░░░     ░░░░░    ░░░░░░░     ░░░░░░░░░  ░░ ░░░░░    ░░░░░░░
//
// CADMOS.IO: https://github.com/CADMOS-SAL
// ==========================================================================================================
// ==================================================  MadPass  =============================================
// ==========================================================================================================

pragma solidity 0.8.7;

import "./IOperatorFilterRegistry.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract MadPass is ERC1155, Ownable {
    using ECDSA for bytes32;
    using SafeERC20 for IERC20;

    /* ========== CONSTANTS ========== */

    string public name;
    string public symbol;
    uint256 private constant MAX_SUPPLY_TEAM = 0;
    uint256 private constant MAX_SUPPLY_OG = 3315 - MAX_SUPPLY_TEAM;
    uint256 private constant MAX_SUPPLY_NORMAL = 4462;
    uint256 private constant MAX_MINT_USER = 2;
    uint256 private constant MAX_MINT_OG = 200;
    address private immutable signingAdrress;
    enum MintMode {
        NormalUser,
        OGUser
    }
    IOperatorFilterRegistry constant operatorFilterRegistry =
        IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); //https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol

    /* ========== STATE VARIABLES ========== */
    bool public FOLLOWOZREGISTRY = true; //apply OZ blacklist
    bool public canMint;
    uint256 public mintPrice;
    uint256 public mintedNumberNormal;
    uint256 public mintedNumberOG;
    uint256 public mintedNumberTeam;
    bool public canChangeURI = true;
    bool public canChangeMadCharacterAddress = true;
    address private _madCharacterAddress;
    mapping(address => uint256) private mintedbyAddress;
    mapping(address => bool) private _frozen; //True if the balance of frozen[address] is frozen (no transfer)

    /* ========== CONSTRUCTOR ========== */

    constructor(
        string memory uri_,
        string memory _name,
        string memory _symbol,
        address _signingAdrress,
        uint256 _mintPrice
    ) ERC1155(uri_) {
        name = _name;
        symbol = _symbol;
        signingAdrress = _signingAdrress;
        mintPrice = _mintPrice;
        _mintTeam(msg.sender);
        if (address(operatorFilterRegistry).code.length > 0) {
            //to not revert in test env
            operatorFilterRegistry.registerAndSubscribe(
                address(this),
                0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6
            ); //https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/DefaultOperatorFilterer.sol
        }
    }

    /* ========== VIEWS ========== */

    function totalSupply() public view returns (uint256) {
        return mintedNumberNormal + mintedNumberOG + mintedNumberTeam;
    }

    function _chainID() private view returns (uint256) {
        uint256 chainID;
        assembly {
            chainID := chainid()
        }

        return chainID;
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    function _isAllowedOperator(address from)
        internal
        view
        returns (bool isAllowed)
    {
        if (_frozen[from]) {
            return false;
        } else {
            //https://github.com/ProjectOpenSea/operator-filter-registry/blob/main/src/OperatorFilterer.sol
            // Check registry code length to facilitate testing in environments without a deployed registry.
            if (
                address(operatorFilterRegistry).code.length > 0 &&
                FOLLOWOZREGISTRY
            ) {
                // Allow spending tokens from addresses with balance
                // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
                // from an EOA.
                if (from == msg.sender) {
                    return true;
                }
                isAllowed = (operatorFilterRegistry.isOperatorAllowed(
                    address(this),
                    msg.sender
                ) &&
                    operatorFilterRegistry.isOperatorAllowed(
                        address(this),
                        from
                    ));
                return isAllowed;
            } else {
                return true;
            }
        }
    }

    function _checksignature(
        bytes memory signature,
        address minter,
        uint256 mintLimit,
        uint8 mintMode
    ) internal view {
        bytes32 hash = keccak256(
            abi.encodePacked(
                minter,
                mintLimit,
                mintMode,
                _chainID(),
                address(this)
            )
        );
        bytes32 messageHash = hash.toEthSignedMessageHash();
        address signer = messageHash.recover(signature);
        require(signer == signingAdrress, "Signer address mismatch.");
    }

    /// @dev Override: Token Freeze
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal override(ERC1155) {
        require(
            _isAllowedOperator(from) && _isAllowedOperator(to),
            "MADPASS: frozen"
        );
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }

    function _mintTeam(address teamAddress) internal {
        mintedNumberTeam = MAX_SUPPLY_TEAM;
        if(mintedNumberTeam>0){
            _mint(teamAddress, 2, MAX_SUPPLY_TEAM, "0x0");
            emit TeamMint(teamAddress, MAX_SUPPLY_TEAM);
        }
    }

    /// @notice Mint amount Madz Pass - Caller need to pay mintPrice x amounts and add a valid signature
    function _mintBatchNormalUser(
        address recipient,
        uint256 amounts,
        bytes calldata signature
    ) internal {
        require(canMint, "Minting did not start");
        uint256 mintedUser_ = mintedbyAddress[recipient];
        mintedUser_ += amounts;
        mintedbyAddress[recipient] = mintedUser_;
        uint256 mintedNumberNormal_ = mintedNumberNormal;
        mintedNumberNormal_ += amounts;
        mintedNumberNormal = mintedNumberNormal_;
        require(amounts > 0, "MADPASS: Nil mint");
        require(
            mintedNumberNormal_ <= MAX_SUPPLY_NORMAL,
            "MADPASS: All the normal passes have already been minted"
        );
        require(
            mintedUser_ <= MAX_MINT_USER,
            "MADPASS: User Mint Allowance Exceeded"
        );
        require(msg.value == mintPrice * amounts, "MADPASS: Mint Price");
        _checksignature(
            signature,
            recipient,
            MAX_MINT_USER,
            uint8(MintMode.NormalUser)
        );
        _mint(recipient, 1, amounts, "0x0");
        emit NormalMint(recipient, amounts);
    }

    /* ========== MUTATIVE FUNCTIONS ========== */

    receive() external payable {}

    /// @notice Mint amount Madz Pass for another user- Caller need to pay mintPrice x amounts and add a valid signature
    function mintBatchNormalUserDelegated(
        address recipient,
        uint256 amounts,
        bytes calldata signature
    ) external payable {
        _mintBatchNormalUser(recipient, amounts, signature);
    }

    /// @notice Mint amount Madz Pass - Caller need to pay mintPrice x amounts and add a valid signature
    function mintBatchNormalUser(uint256 amounts, bytes calldata signature)
        external
        payable
    {
        _mintBatchNormalUser(msg.sender, amounts, signature);
    }

    /// @notice Mint amount Madz Pass for OG - Caller need to add a valid signature
    function mintBatchNormalOG(
        uint256 amounts,
        uint256 mintLimit,
        bytes calldata signature
    ) external {
        require(canMint, "Minting did not start");
        uint256 mintedUser_ = mintedbyAddress[msg.sender];
        mintedUser_ += amounts;
        mintedbyAddress[msg.sender] = mintedUser_;
        uint256 mintedNumberOG_ = mintedNumberOG;
        mintedNumberOG_ += amounts;
        mintedNumberOG = mintedNumberOG_;
        require(amounts > 0, "MADPASS: Nil mint");
        require(
            mintedNumberOG_ <= MAX_SUPPLY_OG,
            "MADPASS: All the normal passes have already been minted"
        );
        require(
            mintedUser_ <= mintLimit,
            "MADPASS: User Mint Allowance Exceeded"
        );
        require(
            mintLimit <= MAX_MINT_OG,
            "MADPASS: User Mint Allowance Exceeded"
        );
        _checksignature(
            signature,
            msg.sender,
            mintLimit,
            uint8(MintMode.OGUser)
        );
        _mint(msg.sender, 1, amounts, "0x0");
        emit OGMint(msg.sender, amounts);
    }

    /// @notice Burn amount Pass #id of 'from'.
    function burn(
        address from,
        uint256 id,
        uint256 amount
    ) external {
        require(
            from == msg.sender || msg.sender == _madCharacterAddress,
            "Account is neither owner nor approved"
        );
        _burn(from, id, amount);
    }

    /// @notice Get Token URI
    function uri(uint256 _tokenId)
        public
        view
        override
        returns (string memory)
    {
        return
            string(
                abi.encodePacked(
                    super.uri(_tokenId),
                    Strings.toString(_tokenId),
                    ".json"
                )
            );
    }

    /* ========== RESTRICTED FUNCTIONS ========== */

    //true iff we want to apply OZ blacklist
    function followOZRegistry(bool status) external onlyOwner {
        FOLLOWOZREGISTRY = status;
    }

    /// @notice Allow people to Mint
    function startMint() public onlyOwner {
        canMint = true;
        emit StartMint();
    }

    /// @notice Allows Admin to withdraw ETH
    function withdrawETH() external onlyOwner {
        Address.sendValue(payable(msg.sender), address(this).balance);
        emit WithdrawETH(address(this).balance);
    }

    /// @notice Allows Admin to withdraw token amount
    function withdrawToken(uint256 amount, address tokenAddress)
        external
        onlyOwner
    {
        IERC20(tokenAddress).safeTransfer(msg.sender, amount);
        emit WithdrawERC20(tokenAddress, amount);
    }

    /// @notice Admin changes URI
    function setURI(string memory newuri) external onlyOwner {
        require(canChangeURI, "Resetting of URI has been renounced by Admin");
        _setURI(newuri);
        emit SetURI(newuri);
    }

    /// @notice Admin renounces the right to change URI
    function renounceChangeURI() external onlyOwner {
        canChangeURI = false;
        emit RenounceChangeURI();
    }

    /// @notice Freezes the tokens of an address
    function freezeAccount(address to) external onlyOwner {
        _frozen[to] = true;
        emit FreezeAccount(to);
    }

    /// @notice UnFreezes the tokens of an address
    function unFreezeAccount(address to) external onlyOwner {
        _frozen[to] = false;
        emit UnFreezeAccount(to);
    }

    /// @notice Admin sets mintPrice
    function setMintPrice(uint256 newMintPrice) external onlyOwner {
        mintPrice = newMintPrice;
        emit SetMintPrice(newMintPrice);
    }

    /// @notice Admin sets _madCharacterAddress (which has the right to burn Passes)
    function setMadCharacterAddress(address preComputedMadCharacter)
        external
        onlyOwner
    {
        require(
            canChangeMadCharacterAddress,
            "Resetting of MadCharacterAddress has been renounced by Admin"
        );
        _madCharacterAddress = preComputedMadCharacter;
    }

    /// @notice Admin renounces the right to change _madCharacterAddress
    function renounceChangeMadCharacterAddress() external onlyOwner {
        canChangeMadCharacterAddress = false;
        emit RenounceChangeMadCharacterAddress();
    }

    /* ========== EVENTS ========== */

    /// @dev Emitted during a call to mintBatchNormalOG
    /// OGMint is the most important event because it will be used to aggregate
    /// data off-chain allowing the vesting admin to then manually distribute
    /// the passes to the OGs who decided to mint some of them.
    event OGMint(address indexed OGAddress, uint256 amount);

    /// @dev Emitted during a call to mintBatchNormalUser
    event NormalMint(address indexed NormalUserAddress, uint256 amount);

    /// @dev Emitted during a call to mintBatchTeam
    event TeamMint(address indexed TeamUserAddress, uint256 amount);

    /// @dev All the following events are emitted during Admin functions call
    event StartMint();
    event WithdrawETH(uint256 value);
    event WithdrawERC20(address indexed tokenAddress, uint256 amount);
    event SetURI(string indexed uri);
    event RenounceChangeURI();
    event RenounceChangeMadCharacterAddress();
    event FreezeAccount(address indexed accountAddress);
    event UnFreezeAccount(address indexed accountAddress);
    event SetMintPrice(uint256 indexed mintprice);
}
ERC1155.sol 517 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

    // Mapping from account to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: address zero is not a valid owner");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
        public
        view
        virtual
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[account][operator];
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner nor approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC1155: setting approval status for self");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `ids` and `amounts` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}
IERC1155.sol 125 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @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);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

Read Contract

FOLLOWOZREGISTRY 0xc3960a3e → bool
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
canChangeMadCharacterAddress 0x11c75fb3 → bool
canChangeURI 0xb012a1d2 → bool
canMint 0xbeb9716d → bool
isApprovedForAll 0xe985e9c5 → bool
mintPrice 0x6817c76c → uint256
mintedNumberNormal 0xbb1e12d0 → uint256
mintedNumberOG 0xddc4b40f → uint256
mintedNumberTeam 0x38f59742 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uri 0x0e89341c → string

Write Contract 20 functions

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

burn 0xf5298aca
address from
uint256 id
uint256 amount
followOZRegistry 0xb1b9686a
bool status
freezeAccount 0xf26c159f
address to
mintBatchNormalOG 0xe26f1ca7
uint256 amounts
uint256 mintLimit
bytes signature
mintBatchNormalUser 0xdd9ffb56
uint256 amounts
bytes signature
mintBatchNormalUserDelegated 0xb14a8026
address recipient
uint256 amounts
bytes signature
renounceChangeMadCharacterAddress 0x2022d8f6
No parameters
renounceChangeURI 0xb54d2d51
No parameters
renounceOwnership 0x715018a6
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setMadCharacterAddress 0xdf1ed498
address preComputedMadCharacter
setMintPrice 0xf4a0a528
uint256 newMintPrice
setURI 0x02fe5305
string newuri
startMint 0x2be09561
No parameters
transferOwnership 0xf2fde38b
address newOwner
unFreezeAccount 0x53cc2fae
address to
withdrawETH 0xe086e5ec
No parameters
withdrawToken 0xbe4b1772
uint256 amount
address tokenAddress

Recent Transactions

No transactions found for this address