Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x8f393E46Ac410118Fd892011B1432bb7D0fD1A54
Balance 0.200000 ETH
Nonce 1
Code Size 12472 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

12472 bytes
0x6080604052600436106102ae5760003560e01c80639231ab2a11610175578063ce22483c116100dc578063dc33e68111610095578063f2fde38b1161006f578063f2fde38b14610863578063f439733514610883578063f921d83f146108a3578063fe4ca847146108b9576102ae565b8063dc33e681146107da578063e985e9c5146107fa578063f176baaa14610843576102ae565b8063ce22483c1461072c578063cfc86f7b1461074c578063d48a05bb14610761578063d4bba0e91461078e578063d7224ba0146107a4578063d897833e146107ba576102ae565b8063a95268621161012e578063a952686214610683578063aa9dc50c14610696578063ae5cc172146106b6578063b88d4fde146106cc578063c54e44eb146106ec578063c87b56dd1461070c576102ae565b80639231ab2a146105a757806395d89b41146105f5578063995b8ef61461060a5780639d902fc014610620578063a22cb46514610636578063a87430ba14610656576102ae565b80634df0821911610219578063715018a6116101d2578063715018a6146105085780637bb5585f1461051d5780637ec0912e1461053d5780637f205a741461055d5780638da5cb5b146105735780638f66291514610591576102ae565b80634df08219146104525780634f6ccce71461047257806355f804b3146104925780636352211e146104b257806370a08231146104d2578063711cc2ae146104f2576102ae565b806318160ddd1161026b57806318160ddd146103a8578063193bc621146103bd57806323b872dd146103dd5780632f745c59146103fd5780633ccfd60b1461041d57806342842e0e14610432576102ae565b806301ffc9a7146102b357806306fdde03146102e8578063081812fc1461030a578063095ea7b3146103425780630990e5341461036457806312f7086c14610388575b600080fd5b3480156102bf57600080fd5b506102d36102ce366004612cab565b6108d3565b60405190151581526020015b60405180910390f35b3480156102f457600080fd5b506102fd610942565b6040516102df9190612e34565b34801561031657600080fd5b5061032a610325366004612d50565b6109d4565b6040516001600160a01b0390911681526020016102df565b34801561034e57600080fd5b5061036261035d366004612ba1565b610a64565b005b34801561037057600080fd5b5061037a60105481565b6040519081526020016102df565b34801561039457600080fd5b5061037a6103a3366004612d50565b610b7c565b3480156103b457600080fd5b5060015461037a565b3480156103c957600080fd5b506103626103d8366004612c33565b610bfb565b3480156103e957600080fd5b506103626103f8366004612a5b565b610d3d565b34801561040957600080fd5b5061037a610418366004612ba1565b610d48565b34801561042957600080fd5b50610362610ec7565b34801561043e57600080fd5b5061036261044d366004612a5b565b610f02565b34801561045e57600080fd5b5061036261046d366004612bca565b610f1d565b34801561047e57600080fd5b5061037a61048d366004612d50565b6111b2565b34801561049e57600080fd5b506103626104ad366004612ce3565b61121b565b3480156104be57600080fd5b5061032a6104cd366004612d50565b61122f565b3480156104de57600080fd5b5061037a6104ed366004612a0f565b611241565b3480156104fe57600080fd5b5061037a600d5481565b34801561051457600080fd5b506103626112d2565b34801561052957600080fd5b50610362610538366004612d50565b6112e6565b34801561054957600080fd5b50610362610558366004612d50565b61144e565b34801561056957600080fd5b5061037a600e5481565b34801561057f57600080fd5b506000546001600160a01b031661032a565b34801561059d57600080fd5b5061037a60145481565b3480156105b357600080fd5b506105c76105c2366004612d50565b61145b565b6040805182516001600160a01b0316815260209283015167ffffffffffffffff1692810192909252016102df565b34801561060157600080fd5b506102fd611478565b34801561061657600080fd5b5061037a600a5481565b34801561062c57600080fd5b5061037a60135481565b34801561064257600080fd5b50610362610651366004612b6b565b611487565b34801561066257600080fd5b5061037a610671366004612a0f565b60166020526000908152604090205481565b610362610691366004612d50565b611559565b3480156106a257600080fd5b506103626106b1366004612d50565b611821565b3480156106c257600080fd5b5061037a600c5481565b3480156106d857600080fd5b506103626106e7366004612a96565b611850565b3480156106f857600080fd5b50600f5461032a906001600160a01b031681565b34801561071857600080fd5b506102fd610727366004612d50565b611889565b34801561073857600080fd5b50610362610747366004612d50565b611955565b34801561075857600080fd5b506102fd611984565b34801561076d57600080fd5b5061037a61077c366004612d50565b60176020526000908152604090205481565b34801561079a57600080fd5b5061037a600b5481565b3480156107b057600080fd5b5061037a60085481565b3480156107c657600080fd5b506103626107d5366004612c73565b611a12565b3480156107e657600080fd5b5061037a6107f5366004612a0f565b611a43565b34801561080657600080fd5b506102d3610815366004612a29565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561084f57600080fd5b5061036261085e366004612d50565b611a4e565b34801561086f57600080fd5b5061036261087e366004612a0f565b611a7d565b34801561088f57600080fd5b5061036261089e366004612d50565b611af6565b3480156108af57600080fd5b5061037a60115481565b3480156108c557600080fd5b506012546102d39060ff1681565b60006001600160e01b031982166380ac58cd60e01b148061090457506001600160e01b03198216635b5e139f60e01b145b8061091f57506001600160e01b0319821663780e9d6360e01b145b8061093a57506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b60606002805461095190612fb2565b80601f016020809104026020016040519081016040528092919081815260200182805461097d90612fb2565b80156109ca5780601f1061099f576101008083540402835291602001916109ca565b820191906000526020600020905b8154815290600101906020018083116109ad57829003601f168201915b5050505050905090565b60006109e1826001541190565b610a485760405162461bcd60e51b815260206004820152602d60248201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a6f8261122f565b9050806001600160a01b0316836001600160a01b03161415610ade5760405162461bcd60e51b815260206004820152602260248201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60448201526132b960f11b6064820152608401610a3f565b336001600160a01b0382161480610afa5750610afa8133610815565b610b6c5760405162461bcd60e51b815260206004820152603960248201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656420666f7220616c6c000000000000006064820152608401610a3f565b610b77838383611b25565b505050565b600081610b8860015490565b1015610bcb5760405162461bcd60e51b8152602060048201526012602482015271139195081b9bdd081b5a5b9d1959081e595d60721b6044820152606401610a3f565b600082815260176020526040812054601354601454610bea9190612efd565b610bf49190612f58565b9392505050565b60005b81811015610b775733610c36848484818110610c2a57634e487b7160e01b600052603260045260246000fd5b9050602002013561122f565b6001600160a01b031614610c8c5760405162461bcd60e51b815260206004820152601b60248201527f496e636f72726563742072657175657374207375626d697474656400000000006044820152606401610a3f565b6000610cbd848484818110610cb157634e487b7160e01b600052603260045260246000fd5b90506020020135610b7c565b600f54909150610cd7906001600160a01b03163383611b81565b8060176000868686818110610cfc57634e487b7160e01b600052603260045260246000fd5b9050602002013581526020019081526020016000206000016000828254610d239190612ee5565b90915550829150610d35905081612fed565b915050610bfe565b610b77838383611be4565b6000610d5383611241565b8210610dac5760405162461bcd60e51b815260206004820152602260248201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e604482015261647360f01b6064820152608401610a3f565b6000610db760015490565b905060008060005b83811015610e61576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff169183019190915215610e1257805192505b876001600160a01b0316836001600160a01b03161415610e4e5786841415610e4057509350610ec192505050565b83610e4a81612fed565b9450505b5080610e5981612fed565b915050610dbf565b5060405162461bcd60e51b815260206004820152602e60248201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060448201526d0deeedccae440c4f240d2dcc8caf60931b6064820152608401610a3f565b92915050565b610ecf611f8f565b6040514790339082156108fc029083906000818181858888f19350505050158015610efe573d6000803e3d6000fd5b5050565b610b7783838360405180602001604052806000815250611850565b610f25611f8f565b60026009541415610f785760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a3f565b6002600955828114610fd75760405162461bcd60e51b815260206004820152602260248201527f4d69736d61746368206265747765656e204164647265737320616e6420636f756044820152611b9d60f21b6064820152608401610a3f565b60005b838110156111a657600b5483838381811061100557634e487b7160e01b600052603260045260246000fd5b905060200201356011546110199190612ee5565b111561105b5760405162461bcd60e51b815260206004820152601160248201527013585e081b1a5b5a5d081c995858da1959607a1b6044820152606401610a3f565b600061106660015490565b905060005b84848481811061108b57634e487b7160e01b600052603260045260246000fd5b905060200201358110156110ef576013546014546110a99190612efd565b601760006110b78486612ee5565b815260200190815260200160002060000160008282546110d79190612ee5565b909155508190506110e781612fed565b91505061106b565b5061115486868481811061111357634e487b7160e01b600052603260045260246000fd5b90506020020160208101906111289190612a0f565b85858581811061114857634e487b7160e01b600052603260045260246000fd5b90506020020135611fe9565b83838381811061117457634e487b7160e01b600052603260045260246000fd5b905060200201356011600082825461118c9190612ee5565b9091555082915061119e905081612fed565b915050610fda565b50506001600955505050565b60006111bd60015490565b82106112175760405162461bcd60e51b815260206004820152602360248201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f756044820152626e647360e81b6064820152608401610a3f565b5090565b611223611f8f565b610b776015838361291f565b600061123a82612003565b5192915050565b60006001600160a01b0382166112ad5760405162461bcd60e51b815260206004820152602b60248201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b6064820152608401610a3f565b506001600160a01b03166000908152600560205260409020546001600160801b031690565b6112da611f8f565b6112e46000612150565b565b6112ee611f8f565b600f546040516370a0823160e01b815233600482015282916001600160a01b0316906370a082319060240160206040518083038186803b15801561133157600080fd5b505afa158015611345573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113699190612d68565b10156113c25760405162461bcd60e51b815260206004820152602260248201527f62616c616e6365206e6f7420617661696c61626c6520666f72207472616e736660448201526132b960f11b6064820152608401610a3f565b6001805410156114095760405162461bcd60e51b8152602060048201526012602482015271139195081b9bdd081b5a5b9d1959081e595d60721b6044820152606401610a3f565b600f54611421906001600160a01b03163330846121a0565b6001546013546114319083612f11565b61143b9190612efd565b6014546114489190612ee5565b60145550565b611456611f8f565b600e55565b604080518082019091526000808252602082015261093a82612003565b60606003805461095190612fb2565b6001600160a01b0382163314156114e05760405162461bcd60e51b815260206004820152601a60248201527f455243373231413a20617070726f766520746f2063616c6c65720000000000006044820152606401610a3f565b3360008181526007602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161154d911515815260200190565b60405180910390a35050565b600260095414156115ac5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a3f565b600260095560125460ff166115f85760405162461bcd60e51b815260206004820152601260248201527153616c65206973206e6f7420656e61626c6560701b6044820152606401610a3f565b600a54816010546116099190612ee5565b111561164b5760405162461bcd60e51b8152602060048201526011602482015270115e18d959591cc81b585e081b1a5b5a5d607a1b6044820152606401610a3f565b600c5433600090815260166020526040902054611669908390612ee5565b11156116c15760405162461bcd60e51b815260206004820152602160248201527f45786365656473206d6178206d696e74206c696d6974207065722077616c6c656044820152601d60fa1b6064820152608401610a3f565b600d548111156117135760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d6178206d696e74206c696d6974207065722074786e00006044820152606401610a3f565b80600e546117219190612f11565b3410156117645760405162461bcd60e51b815260206004820152601160248201527056616c75652062656c6f7720707269636560781b6044820152606401610a3f565b600061176f60015490565b905060005b828110156117d25760135460145461178c9190612efd565b6017600061179a8486612ee5565b815260200190815260200160002060000160008282546117ba9190612ee5565b909155508190506117ca81612fed565b915050611774565b506117dd3383611fe9565b81601060008282546117ef9190612ee5565b90915550503360009081526016602052604081208054849290611813908490612ee5565b909155505060016009555050565b611829611f8f565b60115481101561184b5760405162461bcd60e51b8152600401610a3f90612e47565b600b55565b61185b848484611be4565b611867848484846121d8565b6118835760405162461bcd60e51b8152600401610a3f90612e70565b50505050565b6060611896826001541190565b6118fa5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610a3f565b60006119046122e6565b905060008151116119245760405180602001604052806000815250610bf4565b8061192e846122f5565b60405160200161193f929190612dc8565b6040516020818303038152906040529392505050565b61195d611f8f565b80600a54101561197f5760405162461bcd60e51b8152600401610a3f90612e47565b600d55565b6015805461199190612fb2565b80601f01602080910402602001604051908101604052809291908181526020018280546119bd90612fb2565b8015611a0a5780601f106119df57610100808354040283529160200191611a0a565b820191906000526020600020905b8154815290600101906020018083116119ed57829003601f168201915b505050505081565b611a1a611f8f565b60125460ff1615158115151415611a3057600080fd5b6012805460ff1916911515919091179055565b600061093a82612410565b611a56611f8f565b80600a541015611a785760405162461bcd60e51b8152600401610a3f90612e47565b600c55565b611a85611f8f565b6001600160a01b038116611aea5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a3f565b611af381612150565b50565b611afe611f8f565b601054811015611b205760405162461bcd60e51b8152600401610a3f90612e47565b600a55565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6040516001600160a01b038316602482015260448101829052610b7790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526124ae565b6000611bef82612003565b80519091506000906001600160a01b0316336001600160a01b03161480611c26575033611c1b846109d4565b6001600160a01b0316145b80611c3857508151611c389033610815565b905080611ca25760405162461bcd60e51b815260206004820152603260248201527f455243373231413a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b6064820152608401610a3f565b846001600160a01b031682600001516001600160a01b031614611d165760405162461bcd60e51b815260206004820152602660248201527f455243373231413a207472616e736665722066726f6d20696e636f72726563746044820152651037bbb732b960d11b6064820152608401610a3f565b6001600160a01b038416611d7a5760405162461bcd60e51b815260206004820152602560248201527f455243373231413a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608401610a3f565b611d8a6000848460000151611b25565b6001600160a01b0385166000908152600560205260408120805460019290611dbc9084906001600160801b0316612f30565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b03861660009081526005602052604081208054600194509092611e0891859116612ec3565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b03808716825267ffffffffffffffff428116602080850191825260008981526004909152948520935184549151909216600160a01b0267ffffffffffffffff60a01b19929093166001600160a01b03199091161716179055611e9e846001612ee5565b6000818152600460205260409020549091506001600160a01b0316611f4557611ec8816001541190565b15611f455760408051808201825284516001600160a01b03908116825260208087015167ffffffffffffffff90811682850190815260008781526004909352949091209251835494516001600160a01b031990951692169190911767ffffffffffffffff60a01b1916600160a01b93909116929092029190911790555b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6000546001600160a01b031633146112e45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a3f565b610efe828260405180602001604052806000815250612580565b6040805180820190915260008082526020820152612022826001541190565b6120815760405162461bcd60e51b815260206004820152602a60248201527f455243373231413a206f776e657220717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610a3f565b6000825b8181106120ef576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff1691830191909152156120dc57925061093d915050565b50806120e781612f9b565b915050612085565b5060405162461bcd60e51b815260206004820152602f60248201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560448201526e1037bbb732b91037b3103a37b5b2b760891b6064820152608401610a3f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526118839085906323b872dd60e01b90608401611bad565b60006001600160a01b0384163b156122da57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061221c903390899088908890600401612df7565b602060405180830381600087803b15801561223657600080fd5b505af1925050508015612266575060408051601f3d908101601f1916820190925261226391810190612cc7565b60015b6122c0573d808015612294576040519150601f19603f3d011682016040523d82523d6000602084013e612299565b606091505b5080516122b85760405162461bcd60e51b8152600401610a3f90612e70565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506122de565b5060015b949350505050565b60606015805461095190612fb2565b60608161231a57506040805180820190915260018152600360fc1b602082015261093d565b8160005b8115612344578061232e81612fed565b915061233d9050600a83612efd565b915061231e565b60008167ffffffffffffffff81111561236d57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612397576020820181803683370190505b5090505b84156122de576123ac600183612f58565b91506123b9600a86613008565b6123c4906030612ee5565b60f81b8183815181106123e757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612409600a86612efd565b945061239b565b60006001600160a01b0382166124825760405162461bcd60e51b815260206004820152603160248201527f455243373231413a206e756d626572206d696e74656420717565727920666f7260448201527020746865207a65726f206164647265737360781b6064820152608401610a3f565b506001600160a01b0316600090815260056020526040902054600160801b90046001600160801b031690565b6000612503826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661280b9092919063ffffffff16565b805190915015610b7757808060200190518101906125219190612c8f565b610b775760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a3f565b6001546001600160a01b0384166125e35760405162461bcd60e51b815260206004820152602160248201527f455243373231413a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610a3f565b6125ee816001541190565b1561263b5760405162461bcd60e51b815260206004820152601d60248201527f455243373231413a20746f6b656e20616c7265616479206d696e7465640000006044820152606401610a3f565b6001600160a01b0384166000908152600560209081526040918290208251808401845290546001600160801b038082168352600160801b9091041691810191909152815180830190925280519091908190612697908790612ec3565b6001600160801b031681526020018583602001516126b59190612ec3565b6001600160801b039081169091526001600160a01b03808816600081815260056020908152604080832087518154988401518816600160801b029088166fffffffffffffffffffffffffffffffff1990991698909817909616969096179094558451808601865291825267ffffffffffffffff4281168386019081528883526004909552948120915182549451909516600160a01b0267ffffffffffffffff60a01b19959093166001600160a01b031990941693909317939093161790915582905b858110156128005760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46127c460008884886121d8565b6127e05760405162461bcd60e51b8152600401610a3f90612e70565b816127ea81612fed565b92505080806127f890612fed565b915050612777565b506001819055611f87565b60606122de8484600085856001600160a01b0385163b61286d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a3f565b600080866001600160a01b031685876040516128899190612dac565b60006040518083038185875af1925050503d80600081146128c6576040519150601f19603f3d011682016040523d82523d6000602084013e6128cb565b606091505b50915091506128db8282866128e6565b979650505050505050565b606083156128f5575081610bf4565b8251156129055782518084602001fd5b8160405162461bcd60e51b8152600401610a3f9190612e34565b82805461292b90612fb2565b90600052602060002090601f01602090048101928261294d5760008555612993565b82601f106129665782800160ff19823516178555612993565b82800160010185558215612993579182015b82811115612993578235825591602001919060010190612978565b506112179291505b80821115611217576000815560010161299b565b80356001600160a01b038116811461093d57600080fd5b60008083601f8401126129d7578081fd5b50813567ffffffffffffffff8111156129ee578182fd5b6020830191508360208083028501011115612a0857600080fd5b9250929050565b600060208284031215612a20578081fd5b610bf4826129af565b60008060408385031215612a3b578081fd5b612a44836129af565b9150612a52602084016129af565b90509250929050565b600080600060608486031215612a6f578081fd5b612a78846129af565b9250612a86602085016129af565b9150604084013590509250925092565b60008060008060808587031215612aab578081fd5b612ab4856129af565b9350612ac2602086016129af565b925060408501359150606085013567ffffffffffffffff80821115612ae5578283fd5b818701915087601f830112612af8578283fd5b813581811115612b0a57612b0a613048565b604051601f8201601f19908116603f01168101908382118183101715612b3257612b32613048565b816040528281528a6020848701011115612b4a578586fd5b82602086016020830137918201602001949094529598949750929550505050565b60008060408385031215612b7d578182fd5b612b86836129af565b91506020830135612b968161305e565b809150509250929050565b60008060408385031215612bb3578182fd5b612bbc836129af565b946020939093013593505050565b60008060008060408587031215612bdf578384fd5b843567ffffffffffffffff80821115612bf6578586fd5b612c02888389016129c6565b90965094506020870135915080821115612c1a578384fd5b50612c27878288016129c6565b95989497509550505050565b60008060208385031215612c45578182fd5b823567ffffffffffffffff811115612c5b578283fd5b612c67858286016129c6565b90969095509350505050565b600060208284031215612c84578081fd5b8135610bf48161305e565b600060208284031215612ca0578081fd5b8151610bf48161305e565b600060208284031215612cbc578081fd5b8135610bf48161306c565b600060208284031215612cd8578081fd5b8151610bf48161306c565b60008060208385031215612cf5578182fd5b823567ffffffffffffffff80821115612d0c578384fd5b818501915085601f830112612d1f578384fd5b813581811115612d2d578485fd5b866020828501011115612d3e578485fd5b60209290920196919550909350505050565b600060208284031215612d61578081fd5b5035919050565b600060208284031215612d79578081fd5b5051919050565b60008151808452612d98816020860160208601612f6f565b601f01601f19169290920160200192915050565b60008251612dbe818460208701612f6f565b9190910192915050565b60008351612dda818460208801612f6f565b835190830190612dee818360208801612f6f565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612e2a90830184612d80565b9695505050505050565b600060208252610bf46020830184612d80565b6020808252600f908201526e496e636f72726563742076616c756560881b604082015260600190565b60208082526033908201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260408201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b606082015260800190565b60006001600160801b03808316818516808303821115612dee57612dee61301c565b60008219821115612ef857612ef861301c565b500190565b600082612f0c57612f0c613032565b500490565b6000816000190483118215151615612f2b57612f2b61301c565b500290565b60006001600160801b0383811690831681811015612f5057612f5061301c565b039392505050565b600082821015612f6a57612f6a61301c565b500390565b60005b83811015612f8a578181015183820152602001612f72565b838111156118835750506000910152565b600081612faa57612faa61301c565b506000190190565b600281046001821680612fc657607f821691505b60208210811415612fe757634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156130015761300161301c565b5060010190565b60008261301757613017613032565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114611af357600080fd5b6001600160e01b031981168114611af357600080fdfea2646970667358221220616cd11c214e7239ed1dd97622b170b0901ecf3d9311af3c3f245e57d4f21e4264736f6c63430008020033

