Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xF8C08433DD41eAeE2e424C9E91467aB27772d9ec
Balance 0 ETH
Nonce 1
Code Size 18781 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

18781 bytes
0x6080604052600436106102135760003560e01c806378a8956711610118578063a152e361116100a0578063c313b3391161006f578063c313b33914610800578063c87b56dd1461083d578063dba98e5b1461087a578063e985e9c5146108b7578063f2fde38b146108f457610214565b8063a152e3611461077b578063a22cb465146107a4578063a4821719146107cd578063b88d4fde146107d757610214565b806383b2d174116100e757806383b2d174146106b55780638da5cb5b146106d157806391b7f5ed146106fc57806395d89b411461072557806398d5fdca1461075057610214565b806378a89567146105f95780637ff9b5961461062457806380a9dc0f1461064f578063830639ac1461067857610214565b80633b4c4b251161019b5780635a67de071161016a5780635a67de07146105145780636352211e1461053d5780636c9c2faf1461057a57806370a08231146105a5578063715018a6146105e257610214565b80633b4c4b251461046e5780633ce68dd51461049757806342842e0e146104c257806355f804b3146104eb57610214565b8063095ea7b3116101e2578063095ea7b31461037757806316a1abb4146103a057806323b872dd146103dd57806325bdb2a8146104065780633af32abf1461043157610214565b806301ffc9a7146102a7578063047fc9aa146102e457806306fdde031461030f578063081812fc1461033a57610214565b5b60003411610257576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024e9061411f565b60405180910390fd5b61025f61091d565b73ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156102a4573d6000803e3d6000fd5b50005b3480156102b357600080fd5b506102ce60048036038101906102c991906133cf565b610947565b6040516102db9190614082565b60405180910390f35b3480156102f057600080fd5b506102f9610a29565b60405161030691906143df565b60405180910390f35b34801561031b57600080fd5b50610324610a2f565b604051610331919061409d565b60405180910390f35b34801561034657600080fd5b50610361600480360381019061035c9190613462565b610ac1565b60405161036e9190613ff9565b60405180910390f35b34801561038357600080fd5b5061039e6004803603810190610399919061333f565b610b46565b005b3480156103ac57600080fd5b506103c760048036038101906103c2919061348b565b610c5e565b6040516103d49190614060565b60405180910390f35b3480156103e957600080fd5b5061040460048036038101906103ff9190613239565b610de1565b005b34801561041257600080fd5b5061041b610e41565b60405161042891906143fa565b60405180910390f35b34801561043d57600080fd5b50610458600480360381019061045391906131d4565b610e90565b6040516104659190614082565b60405180910390f35b34801561047a57600080fd5b5061049560048036038101906104909190613462565b610edb565b005b3480156104a357600080fd5b506104ac610f61565b6040516104b9919061409d565b60405180910390f35b3480156104ce57600080fd5b506104e960048036038101906104e49190613239565b610fef565b005b3480156104f757600080fd5b50610512600480360381019061050d9190613421565b61100f565b005b34801561052057600080fd5b5061053b600480360381019061053691906134c7565b6110a5565b005b34801561054957600080fd5b50610564600480360381019061055f9190613462565b6111af565b6040516105719190613ff9565b60405180910390f35b34801561058657600080fd5b5061058f611261565b60405161059c91906143df565b60405180910390f35b3480156105b157600080fd5b506105cc60048036038101906105c791906131d4565b61126b565b6040516105d991906143df565b60405180910390f35b3480156105ee57600080fd5b506105f7611323565b005b34801561060557600080fd5b5061060e6113ab565b60405161061b91906143df565b60405180910390f35b34801561063057600080fd5b506106396113bc565b60405161064691906143df565b60405180910390f35b34801561065b57600080fd5b506106766004803603810190610671919061337b565b6113c2565b005b34801561068457600080fd5b5061069f600480360381019061069a919061333f565b6114e6565b6040516106ac9190614082565b60405180910390f35b6106cf60048036038101906106ca9190613462565b611533565b005b3480156106dd57600080fd5b506106e661091d565b6040516106f39190613ff9565b60405180910390f35b34801561070857600080fd5b50610723600480360381019061071e9190613462565b611864565b005b34801561073157600080fd5b5061073a6118ea565b604051610747919061409d565b60405180910390f35b34801561075c57600080fd5b5061076561197c565b60405161077291906143df565b60405180910390f35b34801561078757600080fd5b506107a2600480360381019061079d919061333f565b611986565b005b3480156107b057600080fd5b506107cb60048036038101906107c69190613303565b611a4a565b005b6107d5611bcb565b005b3480156107e357600080fd5b506107fe60048036038101906107f99190613288565b611fe4565b005b34801561080c57600080fd5b50610827600480360381019061082291906131d4565b612046565b60405161083491906143df565b60405180910390f35b34801561084957600080fd5b50610864600480360381019061085f9190613462565b61208f565b604051610871919061409d565b60405180910390f35b34801561088657600080fd5b506108a1600480360381019061089c91906131d4565b612136565b6040516108ae91906143df565b60405180910390f35b3480156108c357600080fd5b506108de60048036038101906108d991906131fd565b6121df565b6040516108eb9190614082565b60405180910390f35b34801561090057600080fd5b5061091b600480360381019061091691906131d4565b612273565b005b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610a1257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610a225750610a2182612518565b5b9050919050565b60095481565b606060008054610a3e9061473b565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6a9061473b565b8015610ab75780601f10610a8c57610100808354040283529160200191610ab7565b820191906000526020600020905b815481529060010190602001808311610a9a57829003601f168201915b5050505050905090565b6000610acc82612582565b610b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b02906142bf565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610b51826111af565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb99061435f565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610be16125ee565b73ffffffffffffffffffffffffffffffffffffffff161480610c105750610c0f81610c0a6125ee565b6121df565b5b610c4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c46906141df565b60405180910390fd5b610c5983836125f6565b505050565b6060610c686125ee565b73ffffffffffffffffffffffffffffffffffffffff16610c8661091d565b73ffffffffffffffffffffffffffffffffffffffff1614610cdc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd3906142df565b60405180910390fd5b60008367ffffffffffffffff811115610d1e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610d4c5781602001602082028036833780820191505090505b50905060005b84811015610dd6576000610d66600c6126af565b9050610d72600c6126bd565b610d7c85826126d3565b80838381518110610db6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018181525050508080610dce9061476d565b915050610d52565b508091505092915050565b610df2610dec6125ee565b826126f1565b610e31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e289061437f565b60405180910390fd5b610e3c8383836127cf565b505050565b6000600a60009054906101000a900460ff166002811115610e8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b905090565b600080600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b610ee36125ee565b73ffffffffffffffffffffffffffffffffffffffff16610f0161091d565b73ffffffffffffffffffffffffffffffffffffffff1614610f57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4e906142df565b60405180910390fd5b8060098190555050565b60078054610f6e9061473b565b80601f0160208091040260200160405190810160405280929190818152602001828054610f9a9061473b565b8015610fe75780601f10610fbc57610100808354040283529160200191610fe7565b820191906000526020600020905b815481529060010190602001808311610fca57829003601f168201915b505050505081565b61100a83838360405180602001604052806000815250611fe4565b505050565b6110176125ee565b73ffffffffffffffffffffffffffffffffffffffff1661103561091d565b73ffffffffffffffffffffffffffffffffffffffff161461108b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611082906142df565b60405180910390fd5b80600790805190602001906110a1929190612f4d565b5050565b6110ad6125ee565b73ffffffffffffffffffffffffffffffffffffffff166110cb61091d565b73ffffffffffffffffffffffffffffffffffffffff1614611121576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611118906142df565b60405180910390fd5b8060ff16600281111561115d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600a60006101000a81548160ff021916908360028111156111a7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b021790555050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611258576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124f9061423f565b60405180910390fd5b80915050919050565b6000600954905090565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d39061421f565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61132b6125ee565b73ffffffffffffffffffffffffffffffffffffffff1661134961091d565b73ffffffffffffffffffffffffffffffffffffffff161461139f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611396906142df565b60405180910390fd5b6113a96000612a2b565b565b60006113b7600c6126af565b905090565b60085481565b6113ca6125ee565b73ffffffffffffffffffffffffffffffffffffffff166113e861091d565b73ffffffffffffffffffffffffffffffffffffffff161461143e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611435906142df565b60405180910390fd5b60005b82518110156114e15781600b6000858481518110611488577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080806114d99061476d565b915050611441565b505050565b600081600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015905092915050565b6001600281111561156d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600a60009054906101000a900460ff1660028111156115b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b146115f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ec906141ff565b60405180910390fd5b60008160085461160591906145ea565b90508034101561164a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116419061439f565b60405180910390fd5b600954611657600c6126af565b10611697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168e9061433f565b60405180910390fd5b6116a133836114e6565b6116e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d79061429f565b60405180910390fd5b60005b828110156117215760006116f7600c6126af565b9050611703600c6126bd565b61170d33826126d3565b5080806117199061476d565b9150506116e3565b5081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546117719190614644565b92505081905550600061178261091d565b73ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050509050806117f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ef9061413f565b60405180910390fd5b600082346118069190614644565b111561185f573373ffffffffffffffffffffffffffffffffffffffff166108fc83346118329190614644565b9081150290604051600060405180830381858888f1935050505015801561185d573d6000803e3d6000fd5b505b505050565b61186c6125ee565b73ffffffffffffffffffffffffffffffffffffffff1661188a61091d565b73ffffffffffffffffffffffffffffffffffffffff16146118e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d7906142df565b60405180910390fd5b8060088190555050565b6060600180546118f99061473b565b80601f01602080910402602001604051908101604052809291908181526020018280546119259061473b565b80156119725780601f1061194757610100808354040283529160200191611972565b820191906000526020600020905b81548152906001019060200180831161195557829003601f168201915b5050505050905090565b6000600854905090565b61198e6125ee565b73ffffffffffffffffffffffffffffffffffffffff166119ac61091d565b73ffffffffffffffffffffffffffffffffffffffff1614611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f9906142df565b60405180910390fd5b80600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b611a526125ee565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ac0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab79061417f565b60405180910390fd5b8060056000611acd6125ee565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611b7a6125ee565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611bbf9190614082565b60405180910390a35050565b60006002811115611c05577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600a60009054906101000a900460ff166002811115611c4d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415611c8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c859061425f565b60405180910390fd5b600854341015611cd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cca9061439f565b60405180910390fd5b600954611ce0600c6126af565b10611d20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d17906143bf565b60405180910390fd5b60016002811115611d5a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600a60009054906101000a900460ff166002811115611da2577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415611df157611db133610e90565b611df0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de7906141bf565b60405180910390fd5b5b6000611dfd600c6126af565b9050611e09600c6126bd565b611e1333826126d3565b60016002811115611e4d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600a60009054906101000a900460ff166002811115611e95577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415611ef3576001600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611eeb9190614644565b925050819055505b6000611efd61091d565b73ffffffffffffffffffffffffffffffffffffffff166108fc6008549081150290604051600060405180830381858888f19350505050905080611f75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6c9061413f565b60405180910390fd5b600060085434611f859190614644565b1115611fe0573373ffffffffffffffffffffffffffffffffffffffff166108fc60085434611fb39190614644565b9081150290604051600060405180830381858888f19350505050158015611fde573d6000803e3d6000fd5b505b5050565b611ff5611fef6125ee565b836126f1565b612034576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202b9061437f565b60405180910390fd5b61204084848484612af1565b50505050565b6000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606061209a82612582565b6120d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d09061431f565b60405180910390fd5b60006120e3612b4d565b90506000815111612103576040518060200160405280600081525061212e565b8061210d8461236b565b60405160200161211e929190613fb3565b6040516020818303038152906040525b915050919050565b60006121406125ee565b73ffffffffffffffffffffffffffffffffffffffff1661215e61091d565b73ffffffffffffffffffffffffffffffffffffffff16146121b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ab906142df565b60405180910390fd5b60006121c0600c6126af565b90506121cc600c6126bd565b6121d683826126d3565b80915050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61227b6125ee565b73ffffffffffffffffffffffffffffffffffffffff1661229961091d565b73ffffffffffffffffffffffffffffffffffffffff16146122ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122e6906142df565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561235f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612356906140df565b60405180910390fd5b61236881612a2b565b50565b606060008214156123b3576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612513565b600082905060005b600082146123e55780806123ce9061476d565b915050600a826123de91906145b9565b91506123bb565b60008167ffffffffffffffff811115612427577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156124595781602001600182028036833780820191505090505b5090505b6000851461250c576001826124729190614644565b9150600a8561248191906147b6565b603061248d9190614563565b60f81b8183815181106124c9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561250591906145b9565b945061245d565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612669836111af565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600081600001549050919050565b6001816000016000828254019250508190555050565b6126ed828260405180602001604052806000815250612b75565b5050565b60006126fc82612582565b61273b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127329061419f565b60405180910390fd5b6000612746836111af565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806127b557508373ffffffffffffffffffffffffffffffffffffffff1661279d84610ac1565b73ffffffffffffffffffffffffffffffffffffffff16145b806127c657506127c581856121df565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166127ef826111af565b73ffffffffffffffffffffffffffffffffffffffff1614612845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283c906142ff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156128b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128ac9061415f565b60405180910390fd5b6128c0838383612bd0565b6128cb6000826125f6565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461291b9190614644565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546129729190614563565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612afc8484846127cf565b612b0884848484612bd5565b612b47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b3e906140bf565b60405180910390fd5b50505050565b60606007604051602001612b619190613fd7565b604051602081830303815290604052905090565b612b7f8383612d6c565b612b8c6000848484612bd5565b612bcb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bc2906140bf565b60405180910390fd5b505050565b505050565b6000612bf68473ffffffffffffffffffffffffffffffffffffffff16612f3a565b15612d5f578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612c1f6125ee565b8786866040518563ffffffff1660e01b8152600401612c419493929190614014565b602060405180830381600087803b158015612c5b57600080fd5b505af1925050508015612c8c57506040513d601f19601f82011682018060405250810190612c8991906133f8565b60015b612d0f573d8060008114612cbc576040519150601f19603f3d011682016040523d82523d6000602084013e612cc1565b606091505b50600081511415612d07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cfe906140bf565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612d64565b600190505b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612ddc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dd39061427f565b60405180910390fd5b612de581612582565b15612e25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e1c906140ff565b60405180910390fd5b612e3160008383612bd0565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612e819190614563565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b828054612f599061473b565b90600052602060002090601f016020900481019282612f7b5760008555612fc2565b82601f10612f9457805160ff1916838001178555612fc2565b82800160010185558215612fc2579182015b82811115612fc1578251825591602001919060010190612fa6565b5b509050612fcf9190612fd3565b5090565b5b80821115612fec576000816000905550600101612fd4565b5090565b6000613003612ffe84614446565b614415565b9050808382526020820190508285602086028201111561302257600080fd5b60005b85811015613052578161303888826130d8565b845260208401935060208301925050600181019050613025565b5050509392505050565b600061306f61306a84614472565b614415565b90508281526020810184848401111561308757600080fd5b6130928482856146f9565b509392505050565b60006130ad6130a8846144a2565b614415565b9050828152602081018484840111156130c557600080fd5b6130d08482856146f9565b509392505050565b6000813590506130e7816148b4565b92915050565b600082601f8301126130fe57600080fd5b813561310e848260208601612ff0565b91505092915050565b600081359050613126816148cb565b92915050565b60008135905061313b816148e2565b92915050565b600081519050613150816148e2565b92915050565b600082601f83011261316757600080fd5b813561317784826020860161305c565b91505092915050565b600082601f83011261319157600080fd5b81356131a184826020860161309a565b91505092915050565b6000813590506131b9816148f9565b92915050565b6000813590506131ce81614910565b92915050565b6000602082840312156131e657600080fd5b60006131f4848285016130d8565b91505092915050565b6000806040838503121561321057600080fd5b600061321e858286016130d8565b925050602061322f858286016130d8565b9150509250929050565b60008060006060848603121561324e57600080fd5b600061325c868287016130d8565b935050602061326d868287016130d8565b925050604061327e868287016131aa565b9150509250925092565b6000806000806080858703121561329e57600080fd5b60006132ac878288016130d8565b94505060206132bd878288016130d8565b93505060406132ce878288016131aa565b925050606085013567ffffffffffffffff8111156132eb57600080fd5b6132f787828801613156565b91505092959194509250565b6000806040838503121561331657600080fd5b6000613324858286016130d8565b925050602061333585828601613117565b9150509250929050565b6000806040838503121561335257600080fd5b6000613360858286016130d8565b9250506020613371858286016131aa565b9150509250929050565b6000806040838503121561338e57600080fd5b600083013567ffffffffffffffff8111156133a857600080fd5b6133b4858286016130ed565b92505060206133c5858286016131aa565b9150509250929050565b6000602082840312156133e157600080fd5b60006133ef8482850161312c565b91505092915050565b60006020828403121561340a57600080fd5b600061341884828501613141565b91505092915050565b60006020828403121561343357600080fd5b600082013567ffffffffffffffff81111561344d57600080fd5b61345984828501613180565b91505092915050565b60006020828403121561347457600080fd5b6000613482848285016131aa565b91505092915050565b6000806040838503121561349e57600080fd5b60006134ac858286016131aa565b92505060206134bd858286016130d8565b9150509250929050565b6000602082840312156134d957600080fd5b60006134e7848285016131bf565b91505092915050565b60006134fc8383613f86565b60208301905092915050565b61351181614678565b82525050565b6000613522826144f7565b61352c8185614525565b9350613537836144d2565b8060005b8381101561356857815161354f88826134f0565b975061355a83614518565b92505060018101905061353b565b5085935050505092915050565b61357e8161468a565b82525050565b600061358f82614502565b6135998185614536565b93506135a9818560208601614708565b6135b2816148a3565b840191505092915050565b60006135c88261450d565b6135d28185614547565b93506135e2818560208601614708565b6135eb816148a3565b840191505092915050565b60006136018261450d565b61360b8185614558565b935061361b818560208601614708565b80840191505092915050565b600081546136348161473b565b61363e8186614558565b94506001821660008114613659576001811461366a5761369d565b60ff1983168652818601935061369d565b613673856144e2565b60005b8381101561369557815481890152600182019150602081019050613676565b838801955050505b50505092915050565b60006136b3603283614547565b91507f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008301527f63656976657220696d706c656d656e74657200000000000000000000000000006020830152604082019050919050565b6000613719602683614547565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061377f600783614558565b91507f2f746f6b656e2d000000000000000000000000000000000000000000000000006000830152600782019050919050565b60006137bf601c83614547565b91507f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006000830152602082019050919050565b60006137ff601e83614547565b91507f496e73756666696369656e7420696e7075742062616c616e63652028302900006000830152602082019050919050565b600061383f601483614547565b91507f4661696c656420746f2073656e642045746865720000000000000000000000006000830152602082019050919050565b600061387f602483614547565b91507f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006138e5601983614547565b91507f4552433732313a20617070726f766520746f2063616c6c6572000000000000006000830152602082019050919050565b6000613925602c83614547565b91507f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b600061398b602383614547565b91507f4e6f20746f6b656e7320726573657276656420666f7220796f7572206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006139f1603883614547565b91507f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008301527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006020830152604082019050919050565b6000613a57600e83614547565b91507f4e6f7420696e2070726573616c650000000000000000000000000000000000006000830152602082019050919050565b6000613a97602a83614547565b91507f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008301527f726f2061646472657373000000000000000000000000000000000000000000006020830152604082019050919050565b6000613afd602983614547565b91507f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008301527f656e7420746f6b656e00000000000000000000000000000000000000000000006020830152604082019050919050565b6000613b63601083614547565b91507f53616c65732061726520636c6f736564000000000000000000000000000000006000830152602082019050919050565b6000613ba3602083614547565b91507f4552433732313a206d696e7420746f20746865207a65726f20616464726573736000830152602082019050919050565b6000613be3602d83614547565b91507f496e73756666696369656e7420726573657276656420746f6b656e7320666f7260008301527f20796f75722061646472657373000000000000000000000000000000000000006020830152604082019050919050565b6000613c49602c83614547565b91507f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b6000613caf602083614547565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000613cef602983614547565b91507f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008301527f73206e6f74206f776e00000000000000000000000000000000000000000000006020830152604082019050919050565b6000613d55602f83614547565b91507f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008301527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006020830152604082019050919050565b6000613dbb602c83614547565b91507f546f6b656e20737570706c7920696e737566666963656e7420666f722074686560008301527f20676976656e20636f756e7400000000000000000000000000000000000000006020830152604082019050919050565b6000613e21602183614547565b91507f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008301527f72000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613e87603183614547565b91507f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008301527f776e6572206e6f7220617070726f7665640000000000000000000000000000006020830152604082019050919050565b6000613eed602b83614547565b91507f496e73756666696369656e7420696e7075742062616c616e63652c206d75737460008301527f206265203e2070726963650000000000000000000000000000000000000000006020830152604082019050919050565b6000613f53601a83614547565b91507f546f6b656e20737570706c79206c696d697420726561636865640000000000006000830152602082019050919050565b613f8f816146e2565b82525050565b613f9e816146e2565b82525050565b613fad816146ec565b82525050565b6000613fbf82856135f6565b9150613fcb82846135f6565b91508190509392505050565b6000613fe38284613627565b9150613fee82613772565b915081905092915050565b600060208201905061400e6000830184613508565b92915050565b60006080820190506140296000830187613508565b6140366020830186613508565b6140436040830185613f95565b81810360608301526140558184613584565b905095945050505050565b6000602082019050818103600083015261407a8184613517565b905092915050565b60006020820190506140976000830184613575565b92915050565b600060208201905081810360008301526140b781846135bd565b905092915050565b600060208201905081810360008301526140d8816136a6565b9050919050565b600060208201905081810360008301526140f88161370c565b9050919050565b60006020820190508181036000830152614118816137b2565b9050919050565b60006020820190508181036000830152614138816137f2565b9050919050565b6000602082019050818103600083015261415881613832565b9050919050565b6000602082019050818103600083015261417881613872565b9050919050565b60006020820190508181036000830152614198816138d8565b9050919050565b600060208201905081810360008301526141b881613918565b9050919050565b600060208201905081810360008301526141d88161397e565b9050919050565b600060208201905081810360008301526141f8816139e4565b9050919050565b6000602082019050818103600083015261421881613a4a565b9050919050565b6000602082019050818103600083015261423881613a8a565b9050919050565b6000602082019050818103600083015261425881613af0565b9050919050565b6000602082019050818103600083015261427881613b56565b9050919050565b6000602082019050818103600083015261429881613b96565b9050919050565b600060208201905081810360008301526142b881613bd6565b9050919050565b600060208201905081810360008301526142d881613c3c565b9050919050565b600060208201905081810360008301526142f881613ca2565b9050919050565b6000602082019050818103600083015261431881613ce2565b9050919050565b6000602082019050818103600083015261433881613d48565b9050919050565b6000602082019050818103600083015261435881613dae565b9050919050565b6000602082019050818103600083015261437881613e14565b9050919050565b6000602082019050818103600083015261439881613e7a565b9050919050565b600060208201905081810360008301526143b881613ee0565b9050919050565b600060208201905081810360008301526143d881613f46565b9050919050565b60006020820190506143f46000830184613f95565b92915050565b600060208201905061440f6000830184613fa4565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561443c5761443b614874565b5b8060405250919050565b600067ffffffffffffffff82111561446157614460614874565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561448d5761448c614874565b5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff8211156144bd576144bc614874565b5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600061456e826146e2565b9150614579836146e2565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156145ae576145ad6147e7565b5b828201905092915050565b60006145c4826146e2565b91506145cf836146e2565b9250826145df576145de614816565b5b828204905092915050565b60006145f5826146e2565b9150614600836146e2565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614639576146386147e7565b5b828202905092915050565b600061464f826146e2565b915061465a836146e2565b92508282101561466d5761466c6147e7565b5b828203905092915050565b6000614683826146c2565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b8381101561472657808201518184015260208101905061470b565b83811115614735576000848401525b50505050565b6000600282049050600182168061475357607f821691505b6020821081141561476757614766614845565b5b50919050565b6000614778826146e2565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156147ab576147aa6147e7565b5b600182019050919050565b60006147c1826146e2565b91506147cc836146e2565b9250826147dc576147db614816565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6148bd81614678565b81146148c857600080fd5b50565b6148d48161468a565b81146148df57600080fd5b50565b6148eb81614696565b81146148f657600080fd5b50565b614902816146e2565b811461490d57600080fd5b50565b614919816146ec565b811461492457600080fd5b5056fea2646970667358221220e252a76f9e47a98b99bac224dbf8de87e2850adf67ce02bf3393c33d0929e98b64736f6c63430008000033

