Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x2E16303E294A88fF01D905D1481EADca22294F03
Balance 1.5800 ETH
Nonce 1
Code Size 17025 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

17025 bytes
0x6080604052600436106103c65760003560e01c80638b83209b116101f2578063cd2c70521161010d578063f242432a116100a0578063f931a4c21161006f578063f931a4c214610add578063f934688114610af2578063fa5d788214610b12578063ff5a70c614610b325761040d565b8063f242432a14610a6a578063f2fde38b14610a8a578063f5298aca14610aaa578063f759867a14610aca5761040d565b8063d9a02e69116100dc578063d9a02e6914610a0b578063e33b7de314610a20578063e8a3d48514610a35578063e985e9c514610a4a5761040d565b8063cd2c70521461098b578063ce7c2ac2146109ab578063d70c3dba146109cb578063d79779b2146109eb5761040d565b8063a22cb46511610185578063b92bc37511610154578063b92bc3751461092c578063bd85b03914610941578063c7b6945914610961578063cca97911146109765761040d565b8063a22cb465146108b7578063a3106b95146108d7578063a496dedf146108f7578063b8de970a146109175761040d565b80639852595c116101c15780639852595c1461084f5780639be51bea1461086f578063a0712d6814610884578063a1e33d02146108975761040d565b80638b83209b146107e55780638da5cb5b146108055780638f4167da1461081a578063938e3d7b1461082f5761040d565b80634576cdd5116102e25780635e2da7e2116102755780637521134c116102445780637521134c1461077b5780637de69d5f1461079b578063894a8cac146107b05780638b13fde8146107c55761040d565b80635e2da7e2146107065780636b20c45414610726578063715018a614610746578063748c45571461075b5761040d565b80634f558e79116102b15780634f558e79146106915780634f699a43146106b157806359aefc59146106d15780635d04aeab146106e65761040d565b80634576cdd51461060f57806346ca1ab81461062457806348b75044146106445780634e1273f4146106645761040d565b80632b0384111161035a57806335a4faf41161032957806335a4faf4146105a55780633a98ef39146105c55780633ccfd60b146105da578063406072a9146105ef5761040d565b80632b0384111461052e5780632eb2c2d614610543578063311df29a1461056357806334d722c9146105835761040d565b80630c9a6313116103965780630c9a6313146104ac5780630e89341c146104cc57806319165587146104f95780631df09e47146105195761040d565b8062fdd58e1461041257806301ffc9a71461044857806302fe53051461047557806305461a6a146104975761040d565b3661040d577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be7706103f4610b47565b346040516104039291906134c3565b60405180910390a1005b600080fd5b34801561041e57600080fd5b5061043261042d3660046131b9565b610b4c565b60405161043f9190613fe2565b60405180910390f35b34801561045457600080fd5b5061046861046336600461334c565b610ba3565b60405161043f91906135b3565b34801561048157600080fd5b50610495610490366004613396565b610c1b565b005b3480156104a357600080fd5b50610468610c66565b3480156104b857600080fd5b506104686104c7366004612fb4565b610c6f565b3480156104d857600080fd5b506104ec6104e73660046133dc565b610c84565b60405161043f91906135be565b34801561050557600080fd5b50610495610514366004612fb4565b610d18565b34801561052557600080fd5b50610432610d6c565b34801561053a57600080fd5b50610432610d72565b34801561054f57600080fd5b5061049561055e366004613008565b610d78565b34801561056f57600080fd5b5061049561057e3660046133dc565b610dd6565b34801561058f57600080fd5b50610598610e1a565b60405161043f91906134af565b3480156105b157600080fd5b506104956105c03660046133dc565b610e29565b3480156105d157600080fd5b50610432610e6d565b3480156105e657600080fd5b50610495610e73565b3480156105fb57600080fd5b5061043261060a366004613384565b610ec4565b34801561061b57600080fd5b50610432610eef565b34801561063057600080fd5b5061049561063f3660046133dc565b610ef5565b34801561065057600080fd5b5061049561065f366004613384565b610f39565b34801561067057600080fd5b5061068461067f3660046132cf565b61110d565b60405161043f9190613572565b34801561069d57600080fd5b506104686106ac3660046133dc565b61122d565b3480156106bd57600080fd5b506104956106cc366004613294565b611240565b3480156106dd57600080fd5b506104326112f9565b3480156106f257600080fd5b50610495610701366004613294565b6112ff565b34801561071257600080fd5b5061049561072136600461340c565b6113b4565b34801561073257600080fd5b50610495610741366004613119565b61140e565b34801561075257600080fd5b50610495611468565b34801561076757600080fd5b50610468610776366004612fb4565b6114b3565b34801561078757600080fd5b506104956107963660046133dc565b6114c8565b3480156107a757600080fd5b5061043261150c565b3480156107bc57600080fd5b50610495611512565b3480156107d157600080fd5b506104956107e03660046133dc565b611565565b3480156107f157600080fd5b506105986108003660046133dc565b6115a9565b34801561081157600080fd5b506105986115e7565b34801561082657600080fd5b506104326115f6565b34801561083b57600080fd5b5061049561084a366004613396565b6115fc565b34801561085b57600080fd5b5061043261086a366004612fb4565b61164e565b34801561087b57600080fd5b50610432611669565b6104956108923660046133dc565b61166f565b3480156108a357600080fd5b506104956108b23660046133dc565b611746565b3480156108c357600080fd5b506104956108d236600461318c565b6117b2565b3480156108e357600080fd5b506104956108f2366004612fb4565b6117c4565b34801561090357600080fd5b50610495610912366004613218565b611832565b34801561092357600080fd5b506104326118c8565b34801561093857600080fd5b506104956118ce565b34801561094d57600080fd5b5061043261095c3660046133dc565b611921565b34801561096d57600080fd5b50610468611933565b34801561098257600080fd5b5061049561193c565b34801561099757600080fd5b506104956109a63660046133dc565b6119c9565b3480156109b757600080fd5b506104326109c6366004612fb4565b611a0d565b3480156109d757600080fd5b506104956109e63660046133dc565b611a28565b3480156109f757600080fd5b50610432610a06366004612fb4565b611a6c565b348015610a1757600080fd5b50610432611a87565b348015610a2c57600080fd5b50610432611a8d565b348015610a4157600080fd5b506104ec611a93565b348015610a5657600080fd5b50610468610a65366004612fd0565b611b25565b348015610a7657600080fd5b50610495610a853660046130b2565b611b53565b348015610a9657600080fd5b50610495610aa5366004612fb4565b611baa565b348015610ab657600080fd5b50610495610ac53660046131e4565b611c18565b610495610ad83660046133dc565b611c6d565b348015610ae957600080fd5b50610495611d8f565b348015610afe57600080fd5b50610495610b0d3660046133dc565b611de2565b348015610b1e57600080fd5b50610495610b2d3660046133dc565b611e26565b348015610b3e57600080fd5b50610468611e6a565b335b90565b60006001600160a01b038316610b7d5760405162461bcd60e51b8152600401610b74906137a2565b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b031982167fd9b67a26000000000000000000000000000000000000000000000000000000001480610c0657506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b80610c155750610c1582611e73565b92915050565b610c23610b47565b6001600160a01b0316610c346115e7565b6001600160a01b031614610c5a5760405162461bcd60e51b8152600401610b7490613c7d565b610c6381611ea5565b50565b601a5460ff1681565b601b6020526000908152604090205460ff1681565b606060028054610c93906140e5565b80601f0160208091040260200160405190810160405280929190818152602001828054610cbf906140e5565b8015610d0c5780601f10610ce157610100808354040283529160200191610d0c565b820191906000526020600020905b815481529060010190602001808311610cef57829003601f168201915b50505050509050919050565b336001600160a01b0382161480610d475750610d326115e7565b6001600160a01b0316336001600160a01b0316145b610d635760405162461bcd60e51b8152600401610b7490613f17565b610c6381611eb8565b60115481565b60145481565b610d80610b47565b6001600160a01b0316856001600160a01b03161480610da65750610da685610a65610b47565b610dc25760405162461bcd60e51b8152600401610b7490613af8565b610dcf8585858585611fc1565b5050505050565b610dde610b47565b6001600160a01b0316610def6115e7565b6001600160a01b031614610e155760405162461bcd60e51b8152600401610b7490613c7d565b601455565b600d546001600160a01b031681565b610e31610b47565b6001600160a01b0316610e426115e7565b6001600160a01b031614610e685760405162461bcd60e51b8152600401610b7490613c7d565b601755565b60055490565b610e7b610b47565b6001600160a01b0316610e8c6115e7565b6001600160a01b031614610eb25760405162461bcd60e51b8152600401610b7490613c7d565b47610c63610ebe6115e7565b82612192565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205490565b600e5481565b610efd610b47565b6001600160a01b0316610f0e6115e7565b6001600160a01b031614610f345760405162461bcd60e51b8152600401610b7490613c7d565b601955565b6001600160a01b038116600090815260076020526040902054610f6e5760405162461bcd60e51b8152600401610b7490613916565b6000610f7983611a6c565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b038516906370a0823190610fbe9030906004016134af565b60206040518083038186803b158015610fd657600080fd5b505afa158015610fea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100e91906133f4565b6110189190614047565b90506000611030838361102b8787610ec4565b61222e565b90508061104f5760405162461bcd60e51b8152600401610b7490613a3e565b6001600160a01b038085166000908152600b6020908152604080832093871683529290529081208054839290611086908490614047565b90915550506001600160a01b0384166000908152600a6020526040812080548392906110b3908490614047565b909155506110c49050848483612276565b836001600160a01b03167f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a84836040516110ff9291906134c3565b60405180910390a250505050565b606081518351146111305760405162461bcd60e51b8152600401610b7490613e5d565b6000835167ffffffffffffffff81111561115a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611183578160200160208202803683370190505b50905060005b8451811015611225576111ea8582815181106111b557634e487b7160e01b600052603260045260246000fd5b60200260200101518583815181106111dd57634e487b7160e01b600052603260045260246000fd5b6020026020010151610b4c565b82828151811061120a57634e487b7160e01b600052603260045260246000fd5b602090810291909101015261121e81614120565b9050611189565b509392505050565b60008061123983611921565b1192915050565b611248610b47565b6001600160a01b03166112596115e7565b6001600160a01b03161461127f5760405162461bcd60e51b8152600401610b7490613c7d565b60005b81518110156112f5576001601660008484815181106112b157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806112ed81614120565b915050611282565b5050565b60135481565b611307610b47565b6001600160a01b03166113186115e7565b6001600160a01b03161461133e5760405162461bcd60e51b8152600401610b7490613c7d565b60005b81518110156112f5576001601b600084848151811061137057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806113ac81614120565b915050611341565b6113bc610b47565b6001600160a01b03166113cd6115e7565b6001600160a01b0316146113f35760405162461bcd60e51b8152600401610b7490613c7d565b6112f5338383604051806020016040528060008152506122e1565b611416610b47565b6001600160a01b0316836001600160a01b0316148061143c575061143c83610a65610b47565b6114585760405162461bcd60e51b8152600401610b74906138b9565b6114638383836123d0565b505050565b611470610b47565b6001600160a01b03166114816115e7565b6001600160a01b0316146114a75760405162461bcd60e51b8152600401610b7490613c7d565b6114b16000612581565b565b60166020526000908152604090205460ff1681565b6114d0610b47565b6001600160a01b03166114e16115e7565b6001600160a01b0316146115075760405162461bcd60e51b8152600401610b7490613c7d565b601855565b600f5481565b61151a610b47565b6001600160a01b031661152b6115e7565b6001600160a01b0316146115515760405162461bcd60e51b8152600401610b7490613c7d565b601a805460ff19811660ff90911615179055565b61156d610b47565b6001600160a01b031661157e6115e7565b6001600160a01b0316146115a45760405162461bcd60e51b8152600401610b7490613c7d565b600e55565b6000600982815481106115cc57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031692915050565b6004546001600160a01b031690565b60185481565b611604610b47565b6001600160a01b03166116156115e7565b6001600160a01b03161461163b5760405162461bcd60e51b8152600401610b7490613c7d565b80516112f590600c906020840190612dd5565b6001600160a01b031660009081526008602052604090205490565b60175481565b60105460ff166116915760405162461bcd60e51b8152600401610b7490613fab565b6011548111156116b35760405162461bcd60e51b8152600401610b749061368b565b80600f546116c1919061407f565b3410156116e05760405162461bcd60e51b8152600401610b7490613cb2565b601354816012546116f19190614047565b111561170f5760405162461bcd60e51b8152600401610b74906136e8565b61172c33600e5483604051806020016040528060008152506122e1565b806012600082825461173e9190614047565b909155505050565b61174e610b47565b6001600160a01b031661175f6115e7565b6001600160a01b0316146117855760405162461bcd60e51b8152600401610b7490613c7d565b600e556010805460ff199081169091556015805482169055601a8054909116905560006018819055601255565b6112f56117bd610b47565b83836125e0565b6117cc610b47565b6001600160a01b03166117dd6115e7565b6001600160a01b0316146118035760405162461bcd60e51b8152600401610b7490613c7d565b600d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600d546001600160a01b0316331461185c5760405162461bcd60e51b8152600401610b7490613b8c565b60005b83811015610dcf576118b685858381811061188a57634e487b7160e01b600052603260045260246000fd5b905060200201602081019061189f9190612fb4565b8484604051806020016040528060008152506122e1565b806118c081614120565b91505061185f565b60195481565b6118d6610b47565b6001600160a01b03166118e76115e7565b6001600160a01b03161461190d5760405162461bcd60e51b8152600401610b7490613c7d565b6010805460ff19811660ff90911615179055565b60009081526003602052604090205490565b60105460ff1681565b601a5460ff1661195e5760405162461bcd60e51b8152600401610b7490613973565b336000908152601b602052604090205460ff1615156001146119925760405162461bcd60e51b8152600401610b7490613745565b6119b033600e546001604051806020016040528060008152506122e1565b336000908152601b60205260409020805460ff19169055565b6119d1610b47565b6001600160a01b03166119e26115e7565b6001600160a01b031614611a085760405162461bcd60e51b8152600401610b7490613c7d565b600f55565b6001600160a01b031660009081526007602052604090205490565b611a30610b47565b6001600160a01b0316611a416115e7565b6001600160a01b031614611a675760405162461bcd60e51b8152600401610b7490613c7d565b601355565b6001600160a01b03166000908152600a602052604090205490565b60125481565b60065490565b6060600c8054611aa2906140e5565b80601f0160208091040260200160405190810160405280929190818152602001828054611ace906140e5565b8015611b1b5780601f10611af057610100808354040283529160200191611b1b565b820191906000526020600020905b815481529060010190602001808311611afe57829003601f168201915b5050505050905090565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b611b5b610b47565b6001600160a01b0316856001600160a01b03161480611b815750611b8185610a65610b47565b611b9d5760405162461bcd60e51b8152600401610b74906138b9565b610dcf8585858585612683565b611bb2610b47565b6001600160a01b0316611bc36115e7565b6001600160a01b031614611be95760405162461bcd60e51b8152600401610b7490613c7d565b6001600160a01b038116611c0f5760405162461bcd60e51b8152600401610b74906137ff565b610c6381612581565b611c20610b47565b6001600160a01b0316836001600160a01b03161480611c465750611c4683610a65610b47565b611c625760405162461bcd60e51b8152600401610b74906138b9565b6114638383836127b7565b60155460ff16611c8f5760405162461bcd60e51b8152600401610b7490613b55565b601754811115611cb15760405162461bcd60e51b8152600401610b749061368b565b80601454611cbf919061407f565b341015611cde5760405162461bcd60e51b8152600401610b7490613cb2565b3360009081526016602052604090205460ff161515600114611d125760405162461bcd60e51b8152600401610b7490613d46565b60195481601854611d239190614047565b1115611d415760405162461bcd60e51b8152600401610b74906136e8565b611d5e33600e5483604051806020016040528060008152506122e1565b8060186000828254611d709190614047565b9091555050336000908152601660205260409020805460ff1916905550565b611d97610b47565b6001600160a01b0316611da86115e7565b6001600160a01b031614611dce5760405162461bcd60e51b8152600401610b7490613c7d565b6015805460ff19811660ff90911615179055565b611dea610b47565b6001600160a01b0316611dfb6115e7565b6001600160a01b031614611e215760405162461bcd60e51b8152600401610b7490613c7d565b601255565b611e2e610b47565b6001600160a01b0316611e3f6115e7565b6001600160a01b031614611e655760405162461bcd60e51b8152600401610b7490613c7d565b601155565b60155460ff1681565b6001600160e01b031981167f01ffc9a70000000000000000000000000000000000000000000000000000000014919050565b80516112f5906002906020840190612dd5565b6001600160a01b038116600090815260076020526040902054611eed5760405162461bcd60e51b8152600401610b7490613916565b6000611ef7611a8d565b611f019047614047565b90506000611f13838361102b8661164e565b905080611f325760405162461bcd60e51b8152600401610b7490613a3e565b6001600160a01b03831660009081526008602052604081208054839290611f5a908490614047565b925050819055508060066000828254611f739190614047565b90915550611f8390508382612192565b7fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0568382604051611fb49291906134c3565b60405180910390a1505050565b8151835114611fe25760405162461bcd60e51b8152600401610b7490613eba565b6001600160a01b0384166120085760405162461bcd60e51b8152600401610b7490613a9b565b6000612012610b47565b90506120228187878787876128c6565b60005b845181101561212457600085828151811061205057634e487b7160e01b600052603260045260246000fd5b60200260200101519050600085838151811061207c57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151600084815280835260408082206001600160a01b038e1683529093529190912054909150818110156120cc5760405162461bcd60e51b8152600401610b7490613c20565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290612109908490614047565b925050819055505050508061211d90614120565b9050612025565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612174929190613585565b60405180910390a461218a8187878787876128d4565b505050505050565b804710156121b25760405162461bcd60e51b8152600401610b7490613a07565b6000826001600160a01b0316826040516121cb90610b49565b60006040518083038185875af1925050503d8060008114612208576040519150601f19603f3d011682016040523d82523d6000602084013e61220d565b606091505b50509050806114635760405162461bcd60e51b8152600401610b74906139aa565b6005546001600160a01b03841660009081526007602052604081205490918391612258908661407f565b612262919061405f565b61226c919061409e565b90505b9392505050565b6114638363a9059cbb60e01b84846040516024016122959291906134c3565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091526129e2565b6001600160a01b0384166123075760405162461bcd60e51b8152600401610b7490613f4e565b6000612311610b47565b90506123328160008761232388612a71565b61232c88612a71565b876128c6565b6000848152602081815260408083206001600160a01b038916845290915281208054859290612362908490614047565b92505081905550846001600160a01b031660006001600160a01b0316826001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6287876040516123b9929190613feb565b60405180910390a4610dcf81600087878787612aca565b6001600160a01b0383166123f65760405162461bcd60e51b8152600401610b7490613bc3565b80518251146124175760405162461bcd60e51b8152600401610b7490613eba565b6000612421610b47565b9050612441818560008686604051806020016040528060008152506128c6565b60005b835181101561252257600084828151811061246f57634e487b7160e01b600052603260045260246000fd5b60200260200101519050600084838151811061249b57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151600084815280835260408082206001600160a01b038c1683529093529190912054909150818110156124eb5760405162461bcd60e51b8152600401610b749061385c565b6000928352602083815260408085206001600160a01b038b168652909152909220910390558061251a81614120565b915050612444565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612573929190613585565b60405180910390a450505050565b600480546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156126125760405162461bcd60e51b8152600401610b7490613da3565b6001600160a01b0383811660008181526001602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906126769085906135b3565b60405180910390a3505050565b6001600160a01b0384166126a95760405162461bcd60e51b8152600401610b7490613a9b565b60006126b3610b47565b90506126c481878761232388612a71565b6000848152602081815260408083206001600160a01b038a168452909152902054838110156127055760405162461bcd60e51b8152600401610b7490613c20565b6000858152602081815260408083206001600160a01b038b8116855292528083208785039055908816825281208054869290612742908490614047565b92505081905550856001600160a01b0316876001600160a01b0316836001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628888604051612798929190613feb565b60405180910390a46127ae828888888888612aca565b50505050505050565b6001600160a01b0383166127dd5760405162461bcd60e51b8152600401610b7490613bc3565b60006127e7610b47565b9050612817818560006127f987612a71565b61280287612a71565b604051806020016040528060008152506128c6565b6000838152602081815260408083206001600160a01b0388168452909152902054828110156128585760405162461bcd60e51b8152600401610b749061385c565b6000848152602081815260408083206001600160a01b03808a16808652919093528184208786039055905190918516907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62906128b79089908990613feb565b60405180910390a45050505050565b61218a868686868686612b9b565b6128e6846001600160a01b0316612ced565b1561218a5760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061291f90899089908890889088906004016134dc565b602060405180830381600087803b15801561293957600080fd5b505af1925050508015612969575060408051601f3d908101601f1916820190925261296691810190613368565b60015b6129b25761297561416d565b80612980575061299a565b8060405162461bcd60e51b8152600401610b7491906135be565b60405162461bcd60e51b8152600401610b74906135d1565b6001600160e01b0319811663bc197c8160e01b146127ae5760405162461bcd60e51b8152600401610b749061362e565b6000612a37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612cf39092919063ffffffff16565b8051909150156114635780806020019051810190612a559190613330565b6114635760405162461bcd60e51b8152600401610b7490613e00565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612ab957634e487b7160e01b600052603260045260246000fd5b602090810291909101015292915050565b612adc846001600160a01b0316612ced565b1561218a5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190612b15908990899088908890889060040161353a565b602060405180830381600087803b158015612b2f57600080fd5b505af1925050508015612b5f575060408051601f3d908101601f19168201909252612b5c91810190613368565b60015b612b6b5761297561416d565b6001600160e01b0319811663f23a6e6160e01b146127ae5760405162461bcd60e51b8152600401610b749061362e565b612ba986868686868661218a565b6001600160a01b038516612c4c5760005b8351811015612c4a57828181518110612be357634e487b7160e01b600052603260045260246000fd5b602002602001015160036000868481518110612c0f57634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000206000828254612c349190614047565b90915550612c43905081614120565b9050612bba565b505b6001600160a01b03841661218a5760005b83518110156127ae57828181518110612c8657634e487b7160e01b600052603260045260246000fd5b602002602001015160036000868481518110612cb257634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000206000828254612cd7919061409e565b90915550612ce6905081614120565b9050612c5d565b3b151590565b606061226c848460008585612d0785612ced565b612d235760405162461bcd60e51b8152600401610b7490613d0f565b600080866001600160a01b03168587604051612d3f9190613493565b60006040518083038185875af1925050503d8060008114612d7c576040519150601f19603f3d011682016040523d82523d6000602084013e612d81565b606091505b5091509150612d91828286612d9c565b979650505050505050565b60608315612dab57508161226f565b825115612dbb5782518084602001fd5b8160405162461bcd60e51b8152600401610b7491906135be565b828054612de1906140e5565b90600052602060002090601f016020900481019282612e035760008555612e49565b82601f10612e1c57805160ff1916838001178555612e49565b82800160010185558215612e49579182015b82811115612e49578251825591602001919060010190612e2e565b50612e55929150612e59565b5090565b5b80821115612e555760008155600101612e5a565b600067ffffffffffffffff831115612e8857612e88614151565b612e9b601f8401601f1916602001613ff9565b9050828152838383011115612eaf57600080fd5b828260208301376000602084830101529392505050565b600082601f830112612ed6578081fd5b81356020612eeb612ee683614023565b613ff9565b8281528181019085830183850287018401881015612f07578586fd5b855b85811015612f2e578135612f1c81614212565b84529284019290840190600101612f09565b5090979650505050505050565b600082601f830112612f4b578081fd5b81356020612f5b612ee683614023565b8281528181019085830183850287018401881015612f77578586fd5b855b85811015612f2e57813584529284019290840190600101612f79565b600082601f830112612fa5578081fd5b61226f83833560208501612e6e565b600060208284031215612fc5578081fd5b813561226f81614212565b60008060408385031215612fe2578081fd5b8235612fed81614212565b91506020830135612ffd81614212565b809150509250929050565b600080600080600060a0868803121561301f578081fd5b853561302a81614212565b9450602086013561303a81614212565b9350604086013567ffffffffffffffff80821115613056578283fd5b61306289838a01612f3b565b94506060880135915080821115613077578283fd5b61308389838a01612f3b565b93506080880135915080821115613098578283fd5b506130a588828901612f95565b9150509295509295909350565b600080600080600060a086880312156130c9578081fd5b85356130d481614212565b945060208601356130e481614212565b93506040860135925060608601359150608086013567ffffffffffffffff81111561310d578182fd5b6130a588828901612f95565b60008060006060848603121561312d578283fd5b833561313881614212565b9250602084013567ffffffffffffffff80821115613154578384fd5b61316087838801612f3b565b93506040860135915080821115613175578283fd5b5061318286828701612f3b565b9150509250925092565b6000806040838503121561319e578182fd5b82356131a981614212565b91506020830135612ffd81614227565b600080604083850312156131cb578182fd5b82356131d681614212565b946020939093013593505050565b6000806000606084860312156131f8578081fd5b833561320381614212565b95602085013595506040909401359392505050565b6000806000806060858703121561322d578182fd5b843567ffffffffffffffff80821115613244578384fd5b818701915087601f830112613257578384fd5b813581811115613265578485fd5b8860208083028501011115613278578485fd5b6020928301999098509187013596604001359550909350505050565b6000602082840312156132a5578081fd5b813567ffffffffffffffff8111156132bb578182fd5b6132c784828501612ec6565b949350505050565b600080604083850312156132e1578182fd5b823567ffffffffffffffff808211156132f8578384fd5b61330486838701612ec6565b93506020850135915080821115613319578283fd5b5061332685828601612f3b565b9150509250929050565b600060208284031215613341578081fd5b815161226f81614227565b60006020828403121561335d578081fd5b813561226f81614235565b600060208284031215613379578081fd5b815161226f81614235565b60008060408385031215612fe2578182fd5b6000602082840312156133a7578081fd5b813567ffffffffffffffff8111156133bd578182fd5b8201601f810184136133cd578182fd5b6132c784823560208401612e6e565b6000602082840312156133ed578081fd5b5035919050565b600060208284031215613405578081fd5b5051919050565b6000806040838503121561341e578182fd5b50508035926020909101359150565b6000815180845260208085019450808401835b8381101561345c57815187529582019590820190600101613440565b509495945050505050565b6000815180845261347f8160208601602086016140b5565b601f01601f19169290920160200192915050565b600082516134a58184602087016140b5565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b60006001600160a01b03808816835280871660208401525060a0604083015261350860a083018661342d565b828103606084015261351a818661342d565b9050828103608084015261352e8185613467565b98975050505050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152612d9160a0830184613467565b60006020825261226f602083018461342d565b600060408252613598604083018561342d565b82810360208401526135aa818561342d565b95945050505050565b901515815260200190565b60006020825261226f6020830184613467565b60208082526034908201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560408201527f526563656976657220696d706c656d656e746572000000000000000000000000606082015260800190565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a6563746560408201527f6420746f6b656e73000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f596f752077656e74206f766572206d617820746f6b656e73207065722074726160408201527f6e73616374696f6e000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f4e6f7420656e6f75676820746f6b656e73206c65667420746f206d696e74207460408201527f686174206d616e79000000000000000000000000000000000000000000000000606082015260800190565b6020808252603a908201527f596f7520617265206e6f74206f6e2074686520667265652077616c6c6574206c60408201527f697374206f72206861766520616c7265616479206d696e746564000000000000606082015260800190565b6020808252602b908201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60408201527f65726f2061646472657373000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60408201527f616e636500000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201527f20617070726f7665640000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201527f7368617265730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526017908201527f46726565206d696e74206973206e6f7420616374697665000000000000000000604082015260600190565b6020808252603a908201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260408201527f6563697069656e74206d61792068617665207265766572746564000000000000606082015260800190565b6020808252601d908201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604082015260600190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201527f647565207061796d656e74000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526032908201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060408201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606082015260800190565b6020808252601a908201527f50726573616c65206d696e74206973206e6f7420616374697665000000000000604082015260600190565b6020808252601d908201527f596f75206d757374206861766520746865204d696e74657220726f6c65000000604082015260600190565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201527f72207472616e7366657200000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526024908201527f596f752073656e742074686520696e636f727265637420616d6f756e74206f6660408201527f2045544800000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252603d908201527f596f7520617265206e6f74206f6e207468652070726573616c652077616c6c6560408201527f74206c697374206f72206861766520616c7265616479206d696e746564000000606082015260800190565b60208082526029908201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360408201527f20666f722073656c660000000000000000000000000000000000000000000000606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860408201527f206d69736d617463680000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060408201527f6d69736d61746368000000000000000000000000000000000000000000000000606082015260800190565b60208082526016908201527f52656c656173653a206e6f207065726d697373696f6e00000000000000000000604082015260600190565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360408201527f7300000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f5075626c6963206d696e74206973206e6f742061637469766500000000000000604082015260600190565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff8111828210171561401b5761401b614151565b604052919050565b600067ffffffffffffffff82111561403d5761403d614151565b5060209081020190565b6000821982111561405a5761405a61413b565b500190565b60008261407a57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156140995761409961413b565b500290565b6000828210156140b0576140b061413b565b500390565b60005b838110156140d05781810151838201526020016140b8565b838111156140df576000848401525b50505050565b6002810460018216806140f957607f821691505b6020821081141561411a57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156141345761413461413b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60e01c90565b600060443d101561417d57610b49565b600481823e6308c379a06141918251614167565b1461419b57610b49565b6040513d600319016004823e80513d67ffffffffffffffff81602484011181841117156141cb5750505050610b49565b828401925082519150808211156141e55750505050610b49565b503d830160208284010111156141fd57505050610b49565b601f01601f1916810160200160405291505090565b6001600160a01b0381168114610c6357600080fd5b8015158114610c6357600080fd5b6001600160e01b031981168114610c6357600080fdfea2646970667358221220b92d0d721904da8a2a20321225d05e5a5b2196304eb616a6f075cfa738f525d964736f6c63430008000033