Verified Source Code Full Match

Compiler: v0.8.2+commit.661d1103 EVM: istanbul Optimization: Yes (200 runs)
TOADS.sol 190 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./ERC721A.sol";

contract TOADS is Ownable, ERC721A, ReentrancyGuard {
    using SafeERC20 for IERC20;
	
	uint256 public SALE_NFT = 3500;
	uint256 public RESERVED_NFT = 821;
	
	uint256 public MAX_MINT_SALE = 10;
	uint256 public MAX_BY_MINT_IN_TRANSACTION_SALE = 5;
	
	uint256 public SALE_PRICE =  0.05 ether;
	
	address public USDT = address(0xdAC17F958D2ee523a2206206994597C13D831ec7);
	
	uint256 public SALE_MINTED;
	uint256 public RESERVED_MINTED;
	
	bool public saleEnable = false;
	uint256 public precisionFactor = 1 * 10**18;
	uint256 public accTokenPerShare;
	
	string public _baseTokenURI;
	
	struct airdropInfo{
	  uint256 rewardDebt;
    }
	
	struct User {
	  uint256 salemint;
    }
	
	mapping (address => User) public users;
	mapping(uint256 => airdropInfo) public mapAirdropInfo;
    constructor() ERC721A("Toad Friends", "TOADS"){}
	
	function mintReservedNFT(address[] calldata _to, uint256[] calldata _count) external onlyOwner nonReentrant{
        require(
		  _to.length == _count.length,
		  "Mismatch between Address and count"
		);
		for(uint i=0; i < _to.length; i++) {
		    require (
			  RESERVED_MINTED + _count[i] <= RESERVED_NFT, 
			  "Max limit reached"
			);
			
			uint256 totalSupply = totalSupply();
			for (uint256 j = 0; j < _count[i]; j++) 
			{
		       mapAirdropInfo[totalSupply + j].rewardDebt += accTokenPerShare / precisionFactor ;
			}
		    _safeMint(_to[i], _count[i]);
		    RESERVED_MINTED += _count[i];
		}
    }
	
    function mintSaleNFT(uint256 _count) public payable nonReentrant{
		require(
		  saleEnable, 
		  "Sale is not enable"
		);
        require(
		  SALE_MINTED + _count <= SALE_NFT, 
		  "Exceeds max limit"
		);
		require(
		  users[msg.sender].salemint + _count <= MAX_MINT_SALE,
		  "Exceeds max mint limit per wallet"
		);
		require(
		  _count <= MAX_BY_MINT_IN_TRANSACTION_SALE,
		  "Exceeds max mint limit per txn"
		);
		require(
		  msg.value >= SALE_PRICE * _count,
		  "Value below price"
		);
		
		uint256 totalSupply = totalSupply();
		for(uint256 i = 0; i < _count; i++) 
		{
		    mapAirdropInfo[totalSupply + i].rewardDebt += accTokenPerShare / precisionFactor ;
        }
		_safeMint(msg.sender, _count);
	    SALE_MINTED += _count;
		users[msg.sender].salemint += _count;
    }
	
    function _baseURI() internal view virtual override returns (string memory) {
	   return _baseTokenURI;
    }

    function setBaseURI(string calldata baseURI) external onlyOwner {
	    _baseTokenURI = baseURI;
    }

    function withdraw() public onlyOwner {
       uint256 balance = address(this).balance;
       payable(msg.sender).transfer(balance);
    }
	
    function numberMinted(address owner) public view returns (uint256) {
	   return _numberMinted(owner);
    }
	
	function getOwnershipData(uint256 tokenId) external view returns (TokenOwnership memory) {
	   return ownershipOf(tokenId);
	}
	
	function updateSalePrice(uint256 newPrice) external onlyOwner {
        SALE_PRICE = newPrice;
    }
	
	function setSaleStatus(bool status) public onlyOwner {
        require(saleEnable != status);
		saleEnable = status;
    }
	
	function updateSaleMintLimit(uint256 newLimit) external onlyOwner {
	    require(SALE_NFT >= newLimit, "Incorrect value");
        MAX_MINT_SALE = newLimit;
    }
	
	function updateMintLimitPerTransactionSale(uint256 newLimit) external onlyOwner {
	    require(
		  SALE_NFT >= newLimit, 
		  "Incorrect value"
		);
        MAX_BY_MINT_IN_TRANSACTION_SALE = newLimit;
    }
	
	function updateSaleSupply(uint256 newSupply) external onlyOwner {
	    require(
		  newSupply >= SALE_MINTED, 
		  "Incorrect value"
		);
        SALE_NFT = newSupply;
    }
	
	function updateReservedSupply(uint256 newSupply) external onlyOwner {
	    require(
		  newSupply >= RESERVED_MINTED,
		  "Incorrect value"
		);
        RESERVED_NFT = newSupply;
    }
	
	function airdropUSDT(uint256 amount) external onlyOwner {
	   require(
		 IERC20(USDT).balanceOf(msg.sender) >= amount, 
		 "balance not available for transfer"
	   );
	   require(
		  totalSupply() >= 1, 
		  "NFT not minted yet"
	   );
       IERC20(USDT).safeTransferFrom(address(msg.sender), address(this), amount);
	   accTokenPerShare = accTokenPerShare + (amount * precisionFactor / totalSupply());
	}
	
	function withdrawAirdrop(uint256[] calldata ids) external {
	   for(uint i=0; i < ids.length; i++) {
		 require(
		   ownerOf(ids[i]) == address(msg.sender), 
		   "Incorrect request submitted"
		 );
		 uint256 pending = pendingReward(ids[i]);
		 IERC20(USDT).safeTransfer(address(msg.sender), pending);
		 mapAirdropInfo[ids[i]].rewardDebt += pending;
	   }
	}
	
	function pendingReward(uint256 id) public view returns (uint256) {
	   require(
		  totalSupply() >= id, 
		  "NFT not minted yet"
	   );
	   uint256 pending = (accTokenPerShare / precisionFactor) - mapAirdropInfo[id].rewardDebt;
	   return pending;
    }
}
ERC721A.sol 526 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
 *
 * Assumes the number of issuable tokens (collection size) is capped and fits in a uint128.
 *
 * Does not support burning tokens to address(0).
 */
