Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x65b28ED75c12D8ce29d892DE9f8304A6D2e176A7
Balance 0 ETH
Nonce 1
Code Size 17572 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

17572 bytes
0x6080604052600436106103e45760003560e01c80637b38310211610208578063b965e89e11610118578063e8a3d485116100ab578063f2fde38b1161007a578063f2fde38b14610b80578063f6a73e5e14610ba0578063fa54080114610bc0578063faab74cb14610be0578063fc93128514610bf357600080fd5b8063e8a3d48514610ae2578063e985e9c514610af7578063ed3e190314610b40578063f0f4426014610b6057600080fd5b8063cb0a5993116100e7578063cb0a599314610a62578063d7ee01b814610a82578063dfc85a4314610aa2578063e41ceb6914610ac257600080fd5b8063b965e89e146109f6578063bdf7796e14610a0c578063c04e74dd14610a2c578063c87b56dd14610a4257600080fd5b806395d89b411161019b578063a22cb4651161016a578063a22cb46514610960578063b007bc4014610980578063b4fe7e06146109a0578063b808032b146109c0578063b88d4fde146109d657600080fd5b806395d89b41146108fa578063979c4d921461090f5780639aa900121461092f5780639ed1c5131461094557600080fd5b80638809da53116101d75780638809da53146108865780638a1b68b3146108a65780638da5cb5b146108bc5780638f9a9f03146108da57600080fd5b80637b383102146108105780637e41f13714610830578063809beaea1461085057806382d59aca1461086657600080fd5b806342842e0e116103035780635bbaf59b11610296578063627873241161026557806362787324146107855780636352211e1461079b5780636c19e783146107bb57806370a08231146107db578063715018a6146107fb57600080fd5b80635bbaf59b146107195780635d2daed91461072f57806361d027b31461074557806361edd91d1461076557600080fd5b806351cd1fd9116102d257806351cd1fd9146106985780635383abaa146106b8578063539630d0146106d8578063554778d1146106f857600080fd5b806342842e0e14610623578063439cc54c14610643578063468bfb78146106635780634f02c4201461067657600080fd5b80632ca01cee1161037b57806331957e471161034a57806331957e47146105b85780633806eb26146105d85780633ccfd60b146105f8578063419d4d9b1461060d57600080fd5b80632ca01cee1461051e5780632d72225b1461053e5780632ddf991f146105825780632ea29f01146105a257600080fd5b806319293e86116103b757806319293e861461049a5780631f0a8fa7146104be57806322b3b0e8146104de57806323b872dd146104fe57600080fd5b806301ffc9a7146103e957806306fdde031461041e578063081812fc14610440578063095ea7b314610478575b600080fd5b3480156103f557600080fd5b50610409610404366004613adb565b610c13565b60405190151581526020015b60405180910390f35b34801561042a57600080fd5b50610433610c65565b6040516104159190613b50565b34801561044c57600080fd5b5061046061045b366004613b63565b610cf7565b6040516001600160a01b039091168152602001610415565b34801561048457600080fd5b50610498610493366004613b91565b610d91565b005b3480156104a657600080fd5b506104b0600b5481565b604051908152602001610415565b3480156104ca57600080fd5b506104096104d9366004613c60565b610ea7565b3480156104ea57600080fd5b506104b06104f9366004613b63565b610f0f565b34801561050a57600080fd5b50610498610519366004613cb0565b610f30565b34801561052a57600080fd5b50610498610539366004613cf1565b610f61565b34801561054a57600080fd5b5061056f610559366004613b63565b601d6020526000908152604090205461ffff1681565b60405161ffff9091168152602001610415565b34801561058e57600080fd5b5061049861059d366004613d7d565b6110b2565b3480156105ae57600080fd5b506104b0600e5481565b3480156105c457600080fd5b506104606105d3366004613b63565b6116c7565b3480156105e457600080fd5b506104986105f3366004613b63565b6116f1565b34801561060457600080fd5b50610498611720565b34801561061957600080fd5b506104b0600f5481565b34801561062f57600080fd5b5061049861063e366004613cb0565b611860565b34801561064f57600080fd5b5061049861065e366004613d98565b61187b565b610498610671366004613d7d565b611974565b34801561068257600080fd5b50600a5461056f90600160b81b900461ffff1681565b3480156106a457600080fd5b506104986106b3366004613e04565b611cec565b3480156106c457600080fd5b506104606106d3366004613b63565b611d34565b3480156106e457600080fd5b506104986106f3366004613cf1565b611d44565b34801561070457600080fd5b5060175461056f9062010000900461ffff1681565b34801561072557600080fd5b506104b060135481565b34801561073b57600080fd5b506104b0600c5481565b34801561075157600080fd5b50600a54610460906001600160a01b031681565b34801561077157600080fd5b506104b0610780366004613b63565b611e64565b34801561079157600080fd5b506104b060105481565b3480156107a757600080fd5b506104606107b6366004613b63565b611e74565b3480156107c757600080fd5b506104986107d6366004613e21565b611e7f565b3480156107e757600080fd5b506104b06107f6366004613e21565b611ecb565b34801561080757600080fd5b50610498611f52565b34801561081c57600080fd5b5061049861082b366004613b63565b611f88565b34801561083c57600080fd5b506104b061084b366004613b63565b611fb7565b34801561085c57600080fd5b506104b0600d5481565b34801561087257600080fd5b50610498610881366004613e3e565b611fc7565b34801561089257600080fd5b506104986108a1366004613b63565b6123d4565b3480156108b257600080fd5b506104b060155481565b3480156108c857600080fd5b506008546001600160a01b0316610460565b3480156108e657600080fd5b506104986108f5366004613e8c565b612403565b34801561090657600080fd5b50610433612522565b34801561091b57600080fd5b5061049861092a366004613b63565b612531565b34801561093b57600080fd5b506104b060165481565b34801561095157600080fd5b5060175461056f9061ffff1681565b34801561096c57600080fd5b5061049861097b366004613ed7565b612560565b34801561098c57600080fd5b5061049861099b366004613f10565b612625565b3480156109ac57600080fd5b506104b06109bb366004613b63565b612710565b3480156109cc57600080fd5b506104b060125481565b3480156109e257600080fd5b506104986109f1366004613f3e565b612720565b348015610a0257600080fd5b506104b060115481565b348015610a1857600080fd5b50610498610a27366004613b63565b612752565b348015610a3857600080fd5b506104b060145481565b348015610a4e57600080fd5b50610433610a5d366004613b63565b612781565b348015610a6e57600080fd5b50610498610a7d366004613b63565b612838565b348015610a8e57600080fd5b50610460610a9d366004613b63565b612867565b348015610aae57600080fd5b50610460610abd366004613b63565b612877565b348015610ace57600080fd5b50610498610add366004613e04565b612887565b348015610aee57600080fd5b506104336128cf565b348015610b0357600080fd5b50610409610b12366004613f10565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610b4c57600080fd5b506104b0610b5b366004613b63565b6128ef565b348015610b6c57600080fd5b50610498610b7b366004613e21565b6128ff565b348015610b8c57600080fd5b50610498610b9b366004613e21565b61294b565b348015610bac57600080fd5b50610460610bbb366004613b63565b6129e6565b348015610bcc57600080fd5b506104b0610bdb366004613b63565b6129f6565b610498610bee366004613e3e565b612a49565b348015610bff57600080fd5b50610498610c0e366004613e04565b612cc6565b60006001600160e01b031982166380ac58cd60e01b1480610c4457506001600160e01b03198216635b5e139f60e01b145b80610c5f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060008054610c7490613faa565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca090613faa565b8015610ced5780601f10610cc257610100808354040283529160200191610ced565b820191906000526020600020905b815481529060010190602001808311610cd057829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610d755760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610d9c82612d0e565b9050806001600160a01b0316836001600160a01b03161415610e0a5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610d6c565b336001600160a01b0382161480610e265750610e268133610b12565b610e985760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610d6c565b610ea28383612d85565b505050565b604080516001600160a01b03841660208201526000918291016040516020818303038152906040528051906020012090506000610ee3826129f6565b6009549091506001600160a01b0316610efc8286612df3565b6001600160a01b03161495945050505050565b601f8181548110610f1f57600080fd5b600091825260209091200154905081565b610f3a3382612e72565b610f565760405162461bcd60e51b8152600401610d6c90613fe5565b610ea2838383612f69565b6008546001600160a01b03163314610f8b5760405162461bcd60e51b8152600401610d6c90614036565b601654600090610f9c908390614081565b1015610fde5760405162461bcd60e51b8152602060048201526011602482015270546f6f206d616e792061697264726f707360781b6044820152606401610d6c565b60005b8181101561109357600a8054600160b81b900461ffff1690601761100483614098565b91906101000a81548161ffff021916908361ffff1602179055505061103c600a60179054906101000a900461ffff1661ffff16613109565b611079838383818110611051576110516140ba565b90506020020160208101906110669190613e21565b600a54600160b81b900461ffff16613336565b611081613340565b8061108b816140d0565b915050610fe1565b5081819050601660008282546110a99190614081565b90915550505050565b600a5433906110cd90600160b81b900461ffff1660016140eb565b61ffff16813b6111565761271181101561111e576001600160a01b0382166000908152600660205260409020546003116111195760405162461bcd60e51b8152600401610d6c90614111565b611156565b6001600160a01b0382166000908152600760205260409020546003116111565760405162461bcd60e51b8152600401610d6c90614111565b601154600a54600160b81b900461ffff16101561134e57600a54600160a01b900460ff166111c05760405162461bcd60e51b8152602060048201526017602482015276383ab13634b1a3b2b71829b0b632903737ba1037b832b760491b6044820152606401610d6c565b6015546011546111d09190614081565b600a546111e9908590600160b81b900461ffff166140eb565b61ffff16111561120b5760405162461bcd60e51b8152600401610d6c90614156565b6023546040516370a0823160e01b81523360048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611253573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611277919061417a565b8361ffff16600f546112899190614193565b11156112a75760405162461bcd60e51b8152600401610d6c906141b2565b602354604051636eb1769f60e11b81523360048201523060248201526001600160a01b039091169063dd62ed3e90604401602060405180830381865afa1580156112f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611319919061417a565b8361ffff16600f5461132b9190614193565b11156113495760405162461bcd60e51b8152600401610d6c906141de565b611537565b600a54600160a81b900460ff166113a15760405162461bcd60e51b8152602060048201526017602482015276383ab13634b1a3b2b718a9b0b632903737ba1037b832b760491b6044820152606401610d6c565b6016546012546011546113b49190614205565b6113be9190614081565b600a546113d7908590600160b81b900461ffff166140eb565b61ffff1611156113f95760405162461bcd60e51b8152600401610d6c90614156565b6023546040516370a0823160e01b81523360048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611441573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611465919061417a565b8361ffff166010546114779190614193565b11156114955760405162461bcd60e51b8152600401610d6c906141b2565b602354604051636eb1769f60e11b81523360048201523060248201526001600160a01b039091169063dd62ed3e90604401602060405180830381865afa1580156114e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611507919061417a565b8361ffff166010546115199190614193565b11156115375760405162461bcd60e51b8152600401610d6c906141de565b60048361ffff161061155b5760405162461bcd60e51b8152600401610d6c9061421d565b602354600e546001600160a01b03909116906323b872dd90339030906115869061ffff891690614193565b6040518463ffffffff1660e01b81526004016115a493929190614246565b600060405180830381600087803b1580156115be57600080fd5b505af11580156115d2573d6000803e3d6000fd5b5050505060005b8361ffff168110156116c157600a8054600160b81b900461ffff1690601761160083614098565b91906101000a81548161ffff021916908361ffff16021790555050601154600161162a9190614205565b600a54600160b81b900461ffff16101561165d57600f54602660008282546116529190614205565b909155506116779050565b601054602760008282546116719190614205565b90915550505b600a5461168e90600160b81b900461ffff16613109565b600a546116a7903390600160b81b900461ffff16613336565b6116af613340565b806116b9816140d0565b9150506115d9565b50505050565b601a81815481106116d757600080fd5b6000918252602090912001546001600160a01b0316905081565b6008546001600160a01b0316331461171b5760405162461bcd60e51b8152600401610d6c90614036565b601055565b6008546001600160a01b0316331461174a5760405162461bcd60e51b8152600401610d6c90614036565b6008546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015611783573d6000803e3d6000fd5b506023546001600160a01b03166323b872dd306117a86008546001600160a01b031690565b6023546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156117f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611814919061417a565b6040518463ffffffff1660e01b815260040161183293929190614246565b600060405180830381600087803b15801561184c57600080fd5b505af11580156116c1573d6000803e3d6000fd5b610ea283838360405180602001604052806000815250612720565b6008546001600160a01b031633146118a55760405162461bcd60e51b8152600401610d6c90614036565b60235460405163095ea7b360e01b81523060048201526c0c9f2c9cd04674edea4000000060248201526001600160a01b039091169063095ea7b3906044016020604051808303816000875af1158015611902573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611926919061426a565b5060119590955560129390935560138290556015919091556014819055601655600980546001600160a01b039283166001600160a01b031991821617909155600a8054929093169116179055565b600a54339061198f90600160b81b900461ffff1660016140eb565b61ffff16813b611a18576127118110156119e0576001600160a01b0382166000908152600660205260409020546003116119db5760405162461bcd60e51b8152600401610d6c90614111565b611a18565b6001600160a01b038216600090815260076020526040902054600311611a185760405162461bcd60e51b8152600401610d6c90614111565b601154600a54600160b81b900461ffff161015611b0257600a54600160a01b900460ff16611a825760405162461bcd60e51b8152602060048201526017602482015276383ab13634b1a3b2b71829b0b632903737ba1037b832b760491b6044820152606401610d6c565b348361ffff16600c54611a959190614193565b14611ab25760405162461bcd60e51b8152600401610d6c90614287565b601554601154611ac29190614081565b600a54611adb908590600160b81b900461ffff166140eb565b61ffff161115611afd5760405162461bcd60e51b8152600401610d6c90614156565b611bdd565b600a54600160a81b900460ff16611b555760405162461bcd60e51b8152602060048201526017602482015276383ab13634b1a3b2b718a9b0b632903737ba1037b832b760491b6044820152606401610d6c565b348361ffff16600d54611b689190614193565b14611b855760405162461bcd60e51b8152600401610d6c90614287565b601654601254601154611b989190614205565b611ba29190614081565b600a54611bbb908590600160b81b900461ffff166140eb565b61ffff161115611bdd5760405162461bcd60e51b8152600401610d6c90614156565b60048361ffff1610611c015760405162461bcd60e51b8152600401610d6c9061421d565b60005b8361ffff168110156116c157600a8054600160b81b900461ffff16906017611c2b83614098565b91906101000a81548161ffff021916908361ffff160217905550506011546001611c559190614205565b600a54600160b81b900461ffff161015611c8857600c5460246000828254611c7d9190614205565b90915550611ca29050565b600d5460256000828254611c9c9190614205565b90915550505b600a54611cb990600160b81b900461ffff16613109565b600a54611cd2903390600160b81b900461ffff16613336565b611cda613340565b80611ce4816140d0565b915050611c04565b6008546001600160a01b03163314611d165760405162461bcd60e51b8152600401610d6c90614036565b600a8054911515600160a01b0260ff60a01b19909216919091179055565b601c81815481106116d757600080fd5b6008546001600160a01b03163314611d6e5760405162461bcd60e51b8152600401610d6c90614036565b601554600090611d7f908390614081565b1015611dc15760405162461bcd60e51b8152602060048201526011602482015270546f6f206d616e792061697264726f707360781b6044820152606401610d6c565b60005b81811015611e4e57600a8054600160b81b900461ffff16906017611de783614098565b91906101000a81548161ffff021916908361ffff16021790555050611e1f600a60179054906101000a900461ffff1661ffff16613109565b611e34838383818110611051576110516140ba565b611e3c613340565b80611e46816140d0565b915050611dc4565b5081819050601560008282546110a99190614081565b60228181548110610f1f57600080fd5b6000610c5f82612d0e565b6008546001600160a01b03163314611ea95760405162461bcd60e51b8152600401610d6c90614036565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b038216611f365760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610d6c565b506001600160a01b031660009081526003602052604090205490565b6008546001600160a01b03163314611f7c5760405162461bcd60e51b8152600401610d6c90614036565b611f86600061356c565b565b6008546001600160a01b03163314611fb25760405162461bcd60e51b8152600401610d6c90614036565b601155565b60208181548110610f1f57600080fd5b600a543390611fe290600160b81b900461ffff1660016140eb565b61ffff16813b61206b57612711811015612033576001600160a01b03821660009081526006602052604090205460031161202e5760405162461bcd60e51b8152600401610d6c90614111565b61206b565b6001600160a01b03821660009081526007602052604090205460031161206b5760405162461bcd60e51b8152600401610d6c90614111565b600a54600160b01b900460ff166120b55760405162461bcd60e51b815260206004820152600e60248201526d1c1c9954d85b194818db1bdcd95960921b6044820152606401610d6c565b6120bf3385610ea7565b6120fd5760405162461bcd60e51b815260206004820152600f60248201526e139bdd0815da1a5d195b1a5cdd1959608a1b6044820152606401610d6c565b60048361ffff16106121215760405162461bcd60e51b8152600401610d6c9061421d565b6015546011546121319190614081565b600a5461214a908590600160b81b900461ffff166140eb565b61ffff16111561216c5760405162461bcd60e51b8152600401610d6c90614156565b6023546040516370a0823160e01b81523360048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156121b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d8919061417a565b8361ffff16600e546121ea9190614193565b11156122085760405162461bcd60e51b8152600401610d6c906141b2565b602354604051636eb1769f60e11b81523360048201523060248201526001600160a01b039091169063dd62ed3e90604401602060405180830381865afa158015612256573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061227a919061417a565b8361ffff16600e5461228c9190614193565b11156122aa5760405162461bcd60e51b8152600401610d6c906141de565b602354600e546001600160a01b03909116906323b872dd90339030906122d59061ffff891690614193565b6040518463ffffffff1660e01b81526004016122f393929190614246565b600060405180830381600087803b15801561230d57600080fd5b505af1158015612321573d6000803e3d6000fd5b5050505060005b8361ffff168110156123cd57600a8054600160b81b900461ffff1690601761234f83614098565b91906101000a81548161ffff021916908361ffff16021790555050600e546026600082825461237e9190614205565b9091555050600a5461239a90600160b81b900461ffff16613109565b600a546123b3903390600160b81b900461ffff16613336565b6123bb613340565b806123c5816140d0565b915050612328565b5050505050565b6008546001600160a01b031633146123fe5760405162461bcd60e51b8152600401610d6c90614036565b601355565b6008546001600160a01b0316331461242d5760405162461bcd60e51b8152600401610d6c90614036565b6018805460018181019092557fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e0180546001600160a01b038087166001600160a01b031992831617909255601980548085019091557f944998273e477b495144fb8794c914197f3ccb46be2900f4698fd0ef743c9695018054868416908316179055601a8054938401815560009081527f057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63e9093018054928516929091169190911790556017805461ffff169161250283614098565b91906101000a81548161ffff021916908361ffff16021790555050505050565b606060018054610c7490613faa565b6008546001600160a01b0316331461255b5760405162461bcd60e51b8152600401610d6c90614036565b601455565b6001600160a01b0382163314156125b95760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610d6c565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6008546001600160a01b0316331461264f5760405162461bcd60e51b8152600401610d6c90614036565b601b805460018181019092557f3ad8aa4f87544323a9d1e5dd902f40c356527a7955687113db5f9a85ad579dc10180546001600160a01b038086166001600160a01b031992831617909255601c805493840181556000527f0e4562a10381dec21b205ed72637e6b1b523bdd0e4d4d50af5cd23dd4500a2119092018054918416919092161790556017805461ffff62010000909104169060026126f183614098565b91906101000a81548161ffff021916908361ffff160217905550505050565b601e8181548110610f1f57600080fd5b61272a3383612e72565b6127465760405162461bcd60e51b8152600401610d6c90613fe5565b6116c1848484846135be565b6008546001600160a01b0316331461277c5760405162461bcd60e51b8152600401610d6c90614036565b600f55565b6000818152600260205260409020546060906001600160a01b03166127dc5760405162461bcd60e51b81526020600482015260116024820152703737b732bc34b9ba32b73a103a37b5b2b760791b6044820152606401610d6c565b60006127e66135f1565b905060008151116128065760405180602001604052806000815250612831565b8061281084613611565b6040516020016128219291906142b7565b6040516020818303038152906040525b9392505050565b6008546001600160a01b031633146128625760405162461bcd60e51b8152600401610d6c90614036565b601255565b601981815481106116d757600080fd5b601881815481106116d757600080fd5b6008546001600160a01b031633146128b15760405162461bcd60e51b8152600401610d6c90614036565b600a8054911515600160a81b0260ff60a81b19909216919091179055565b606060405180608001604052806044815260200161442b60449139905090565b60218181548110610f1f57600080fd5b6008546001600160a01b031633146129295760405162461bcd60e51b8152600401610d6c90614036565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6008546001600160a01b031633146129755760405162461bcd60e51b8152600401610d6c90614036565b6001600160a01b0381166129da5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d6c565b6129e38161356c565b50565b601b81815481106116d757600080fd5b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b600a543390612a6490600160b81b900461ffff1660016140eb565b61ffff16813b612aed57612711811015612ab5576001600160a01b038216600090815260066020526040902054600311612ab05760405162461bcd60e51b8152600401610d6c90614111565b612aed565b6001600160a01b038216600090815260076020526040902054600311612aed5760405162461bcd60e51b8152600401610d6c90614111565b600a54600160b01b900460ff16612b375760405162461bcd60e51b815260206004820152600e60248201526d1c1c9954d85b194818db1bdcd95960921b6044820152606401610d6c565b612b413385610ea7565b612b7f5760405162461bcd60e51b815260206004820152600f60248201526e139bdd0815da1a5d195b1a5cdd1959608a1b6044820152606401610d6c565b348361ffff16600b54612b929190614193565b14612baf5760405162461bcd60e51b8152600401610d6c90614287565b60048361ffff1610612bd35760405162461bcd60e51b8152600401610d6c9061421d565b601554601154612be39190614081565b600a54612bfc908590600160b81b900461ffff166140eb565b61ffff161115612c1e5760405162461bcd60e51b8152600401610d6c90614156565b60005b8361ffff168110156123cd57600a8054600160b81b900461ffff16906017612c4883614098565b91906101000a81548161ffff021916908361ffff16021790555050600b5460246000828254612c779190614205565b9091555050600a54612c9390600160b81b900461ffff16613109565b600a54612cac903390600160b81b900461ffff16613336565b612cb4613340565b80612cbe816140d0565b915050612c21565b6008546001600160a01b03163314612cf05760405162461bcd60e51b8152600401610d6c90614036565b600a8054911515600160b01b0260ff60b01b19909216919091179055565b6000818152600260205260408120546001600160a01b031680610c5f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610d6c565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612dba82612d0e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080600080612e028561370f565b6040805160008152602081018083528b905260ff8316918101919091526060810184905260808101839052929550909350915060019060a0016020604051602081039080840390855afa158015612e5d573d6000803e3d6000fd5b5050604051601f190151979650505050505050565b6000818152600260205260408120546001600160a01b0316612eeb5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610d6c565b6000612ef683612d0e565b9050806001600160a01b0316846001600160a01b03161480612f315750836001600160a01b0316612f2684610cf7565b6001600160a01b0316145b80612f6157506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316612f7c82612d0e565b6001600160a01b031614612fe45760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610d6c565b6001600160a01b0382166130465760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610d6c565b613051600082612d85565b6001600160a01b038316600090815260036020526040812080546001929061307a908490614081565b90915550506001600160a01b03821660009081526003602052604081208054600192906130a8908490614205565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b604080514260208083019190915281830184905282518083038401815260609092019092528051910120601154613141906001614205565b8210156132665760006131556003836142f3565b6000848152601d60205260409020805461ffff191661ffff83169081179091559091501580156131945750600360115461318f9190614307565b601e54105b156131d0575050601e80546001810182556000919091527f50bb669a95c7b50b7e8a6f09454034b2b14cf2b85c730dca9a539ca82cb6e3500155565b8061ffff1660011480156131f3575060036011546131ee9190614307565b601f54105b1561322f575050601f80546001810182556000919091527fa03837a25210ee280c2113ff4b77ca23440b19d4866cca721c801278fd08d8070155565b5050602080546001810182556000919091527fc97bfaf2f8ee708c303a06d134f5ecd8389ae0432af62dc132a24118292866bb0155565b60006132736002836142f3565b61327e9060036140eb565b6000848152601d60205260409020805461ffff191661ffff831690811790915590915060031480156132bf575060026012546132ba9190614307565b602154105b156132fb575050602180546001810182556000919091527f3a6357012c1a3ae0a17d304c9920310382d968ebcc4b1771f41c6b304205b5700155565b602280546001810182556000919091527f61035b26e3e9eee00e0d72fd1ee8ddca6894550dca6916ea2ac6baa90d11e51001839055505b5050565b6133328282613771565b60115461334e906001614205565b600a54600160b81b900461ffff16101561346757600a5461337d906103e890600160b81b900461ffff1661431b565b61ffff16611f865760245447101561339457600080fd5b600a546024546001600160a01b03909116906108fc906133b690600490614307565b6040518115909202916000818181858888f193505050501580156133de573d6000803e3d6000fd5b50602354600a546026546001600160a01b03928316926323b872dd92309291169061340b90600490614307565b6040518463ffffffff1660e01b815260040161342993929190614246565b600060405180830381600087803b15801561344357600080fd5b505af1158015613457573d6000803e3d6000fd5b5050600060248190556026555050565b600a54613482906103e890600160b81b900461ffff1661431b565b61ffff16611f865760255447101561349957600080fd5b600a546025546001600160a01b03909116906108fc906134bb90600490614307565b6040518115909202916000818181858888f193505050501580156134e3573d6000803e3d6000fd5b50602354600a546027546001600160a01b03928316926323b872dd92309291169061351090600490614307565b6040518463ffffffff1660e01b815260040161352e93929190614246565b600060405180830381600087803b15801561354857600080fd5b505af115801561355c573d6000803e3d6000fd5b5050600060258190556027555050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6135c9848484612f69565b6135d584848484613885565b6116c15760405162461bcd60e51b8152600401610d6c9061433c565b60606040518060800160405280604281526020016143e960429139905090565b6060816136355750506040805180820190915260018152600360fc1b602082015290565b8160005b811561365f5780613649816140d0565b91506136589050600a83614307565b9150613639565b60008167ffffffffffffffff81111561367a5761367a613bbd565b6040519080825280601f01601f1916602001820160405280156136a4576020820181803683370190505b5090505b8415612f61576136b9600183614081565b91506136c6600a866142f3565b6136d1906030614205565b60f81b8183815181106136e6576136e66140ba565b60200101906001600160f81b031916908160001a905350613708600a86614307565b94506136a8565b600080600083516041146137535760405162461bcd60e51b815260206004820152600b60248201526a1cda59c81a5b9d985b1a5960aa1b6044820152606401610d6c565b50505060208101516040820151606090920151909260009190911a90565b8181813b6137f8576127118110156137c0576001600160a01b0382166000908152600660205260409020546003116137bb5760405162461bcd60e51b8152600401610d6c90614111565b6137f8565b6001600160a01b0382166000908152600760205260409020546003116137f85760405162461bcd60e51b8152600401610d6c90614111565b6138028484613983565b336001600160a01b03851614156116c157612711831015613851576001600160a01b0384166000908152600660205260408120805460019290613846908490614205565b909155506116c19050565b6001600160a01b038416600090815260076020526040812080546001929061387a908490614205565b909155505050505050565b60006001600160a01b0384163b1561397857604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906138c990339089908890889060040161438e565b6020604051808303816000875af1925050508015613904575060408051601f3d908101601f19168201909252613901918101906143cb565b60015b61395e573d808015613932576040519150601f19603f3d011682016040523d82523d6000602084013e613937565b606091505b5080516139565760405162461bcd60e51b8152600401610d6c9061433c565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612f61565b506001949350505050565b6001600160a01b0382166139d95760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d6c565b6000818152600260205260409020546001600160a01b031615613a3e5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610d6c565b6001600160a01b0382166000908152600360205260408120805460019290613a67908490614205565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160e01b0319811681146129e357600080fd5b600060208284031215613aed57600080fd5b813561283181613ac5565b60005b83811015613b13578181015183820152602001613afb565b838111156116c15750506000910152565b60008151808452613b3c816020860160208601613af8565b601f01601f19169290920160200192915050565b6020815260006128316020830184613b24565b600060208284031215613b7557600080fd5b5035919050565b6001600160a01b03811681146129e357600080fd5b60008060408385031215613ba457600080fd5b8235613baf81613b7c565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112613be457600080fd5b813567ffffffffffffffff80821115613bff57613bff613bbd565b604051601f8301601f19908116603f01168101908282118183101715613c2757613c27613bbd565b81604052838152866020858801011115613c4057600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060408385031215613c7357600080fd5b8235613c7e81613b7c565b9150602083013567ffffffffffffffff811115613c9a57600080fd5b613ca685828601613bd3565b9150509250929050565b600080600060608486031215613cc557600080fd5b8335613cd081613b7c565b92506020840135613ce081613b7c565b929592945050506040919091013590565b60008060208385031215613d0457600080fd5b823567ffffffffffffffff80821115613d1c57600080fd5b818501915085601f830112613d3057600080fd5b813581811115613d3f57600080fd5b8660208260051b8501011115613d5457600080fd5b60209290920196919550909350505050565b803561ffff81168114613d7857600080fd5b919050565b600060208284031215613d8f57600080fd5b61283182613d66565b60008060008060008060c08789031215613db157600080fd5b863595506020870135945060408701359350606087013592506080870135613dd881613b7c565b915060a0870135613de881613b7c565b809150509295509295509295565b80151581146129e357600080fd5b600060208284031215613e1657600080fd5b813561283181613df6565b600060208284031215613e3357600080fd5b813561283181613b7c565b60008060408385031215613e5157600080fd5b823567ffffffffffffffff811115613e6857600080fd5b613e7485828601613bd3565b925050613e8360208401613d66565b90509250929050565b600080600060608486031215613ea157600080fd5b8335613eac81613b7c565b92506020840135613ebc81613b7c565b91506040840135613ecc81613b7c565b809150509250925092565b60008060408385031215613eea57600080fd5b8235613ef581613b7c565b91506020830135613f0581613df6565b809150509250929050565b60008060408385031215613f2357600080fd5b8235613f2e81613b7c565b91506020830135613f0581613b7c565b60008060008060808587031215613f5457600080fd5b8435613f5f81613b7c565b93506020850135613f6f81613b7c565b925060408501359150606085013567ffffffffffffffff811115613f9257600080fd5b613f9e87828801613bd3565b91505092959194509250565b600181811c90821680613fbe57607f821691505b60208210811415613fdf57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000828210156140935761409361406b565b500390565b600061ffff808316818114156140b0576140b061406b565b6001019392505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156140e4576140e461406b565b5060010190565b600061ffff8083168185168083038211156141085761410861406b565b01949350505050565b60208082526025908201527f43616e206f6e6c7920686f6c6420746872656520746f6b656e73207065722077604082015264185b1b195d60da1b606082015260800190565b6020808252600a90820152691b5a5b9d1959081bdd5d60b21b604082015260600190565b60006020828403121561418c57600080fd5b5051919050565b60008160001904831182151516156141ad576141ad61406b565b500290565b6020808252601290820152716e6f7420656e6f7567682062616c616e636560701b604082015260600190565b6020808252600d908201526c6c6f7720616c6c6f77616e636560981b604082015260600190565b600082198211156142185761421861406b565b500190565b6020808252600f908201526e151bdbc81b585b9e48185b5bdd5b9d608a1b604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561427c57600080fd5b815161283181613df6565b602080825260169082015275125b9d985b1a59081c185e5b595b9d08185b5bdd5b9d60521b604082015260600190565b600083516142c9818460208801613af8565b835190830190614108818360208801613af8565b634e487b7160e01b600052601260045260246000fd5b600082614302576143026142dd565b500690565b600082614316576143166142dd565b500490565b600061ffff80841680614330576143306142dd565b92169190910692915050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906143c190830184613b24565b9695505050505050565b6000602082840312156143dd57600080fd5b815161283181613ac556fe68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4b61696a7544414f2f6b61696a7564616f2f6d61696e2f746f6b656e7572692f68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4b61696a7544414f2f6b61696a7564616f2f6d61696e2f636f6e7472616374757269a2646970667358221220690534ba1ec309e506ae1cd8e18a3c8e3dd254be1043d92f3c425a9892e531c764736f6c634300080a0033