Verified Source Code Partial Match

Compiler: v0.8.0+commit.c7dfd78e EVM: istanbul Optimization: No
Entrope.sol 208 lines
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract Entrope is ERC721, Ownable {
    string public _base;

    // Token price
    uint256 public tokenPrice = 2e7 gwei;

    // Token supply
    uint256 public supply = 2358;

    // Minting sale state
    enum SaleState {
        CLOSED,
        PRESALE,
        OPEN
    }
    SaleState saleState = SaleState.CLOSED;

    // Whitelist token allowances
    mapping(address => uint256) presaleAllowance;

    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor(uint256 _projectId) ERC721("Entrope", "*") {
        _base = string(
            abi.encodePacked(
                "http://host.entropes.xyz/project/",
                Strings.toString(_projectId)
            )
        );
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return string(abi.encodePacked(_base, "/token-"));
    }

    function setBaseURI(string memory _uri) public onlyOwner {
        _base = _uri;
    }

    function setPresaleAllowance(address _to, uint256 _allowance)
        public
        onlyOwner
    {
        presaleAllowance[_to] = _allowance;
    }

    function setPresaleAllowances(address[] memory _to, uint256 _allowance)
        public
        onlyOwner
    {
        for (uint256 i = 0; i < _to.length; i++) {
            presaleAllowance[_to[i]] = _allowance;
        }
    }

    function getPresaleAllowance(address _to) public view returns (uint256) {
        return presaleAllowance[_to];
    }

    function isWhitelisted(address _account) public view returns (bool) {
        return presaleAllowance[_account] > 0;
    }

    function isWhitelisted(address _account, uint256 _count)
        public
        view
        returns (bool)
    {
        return presaleAllowance[_account] >= _count;
    }

    /**
     * @dev Sets sale state to CLOSED (0), PRESALE (1), or OPEN (2).
     */
    function setSaleState(uint8 _state) public onlyOwner {
        saleState = SaleState(_state);
    }

    function getSaleState() public view returns (uint8) {
        return uint8(saleState);
    }

    function setPrice(uint256 _price) public onlyOwner {
        tokenPrice = _price;
    }

    function getPrice() public view returns (uint256) {
        return tokenPrice;
    }

    function getTokenCount() public view returns (uint256) {
        return _tokenIds.current();
    }

    function getSupply() public view returns (uint256) {
        return supply;
    }

    function setSupply(uint256 _supply) public onlyOwner {
        supply = _supply;
    }

    /**
     * @dev Mints a token to `to`.
     */
    function awardToken(address _to) public onlyOwner returns (uint256) {
        uint256 newItemId = _tokenIds.current();
        _tokenIds.increment();
        _safeMint(_to, newItemId);
        return newItemId;
    }

    /**
     * @dev Mints `_count` tokens to `_to`.
     */
    function awardTokens(uint256 _count, address _to)
        public
        onlyOwner
        returns (uint256[] memory)
    {
        uint256[] memory ids = new uint256[](_count);
        for (uint256 i = 0; i < _count; i++) {
            uint256 newItemId = _tokenIds.current();
            _tokenIds.increment();
            _safeMint(_to, newItemId);
            ids[i] = newItemId;
        }
        return ids;
    }

    /**
     * @dev Mints reserved tokens to msg.sender during presale.
     */
    function buyPresaleTokens(uint256 _count) public payable {
        require(saleState == SaleState.PRESALE, "Not in presale");
        uint256 totalPrice = tokenPrice * _count;
        require(
            msg.value >= totalPrice,
            "Insufficient input balance, must be > price"
        );
        require(
            _tokenIds.current() < supply,
            "Token supply insufficent for the given count"
        );
        require(
            isWhitelisted(msg.sender, _count),
            "Insufficient reserved tokens for your address"
        );
        for (uint256 i = 0; i < _count; i++) {
            uint256 newItemId = _tokenIds.current();
            _tokenIds.increment();
            _safeMint(msg.sender, newItemId);
        }
        presaleAllowance[msg.sender] -= _count;

        // reconcile payments
        bool sent = payable(owner()).send(totalPrice);
        require(sent, "Failed to send Ether");
        if (msg.value - totalPrice > 0) {
            payable(msg.sender).transfer(msg.value - totalPrice);
        }
    }

    /**
     * @dev Mints a token to msg.sender during open sale.
     */
    function buyToken() public payable {
        require(saleState != SaleState.CLOSED, "Sales are closed");
        require(
            msg.value >= tokenPrice,
            "Insufficient input balance, must be > price"
        );
        require(_tokenIds.current() < supply, "Token supply limit reached");
        if (saleState == SaleState.PRESALE) {
            require(
                isWhitelisted(msg.sender),
                "No tokens reserved for your address"
            );
        }

        uint256 newItemId = _tokenIds.current();
        _tokenIds.increment();
        _safeMint(msg.sender, newItemId);
        if (saleState == SaleState.PRESALE) {
            presaleAllowance[msg.sender] -= 1;
        }

        // Reconcile payments
        bool sent = payable(owner()).send(tokenPrice);
        require(sent, "Failed to send Ether");
        if (msg.value - tokenPrice > 0) {
            payable(msg.sender).transfer(msg.value - tokenPrice);
        }
    }

    fallback() external payable {
        require(msg.value > 0, "Insufficient input balance (0)");
        payable(owner()).transfer(msg.value);
    }
}
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;
    }
}
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);
    }
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _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);
    }
}
Counters.sol 42 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/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 {}
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, 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;
}
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;
    }
}
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);
}
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);
}
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);
}

Read Contract

_base 0x3ce68dd5 → string
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
getPresaleAllowance 0xc313b339 → uint256
getPrice 0x98d5fdca → uint256
getSaleState 0x25bdb2a8 → uint8
getSupply 0x6c9c2faf → uint256
getTokenCount 0x78a89567 → uint256
isApprovedForAll 0xe985e9c5 → bool
isWhitelisted 0x3af32abf → bool
isWhitelisted 0x830639ac → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supply 0x047fc9aa → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenPrice 0x7ff9b596 → uint256
tokenURI 0xc87b56dd → string

Write Contract 17 functions

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

approve 0x095ea7b3
address to
uint256 tokenId
awardToken 0xdba98e5b
address _to
returns: uint256
awardTokens 0x16a1abb4
uint256 _count
address _to
returns: uint256[]
buyPresaleTokens 0x83b2d174
uint256 _count
buyToken 0xa4821719
No parameters
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _uri
setPresaleAllowance 0xa152e361
address _to
uint256 _allowance
setPresaleAllowances 0x80a9dc0f
address[] _to
uint256 _allowance
setPrice 0x91b7f5ed
uint256 _price
setSaleState 0x5a67de07
uint8 _state
setSupply 0x3b4c4b25
uint256 _supply
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address