contract ERC721A is
  Context,
  ERC165,
  IERC721,
  IERC721Metadata,
  IERC721Enumerable
{
  using Address for address;
  using Strings for uint256;

  struct TokenOwnership {
    address addr;
    uint64 startTimestamp;
  }

  struct AddressData {
    uint128 balance;
    uint128 numberMinted;
  }

  uint256 private currentIndex = 0;

  // Token name
  string private _name;

  // Token symbol
  string private _symbol;

  // Mapping from token ID to ownership details
  // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
  mapping(uint256 => TokenOwnership) private _ownerships;

  // Mapping owner address to address data
  mapping(address => AddressData) private _addressData;

  // Mapping from token ID to approved address
  mapping(uint256 => address) private _tokenApprovals;

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

  constructor(string memory name_, string memory symbol_) {
    _name = name_;
    _symbol = symbol_;
  }

  /**
   * @dev See {IERC721Enumerable-totalSupply}.
   */
  function totalSupply() public view override returns (uint256) {
    return currentIndex;
  }

  /**
   * @dev See {IERC721Enumerable-tokenByIndex}.
   */
  function tokenByIndex(uint256 index) public view override returns (uint256) {
    require(index < totalSupply(), "ERC721A: global index out of bounds");
    return index;
  }

  function tokenOfOwnerByIndex(address owner, uint256 index)
    public
    view
    override
    returns (uint256)
  {
    require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
    uint256 numMintedSoFar = totalSupply();
    uint256 tokenIdsIdx = 0;
    address currOwnershipAddr = address(0);
    for (uint256 i = 0; i < numMintedSoFar; i++) {
      TokenOwnership memory ownership = _ownerships[i];
      if (ownership.addr != address(0)) {
        currOwnershipAddr = ownership.addr;
      }
      if (currOwnershipAddr == owner) {
        if (tokenIdsIdx == index) {
          return i;
        }
        tokenIdsIdx++;
      }
    }
    revert("ERC721A: unable to get token of owner by index");
  }

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

  /**
   * @dev See {IERC721-balanceOf}.
   */
  function balanceOf(address owner) public view override returns (uint256) {
    require(owner != address(0), "ERC721A: balance query for the zero address");
    return uint256(_addressData[owner].balance);
  }

  function _numberMinted(address owner) internal view returns (uint256) {
    require(
      owner != address(0),
      "ERC721A: number minted query for the zero address"
    );
    return uint256(_addressData[owner].numberMinted);
  }

  function ownershipOf(uint256 tokenId)
    internal
    view
    returns (TokenOwnership memory)
  {
    require(_exists(tokenId), "ERC721A: owner query for nonexistent token");

    uint256 lowestTokenToCheck;
	
    for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
      TokenOwnership memory ownership = _ownerships[curr];
      if (ownership.addr != address(0)) {
          return ownership;
      }
    }

    revert("ERC721A: unable to determine the owner of token");
  }

  /**
   * @dev See {IERC721-ownerOf}.
   */
  function ownerOf(uint256 tokenId) public view override returns (address) {
    return ownershipOf(tokenId).addr;
  }

  /**
   * @dev See {IERC721Metadata-name}.
   */
  function name() public view virtual override returns (string memory) {
    return _name;
  }

  /**
   * @dev See {IERC721Metadata-symbol}.
   */
  function symbol() public view virtual override returns (string memory) {
    return _symbol;
  }

  /**
   * @dev See {IERC721Metadata-tokenURI}.
   */
  function tokenURI(uint256 tokenId)
    public
    view
    virtual
    override
    returns (string memory)
  {
    require(
      _exists(tokenId),
      "ERC721Metadata: URI query for nonexistent token"
    );

    string memory baseURI = _baseURI();
    return
      bytes(baseURI).length > 0
        ? string(abi.encodePacked(baseURI, tokenId.toString()))
        : "";
  }

  /**
   * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
   * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
   * by default, can be overriden in child contracts.
   */
  function _baseURI() internal view virtual returns (string memory) {
    return "";
  }

  /**
   * @dev See {IERC721-approve}.
   */
  function approve(address to, uint256 tokenId) public override {
    address owner = ERC721A.ownerOf(tokenId);
    require(to != owner, "ERC721A: approval to current owner");

    require(
      _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
      "ERC721A: approve caller is not owner nor approved for all"
    );

    _approve(to, tokenId, owner);
  }

  /**
   * @dev See {IERC721-getApproved}.
   */
  function getApproved(uint256 tokenId) public view override returns (address) {
    require(_exists(tokenId), "ERC721A: approved query for nonexistent token");

    return _tokenApprovals[tokenId];
  }

  /**
   * @dev See {IERC721-setApprovalForAll}.
   */
  function setApprovalForAll(address operator, bool approved) public override {
    require(operator != _msgSender(), "ERC721A: approve to caller");

    _operatorApprovals[_msgSender()][operator] = approved;
    emit ApprovalForAll(_msgSender(), operator, approved);
  }

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

  /**
   * @dev See {IERC721-transferFrom}.
   */
  function transferFrom(
    address from,
    address to,
    uint256 tokenId
  ) public override {
    _transfer(from, to, tokenId);
  }

  /**
   * @dev See {IERC721-safeTransferFrom}.
   */
  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId
  ) public override {
    safeTransferFrom(from, to, tokenId, "");
  }

  /**
   * @dev See {IERC721-safeTransferFrom}.
   */
  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes memory _data
  ) public override {
    _transfer(from, to, tokenId);
    require(
      _checkOnERC721Received(from, to, tokenId, _data),
      "ERC721A: transfer to non ERC721Receiver implementer"
    );
  }

  /**
   * @dev Returns whether `tokenId` exists.
   *
   * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
   *
   * Tokens start existing when they are minted (`_mint`),
   */
  function _exists(uint256 tokenId) internal view returns (bool) {
    return tokenId < currentIndex;
  }

  function _safeMint(address to, uint256 quantity) internal {
    _safeMint(to, quantity, "");
  }

  /**
   * @dev Mints `quantity` tokens and transfers them to `to`.
   *
   * Requirements:
   *
   * - there must be `quantity` tokens remaining unminted in the total collection.
   * - `to` cannot be the zero address.
   * - `quantity` cannot be larger than the max batch size.
   *
   * Emits a {Transfer} event.
   */
  function _safeMint(
    address to,
    uint256 quantity,
    bytes memory _data
  ) internal {
    uint256 startTokenId = currentIndex;
    require(to != address(0), "ERC721A: mint to the zero address");
    // We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
    require(!_exists(startTokenId), "ERC721A: token already minted");

    _beforeTokenTransfers(address(0), to, startTokenId, quantity);

    AddressData memory addressData = _addressData[to];
    _addressData[to] = AddressData(
      addressData.balance + uint128(quantity),
      addressData.numberMinted + uint128(quantity)
    );
    _ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));

    uint256 updatedIndex = startTokenId;

    for (uint256 i = 0; i < quantity; i++) {
      emit Transfer(address(0), to, updatedIndex);
      require(
        _checkOnERC721Received(address(0), to, updatedIndex, _data),
        "ERC721A: transfer to non ERC721Receiver implementer"
      );
      updatedIndex++;
    }

    currentIndex = updatedIndex;
    _afterTokenTransfers(address(0), to, startTokenId, quantity);
  }

  /**
   * @dev Transfers `tokenId` from `from` to `to`.
   *
   * Requirements:
   *
   * - `to` cannot be the zero address.
   * - `tokenId` token must be owned by `from`.
   *
   * Emits a {Transfer} event.
   */
  function _transfer(
    address from,
    address to,
    uint256 tokenId
  ) private {
    TokenOwnership memory prevOwnership = ownershipOf(tokenId);

    bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
      getApproved(tokenId) == _msgSender() ||
      isApprovedForAll(prevOwnership.addr, _msgSender()));

    require(
      isApprovedOrOwner,
      "ERC721A: transfer caller is not owner nor approved"
    );

    require(
      prevOwnership.addr == from,
      "ERC721A: transfer from incorrect owner"
    );
    require(to != address(0), "ERC721A: transfer to the zero address");

    _beforeTokenTransfers(from, to, tokenId, 1);

    // Clear approvals from the previous owner
    _approve(address(0), tokenId, prevOwnership.addr);

    _addressData[from].balance -= 1;
    _addressData[to].balance += 1;
    _ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));

    // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
    // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
    uint256 nextTokenId = tokenId + 1;
    if (_ownerships[nextTokenId].addr == address(0)) {
      if (_exists(nextTokenId)) {
        _ownerships[nextTokenId] = TokenOwnership(
          prevOwnership.addr,
          prevOwnership.startTimestamp
        );
      }
    }

    emit Transfer(from, to, tokenId);
    _afterTokenTransfers(from, to, tokenId, 1);
  }

  /**
   * @dev Approve `to` to operate on `tokenId`
   *
   * Emits a {Approval} event.
   */
  function _approve(
    address to,
    uint256 tokenId,
    address owner
  ) private {
    _tokenApprovals[tokenId] = to;
    emit Approval(owner, to, tokenId);
  }

  uint256 public nextOwnerToExplicitlySet = 0;

  /**
   * @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
   */
  function _setOwnersExplicit(uint256 quantity) internal {
    uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
    require(quantity > 0, "quantity must be nonzero");
    uint256 endIndex = oldNextOwnerToSet + quantity - 1;
	
    // We know if the last one in the group exists, all in the group exist, due to serial ordering.
    require(_exists(endIndex), "not enough minted yet for this cleanup");
    for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
      if (_ownerships[i].addr == address(0)) {
        TokenOwnership memory ownership = ownershipOf(i);
        _ownerships[i] = TokenOwnership(
          ownership.addr,
          ownership.startTimestamp
        );
      }
    }
    nextOwnerToExplicitlySet = endIndex + 1;
  }

  /**
   * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
   * The call is not executed if the target address is not a contract.
   *
   * @param from address representing the previous owner of the given token ID
   * @param to target address that will receive the tokens
   * @param tokenId uint256 ID of the token to be transferred
   * @param _data bytes optional data to send along with the call
   * @return bool whether the call correctly returned the expected magic value
   */
  function _checkOnERC721Received(
    address from,
    address to,
    uint256 tokenId,
    bytes memory _data
  ) private returns (bool) {
    if (to.isContract()) {
      try
        IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
      returns (bytes4 retval) {
        return retval == IERC721Receiver(to).onERC721Received.selector;
      } catch (bytes memory reason) {
        if (reason.length == 0) {
          revert("ERC721A: transfer to non ERC721Receiver implementer");
        } else {
          assembly {
            revert(add(32, reason), mload(reason))
          }
        }
      }
    } else {
      return true;
    }
  }

  /**
   * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
   *
   * startTokenId - the first token id to be transferred
   * quantity - the amount to be transferred
   *
   * Calling conditions:
   *
   * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
   * transferred to `to`.
   * - When `from` is zero, `tokenId` will be minted for `to`.
   */
  function _beforeTokenTransfers(
    address from,
    address to,
    uint256 startTokenId,
    uint256 quantity
  ) internal virtual {}

  /**
   * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
   * minting.
   *
   * startTokenId - the first token id to be transferred
   * quantity - the amount to be transferred
   *
   * Calling conditions:
   *
   * - when `from` and `to` are both non-zero.
   * - `from` and `to` are never both zero.
   */
  function _afterTokenTransfers(
    address from,
    address to,
    uint256 startTokenId,
    uint256 quantity
  ) internal virtual {}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}
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 116 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
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);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}
draft-IERC20Permit.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