Verified Source Code Partial Match

Compiler: v0.8.10+commit.fc410830 EVM: istanbul Optimization: Yes (200 runs)
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT

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;
    }
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "IERC721.sol";
import "IERC721Receiver.sol";
import "IERC721Metadata.sol";
import "Address.sol";
import "Context.sol";
import "Strings.sol";
import "ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // 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;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @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 ||
            super.supportsInterface(interfaceId);
    }

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @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 virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: 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 virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @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.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: 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`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * 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
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

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

    /**
     * @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.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * 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`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}
Address.sol 216 lines
// SPDX-License-Identifier: MIT

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 23 lines
// SPDX-License-Identifier: MIT

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;
    }
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT

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);
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "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`, 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 be 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 Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @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 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);

    /**
     * @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;
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "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() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

    /**
     * @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);
    }
}
IOpenDAO.sol 9 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IOpenDAO {
    function balanceOf(address owner) external view returns(uint256);
    function transferFrom(address, address, uint256) external;
    function allowance(address owner, address spender) external view returns(uint256);
    function approve(address spender, uint256 amount) external returns(bool);
}
KaijuDAO.sol 402 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


import "ThreePerWallet.sol";
import "Ownable.sol";
import "ERC721.sol";
import "IERC721.sol";

import "IOpenDAO.sol";
/***************************************************************************************************
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo+/::://+ooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo/-`       `./ooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo/.             .+ooooooooo
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo/`               `+oooooooo
ooooooooooooooooooooooooooooooooooooooossyyhhddddmmmmmddddhhyyssoooooooo+`                 ./++ooooo
ooooooooooooooooooooooooooooooooosyhdmNNNNNmmmmmddddddddmmmmNNNNNmdhyso/-                   ```-/ooo
ooooooooooooooooooooooooooooosydNNNmmddhhdddmddddddddddddddhhysyhhdmNNmo`                       `:oo
ooooooooooooo++:-....-:++oosdNMMd+/:yNMMMMNmdhhyyyyyyyyyyhhdmMMNmo-:/oNMh                         /o
oooooooooooo/.          ./oNMNMMdyo/ossyyyhddmmNmmmmmmmmmmmmNmhs+:::/sNMh                         `:
ooooooooooo-              +MMoshdNNMMNmdhysoo+/////++++oooooosyhhdmNMNd+`                           
oooooooooo/               /MMo::::/+oshNMMMMMMMMMMMMMMMMMMMMMMMMmdhyo.                              
oooo+/:::/-             `.-NMm::::::/yNMNhs+++oooossssoooo++sdMMmyooo+:.``                      ``..
o/.`                  omMMMMMMy::::sNMNy+/////////////////////+hMMmsooooooo+++/////////////+++oooooo
.                    hMNs++ohMMs:+mMNy+/////////////////////////odMMhooooooooooooooooooooooooooooooo
                    -MMs:::::yMMhNMmo////////////////////////////+yMMdoooooooooooooooooooooooooooooo
                    -MMs::::::smMMd+/////////////////////////////++yMMdooooooooooooooooooooooooooooo
                     dMm/:::::+NMd+//////////osys+//////////////smNNMMMhoooooooooooooooooooooooooooo
                     -mMd/::::mMN+/////////+hNNMMmo////////////sMMyyMMMMsooooooooooooooooooooooooooo
                      -dMNs/:sMMs//////////yMM/-hMNo///////////NMd .MMMMdooooooooooooooooooooooooooo
`                     `hMMMmomMm///////////NMd  `MMh///////////mMm`.MMMMNooooooooooooooooooooooooooo
+/:-----------------..oMMshNMMMy///////////mMm` .MMh///////////oNMmmMNdMMsoooooooooooooooooooooooooo
oooooooooooooooooooooohMM+:/hMMs///////////sNMmymMNo///+++syyhhhdNMNhoyMMsoooooooooooooooooooooooooo
oooooooooooooooooooooosMMh::sMMo////////////+ydddy+/+oydNMMNNNmmmNNMMNNMMooooooooooooooooooooooooooo
oooooooooooooooooooooooyMMh:sMMo//////////////////+smMMmhyo+//////+yyymMMdoooooooooooooooooooooooooo
ooooooydmNMMMNNNmmdhysooyNMmhMMs/////////////////omMMho/oNNo//////yMM+/sNMmooooooooooosssyyssooooooo
ooooohMMy+///++oshdNMMNdoohMMMMh/////////////////smd+///oMMo//////omd+//hMMoooooyhmNMMMMMMMMMNdooooo
ooooohMMs-`         ./mMNooodNMN//////////////////+//////++////////+////hMMooymMMmhs+:-..``./NMdoooo
ooooooyMMMNmhysso.    :MMyoooyMMs/////////////+s+//////////////////////+NMmodMMs-`   `.-:/+ydMMhoooo
oooooooMMmosyhhdd:    .MMhooooNMm+////////////hMN+/////////+oyhmmmdysoodMMsoMMs    `mNNNNNmhmMMooooo
ooooooohNMdsosymNd     hMNsoooyMMy////////////oNMmso++++oshNNNmdhdmNMNNMmyohMM-    /hs+/::/+mMmooooo
oooooooosNMMddhyo/     `yNNmddNMMNy+///////////ohNMNNmNNNNmdyo+///+yMMNyosyNMh     hNNmmmNNMNhoooooo
ooooooooodMM+--+dm+  ..  -ohNMMNymMmy+///////////+oyyhyyso+//////+omMNMNmNMmo`   .-..://+dMMoooooooo
oooooooooohNNNMMms--ymm. ``+NMM: .omMmy+////////////oso++/+++ooshmMNdohMMm/. --``dNmhsosdMNyoooooooo
oooooooooooosmMMdhdMMh:`/dmMMMMy   .oNMNhs+////////+mMNmmdmmNNMNNdyo///yNMy``mMh::omMMNNmhsooooooooo
oooooooooooooohmNMMMMhydMMMMyyMMo `+dMNNNMNho///////+syhdddhysso+///////sNMdssNMMNNMNhoooooooooooooo
oooooooooooosmMMMMMMMMmhhMMh//yMMohMNyssyymMNs///////////////////////////oNMMMNNdyysoooooooooooooooo
oooooooooooomMm++oshNMNyNMm+///yMMMM+dMmmMmdMMs+//////////////////////////oNMmoooooooooooooooooooooo
ooooooooooooNMd::::::omMMMo/////oNMN:NMsoNMsMMMms/////+++++////////////////sMMhooooooooooooooooooooo
oooo+/:--::/mMm:::::::+MMh///////yMMy+dmmdohMMyMMmhdNMMMNMMMMNNmdys+////////hMMyoooooooooooooooooooo
o+:`        yMM:::::::dMN+////////yNMmysshmMMm..omMMmo:::::://+oydNNdo//////+mMNoooooooooooooooooooo
/`          :MMs:::::/MMh//////////+yNMMNMMo/NN: `/hNMmy+:::::::::/omMh//////oMMdo+/:::/+ooooooooooo
             dMm:::::yMM+////////////oNMdoMd`.dd    .+hNMmho/:::::::/dMy//////dMM/`     `-+ooooooooo
             +MMy::::NMm//////////////sMMy+Nd.``      `./ymMNdyo/::::/MN++mms/oMMo        `+oooooooo
            sNMMMs::+MMy///////////////yMM//Nm:           `-ohmNNmyo+/mMo/mMm//mMm         /oooooooo
           :MMshMNs:sMMo////////////ymh+mMm -hNs`             .-+ymNNmNMhohMMo/yMM-        -/+oooooo
           +MM+:hMMohMM/////////////dMN/yMM: `oNd/`               `-/shmNNNMMh/oMM+          `/ooooo
           -MMs::os/mMm/////////////dMM/+MMo   -yNy                    `-/sNMm//MMy           `+oooo
            dMm:::::NMm/////////////hMM++MMs     -.                        yMM+/NMd            /oooo
            :MMy::::NMd/////////////hMM+oMM+                               +MMo/mMm`          .+oooo
             sMMo:::NMd/////////////hMModMN`                               /MMs/mMNo+++++////+oooooo
              yMMs::mMm/////////////yMMdMM/                                :MMs/NMmooooooooooooooooo
 ***************************************************************************************************/

