Address Contract Partially Verified
Address
0xCc15b249f8aC06b4A56dEB5627afcef061dF45A4
Balance
0.010000 ETH
Nonce
1
Code Size
20334 bytes
Creator
0xEFd5EFe3...A41A at tx 0xdb4e13de...1b8fa6
Indexed Transactions
0
Contract Bytecode
20334 bytes
0x6080604052600436106102675760003560e01c80636c0360eb11610144578063ba4e5c49116100b6578063d5abeb011161007a578063d5abeb0114610914578063da3ef23f1461093f578063e985e9c514610968578063edec5f27146109a5578063f2c4ce1e146109ce578063f2fde38b146109f757610267565b8063ba4e5c491461081b578063ba7d2c7614610858578063c668286214610883578063c87b56dd146108ae578063d0eb26b0146108eb57610267565b806395d89b411161010857806395d89b41146107405780639c70b5121461076b578063a0712d6814610796578063a22cb465146107b2578063a475b5dd146107db578063b88d4fde146107f257610267565b80636c0360eb1461066d57806370a0823114610698578063715018a6146106d55780637f00c7a6146106ec5780638da5cb5b1461071557610267565b80633af32abf116101dd57806344a0d68a116101a157806344a0d68a1461054b5780634f6ccce71461057457806351830227146105b157806355f804b3146105dc5780635c975abb146106055780636352211e1461063057610267565b80633af32abf146104755780633c952764146104b25780633ccfd60b146104db57806342842e0e146104e5578063438b63001461050e57610267565b8063095ea7b31161022f578063095ea7b31461036557806313faede61461038e57806318160ddd146103b9578063239c70ae146103e457806323b872dd1461040f5780632f745c591461043857610267565b806301ffc9a71461026c57806302329a29146102a957806306fdde03146102d2578063081812fc146102fd578063081c8c441461033a575b600080fd5b34801561027857600080fd5b50610293600480360381019061028e919061390b565b610a20565b6040516102a09190613fe9565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb91906138de565b610a9a565b005b3480156102de57600080fd5b506102e7610b33565b6040516102f49190614004565b60405180910390f35b34801561030957600080fd5b50610324600480360381019061031f91906139ae565b610bc5565b6040516103319190613f60565b60405180910390f35b34801561034657600080fd5b5061034f610c4a565b60405161035c9190614004565b60405180910390f35b34801561037157600080fd5b5061038c60048036038101906103879190613851565b610cd8565b005b34801561039a57600080fd5b506103a3610df0565b6040516103b09190614326565b60405180910390f35b3480156103c557600080fd5b506103ce610df6565b6040516103db9190614326565b60405180910390f35b3480156103f057600080fd5b506103f9610e03565b6040516104069190614326565b60405180910390f35b34801561041b57600080fd5b506104366004803603810190610431919061373b565b610e09565b005b34801561044457600080fd5b5061045f600480360381019061045a9190613851565b610e69565b60405161046c9190614326565b60405180910390f35b34801561048157600080fd5b5061049c600480360381019061049791906136ce565b610f0e565b6040516104a99190613fe9565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d491906138de565b610fbd565b005b6104e3611056565b005b3480156104f157600080fd5b5061050c6004803603810190610507919061373b565b611152565b005b34801561051a57600080fd5b50610535600480360381019061053091906136ce565b611172565b6040516105429190613fc7565b60405180910390f35b34801561055757600080fd5b50610572600480360381019061056d91906139ae565b611220565b005b34801561058057600080fd5b5061059b600480360381019061059691906139ae565b6112a6565b6040516105a89190614326565b60405180910390f35b3480156105bd57600080fd5b506105c6611317565b6040516105d39190613fe9565b60405180910390f35b3480156105e857600080fd5b5061060360048036038101906105fe9190613965565b61132a565b005b34801561061157600080fd5b5061061a6113c0565b6040516106279190613fe9565b60405180910390f35b34801561063c57600080fd5b50610657600480360381019061065291906139ae565b6113d3565b6040516106649190613f60565b60405180910390f35b34801561067957600080fd5b50610682611485565b60405161068f9190614004565b60405180910390f35b3480156106a457600080fd5b506106bf60048036038101906106ba91906136ce565b611513565b6040516106cc9190614326565b60405180910390f35b3480156106e157600080fd5b506106ea6115cb565b005b3480156106f857600080fd5b50610713600480360381019061070e91906139ae565b611653565b005b34801561072157600080fd5b5061072a6116d9565b6040516107379190613f60565b60405180910390f35b34801561074c57600080fd5b50610755611703565b6040516107629190614004565b60405180910390f35b34801561077757600080fd5b50610780611795565b60405161078d9190613fe9565b60405180910390f35b6107b060048036038101906107ab91906139ae565b6117a8565b005b3480156107be57600080fd5b506107d960048036038101906107d49190613811565b611a39565b005b3480156107e757600080fd5b506107f0611a4f565b005b3480156107fe57600080fd5b506108196004803603810190610814919061378e565b611ae8565b005b34801561082757600080fd5b50610842600480360381019061083d91906139ae565b611b4a565b60405161084f9190613f60565b60405180910390f35b34801561086457600080fd5b5061086d611b89565b60405161087a9190614326565b60405180910390f35b34801561088f57600080fd5b50610898611b8f565b6040516108a59190614004565b60405180910390f35b3480156108ba57600080fd5b506108d560048036038101906108d091906139ae565b611c1d565b6040516108e29190614004565b60405180910390f35b3480156108f757600080fd5b50610912600480360381019061090d91906139ae565b611d76565b005b34801561092057600080fd5b50610929611dfc565b6040516109369190614326565b60405180910390f35b34801561094b57600080fd5b5061096660048036038101906109619190613965565b611e02565b005b34801561097457600080fd5b5061098f600480360381019061098a91906136fb565b611e98565b60405161099c9190613fe9565b60405180910390f35b3480156109b157600080fd5b506109cc60048036038101906109c79190613891565b611f2c565b005b3480156109da57600080fd5b506109f560048036038101906109f09190613965565b611fcc565b005b348015610a0357600080fd5b50610a1e6004803603810190610a1991906136ce565b612062565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610a935750610a9282612182565b5b9050919050565b610aa2612264565b73ffffffffffffffffffffffffffffffffffffffff16610ac06116d9565b73ffffffffffffffffffffffffffffffffffffffff1614610b16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0d90614226565b60405180910390fd5b80601260006101000a81548160ff02191690831515021790555050565b606060008054610b429061462f565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6e9061462f565b8015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b820191906000526020600020905b815481529060010190602001808311610b9e57829003601f168201915b5050505050905090565b6000610bd08261226c565b610c0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0690614206565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600d8054610c579061462f565b80601f0160208091040260200160405190810160405280929190818152602001828054610c839061462f565b8015610cd05780601f10610ca557610100808354040283529160200191610cd0565b820191906000526020600020905b815481529060010190602001808311610cb357829003601f168201915b505050505081565b6000610ce3826113d3565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4b90614266565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610d73612264565b73ffffffffffffffffffffffffffffffffffffffff161480610da25750610da181610d9c612264565b611e98565b5b610de1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd890614186565b60405180910390fd5b610deb83836122d8565b505050565b600e5481565b6000600880549050905090565b60105481565b610e1a610e14612264565b82612391565b610e59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5090614286565b60405180910390fd5b610e6483838361246f565b505050565b6000610e7483611513565b8210610eb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eac90614026565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b600080600090505b601380549050811015610fb2578273ffffffffffffffffffffffffffffffffffffffff1660138281548110610f4e57610f4d6147c8565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610f9f576001915050610fb8565b8080610faa90614692565b915050610f16565b50600090505b919050565b610fc5612264565b73ffffffffffffffffffffffffffffffffffffffff16610fe36116d9565b73ffffffffffffffffffffffffffffffffffffffff1614611039576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103090614226565b60405180910390fd5b80601260026101000a81548160ff02191690831515021790555050565b61105e612264565b73ffffffffffffffffffffffffffffffffffffffff1661107c6116d9565b73ffffffffffffffffffffffffffffffffffffffff16146110d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c990614226565b60405180910390fd5b60006110dc6116d9565b73ffffffffffffffffffffffffffffffffffffffff16476040516110ff90613f4b565b60006040518083038185875af1925050503d806000811461113c576040519150601f19603f3d011682016040523d82523d6000602084013e611141565b606091505b505090508061114f57600080fd5b50565b61116d83838360405180602001604052806000815250611ae8565b505050565b6060600061117f83611513565b905060008167ffffffffffffffff81111561119d5761119c6147f7565b5b6040519080825280602002602001820160405280156111cb5781602001602082028036833780820191505090505b50905060005b82811015611215576111e38582610e69565b8282815181106111f6576111f56147c8565b5b602002602001018181525050808061120d90614692565b9150506111d1565b508092505050919050565b611228612264565b73ffffffffffffffffffffffffffffffffffffffff166112466116d9565b73ffffffffffffffffffffffffffffffffffffffff161461129c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129390614226565b60405180910390fd5b80600e8190555050565b60006112b0610df6565b82106112f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e8906142a6565b60405180910390fd5b60088281548110611305576113046147c8565b5b90600052602060002001549050919050565b601260019054906101000a900460ff1681565b611332612264565b73ffffffffffffffffffffffffffffffffffffffff166113506116d9565b73ffffffffffffffffffffffffffffffffffffffff16146113a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139d90614226565b60405180910390fd5b80600b90805190602001906113bc9291906133cb565b5050565b601260009054906101000a900460ff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561147c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611473906141c6565b60405180910390fd5b80915050919050565b600b80546114929061462f565b80601f01602080910402602001604051908101604052809291908181526020018280546114be9061462f565b801561150b5780601f106114e05761010080835404028352916020019161150b565b820191906000526020600020905b8154815290600101906020018083116114ee57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157b906141a6565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6115d3612264565b73ffffffffffffffffffffffffffffffffffffffff166115f16116d9565b73ffffffffffffffffffffffffffffffffffffffff1614611647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163e90614226565b60405180910390fd5b61165160006126d6565b565b61165b612264565b73ffffffffffffffffffffffffffffffffffffffff166116796116d9565b73ffffffffffffffffffffffffffffffffffffffff16146116cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c690614226565b60405180910390fd5b8060108190555050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546117129061462f565b80601f016020809104026020016040519081016040528092919081815260200182805461173e9061462f565b801561178b5780601f106117605761010080835404028352916020019161178b565b820191906000526020600020905b81548152906001019060200180831161176e57829003601f168201915b5050505050905090565b601260029054906101000a900460ff1681565b601260009054906101000a900460ff16156117f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ef906140c6565b60405180910390fd5b6000611802610df6565b90506000821161181157600080fd5b601054821115611856576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184d906142e6565b60405180910390fd5b600f5482826118659190614464565b11156118a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189d90614306565b60405180910390fd5b6118ae6116d9565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146119fe5760011515601260029054906101000a900460ff16151514156119975761190533610f0e565b611944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193b90614166565b60405180910390fd5b600061194f33611513565b90506011548110611995576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198c90614146565b60405180910390fd5b505b6011546119a333611513565b106119e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119da906142c6565b60405180910390fd5b81600e546119f191906144eb565b3410156119fd57600080fd5b5b6000600190505b828111611a3457611a21338284611a1c9190614464565b61279c565b8080611a2c90614692565b915050611a05565b505050565b611a4b611a44612264565b83836127ba565b5050565b611a57612264565b73ffffffffffffffffffffffffffffffffffffffff16611a756116d9565b73ffffffffffffffffffffffffffffffffffffffff1614611acb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac290614226565b60405180910390fd5b6001601260016101000a81548160ff021916908315150217905550565b611af9611af3612264565b83612391565b611b38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2f90614286565b60405180910390fd5b611b4484848484612927565b50505050565b60138181548110611b5a57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60115481565b600c8054611b9c9061462f565b80601f0160208091040260200160405190810160405280929190818152602001828054611bc89061462f565b8015611c155780601f10611bea57610100808354040283529160200191611c15565b820191906000526020600020905b815481529060010190602001808311611bf857829003601f168201915b505050505081565b6060611c288261226c565b611c67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c5e90614246565b60405180910390fd5b60001515601260019054906101000a900460ff1615151415611d1557600d8054611c909061462f565b80601f0160208091040260200160405190810160405280929190818152602001828054611cbc9061462f565b8015611d095780601f10611cde57610100808354040283529160200191611d09565b820191906000526020600020905b815481529060010190602001808311611cec57829003601f168201915b50505050509050611d71565b6000611d1f612983565b90506000815111611d3f5760405180602001604052806000815250611d6d565b80611d4984612a15565b600c604051602001611d5d93929190613f1a565b6040516020818303038152906040525b9150505b919050565b611d7e612264565b73ffffffffffffffffffffffffffffffffffffffff16611d9c6116d9565b73ffffffffffffffffffffffffffffffffffffffff1614611df2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de990614226565b60405180910390fd5b8060118190555050565b600f5481565b611e0a612264565b73ffffffffffffffffffffffffffffffffffffffff16611e286116d9565b73ffffffffffffffffffffffffffffffffffffffff1614611e7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7590614226565b60405180910390fd5b80600c9080519060200190611e949291906133cb565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611f34612264565b73ffffffffffffffffffffffffffffffffffffffff16611f526116d9565b73ffffffffffffffffffffffffffffffffffffffff1614611fa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f9f90614226565b60405180910390fd5b60136000611fb69190613451565b818160139190611fc7929190613472565b505050565b611fd4612264565b73ffffffffffffffffffffffffffffffffffffffff16611ff26116d9565b73ffffffffffffffffffffffffffffffffffffffff1614612048576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203f90614226565b60405180910390fd5b80600d908051906020019061205e9291906133cb565b5050565b61206a612264565b73ffffffffffffffffffffffffffffffffffffffff166120886116d9565b73ffffffffffffffffffffffffffffffffffffffff16146120de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d590614226565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561214e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214590614066565b60405180910390fd5b612157816126d6565b50565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b505050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061224d57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061225d575061225c82612b76565b5b9050919050565b600033905090565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661234b836113d3565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061239c8261226c565b6123db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d290614126565b60405180910390fd5b60006123e6836113d3565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061242857506124278185611e98565b5b8061246657508373ffffffffffffffffffffffffffffffffffffffff1661244e84610bc5565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661248f826113d3565b73ffffffffffffffffffffffffffffffffffffffff16146124e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124dc90614086565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254c906140e6565b60405180910390fd5b612560838383612be0565b61256b6000826122d8565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546125bb9190614545565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546126129190614464565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46126d1838383612cf4565b505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6127b6828260405180602001604052806000815250612cf9565b5050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612829576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161282090614106565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161291a9190613fe9565b60405180910390a3505050565b61293284848461246f565b61293e84848484612d54565b61297d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161297490614046565b60405180910390fd5b50505050565b6060600b80546129929061462f565b80601f01602080910402602001604051908101604052809291908181526020018280546129be9061462f565b8015612a0b5780601f106129e057610100808354040283529160200191612a0b565b820191906000526020600020905b8154815290600101906020018083116129ee57829003601f168201915b5050505050905090565b60606000821415612a5d576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612b71565b600082905060005b60008214612a8f578080612a7890614692565b915050600a82612a8891906144ba565b9150612a65565b60008167ffffffffffffffff811115612aab57612aaa6147f7565b5b6040519080825280601f01601f191660200182016040528015612add5781602001600182028036833780820191505090505b5090505b60008514612b6a57600182612af69190614545565b9150600a85612b0591906146db565b6030612b119190614464565b60f81b818381518110612b2757612b266147c8565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612b6391906144ba565b9450612ae1565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612beb83838361217d565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612c2e57612c2981612eeb565b612c6d565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612c6c57612c6b8382612f34565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612cb057612cab816130a1565b612cef565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612cee57612ced8282613172565b5b5b505050565b505050565b612d0383836131f1565b612d106000848484612d54565b612d4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d4690614046565b60405180910390fd5b505050565b6000612d758473ffffffffffffffffffffffffffffffffffffffff1661215a565b15612ede578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612d9e612264565b8786866040518563ffffffff1660e01b8152600401612dc09493929190613f7b565b602060405180830381600087803b158015612dda57600080fd5b505af1925050508015612e0b57506040513d601f19601f82011682018060405250810190612e089190613938565b60015b612e8e573d8060008114612e3b576040519150601f19603f3d011682016040523d82523d6000602084013e612e40565b606091505b50600081511415612e86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e7d90614046565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612ee3565b600190505b949350505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001612f4184611513565b612f4b9190614545565b9050600060076000848152602001908152602001600020549050818114613030576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b600060016008805490506130b59190614545565b90506000600960008481526020019081526020016000205490506000600883815481106130e5576130e46147c8565b5b906000526020600020015490508060088381548110613107576131066147c8565b5b90600052602060002001819055508160096000838152602001908152602001600020819055506009600085815260200190815260200160002060009055600880548061315657613155614799565b5b6001900381819060005260206000200160009055905550505050565b600061317d83611513565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613261576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613258906141e6565b60405180910390fd5b61326a8161226c565b156132aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132a1906140a6565b60405180910390fd5b6132b660008383612be0565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546133069190614464565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46133c760008383612cf4565b5050565b8280546133d79061462f565b90600052602060002090601f0160209004810192826133f95760008555613440565b82601f1061341257805160ff1916838001178555613440565b82800160010185558215613440579182015b8281111561343f578251825591602001919060010190613424565b5b50905061344d9190613512565b5090565b508054600082559060005260206000209081019061346f9190613512565b50565b828054828255906000526020600020908101928215613501579160200282015b8281111561350057823573ffffffffffffffffffffffffffffffffffffffff168260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190613492565b5b50905061350e9190613512565b5090565b5b8082111561352b576000816000905550600101613513565b5090565b600061354261353d84614366565b614341565b90508281526020810184848401111561355e5761355d614835565b5b6135698482856145ed565b509392505050565b600061358461357f84614397565b614341565b9050828152602081018484840111156135a05761359f614835565b5b6135ab8482856145ed565b509392505050565b6000813590506135c281614edc565b92915050565b60008083601f8401126135de576135dd61482b565b5b8235905067ffffffffffffffff8111156135fb576135fa614826565b5b60208301915083602082028301111561361757613616614830565b5b9250929050565b60008135905061362d81614ef3565b92915050565b60008135905061364281614f0a565b92915050565b60008151905061365781614f0a565b92915050565b600082601f8301126136725761367161482b565b5b813561368284826020860161352f565b91505092915050565b600082601f8301126136a05761369f61482b565b5b81356136b0848260208601613571565b91505092915050565b6000813590506136c881614f21565b92915050565b6000602082840312156136e4576136e361483f565b5b60006136f2848285016135b3565b91505092915050565b600080604083850312156137125761371161483f565b5b6000613720858286016135b3565b9250506020613731858286016135b3565b9150509250929050565b6000806000606084860312156137545761375361483f565b5b6000613762868287016135b3565b9350506020613773868287016135b3565b9250506040613784868287016136b9565b9150509250925092565b600080600080608085870312156137a8576137a761483f565b5b60006137b6878288016135b3565b94505060206137c7878288016135b3565b93505060406137d8878288016136b9565b925050606085013567ffffffffffffffff8111156137f9576137f861483a565b5b6138058782880161365d565b91505092959194509250565b600080604083850312156138285761382761483f565b5b6000613836858286016135b3565b92505060206138478582860161361e565b9150509250929050565b600080604083850312156138685761386761483f565b5b6000613876858286016135b3565b9250506020613887858286016136b9565b9150509250929050565b600080602083850312156138a8576138a761483f565b5b600083013567ffffffffffffffff8111156138c6576138c561483a565b5b6138d2858286016135c8565b92509250509250929050565b6000602082840312156138f4576138f361483f565b5b60006139028482850161361e565b91505092915050565b6000602082840312156139215761392061483f565b5b600061392f84828501613633565b91505092915050565b60006020828403121561394e5761394d61483f565b5b600061395c84828501613648565b91505092915050565b60006020828403121561397b5761397a61483f565b5b600082013567ffffffffffffffff8111156139995761399861483a565b5b6139a58482850161368b565b91505092915050565b6000602082840312156139c4576139c361483f565b5b60006139d2848285016136b9565b91505092915050565b60006139e78383613efc565b60208301905092915050565b6139fc81614579565b82525050565b6000613a0d826143ed565b613a17818561441b565b9350613a22836143c8565b8060005b83811015613a53578151613a3a88826139db565b9750613a458361440e565b925050600181019050613a26565b5085935050505092915050565b613a698161458b565b82525050565b6000613a7a826143f8565b613a84818561442c565b9350613a948185602086016145fc565b613a9d81614844565b840191505092915050565b6000613ab382614403565b613abd8185614448565b9350613acd8185602086016145fc565b613ad681614844565b840191505092915050565b6000613aec82614403565b613af68185614459565b9350613b068185602086016145fc565b80840191505092915050565b60008154613b1f8161462f565b613b298186614459565b94506001821660008114613b445760018114613b5557613b88565b60ff19831686528186019350613b88565b613b5e856143d8565b60005b83811015613b8057815481890152600182019150602081019050613b61565b838801955050505b50505092915050565b6000613b9e602b83614448565b9150613ba982614855565b604082019050919050565b6000613bc1603283614448565b9150613bcc826148a4565b604082019050919050565b6000613be4602683614448565b9150613bef826148f3565b604082019050919050565b6000613c07602583614448565b9150613c1282614942565b604082019050919050565b6000613c2a601c83614448565b9150613c3582614991565b602082019050919050565b6000613c4d601983614448565b9150613c58826149ba565b602082019050919050565b6000613c70602483614448565b9150613c7b826149e3565b604082019050919050565b6000613c93601983614448565b9150613c9e82614a32565b602082019050919050565b6000613cb6602c83614448565b9150613cc182614a5b565b604082019050919050565b6000613cd9604483614448565b9150613ce482614aaa565b606082019050919050565b6000613cfc601783614448565b9150613d0782614b1f565b602082019050919050565b6000613d1f603883614448565b9150613d2a82614b48565b604082019050919050565b6000613d42602a83614448565b9150613d4d82614b97565b604082019050919050565b6000613d65602983614448565b9150613d7082614be6565b604082019050919050565b6000613d88602083614448565b9150613d9382614c35565b602082019050919050565b6000613dab602c83614448565b9150613db682614c5e565b604082019050919050565b6000613dce602083614448565b9150613dd982614cad565b602082019050919050565b6000613df1602f83614448565b9150613dfc82614cd6565b604082019050919050565b6000613e14602183614448565b9150613e1f82614d25565b604082019050919050565b6000613e3760008361443d565b9150613e4282614d74565b600082019050919050565b6000613e5a603183614448565b9150613e6582614d77565b604082019050919050565b6000613e7d602c83614448565b9150613e8882614dc6565b604082019050919050565b6000613ea0602e83614448565b9150613eab82614e15565b604082019050919050565b6000613ec3602e83614448565b9150613ece82614e64565b604082019050919050565b6000613ee6600983614448565b9150613ef182614eb3565b602082019050919050565b613f05816145e3565b82525050565b613f14816145e3565b82525050565b6000613f268286613ae1565b9150613f328285613ae1565b9150613f3e8284613b12565b9150819050949350505050565b6000613f5682613e2a565b9150819050919050565b6000602082019050613f7560008301846139f3565b92915050565b6000608082019050613f9060008301876139f3565b613f9d60208301866139f3565b613faa6040830185613f0b565b8181036060830152613fbc8184613a6f565b905095945050505050565b60006020820190508181036000830152613fe18184613a02565b905092915050565b6000602082019050613ffe6000830184613a60565b92915050565b6000602082019050818103600083015261401e8184613aa8565b905092915050565b6000602082019050818103600083015261403f81613b91565b9050919050565b6000602082019050818103600083015261405f81613bb4565b9050919050565b6000602082019050818103600083015261407f81613bd7565b9050919050565b6000602082019050818103600083015261409f81613bfa565b9050919050565b600060208201905081810360008301526140bf81613c1d565b9050919050565b600060208201905081810360008301526140df81613c40565b9050919050565b600060208201905081810360008301526140ff81613c63565b9050919050565b6000602082019050818103600083015261411f81613c86565b9050919050565b6000602082019050818103600083015261413f81613ca9565b9050919050565b6000602082019050818103600083015261415f81613ccc565b9050919050565b6000602082019050818103600083015261417f81613cef565b9050919050565b6000602082019050818103600083015261419f81613d12565b9050919050565b600060208201905081810360008301526141bf81613d35565b9050919050565b600060208201905081810360008301526141df81613d58565b9050919050565b600060208201905081810360008301526141ff81613d7b565b9050919050565b6000602082019050818103600083015261421f81613d9e565b9050919050565b6000602082019050818103600083015261423f81613dc1565b9050919050565b6000602082019050818103600083015261425f81613de4565b9050919050565b6000602082019050818103600083015261427f81613e07565b9050919050565b6000602082019050818103600083015261429f81613e4d565b9050919050565b600060208201905081810360008301526142bf81613e70565b9050919050565b600060208201905081810360008301526142df81613e93565b9050919050565b600060208201905081810360008301526142ff81613eb6565b9050919050565b6000602082019050818103600083015261431f81613ed9565b9050919050565b600060208201905061433b6000830184613f0b565b92915050565b600061434b61435c565b90506143578282614661565b919050565b6000604051905090565b600067ffffffffffffffff821115614381576143806147f7565b5b61438a82614844565b9050602081019050919050565b600067ffffffffffffffff8211156143b2576143b16147f7565b5b6143bb82614844565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061446f826145e3565b915061447a836145e3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156144af576144ae61470c565b5b828201905092915050565b60006144c5826145e3565b91506144d0836145e3565b9250826144e0576144df61473b565b5b828204905092915050565b60006144f6826145e3565b9150614501836145e3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561453a5761453961470c565b5b828202905092915050565b6000614550826145e3565b915061455b836145e3565b92508282101561456e5761456d61470c565b5b828203905092915050565b6000614584826145c3565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561461a5780820151818401526020810190506145ff565b83811115614629576000848401525b50505050565b6000600282049050600182168061464757607f821691505b6020821081141561465b5761465a61476a565b5b50919050565b61466a82614844565b810181811067ffffffffffffffff82111715614689576146886147f7565b5b80604052505050565b600061469d826145e3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156146d0576146cf61470c565b5b600182019050919050565b60006146e6826145e3565b91506146f1836145e3565b9250826147015761470061473b565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f536f7272792c207468652073616c652069732070617573656400000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f596f752068617665206d696e74656420746865206d6178696d756d205370756e60008201527f4d6f6e6b657320616c6c6f77656420666f722077686974656c6973746564207560208201527f7365727300000000000000000000000000000000000000000000000000000000604082015250565b7f55736572206973206e6f742077686974656c6973746564000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f596f752068617665206d696e74656420746865206d6178696d756d205370756e60008201527f4d6f6e6b657320616c6c6f776564000000000000000000000000000000000000602082015250565b7f596f752068617665206d696e74656420746865206d6178696d756d20616c6c6f60008201527f776564205370756e4d6f6e6b6573000000000000000000000000000000000000602082015250565b7f536f6c64206f7574210000000000000000000000000000000000000000000000600082015250565b614ee581614579565b8114614ef057600080fd5b50565b614efc8161458b565b8114614f0757600080fd5b50565b614f1381614597565b8114614f1e57600080fd5b50565b614f2a816145e3565b8114614f3557600080fd5b5056fea2646970667358221220e867c9ba9839ed7e073d7202c77e75fd846d97186af88e771c7f10377aaa4cb564736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: No
spunmonkes.sol 154 lines
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract NFT is ERC721Enumerable, Ownable {
using Strings for uint256;
string public baseURI;
string public baseExtension = ".json";
string public notRevealedUri;
uint256 public cost = 0 ether;
uint256 public maxSupply = 3333;
uint256 public maxMintAmount = 100;
uint256 public nftPerAddressLimit = 1;
bool public paused = false;
bool public revealed = true;
bool public onlyWhitelisted = false;
address[] public whitelistedAddresses;
// mapping(address => bool) public whitelisted;
constructor(
string memory _name,
string memory _symbol,
string memory _initBaseURI,
string memory _initNotRevealedUri
) ERC721(_name, _symbol) {
setBaseURI(_initBaseURI);
setNotRevealedURI(_initNotRevealedUri);
mint(100);
}
// internal
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
// public
function mint(uint256 _mintAmount) public payable {
require(!paused, "Sorry, the sale is paused");
uint256 supply = totalSupply();
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount, "You have minted the maximum allowed SpunMonkes");
require(supply + _mintAmount <= maxSupply, "Sold out!");
if (msg.sender != owner()) {
if(onlyWhitelisted == true) {
require(isWhitelisted(msg.sender), "User is not whitelisted");
uint256 ownerTokenCount = balanceOf(msg.sender);
require(ownerTokenCount < nftPerAddressLimit, "You have minted the maximum SpunMonkes allowed for whitelisted users");
}
require(balanceOf(msg.sender) < nftPerAddressLimit, "You have minted the maximum SpunMonkes allowed");
require(msg.value >= cost * _mintAmount);
}
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(msg.sender, supply + i);
}
}
// check user is whitelisted
function isWhitelisted(address _user) public view returns (bool) {
for( uint256 i = 0; i < whitelistedAddresses.length; i++ ) {
if(whitelistedAddresses[i] == _user) {
return true;
}
}
return false;
}
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256[](ownerTokenCount);
for (uint256 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIds;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
if(revealed == false) {
return notRevealedUri;
}
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension))
: "";
}
//only owner
function reveal() public onlyOwner {
revealed = true;
}
function setNftPerAddressLimit(uint256 _limit) public onlyOwner {
nftPerAddressLimit = _limit;
}
function setCost(uint256 _newCost) public onlyOwner {
cost = _newCost;
}
function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner {
maxMintAmount = _newmaxMintAmount;
}
function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner {
notRevealedUri = _notRevealedURI;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function setBaseExtension(string memory _newBaseExtension) public onlyOwner {
baseExtension = _newBaseExtension;
}
function pause(bool _state) public onlyOwner {
paused = _state;
}
function setOnlyWhitelisted(bool _state) public onlyOwner {
onlyWhitelisted = _state;
}
function whitelistUsers(address[] calldata _users) public onlyOwner {
delete whitelistedAddresses;
whitelistedAddresses = _users;
}
function withdraw() public payable onlyOwner {
(bool os, ) = payable(owner()).call{value: address(this).balance}("");
require(os);
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
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 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 447 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)
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 overridden 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 {
_setApprovalForAll(_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 || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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);
_afterTokenTransfer(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);
_afterTokenTransfer(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 from incorrect owner");
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);
_afterTokenTransfer(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 Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @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 {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must 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 Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 163 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @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` cannot be the zero address.
* - `to` cannot be the zero address.
*
* 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 override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
balanceOf 0x70a08231 → uint256
baseExtension 0xc6682862 → string
baseURI 0x6c0360eb → string
cost 0x13faede6 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
isWhitelisted 0x3af32abf → bool
maxMintAmount 0x239c70ae → uint256
maxSupply 0xd5abeb01 → uint256
name 0x06fdde03 → string
nftPerAddressLimit 0xba7d2c76 → uint256
notRevealedUri 0x081c8c44 → string
onlyWhitelisted 0x9c70b512 → bool
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
revealed 0x51830227 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
whitelistedAddresses 0xba4e5c49 → address
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
mint 0xa0712d68
uint256 _mintAmount
pause 0x02329a29
bool _state
renounceOwnership 0x715018a6
No parameters
reveal 0xa475b5dd
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
setBaseExtension 0xda3ef23f
string _newBaseExtension
setBaseURI 0x55f804b3
string _newBaseURI
setCost 0x44a0d68a
uint256 _newCost
setNftPerAddressLimit 0xd0eb26b0
uint256 _limit
setNotRevealedURI 0xf2c4ce1e
string _notRevealedURI
setOnlyWhitelisted 0x3c952764
bool _state
setmaxMintAmount 0x7f00c7a6
uint256 _newmaxMintAmount
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistUsers 0xedec5f27
address[] _users
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address