Read Contract

MAX_BY_MINT_IN_TRANSACTION_SALE 0x711cc2ae → uint256
MAX_MINT_SALE 0xae5cc172 → uint256
RESERVED_MINTED 0xf921d83f → uint256
RESERVED_NFT 0xd4bba0e9 → uint256
SALE_MINTED 0x0990e534 → uint256
SALE_NFT 0x995b8ef6 → uint256
SALE_PRICE 0x7f205a74 → uint256
USDT 0xc54e44eb → address
_baseTokenURI 0xcfc86f7b → string
accTokenPerShare 0x8f662915 → uint256
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
getOwnershipData 0x9231ab2a → tuple
isApprovedForAll 0xe985e9c5 → bool
mapAirdropInfo 0xd48a05bb → uint256
name 0x06fdde03 → string
nextOwnerToExplicitlySet 0xd7224ba0 → uint256
numberMinted 0xdc33e681 → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
pendingReward 0x12f7086c → uint256
precisionFactor 0x9d902fc0 → uint256
saleEnable 0xfe4ca847 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
users 0xa87430ba → uint256

Write Contract 19 functions

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

airdropUSDT 0x7bb5585f
uint256 amount
approve 0x095ea7b3
address to
uint256 tokenId
mintReservedNFT 0x4df08219
address[] _to
uint256[] _count
mintSaleNFT 0xa9526862
uint256 _count
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string baseURI
setSaleStatus 0xd897833e
bool status
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateMintLimitPerTransactionSale 0xce22483c
uint256 newLimit
updateReservedSupply 0xaa9dc50c
uint256 newSupply
updateSaleMintLimit 0xf176baaa
uint256 newLimit
updateSalePrice 0x7ec0912e
uint256 newPrice
updateSaleSupply 0xf4397335
uint256 newSupply
withdraw 0x3ccfd60b
No parameters
withdrawAirdrop 0x193bc621
uint256[] ids

Recent Transactions

No transactions found for this address