contract KaijuDAO is ERC721, ThreePerWallet, Ownable{
    using Address for address;
    using Strings for uint256;

    address private signer;
    address payable public treasury;
    bool private publicGen0Sale;
    bool private publicGen1Sale;
    bool private preGen0Sale;
    
    uint16 public minted;
    //uint256 public constant MINT_PRICE_SOS_GEN0 = 50000000000000000000000000;
    uint256 public  MINT_PRICE_ETH_GEN0_PRESALE = 0.03 ether;
    uint256 public  MINT_PRICE_ETH_GEN0 = 0.04 ether;
    uint256 public  MINT_PRICE_ETH_GEN1 = 0.04 ether;
    uint256 public  MINT_PRICE_SOS_GEN0_PRESALE = 23000000000000000000000000;
    uint256 public  MINT_PRICE_SOS_GEN0 = 31000000000000000000000000;
    uint256 public  MINT_PRICE_SOS_GEN1 = 31000000000000000000000000;
    uint256 public MAX_TOKENS_GEN0 = 10000;
    uint256 public MAX_TOKENS_GEN1 = 10000;
    uint256 public MAX_AIRDROPS_GEN0 = 100;
    uint256 public MAX_AIRDROPS_GEN1 = 100;
    uint256 public remain_airdrops_gen0 = 100;
    uint256 public remain_airdrops_gen1 = 100;

    uint16 public round_gen0;
    uint16 public round_gen1;

    address[] public power_leaders;
    address[] public money_leaders;
    address[] public music_leaders;
    address[] public alien_leaders;
    address[] public zombie_leaders;

    mapping(uint256 => uint16) public traits;
    uint256[] public power_list;
    uint256[] public money_list;
    uint256[] public music_list;
    uint256[] public alien_list;
    uint256[] public zombie_list;

    IOpenDAO private openDAO;

    uint256 private accum_eth_gen0 = 0 ether;
    uint256 private accum_eth_gen1 = 0 ether;

    uint256 private accum_sos_gen0 = 0;
    uint256 private accum_sos_gen1 = 0;

    constructor(address _openDAOAddress) ERC721("ChubbyKaijuDAO", "CKAIJU"){
        openDAO = IOpenDAO(_openDAOAddress);
    }

    function initialize(uint256 supply0, uint256 supply1, uint256 airdrop0, uint256 airdrop1, address _signer, address payable _treasury) public onlyOwner {
        openDAO.approve(address(this), 1000000000000000000000000000000);
        MAX_TOKENS_GEN0=supply0;
        MAX_TOKENS_GEN1=supply1;
        MAX_AIRDROPS_GEN0 = airdrop0;
        remain_airdrops_gen0 = MAX_AIRDROPS_GEN0;
        MAX_AIRDROPS_GEN1 = airdrop1;
        remain_airdrops_gen1 = MAX_AIRDROPS_GEN1;
        signer = _signer;
        treasury = _treasury;
    }

    function _setTrait(uint256 tokenId) internal {
        uint256 seed = uint256(keccak256(abi.encodePacked(block.timestamp, tokenId)));
        if(tokenId<MAX_TOKENS_GEN0+1){
            uint16 mod = uint16(seed % 3);
            traits[tokenId] = mod;
            if(mod == 0 && power_list.length<uint256(MAX_TOKENS_GEN0/3)){
                power_list.push(tokenId);
            }else if(mod == 1 && money_list.length<uint256(MAX_TOKENS_GEN0/3)){
                money_list.push(tokenId);
            }else{
                music_list.push(tokenId);
            }
        }else{
            uint16 mod = uint16(seed % 2)+3;
            traits[tokenId] = mod;
            if(mod==3 && alien_list.length < MAX_TOKENS_GEN1/2) alien_list.push(tokenId);
            else zombie_list.push(tokenId);
        }
    }

    function airdropGEN0(address[] calldata airdropAddresses) public onlyOwner {
        require(remain_airdrops_gen0-airdropAddresses.length>=0, "Too many airdrops");
        for(uint256 i = 0; i < airdropAddresses.length; i++) {
            minted++;
            _setTrait(minted);
            _mint(airdropAddresses[i], minted);
            _autoTransfer();
        }
        remain_airdrops_gen0 -= airdropAddresses.length;
    }

    function airdropGEN1(address[] calldata airdropAddresses) public onlyOwner {
        require(remain_airdrops_gen1-airdropAddresses.length>=0, "Too many airdrops");
        for(uint256 i = 0; i < airdropAddresses.length; i++) {
            minted++;
            _setTrait(minted);
            _mint(airdropAddresses[i], minted);
            _autoTransfer();
        }
        remain_airdrops_gen1 -= airdropAddresses.length;
    }

    function preSaleETH(bytes memory signature, uint16 amount) external payable threePerWallet(msg.sender, minted+1){
        require(preGen0Sale, "preSale closed");
        require(isWhitelisted(msg.sender, signature), "Not Whitelisted");
        require(MINT_PRICE_ETH_GEN0_PRESALE * amount == msg.value, "Invalid payment amount");
        require(amount < 4, "Too many amount");
        require(minted + amount <= MAX_TOKENS_GEN0-remain_airdrops_gen0, "minted out");
        for(uint i=0; i<amount; i++){
            minted++;
            accum_eth_gen0 += MINT_PRICE_ETH_GEN0_PRESALE;
            _setTrait(minted);
            _mint(msg.sender, minted);
            _autoTransfer();
        }
    }
    function publicETH(uint16 amount) external payable threePerWallet(msg.sender, minted+1){
        if(minted<MAX_TOKENS_GEN0){
            require(publicGen0Sale, "publicGen0Sale not open");
            require(MINT_PRICE_ETH_GEN0 * amount == msg.value, "Invalid payment amount");
            require(minted + amount <= MAX_TOKENS_GEN0-remain_airdrops_gen0, "minted out");
        }else{
            require(publicGen1Sale, "publicGen1Sale not open");
            require(MINT_PRICE_ETH_GEN1 * amount == msg.value, "Invalid payment amount");
            require(minted + amount <= MAX_TOKENS_GEN0+MAX_TOKENS_GEN1-remain_airdrops_gen1, "minted out");
        } 
        require(amount < 4, "Too many amount");
        
        for(uint i=0; i<amount; i++){
            minted++;
            if(minted < MAX_TOKENS_GEN0+1) accum_eth_gen0 += MINT_PRICE_ETH_GEN0;
            else accum_eth_gen1 += MINT_PRICE_ETH_GEN1;
            _setTrait(minted);
            _mint(msg.sender, minted);
            _autoTransfer();
        }
    }
    function preSaleSOS(bytes memory signature, uint16 amount) external threePerWallet(msg.sender, minted+1){
        require(preGen0Sale, "preSale closed");
        require(isWhitelisted(msg.sender, signature), "Not Whitelisted");
        require(amount < 4, "Too many amount");
        require(minted + amount <= MAX_TOKENS_GEN0-remain_airdrops_gen0, "minted out");
        require(MINT_PRICE_SOS_GEN0_PRESALE * amount <= openDAO.balanceOf(msg.sender), "not enough balance");
        require(MINT_PRICE_SOS_GEN0_PRESALE * amount <= openDAO.allowance(msg.sender, address(this)), "low allowance");
        openDAO.transferFrom(msg.sender, address(this), MINT_PRICE_SOS_GEN0_PRESALE * amount);
        for(uint i=0; i<amount; i++){
            minted++;
            accum_sos_gen0 += MINT_PRICE_SOS_GEN0_PRESALE;
            _setTrait(minted);
            _mint(msg.sender, minted);
            _autoTransfer();
        }
    }
    function publicSOS(uint16 amount) external threePerWallet(msg.sender, minted+1){
        if(minted<MAX_TOKENS_GEN0){
            require(publicGen0Sale, "publicGen0Sale not open");
            require(minted + amount <= MAX_TOKENS_GEN0-remain_airdrops_gen0, "minted out");
            require(MINT_PRICE_SOS_GEN0 * amount <= openDAO.balanceOf(msg.sender), "not enough balance");
            require(MINT_PRICE_SOS_GEN0 * amount <= openDAO.allowance(msg.sender, address(this)), "low allowance");
        }else{
            require(publicGen1Sale, "publicGen1Sale not open");
            require(minted + amount <= MAX_TOKENS_GEN0+MAX_TOKENS_GEN1-remain_airdrops_gen1, "minted out");
            require(MINT_PRICE_SOS_GEN1 * amount <= openDAO.balanceOf(msg.sender), "not enough balance");
            require(MINT_PRICE_SOS_GEN1 * amount <= openDAO.allowance(msg.sender, address(this)), "low allowance");
        } 
        require(amount < 4, "Too many amount");
        
        openDAO.transferFrom(msg.sender, address(this), MINT_PRICE_SOS_GEN0_PRESALE * amount);
        for(uint i=0; i<amount; i++){
            minted++;
            if(minted < MAX_TOKENS_GEN0+1) accum_sos_gen0 += MINT_PRICE_SOS_GEN0;
            else accum_sos_gen1 += MINT_PRICE_SOS_GEN1;
            _setTrait(minted);
            _mint(msg.sender, minted);
            _autoTransfer();
        }
    }

    function ownerOf(uint256 tokenId) public view override(ERC721) returns (address) {
        return super.ownerOf(tokenId);
    }

    function contractURI() public pure returns (string memory) {
        //TODO change contractURI
        return "https://raw.githubusercontent.com/KaijuDAO/kaijudao/main/contracturi";
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        require(_exists(tokenId), "nonexistent token");

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

    function _baseURI() override internal pure returns (string memory) {
        //TODO change baseURI
        return "https://raw.githubusercontent.com/KaijuDAO/kaijudao/main/tokenuri/";
    }

    function _mint(address to, uint256 tokenId) internal override(ERC721, ThreePerWallet) {
        ThreePerWallet._mint(to, tokenId);
    }

    function setLeadersGen0(address power, address money, address music) external onlyOwner {
        power_leaders.push(power);
        money_leaders.push(money);
        music_leaders.push(music);
        round_gen0++;
    }

    function setLeadersGen1(address alien, address zombie) external onlyOwner {
        alien_leaders.push(alien);
        zombie_leaders.push(zombie);
        round_gen1++;
    }

    function getEthSignedMessageHash(bytes32 _messageHash) public pure returns (bytes32) {
        /*
        Signature is produced by signing a keccak256 hash with the following format:
        "\x19Ethereum Signed Message\n" + len(msg) + msg
        */
        return
        keccak256(
            abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash)
        );
    }

    function isWhitelisted(address user, bytes memory signature) public view returns (bool) {
        bytes32 messageHash = keccak256(abi.encode(user));
        bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash);

        return recoverSigner(ethSignedMessageHash, signature) == signer;
    }

    function recoverSigner(bytes32 _ethSignedMessageHash, bytes memory _signature) private pure returns (address) {
        (bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);
        return ecrecover(_ethSignedMessageHash, v, r, s);
    }

    function splitSignature(bytes memory sig) private pure returns (bytes32 r, bytes32 s, uint8 v) {
        require(sig.length == 65, "sig invalid");

        assembly {
        /*
        First 32 bytes stores the length of the signature

        add(sig, 32) = pointer of sig + 32
        effectively, skips first 32 bytes of signature

        mload(p) loads next 32 bytes starting at the memory address p into memory
        */

        // first 32 bytes, after the length prefix
            r := mload(add(sig, 32))
        // second 32 bytes
            s := mload(add(sig, 64))
        // final byte (first byte of the next 32 bytes)
            v := byte(0, mload(add(sig, 96)))
        }

        // implicitly return (r, s, v)
    }
    function setPreGen0Sale(bool isPre) public onlyOwner {
        preGen0Sale = isPre;
    }
    function setpublicGen0Sale(bool isPublic) public onlyOwner {
        publicGen0Sale = isPublic;
    }
    
    function setpublicGen1Sale(bool isPublic) public onlyOwner {
        publicGen1Sale = isPublic;
    }

    function setSupplyGen0(uint256 supply) public onlyOwner {
        MAX_TOKENS_GEN0=supply;
    }

    function setSupplyGen1(uint256 supply) public onlyOwner {
        MAX_TOKENS_GEN1=supply;
    }

    function setSigner(address _signer) public onlyOwner {
        signer = _signer;
    }

    function setTreasury(address payable _treasury) public onlyOwner {
        treasury = _treasury;
    }

    function setAirdropGen0(uint256 airdrop) public onlyOwner{
        MAX_AIRDROPS_GEN0 = airdrop;
    }

    function setAirdropGen1(uint256 airdrop) public onlyOwner{
        MAX_AIRDROPS_GEN1 = airdrop;
    }

    function setGen0SOSPrice(uint256 price) public onlyOwner{
        MINT_PRICE_SOS_GEN0 = price;
    }

    function setGen1SOSPrice(uint256 price) public onlyOwner{
        MINT_PRICE_SOS_GEN1 = price;
    }

    function _autoTransfer() internal {
        if(minted < MAX_TOKENS_GEN0+1){
            if(minted%1000 == 0){
                require(address(this).balance>=accum_eth_gen0);
                treasury.transfer(accum_eth_gen0/4);
                openDAO.transferFrom(address(this), treasury, uint256(accum_sos_gen0/4));
                accum_eth_gen0=0 ether;
                accum_sos_gen0=0 ;
                
            }
        }else{
            // TODO: Gen1 treasury autotransfer
            if(minted%1000 == 0){
                require(address(this).balance>=accum_eth_gen1);
                treasury.transfer(accum_eth_gen1/4);
                openDAO.transferFrom(address(this), treasury, uint256(accum_sos_gen1/4));
                accum_eth_gen1=0 ether;
                accum_sos_gen1=0 ;
            }
        }
    }

    function withdraw() public onlyOwner{
        payable(owner()).transfer(address(this).balance);
        openDAO.transferFrom(address(this), owner(), openDAO.balanceOf(address(this)));
    }
}
ThreePerWallet.sol 90 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "ERC721.sol";