Verified Source Code Full Match

Compiler: v0.8.0+commit.c7dfd78e EVM: istanbul Optimization: Yes (1000 runs)
MythDivisionAllAccessToken.sol 332 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";

/**
*              _____            ___ _____        _____  __   _____  ___    __ 
*   /\/\ /\_/\/__   \/\  /\    /   \\_   \/\   /\\_   \/ _\  \_   \/___\/\ \ \
*  /    \\_ _/  / /\/ /_/ /   / /\ / / /\/\ \ / / / /\/\ \    / /\//  //  \/ /
* / /\/\ \/ \  / / / __  /   / /_//\/ /_   \ V /\/ /_  _\ \/\/ /_/ \_// /\  / 
* \/    \/\_/  \/  \/ /_/   /___,'\____/    \_/\____/  \__/\____/\___/\_\ \/  
* 
*/

/**
 * @title Myth Division All Access Token ERC1155 Smart Contract
 * @notice Extends ERC1155 
 */

contract MythDivisionAllAccessToken is ERC1155, ERC1155Supply, ERC1155Burnable, Ownable, PaymentSplitter {
    string private _contractURI;
    address public minterAddress;
    uint256 public mintingTokenID = 0;

    /// PUBLIC MINT
    uint256 public tokenPricePublic = 1.0 ether; 
    bool public mintIsActivePublic = false;
    uint256 public maxTokensPerTransactionPublic = 5;
    uint256 public numberMintedPublic = 0;
    uint256 public maxTokensPublic  = 100;

    /// PRESALE MINT
    uint256 public tokenPricePresale = 0.5 ether;
    bool public mintIsActivePresale = false;
    mapping (address => bool) public presaleWalletList;
    uint256 public maxTokensPerTransactionPresale = 2;
    uint256 public numberMintedPresale = 0;
    uint256 public maxTokensPresale = 100;

    /// FREE WALLET BASED MINT
    bool public mintIsActiveFree = false;
    mapping (address => bool) public freeWalletList;

    constructor(address[] memory _payees, uint256[] memory _shares) ERC1155("") PaymentSplitter(_payees, _shares) {}

    /// @title PUBLIC MINT

    /**
     * @notice turn on/off public mint
     */
    function flipMintStatePublic() external onlyOwner {
        mintIsActivePublic = !mintIsActivePublic;
    }

    /**
     * @notice Public mint function
     */
    function mint(uint256 numberOfTokens) external payable {
        require(mintIsActivePublic, "Public mint is not active");
        require(
            numberOfTokens <= maxTokensPerTransactionPublic, 
            "You went over max tokens per transaction"
        );
        require(
	        msg.value >= tokenPricePublic * numberOfTokens,
            "You sent the incorrect amount of ETH"
        );
        require(
            numberMintedPublic + numberOfTokens <= maxTokensPublic, 
            "Not enough tokens left to mint that many"
        );

        _mint(msg.sender, mintingTokenID, numberOfTokens, "");
        numberMintedPublic += numberOfTokens;
    }

    /// @title PRESALE WALLET MINT

    /**
     * @notice Turn on/off presale wallet mint
     */
    function flipPresaleMintState() external onlyOwner {
        mintIsActivePresale = !mintIsActivePresale;
    }

    /**
     * @notice Add wallets to presale wallet list
     */
    function initPresaleWalletList(address[] memory walletList) external onlyOwner {
	    for (uint i; i < walletList.length; i++) {
		    presaleWalletList[walletList[i]] = true;
	    }
    }

    /**
     * @notice Presale wallet list mint 
     */
    function mintPresale(uint256 numberOfTokens) external payable {
        require(mintIsActivePresale, "Presale mint is not active");
        require(
            numberOfTokens <= maxTokensPerTransactionPresale, 
            "You went over max tokens per transaction"
        );
        require(
	        msg.value >= tokenPricePresale * numberOfTokens,
            "You sent the incorrect amount of ETH"
        );
        require(
            presaleWalletList[msg.sender] == true, 
            "You are not on the presale wallet list or have already minted"
        );
        require(
            numberMintedPresale + numberOfTokens <= maxTokensPresale, 
            "Not enough tokens left to mint that many"
        );

        _mint(msg.sender, mintingTokenID, numberOfTokens, "");
        numberMintedPresale += numberOfTokens;

        presaleWalletList[msg.sender] = false;
    }


    /// @title Free Wallet Mint

    /**
     * @notice turn on/off free wallet mint
     */
    function flipFreeWalletState() external onlyOwner {
	    mintIsActiveFree = !mintIsActiveFree;
    }

    /**
     * @notice data structure for uploading free mint wallets
     */
    function initFreeWalletList(address[] memory walletList) external onlyOwner {
	    for (uint256 i = 0; i < walletList.length; i++) {
		    freeWalletList[walletList[i]] = true;
	    }
    }

    /**
     * @notice Free mint for wallets in freeWalletList
     */
    function mintFreeWalletList() external {
        require(mintIsActiveFree, "Free mint is not active");
	    require(
            freeWalletList[msg.sender] == true, 
            "You are not on the free wallet list or have already minted"
        );

        _mint(msg.sender, mintingTokenID, 1, "");

	    freeWalletList[msg.sender] = false;
    }

    /**
     * @notice get contractURI
     */
    function contractURI() public view returns (string memory) {
	    return _contractURI;
    }

    // OWNER FUNCTIONS

    /**
    *  @notice Reserve mint a token
    */
    function mintReserve(uint256 id, uint256 numberOfTokens) external onlyOwner {
        _mint(msg.sender, id, numberOfTokens, "");
    }

   /**
    * @notice Enable additional wallet to airdrop tokens
    */
    modifier onlyMinter {
	    require(minterAddress == msg.sender, "You must have the Minter role");
	    _;
    }

    /**
    * @notice Airdrop a specific token to a list of addresses
    */
    function airdrop(address[] calldata addresses, uint id, uint amt_each) external onlyMinter {
        for (uint i=0; i < addresses.length; i++) {
            _mint(addresses[i], id, amt_each, "");
        }
    }

    /**
     * @notice Withdraw ETH in contract to ownership wallet
     */
    function withdraw() external onlyOwner {
        uint256 balance = address(this).balance;
        Address.sendValue(payable(owner()), balance);
    }

    // @title SETTER FUNCTIONS

    /**
    *  @notice Set airdrop minter address
    */
   function setMinterAddress(address minter) external onlyOwner {
	    minterAddress = minter;
    }

    /**
    *  @notice Set contract uri
    */
    function setContractURI(string memory newContractURI) external onlyOwner {
        _contractURI = newContractURI;
    }

    /**
    *  @notice Set base URI
    */
    function setURI(string memory baseURI) public onlyOwner {
        _setURI(baseURI);
    }

    /**
    *  @notice Set token price of presale - tokenPricePublic
    */
    function setTokenPricePublic(uint256 tokenPrice) external onlyOwner {
        require(tokenPrice >= 0, "Must be greater or equal then zer0");
        tokenPricePublic = tokenPrice;
    }

    /**
    *  @notice Set max tokens allowed minted in public sale - maxTokensPublic
    */
    function setMaxTokensPublic (uint256 amount) external onlyOwner {
        require(amount >= 0, "Must be greater or equal than zer0");
        maxTokensPublic = amount;
    }

    /**
    *  @notice Set total number of tokens minted in public sale - numberMintedPublic
    */
    function setNumberMintedPublic(uint256 amount) external onlyOwner {
        require(amount >= 0, "Must be greater or equal than zer0");
        numberMintedPublic = amount;
    }

    /**
    *  @notice Set max tokens per transaction for public sale - maxTokensPerTransactionPublic 
    */
    function setMaxTokensPerTransactionPublic(uint256 amount) external onlyOwner {
        require(amount >= 0, "Invalid amount");
        maxTokensPerTransactionPublic = amount;
    }

    /**
    *  @notice Set token price of presale - tokenPricePresale
    */
    function setTokenPricePresale(uint256 tokenPrice) external onlyOwner {
        require(tokenPrice >= 0, "Must be greater or equal than zer0");
        tokenPricePresale = tokenPrice;
    }

    /**
    *  @notice Set max tokens allowed minted in presale - maxTokensPresale
    */
    function setMaxTokensPresale(uint256 amount) external onlyOwner {
        require(amount >= 0, "Invalid amount");
        maxTokensPresale = amount;
    }

    /**
    *  @notice Set total number of tokens minted in presale - numberMintedPresale
    */
    function setNumberMintedPresale(uint256 amount) external onlyOwner {
        require(amount >= 0, "Invalid amount");
        numberMintedPresale = amount;
    }

    /**
    *  @notice Set max tokens per transaction for presale - maxTokensPerTransactionPresale 
    */
    function setMaxTokensPerTransactionPresale(uint256 amount) external onlyOwner {
        require(amount >= 0, "Invalid amount");
        maxTokensPerTransactionPresale = amount;
    }

    /**
    *  @notice Set the current token ID minting - mintingTokenID
    */
    function setMintingTokenID(uint256 tokenID) external onlyOwner {
        require(tokenID >= 0, "Invalid token id");
        mintingTokenID = tokenID;
    }

    /**
    *  @notice Set the current token ID minting and reset all counters and active mints to 0 and false respectively
    */
    function setMintingTokenIdAndResetState(uint256 tokenID) external onlyOwner {
	    require(tokenID >= 0, "Invalid token id");
	    mintingTokenID = tokenID;

	    mintIsActivePublic = false;
	    mintIsActivePresale = false;
	    mintIsActiveFree = false;

	    numberMintedPresale = 0;
	    numberMintedPublic = 0;
    }

    /**
    *  @notice Withdraw eth from contract by wallet
    */
    function release(address payable account) public override {
        require(msg.sender == account || msg.sender == owner(), "Release: no permission");

        super.release(account);
    }

    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override(ERC1155, ERC1155Supply) {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }

}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
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;
    }
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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);
    }
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}
ERC1155.sol 464 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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: balance query for the zero address");
        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 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: transfer caller is not 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();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), 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);

        _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);

        _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();

        _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);

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

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

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * 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);

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

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * 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();

        _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        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);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * 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);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {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 `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 _beforeTokenTransfer(
        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 v4.4.1 (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 be 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;
}
PaymentSplitter.sol 189 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol)

pragma solidity ^0.8.0;

import "../token/ERC20/utils/SafeERC20.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";

/**
 * @title PaymentSplitter
 * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware
 * that the Ether will be split in this way, since it is handled transparently by the contract.
 *
 * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
 * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
 * an amount proportional to the percentage of total shares they were assigned.
 *
 * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
 * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
 * function.
 *
 * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and
 * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you
 * to run tests before sending real value to this contract.
 */
contract PaymentSplitter is Context {
    event PayeeAdded(address account, uint256 shares);
    event PaymentReleased(address to, uint256 amount);
    event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);
    event PaymentReceived(address from, uint256 amount);

    uint256 private _totalShares;
    uint256 private _totalReleased;

    mapping(address => uint256) private _shares;
    mapping(address => uint256) private _released;
    address[] private _payees;

    mapping(IERC20 => uint256) private _erc20TotalReleased;
    mapping(IERC20 => mapping(address => uint256)) private _erc20Released;

    /**
     * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at
     * the matching position in the `shares` array.
     *
     * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
     * duplicates in `payees`.
     */
    constructor(address[] memory payees, uint256[] memory shares_) payable {
        require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
        require(payees.length > 0, "PaymentSplitter: no payees");

        for (uint256 i = 0; i < payees.length; i++) {
            _addPayee(payees[i], shares_[i]);
        }
    }

    /**
     * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
     * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
     * reliability of the events, and not the actual splitting of Ether.
     *
     * To learn more about this see the Solidity documentation for
     * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
     * functions].
     */
    receive() external payable virtual {
        emit PaymentReceived(_msgSender(), msg.value);
    }

    /**
     * @dev Getter for the total shares held by payees.
     */
    function totalShares() public view returns (uint256) {
        return _totalShares;
    }

    /**
     * @dev Getter for the total amount of Ether already released.
     */
    function totalReleased() public view returns (uint256) {
        return _totalReleased;
    }

    /**
     * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20
     * contract.
     */
    function totalReleased(IERC20 token) public view returns (uint256) {
        return _erc20TotalReleased[token];
    }

    /**
     * @dev Getter for the amount of shares held by an account.
     */
    function shares(address account) public view returns (uint256) {
        return _shares[account];
    }

    /**
     * @dev Getter for the amount of Ether already released to a payee.
     */
    function released(address account) public view returns (uint256) {
        return _released[account];
    }

    /**
     * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an
     * IERC20 contract.
     */
    function released(IERC20 token, address account) public view returns (uint256) {
        return _erc20Released[token][account];
    }

    /**
     * @dev Getter for the address of the payee number `index`.
     */
    function payee(uint256 index) public view returns (address) {
        return _payees[index];
    }

    /**
     * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the
     * total shares and their previous withdrawals.
     */
    function release(address payable account) public virtual {
        require(_shares[account] > 0, "PaymentSplitter: account has no shares");

        uint256 totalReceived = address(this).balance + totalReleased();
        uint256 payment = _pendingPayment(account, totalReceived, released(account));

        require(payment != 0, "PaymentSplitter: account is not due payment");

        _released[account] += payment;
        _totalReleased += payment;

        Address.sendValue(account, payment);
        emit PaymentReleased(account, payment);
    }

    /**
     * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their
     * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20
     * contract.
     */
    function release(IERC20 token, address account) public virtual {
        require(_shares[account] > 0, "PaymentSplitter: account has no shares");

        uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);
        uint256 payment = _pendingPayment(account, totalReceived, released(token, account));

        require(payment != 0, "PaymentSplitter: account is not due payment");

        _erc20Released[token][account] += payment;
        _erc20TotalReleased[token] += payment;

        SafeERC20.safeTransfer(token, account, payment);
        emit ERC20PaymentReleased(token, account, payment);
    }

    /**
     * @dev internal logic for computing the pending payment of an `account` given the token historical balances and
     * already released amounts.
     */
    function _pendingPayment(
        address account,
        uint256 totalReceived,
        uint256 alreadyReleased
    ) private view returns (uint256) {
        return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;
    }

    /**
     * @dev Add a new payee to the contract.
     * @param account The address of the payee to add.
     * @param shares_ The number of shares owned by the payee.
     */
    function _addPayee(address account, uint256 shares_) private {
        require(account != address(0), "PaymentSplitter: account is the zero address");
        require(shares_ > 0, "PaymentSplitter: shares are 0");
        require(_shares[account] == 0, "PaymentSplitter: account already has shares");

        _payees.push(account);
        _shares[account] = shares_;
        _totalShares = _totalShares + shares_;
        emit PayeeAdded(account, shares_);
    }
}
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;
    }
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.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));
        }
    }

    /**
     * @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");
        }
    }
}
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);
}
IERC1155Receiver.sol 53 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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.
        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. 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);
}
ERC1155Supply.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Supply.sol)

pragma solidity ^0.8.0;

import "../ERC1155.sol";

/**
 * @dev Extension of ERC1155 that adds tracking of total supply per id.
 *
 * Useful for scenarios where Fungible and Non-fungible tokens have to be
 * clearly identified. Note: While a totalSupply of 1 might mean the
 * corresponding is an NFT, there is no guarantees that no other token with the
 * same id are not going to be minted.
 */
abstract contract ERC1155Supply is ERC1155 {
    mapping(uint256 => uint256) private _totalSupply;

    /**
     * @dev Total amount of tokens in with a given id.
     */
    function totalSupply(uint256 id) public view virtual returns (uint256) {
        return _totalSupply[id];
    }

    /**
     * @dev Indicates whether any token exist with a given id, or not.
     */
    function exists(uint256 id) public view virtual returns (bool) {
        return ERC1155Supply.totalSupply(id) > 0;
    }

    /**
     * @dev See {ERC1155-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

        if (from == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                _totalSupply[ids[i]] += amounts[i];
            }
        }

        if (to == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                _totalSupply[ids[i]] -= amounts[i];
            }
        }
    }
}
ERC1155Burnable.sol 40 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)

pragma solidity ^0.8.0;

import "../ERC1155.sol";

/**
 * @dev Extension of {ERC1155} that allows token holders to destroy both their
 * own tokens and those that they have been approved to use.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155Burnable is ERC1155 {
    function burn(
        address account,
        uint256 id,
        uint256 value
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burn(account, id, value);
    }

    function burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory values
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burnBatch(account, ids, values);
    }
}
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);
}

Read Contract

balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
contractURI 0xe8a3d485 → string
exists 0x4f558e79 → bool
freeWalletList 0x0c9a6313 → bool
isApprovedForAll 0xe985e9c5 → bool
maxTokensPerTransactionPresale 0x9be51bea → uint256
maxTokensPerTransactionPublic 0x1df09e47 → uint256
maxTokensPresale 0xb8de970a → uint256
maxTokensPublic 0x59aefc59 → uint256
mintIsActiveFree 0x05461a6a → bool
mintIsActivePresale 0xff5a70c6 → bool
mintIsActivePublic 0xc7b69459 → bool
minterAddress 0x34d722c9 → address
mintingTokenID 0x4576cdd5 → uint256
numberMintedPresale 0x8f4167da → uint256
numberMintedPublic 0xd9a02e69 → uint256
owner 0x8da5cb5b → address
payee 0x8b83209b → address
presaleWalletList 0x748c4557 → bool
released 0x406072a9 → uint256
released 0x9852595c → uint256
shares 0xce7c2ac2 → uint256
supportsInterface 0x01ffc9a7 → bool
tokenPricePresale 0x2b038411 → uint256
tokenPricePublic 0x7de69d5f → uint256
totalReleased 0xd79779b2 → uint256
totalReleased 0xe33b7de3 → uint256
totalShares 0x3a98ef39 → uint256
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string

Write Contract 33 functions

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

airdrop 0xa496dedf
address[] addresses
uint256 id
uint256 amt_each
burn 0xf5298aca
address account
uint256 id
uint256 value
burnBatch 0x6b20c454
address account
uint256[] ids
uint256[] values
flipFreeWalletState 0x894a8cac
No parameters
flipMintStatePublic 0xb92bc375
No parameters
flipPresaleMintState 0xf931a4c2
No parameters
initFreeWalletList 0x5d04aeab
address[] walletList
initPresaleWalletList 0x4f699a43
address[] walletList
mint 0xa0712d68
uint256 numberOfTokens
mintFreeWalletList 0xcca97911
No parameters
mintPresale 0xf759867a
uint256 numberOfTokens
mintReserve 0x5e2da7e2
uint256 id
uint256 numberOfTokens
release 0x19165587
address account
release 0x48b75044
address token
address account
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
setContractURI 0x938e3d7b
string newContractURI
setMaxTokensPerTransactionPresale 0x35a4faf4
uint256 amount
setMaxTokensPerTransactionPublic 0xfa5d7882
uint256 amount
setMaxTokensPresale 0x46ca1ab8
uint256 amount
setMaxTokensPublic 0xd70c3dba
uint256 amount
setMinterAddress 0xa3106b95
address minter
setMintingTokenID 0x8b13fde8
uint256 tokenID
setMintingTokenIdAndResetState 0xa1e33d02
uint256 tokenID
setNumberMintedPresale 0x7521134c
uint256 amount
setNumberMintedPublic 0xf9346881
uint256 amount
setTokenPricePresale 0x311df29a
uint256 tokenPrice
setTokenPricePublic 0xcd2c7052
uint256 tokenPrice
setURI 0x02fe5305
string baseURI
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters

Token Balances (1)

View Transfers →
WETH 0

Recent Transactions

No transactions found for this address