/// @author 1001.digital
/// @title An extension that enables checking that an address only holds one token.
abstract contract ThreePerWallet is ERC721 {
    // Mapping owner address to token
    mapping (address => uint256) private _ownedGen0;
    mapping (address => uint256) private _ownedGen1;

    /// Require an externally owned account to only hold one token.
    /// @param wallet the address of
    /// @dev Only allow one token per wallet
    modifier threePerWallet(address wallet, uint256 tokenId) {
        if (_isExternal(wallet)) {
            if(tokenId<10001){
                require(_ownedGen0[wallet] < 3, "Can only hold three tokens per wallet");
            }else{
                require(_ownedGen1[wallet] < 3, "Can only hold three tokens per wallet");
            }
            
        }

        _;
    }


    /// Store `_ownedGen0` instead of `_balances`.
    /// @param to the address to which to mint the token
    /// @param tokenId the tokenId that should be minted
    /// @dev overrides the OpenZeppelin `_mint` method to accomodate for our own balance tracker
    function _mint(address to, uint256 tokenId) internal virtual override threePerWallet(to, tokenId) {
        super._mint(to, tokenId);

        // We add one to account for 0-index based collections
        if(msg.sender==to){
            if(tokenId<10001){
                _ownedGen0[to] += 1;
            }else{
                _ownedGen1[to] += 1;
            }
        }
        
    }
    /*
    /// Track transfers in `_ownedGen0` instead of `_balances`
    /// @param from the address from which to transfer the token
    /// @param to the address to which to transfer the token
    /// @param tokenId the tokenId that is being transferred
    /// @dev overrides the OpenZeppelin `_transfer` method to accomodate for our own balance tracker
    function _transfer(address from, address to, uint256 tokenId) internal virtual override threePerWallet(to, tokenId) {
        super._transfer(from, to, tokenId);
        if(tokenId<10001){
            _ownedGen0[from] -= 1;
            // We add one to account for 0-index based collections
            _ownedGen0[to] += 1;
        }else{
            _ownedGen1[from] -= 1;
            // We add one to account for 0-index based collections
            _ownedGen1[to] += 1;
        }
        
    }
    */
    function _isContract(address account) internal view returns (bool) {
        return _getSize(account) > 0;
    }

    /// Check whether an address is an external wallet.
    /// @param account the address to check
    /// @dev checks if the `extcodesize` of `address` is zero
    /// @return true for external wallets
    function _isExternal(address account) internal view returns (bool) {
        return _getSize(account) == 0;
    }

    /// Get the size of the code of an address
    /// @param account the address to check
    /// @dev gets the `extcodesize` of `address`
    /// @return the size of the address
    function _getSize(address account) internal view returns (uint256) {
        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size;
    }
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT

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);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT

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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

Read Contract

MAX_AIRDROPS_GEN0 0x5bbaf59b → uint256
MAX_AIRDROPS_GEN1 0xc04e74dd → uint256
MAX_TOKENS_GEN0 0xb965e89e → uint256
MAX_TOKENS_GEN1 0xb808032b → uint256
MINT_PRICE_ETH_GEN0 0x5d2daed9 → uint256
MINT_PRICE_ETH_GEN0_PRESALE 0x19293e86 → uint256
MINT_PRICE_ETH_GEN1 0x809beaea → uint256
MINT_PRICE_SOS_GEN0 0x419d4d9b → uint256
MINT_PRICE_SOS_GEN0_PRESALE 0x2ea29f01 → uint256
MINT_PRICE_SOS_GEN1 0x62787324 → uint256
alien_leaders 0xf6a73e5e → address
alien_list 0xed3e1903 → uint256
balanceOf 0x70a08231 → uint256
contractURI 0xe8a3d485 → string
getApproved 0x081812fc → address
getEthSignedMessageHash 0xfa540801 → bytes32
isApprovedForAll 0xe985e9c5 → bool
isWhitelisted 0x1f0a8fa7 → bool
minted 0x4f02c420 → uint16
money_leaders 0xd7ee01b8 → address
money_list 0x22b3b0e8 → uint256
music_leaders 0x31957e47 → address
music_list 0x7e41f137 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
power_leaders 0xdfc85a43 → address
power_list 0xb4fe7e06 → uint256
remain_airdrops_gen0 0x8a1b68b3 → uint256
remain_airdrops_gen1 0x9aa90012 → uint256
round_gen0 0x9ed1c513 → uint16
round_gen1 0x554778d1 → uint16
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
traits 0x2d72225b → uint16
treasury 0x61d027b3 → address
zombie_leaders 0x5383abaa → address
zombie_list 0x61edd91d → uint256

Write Contract 28 functions

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

airdropGEN0 0x539630d0
address[] airdropAddresses
airdropGEN1 0x2ca01cee
address[] airdropAddresses
approve 0x095ea7b3
address to
uint256 tokenId
initialize 0x439cc54c
uint256 supply0
uint256 supply1
uint256 airdrop0
uint256 airdrop1
address _signer
address _treasury
preSaleETH 0xfaab74cb
bytes signature
uint16 amount
preSaleSOS 0x82d59aca
bytes signature
uint16 amount
publicETH 0x468bfb78
uint16 amount
publicSOS 0x2ddf991f
uint16 amount
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setAirdropGen0 0x8809da53
uint256 airdrop
setAirdropGen1 0x979c4d92
uint256 airdrop
setApprovalForAll 0xa22cb465
address operator
bool approved
setGen0SOSPrice 0xbdf7796e
uint256 price
setGen1SOSPrice 0x3806eb26
uint256 price
setLeadersGen0 0x8f9a9f03
address power
address money
address music
setLeadersGen1 0xb007bc40
address alien
address zombie
setPreGen0Sale 0xfc931285
bool isPre
setSigner 0x6c19e783
address _signer
setSupplyGen0 0x7b383102
uint256 supply
setSupplyGen1 0xcb0a5993
uint256 supply
setTreasury 0xf0f44260
address _treasury
setpublicGen0Sale 0x51cd1fd9
bool isPublic
setpublicGen1Sale 0xe41ceb69
bool isPublic
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters

Recent Transactions

No transactions found for this address