Address Contract Partially Verified
Address
0x3c0f2e22dE221B80B38A8BbE8Dd367b5a436753E
Balance
0 ETH
Nonce
1
Code Size
22394 bytes
Creator
0xF55D8644...B544 at tx 0x963a7164...28bd1c
Indexed Transactions
0
Contract Bytecode
22394 bytes
0x6080604052600436106102455760003560e01c806342966c6811610139578063931688cb116100b6578063b88d4fde1161007a578063b88d4fde1461084f578063c87b56dd14610878578063d547cfb7146108b5578063e985e9c5146108e0578063f2fde38b1461091d578063f4a0a5281461094657610245565b8063931688cb1461078b57806395d89b41146107b4578063a22cb465146107df578063a7f93ebd14610808578063b007e1881461083357610245565b80636d44a3b2116100fd5780636d44a3b2146106cc57806370a08231146106f5578063715018a6146107325780638456cb59146107495780638da5cb5b1461076057610245565b806342966c68146105d55780634f6ccce7146105fe5780635c975abb1461063b5780636352211e146106665780636a627842146106a357610245565b806318160ddd116101c75780632f745c591161018b5780632f745c59146105165780633408e470146105535780633ccfd60b1461057e5780633f4ba83a1461059557806342842e0e146105ac57610245565b806318160ddd1461043157806320379ee51461045c57806323b872dd14610487578063248b71fc146104b05780632d0335ab146104d957610245565b8063095ea7b31161020e578063095ea7b3146103455780630c53c51c1461036e5780630f7e59701461039e57806312065fe0146103c957806313e7c9d8146103f457610245565b80629a9b7b1461024a57806301ffc9a7146102755780630387da42146102b257806306fdde03146102dd578063081812fc14610308575b600080fd5b34801561025657600080fd5b5061025f61096f565b60405161026c9190614a7b565b60405180910390f35b34801561028157600080fd5b5061029c60048036038101906102979190613e28565b610975565b6040516102a99190614637565b60405180910390f35b3480156102be57600080fd5b506102c7610987565b6040516102d49190614a7b565b60405180910390f35b3480156102e957600080fd5b506102f261098d565b6040516102ff9190614719565b60405180910390f35b34801561031457600080fd5b5061032f600480360381019061032a9190613ee4565b610a1f565b60405161033c9190614539565b60405180910390f35b34801561035157600080fd5b5061036c60048036038101906103679190613dab565b610aa4565b005b61038860048036038101906103839190613d1c565b610bbc565b60405161039591906146f7565b60405180910390f35b3480156103aa57600080fd5b506103b3610e2e565b6040516103c09190614719565b60405180910390f35b3480156103d557600080fd5b506103de610e67565b6040516103eb9190614a7b565b60405180910390f35b34801561040057600080fd5b5061041b60048036038101906104169190613b88565b610e6f565b6040516104289190614637565b60405180910390f35b34801561043d57600080fd5b50610446610e8f565b6040516104539190614a7b565b60405180910390f35b34801561046857600080fd5b50610471610e9c565b60405161047e9190614652565b60405180910390f35b34801561049357600080fd5b506104ae60048036038101906104a99190613c16565b610ea6565b005b3480156104bc57600080fd5b506104d760048036038101906104d29190613dab565b610f06565b005b3480156104e557600080fd5b5061050060048036038101906104fb9190613b88565b610fdc565b60405161050d9190614a7b565b60405180910390f35b34801561052257600080fd5b5061053d60048036038101906105389190613dab565b611025565b60405161054a9190614a7b565b60405180910390f35b34801561055f57600080fd5b506105686110ca565b6040516105759190614a7b565b60405180910390f35b34801561058a57600080fd5b506105936110d7565b005b3480156105a157600080fd5b506105aa6111ac565b005b3480156105b857600080fd5b506105d360048036038101906105ce9190613c16565b611242565b005b3480156105e157600080fd5b506105fc60048036038101906105f79190613ee4565b611262565b005b34801561060a57600080fd5b5061062560048036038101906106209190613ee4565b6112be565b6040516106329190614a7b565b60405180910390f35b34801561064757600080fd5b50610650611355565b60405161065d9190614637565b60405180910390f35b34801561067257600080fd5b5061068d60048036038101906106889190613ee4565b61136c565b60405161069a9190614539565b60405180910390f35b3480156106af57600080fd5b506106ca60048036038101906106c59190613b88565b61141e565b005b3480156106d857600080fd5b506106f360048036038101906106ee9190613ce0565b6114d1565b005b34801561070157600080fd5b5061071c60048036038101906107179190613b88565b6115a8565b6040516107299190614a7b565b60405180910390f35b34801561073e57600080fd5b50610747611660565b005b34801561075557600080fd5b5061075e6116e8565b005b34801561076c57600080fd5b5061077561177e565b6040516107829190614539565b60405180910390f35b34801561079757600080fd5b506107b260048036038101906107ad9190613ea3565b6117a8565b005b3480156107c057600080fd5b506107c961183e565b6040516107d69190614719565b60405180910390f35b3480156107eb57600080fd5b5061080660048036038101906108019190613ce0565b6118d0565b005b34801561081457600080fd5b5061081d6118e6565b60405161082a9190614a7b565b60405180910390f35b61084d60048036038101906108489190613de7565b6118f0565b005b34801561085b57600080fd5b5061087660048036038101906108719190613c65565b611be2565b005b34801561088457600080fd5b5061089f600480360381019061089a9190613ee4565b611c44565b6040516108ac9190614719565b60405180910390f35b3480156108c157600080fd5b506108ca611c56565b6040516108d79190614719565b60405180910390f35b3480156108ec57600080fd5b5061090760048036038101906109029190613bda565b611ce8565b6040516109149190614637565b60405180910390f35b34801561092957600080fd5b50610944600480360381019061093f9190613b88565b611cfc565b005b34801561095257600080fd5b5061096d60048036038101906109689190613ee4565b611df4565b005b600f5481565b600061098082611f4a565b9050919050565b60145481565b60606000805461099c90614d7c565b80601f01602080910402602001604051908101604052809291908181526020018280546109c890614d7c565b8015610a155780601f106109ea57610100808354040283529160200191610a15565b820191906000526020600020905b8154815290600101906020018083116109f857829003601f168201915b5050505050905090565b6000610a2a82611fc4565b610a69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a609061497b565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610aaf8261136c565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b17906149db565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b3f612030565b73ffffffffffffffffffffffffffffffffffffffff161480610b6e5750610b6d81610b68612030565b611ce8565b5b610bad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba4906148fb565b60405180910390fd5b610bb7838361203f565b505050565b606060006040518060600160405280600c60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481526020018873ffffffffffffffffffffffffffffffffffffffff168152602001878152509050610c3f87828787876120f8565b610c7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c75906149bb565b60405180910390fd5b610cd16001600c60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461220190919063ffffffff16565b600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b873388604051610d4793929190614554565b60405180910390a16000803073ffffffffffffffffffffffffffffffffffffffff16888a604051602001610d7c9291906144b6565b604051602081830303815290604052604051610d98919061449f565b6000604051808303816000865af19150503d8060008114610dd5576040519150601f19603f3d011682016040523d82523d6000602084013e610dda565b606091505b509150915081610e1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e16906147fb565b60405180910390fd5b80935050505095945050505050565b6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b600047905090565b60106020528060005260406000206000915054906101000a900460ff1681565b6000600880549050905090565b6000600b54905090565b610eb7610eb1612030565b82612217565b610ef6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eed906149fb565b60405180910390fd5b610f018383836122f5565b505050565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610f92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f899061477b565b60405180910390fd5b6000600f54905060005b82811015610fcf578180610faf90614ddf565b925050610fbc848361255c565b8080610fc790614ddf565b915050610f9c565b5080600f81905550505050565b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000611030836115a8565b8210611071576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110689061479b565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b6000804690508091505090565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115a9061477b565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156111a9573d6000803e3d6000fd5b50565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611238576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122f9061477b565b60405180910390fd5b61124061257a565b565b61125d83838360405180602001604052806000815250611be2565b505050565b61127361126d612030565b82612217565b6112b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a990614a5b565b60405180910390fd5b6112bb8161261c565b50565b60006112c8610e8f565b8210611309576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130090614a1b565b60405180910390fd5b60088281548110611343577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b6000600e60149054906101000a900460ff16905090565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611415576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140c9061493b565b60405180910390fd5b80915050919050565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a19061477b565b60405180910390fd5b600f60008154809291906114bd90614ddf565b91905055506114ce81600f5461255c565b50565b6114d9612030565b73ffffffffffffffffffffffffffffffffffffffff166114f761177e565b73ffffffffffffffffffffffffffffffffffffffff161461154d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115449061499b565b60405180910390fd5b80601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611619576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116109061491b565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611668612030565b73ffffffffffffffffffffffffffffffffffffffff1661168661177e565b73ffffffffffffffffffffffffffffffffffffffff16146116dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d39061499b565b60405180910390fd5b6116e66000612739565b565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611774576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176b9061477b565b60405180910390fd5b61177c6127ff565b565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6117b0612030565b73ffffffffffffffffffffffffffffffffffffffff166117ce61177e565b73ffffffffffffffffffffffffffffffffffffffff1614611824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181b9061499b565b60405180910390fd5b806011908051906020019061183a9291906138c2565b5050565b60606001805461184d90614d7c565b80601f016020809104026020016040519081016040528092919081815260200182805461187990614d7c565b80156118c65780601f1061189b576101008083540402835291602001916118c6565b820191906000526020600020905b8154815290600101906020018083116118a957829003601f168201915b5050505050905090565b6118e26118db612030565b83836128a2565b5050565b6000601454905090565b601454341015611935576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192c90614a3b565b60405180910390fd5b6000601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060005b8251811015611b5a57611970612030565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16636352211e8584815181106119db577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b81526004016119ff9190614a7b565b60206040518083038186803b158015611a1757600080fd5b505afa158015611a2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4f9190613bb1565b73ffffffffffffffffffffffffffffffffffffffff1614611a6f57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166342842e0e611a93612030565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16868581518110611aef577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518463ffffffff1660e01b8152600401611b1593929190614592565b600060405180830381600087803b158015611b2f57600080fd5b505af1158015611b43573d6000803e3d6000fd5b505050508080611b5290614ddf565b91505061195f565b50600f6000815480929190611b6e90614ddf565b9190505550611b86611b7e612030565b600f5461255c565b600f54611b91612030565b73ffffffffffffffffffffffffffffffffffffffff167f30bb318a4c4619bc3ad069802f006b64e89211ebd8f37268db8ddcbb62250ab284604051611bd69190614615565b60405180910390a35050565b611bf3611bed612030565b83612217565b611c32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c29906149fb565b60405180910390fd5b611c3e84848484612a0f565b50505050565b6060611c4f82612a6b565b9050919050565b606060118054611c6590614d7c565b80601f0160208091040260200160405190810160405280929190818152602001828054611c9190614d7c565b8015611cde5780601f10611cb357610100808354040283529160200191611cde565b820191906000526020600020905b815481529060010190602001808311611cc157829003601f168201915b5050505050905090565b6000611cf48383612aa5565b905092915050565b611d04612030565b73ffffffffffffffffffffffffffffffffffffffff16611d2261177e565b73ffffffffffffffffffffffffffffffffffffffff1614611d78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6f9061499b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611de8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ddf906147db565b60405180910390fd5b611df181612739565b50565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e779061477b565b60405180910390fd5b8060148190555050565b6000611e94611e99565b905090565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611f4357600080368080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509050600080369050905073ffffffffffffffffffffffffffffffffffffffff818301511692505050611f47565b3390505b90565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611fbd5750611fbc82612ba7565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600061203a611e8a565b905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166120b28361136c565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612169576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612160906148bb565b60405180910390fd5b600161217c61217787612c89565b612cf1565b8386866040516000815260200160405260405161219c94939291906146b2565b6020604051602081039080840390855afa1580156121be573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614905095945050505050565b6000818361220f9190614bd0565b905092915050565b600061222282611fc4565b612261576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122589061489b565b60405180910390fd5b600061226c8361136c565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806122db57508373ffffffffffffffffffffffffffffffffffffffff166122c384610a1f565b73ffffffffffffffffffffffffffffffffffffffff16145b806122ec57506122eb8185611ce8565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166123158261136c565b73ffffffffffffffffffffffffffffffffffffffff161461236b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123629061481b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156123db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d29061485b565b60405180910390fd5b6123e6838383612d2a565b6123f160008261203f565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546124419190614c57565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546124989190614bd0565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612557838383612d3a565b505050565b612576828260405180602001604052806000815250612d3f565b5050565b612582611355565b6125c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125b89061475b565b60405180910390fd5b6000600e60146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612605612030565b6040516126129190614539565b60405180910390a1565b60006126278261136c565b905061263581600084612d2a565b61264060008361203f565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546126909190614c57565b925050819055506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461273581600084612d3a565b5050565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612807611355565b15612847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283e906148db565b60405180910390fd5b6001600e60146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861288b612030565b6040516128989190614539565b60405180910390a1565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612911576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129089061487b565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612a029190614637565b60405180910390a3505050565b612a1a8484846122f5565b612a2684848484612d9a565b612a65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a5c906147bb565b60405180910390fd5b50505050565b6060612a75611c56565b612a7e83612f31565b604051602001612a8f9291906144de565b6040516020818303038152906040529050919050565b600080600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1663c4552791866040518263ffffffff1660e01b8152600401612b1d9190614539565b60206040518083038186803b158015612b3557600080fd5b505afa158015612b49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6d9190613e7a565b73ffffffffffffffffffffffffffffffffffffffff161415612b93576001915050612ba1565b612b9d84846130de565b9150505b92915050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612c7257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612c825750612c8182613172565b5b9050919050565b6000604051806080016040528060438152602001615702604391398051906020012082600001518360200151846040015180519060200120604051602001612cd4949392919061466d565b604051602081830303815290604052805190602001209050919050565b6000612cfb610e9c565b82604051602001612d0d929190614502565b604051602081830303815290604052805190602001209050919050565b612d358383836131dc565b505050565b505050565b612d498383613234565b612d566000848484612d9a565b612d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d8c906147bb565b60405180910390fd5b505050565b6000612dbb8473ffffffffffffffffffffffffffffffffffffffff1661340e565b15612f24578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612de4612030565b8786866040518563ffffffff1660e01b8152600401612e0694939291906145c9565b602060405180830381600087803b158015612e2057600080fd5b505af1925050508015612e5157506040513d601f19601f82011682018060405250810190612e4e9190613e51565b60015b612ed4573d8060008114612e81576040519150601f19603f3d011682016040523d82523d6000602084013e612e86565b606091505b50600081511415612ecc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ec3906147bb565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612f29565b600190505b949350505050565b60606000821415612f79576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506130d9565b600082905060005b60008214612fab578080612f9490614ddf565b915050600a82612fa49190614c26565b9150612f81565b60008167ffffffffffffffff811115612fed577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561301f5781602001600182028036833780820191505090505b5090505b600085146130d2576001826130389190614c57565b9150600a856130479190614e56565b60306130539190614bd0565b60f81b81838151811061308f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856130cb9190614c26565b9450613023565b8093505050505b919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6131e7838383613431565b6131ef611355565b1561322f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132269061473b565b60405180910390fd5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156132a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161329b9061495b565b60405180910390fd5b6132ad81611fc4565b156132ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132e49061483b565b60405180910390fd5b6132f960008383612d2a565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546133499190614bd0565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461340a60008383612d3a565b5050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b61343c838383613545565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561347f5761347a8161354a565b6134be565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146134bd576134bc8382613593565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613501576134fc81613700565b613540565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461353f5761353e8282613843565b5b5b505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016135a0846115a8565b6135aa9190614c57565b905060006007600084815260200190815260200160002054905081811461368f576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b600060016008805490506137149190614c57565b905060006009600084815260200190815260200160002054905060006008838154811061376a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080600883815481106137b2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480613827577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061384e836115a8565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b8280546138ce90614d7c565b90600052602060002090601f0160209004810192826138f05760008555613937565b82601f1061390957805160ff1916838001178555613937565b82800160010185558215613937579182015b8281111561393657825182559160200191906001019061391b565b5b5090506139449190613948565b5090565b5b80821115613961576000816000905550600101613949565b5090565b600061397861397384614abb565b614a96565b9050808382526020820190508285602086028201111561399757600080fd5b60005b858110156139c757816139ad8882613b5e565b84526020840193506020830192505060018101905061399a565b5050509392505050565b60006139e46139df84614ae7565b614a96565b9050828152602081018484840111156139fc57600080fd5b613a07848285614d3a565b509392505050565b6000613a22613a1d84614b18565b614a96565b905082815260208101848484011115613a3a57600080fd5b613a45848285614d3a565b509392505050565b600081359050613a5c81615660565b92915050565b600081519050613a7181615660565b92915050565b600082601f830112613a8857600080fd5b8135613a98848260208601613965565b91505092915050565b600081359050613ab081615677565b92915050565b600081359050613ac58161568e565b92915050565b600081359050613ada816156a5565b92915050565b600081519050613aef816156a5565b92915050565b600082601f830112613b0657600080fd5b8135613b168482602086016139d1565b91505092915050565b600081519050613b2e816156bc565b92915050565b600082601f830112613b4557600080fd5b8135613b55848260208601613a0f565b91505092915050565b600081359050613b6d816156d3565b92915050565b600081359050613b82816156ea565b92915050565b600060208284031215613b9a57600080fd5b6000613ba884828501613a4d565b91505092915050565b600060208284031215613bc357600080fd5b6000613bd184828501613a62565b91505092915050565b60008060408385031215613bed57600080fd5b6000613bfb85828601613a4d565b9250506020613c0c85828601613a4d565b9150509250929050565b600080600060608486031215613c2b57600080fd5b6000613c3986828701613a4d565b9350506020613c4a86828701613a4d565b9250506040613c5b86828701613b5e565b9150509250925092565b60008060008060808587031215613c7b57600080fd5b6000613c8987828801613a4d565b9450506020613c9a87828801613a4d565b9350506040613cab87828801613b5e565b925050606085013567ffffffffffffffff811115613cc857600080fd5b613cd487828801613af5565b91505092959194509250565b60008060408385031215613cf357600080fd5b6000613d0185828601613a4d565b9250506020613d1285828601613aa1565b9150509250929050565b600080600080600060a08688031215613d3457600080fd5b6000613d4288828901613a4d565b955050602086013567ffffffffffffffff811115613d5f57600080fd5b613d6b88828901613af5565b9450506040613d7c88828901613ab6565b9350506060613d8d88828901613ab6565b9250506080613d9e88828901613b73565b9150509295509295909350565b60008060408385031215613dbe57600080fd5b6000613dcc85828601613a4d565b9250506020613ddd85828601613b5e565b9150509250929050565b600060208284031215613df957600080fd5b600082013567ffffffffffffffff811115613e1357600080fd5b613e1f84828501613a77565b91505092915050565b600060208284031215613e3a57600080fd5b6000613e4884828501613acb565b91505092915050565b600060208284031215613e6357600080fd5b6000613e7184828501613ae0565b91505092915050565b600060208284031215613e8c57600080fd5b6000613e9a84828501613b1f565b91505092915050565b600060208284031215613eb557600080fd5b600082013567ffffffffffffffff811115613ecf57600080fd5b613edb84828501613b34565b91505092915050565b600060208284031215613ef657600080fd5b6000613f0484828501613b5e565b91505092915050565b6000613f198383614472565b60208301905092915050565b613f2e81614c9d565b82525050565b613f3d81614c8b565b82525050565b613f54613f4f82614c8b565b614e28565b82525050565b6000613f6582614b59565b613f6f8185614b87565b9350613f7a83614b49565b8060005b83811015613fab578151613f928882613f0d565b9750613f9d83614b7a565b925050600181019050613f7e565b5085935050505092915050565b613fc181614caf565b82525050565b613fd081614cbb565b82525050565b613fe7613fe282614cbb565b614e3a565b82525050565b6000613ff882614b64565b6140028185614b98565b9350614012818560208601614d49565b61401b81614f43565b840191505092915050565b600061403182614b64565b61403b8185614ba9565b935061404b818560208601614d49565b80840191505092915050565b600061406282614b6f565b61406c8185614bb4565b935061407c818560208601614d49565b61408581614f43565b840191505092915050565b600061409b82614b6f565b6140a58185614bc5565b93506140b5818560208601614d49565b80840191505092915050565b60006140ce602b83614bb4565b91506140d982614f61565b604082019050919050565b60006140f1601483614bb4565b91506140fc82614fb0565b602082019050919050565b6000614114600e83614bb4565b915061411f82614fd9565b602082019050919050565b6000614137602b83614bb4565b915061414282615002565b604082019050919050565b600061415a603283614bb4565b915061416582615051565b604082019050919050565b600061417d602683614bb4565b9150614188826150a0565b604082019050919050565b60006141a0601c83614bb4565b91506141ab826150ef565b602082019050919050565b60006141c3602583614bb4565b91506141ce82615118565b604082019050919050565b60006141e6601c83614bb4565b91506141f182615167565b602082019050919050565b6000614209600283614bc5565b915061421482615190565b600282019050919050565b600061422c602483614bb4565b9150614237826151b9565b604082019050919050565b600061424f601983614bb4565b915061425a82615208565b602082019050919050565b6000614272602c83614bb4565b915061427d82615231565b604082019050919050565b6000614295602583614bb4565b91506142a082615280565b604082019050919050565b60006142b8601083614bb4565b91506142c3826152cf565b602082019050919050565b60006142db603883614bb4565b91506142e6826152f8565b604082019050919050565b60006142fe602a83614bb4565b915061430982615347565b604082019050919050565b6000614321602983614bb4565b915061432c82615396565b604082019050919050565b6000614344602083614bb4565b915061434f826153e5565b602082019050919050565b6000614367602c83614bb4565b91506143728261540e565b604082019050919050565b600061438a602083614bb4565b91506143958261545d565b602082019050919050565b60006143ad602183614bb4565b91506143b882615486565b604082019050919050565b60006143d0602183614bb4565b91506143db826154d5565b604082019050919050565b60006143f3603183614bb4565b91506143fe82615524565b604082019050919050565b6000614416602c83614bb4565b915061442182615573565b604082019050919050565b6000614439602183614bb4565b9150614444826155c2565b604082019050919050565b600061445c603083614bb4565b915061446782615611565b604082019050919050565b61447b81614d23565b82525050565b61448a81614d23565b82525050565b61449981614d2d565b82525050565b60006144ab8284614026565b915081905092915050565b60006144c28285614026565b91506144ce8284613f43565b6014820191508190509392505050565b60006144ea8285614090565b91506144f68284614090565b91508190509392505050565b600061450d826141fc565b91506145198285613fd6565b6020820191506145298284613fd6565b6020820191508190509392505050565b600060208201905061454e6000830184613f34565b92915050565b60006060820190506145696000830186613f34565b6145766020830185613f25565b81810360408301526145888184613fed565b9050949350505050565b60006060820190506145a76000830186613f34565b6145b46020830185613f34565b6145c16040830184614481565b949350505050565b60006080820190506145de6000830187613f34565b6145eb6020830186613f34565b6145f86040830185614481565b818103606083015261460a8184613fed565b905095945050505050565b6000602082019050818103600083015261462f8184613f5a565b905092915050565b600060208201905061464c6000830184613fb8565b92915050565b60006020820190506146676000830184613fc7565b92915050565b60006080820190506146826000830187613fc7565b61468f6020830186614481565b61469c6040830185613f34565b6146a96060830184613fc7565b95945050505050565b60006080820190506146c76000830187613fc7565b6146d46020830186614490565b6146e16040830185613fc7565b6146ee6060830184613fc7565b95945050505050565b600060208201905081810360008301526147118184613fed565b905092915050565b600060208201905081810360008301526147338184614057565b905092915050565b60006020820190508181036000830152614754816140c1565b9050919050565b60006020820190508181036000830152614774816140e4565b9050919050565b6000602082019050818103600083015261479481614107565b9050919050565b600060208201905081810360008301526147b48161412a565b9050919050565b600060208201905081810360008301526147d48161414d565b9050919050565b600060208201905081810360008301526147f481614170565b9050919050565b6000602082019050818103600083015261481481614193565b9050919050565b60006020820190508181036000830152614834816141b6565b9050919050565b60006020820190508181036000830152614854816141d9565b9050919050565b600060208201905081810360008301526148748161421f565b9050919050565b6000602082019050818103600083015261489481614242565b9050919050565b600060208201905081810360008301526148b481614265565b9050919050565b600060208201905081810360008301526148d481614288565b9050919050565b600060208201905081810360008301526148f4816142ab565b9050919050565b60006020820190508181036000830152614914816142ce565b9050919050565b60006020820190508181036000830152614934816142f1565b9050919050565b6000602082019050818103600083015261495481614314565b9050919050565b6000602082019050818103600083015261497481614337565b9050919050565b600060208201905081810360008301526149948161435a565b9050919050565b600060208201905081810360008301526149b48161437d565b9050919050565b600060208201905081810360008301526149d4816143a0565b9050919050565b600060208201905081810360008301526149f4816143c3565b9050919050565b60006020820190508181036000830152614a14816143e6565b9050919050565b60006020820190508181036000830152614a3481614409565b9050919050565b60006020820190508181036000830152614a548161442c565b9050919050565b60006020820190508181036000830152614a748161444f565b9050919050565b6000602082019050614a906000830184614481565b92915050565b6000614aa0614ab1565b9050614aac8282614dae565b919050565b6000604051905090565b600067ffffffffffffffff821115614ad657614ad5614f14565b5b602082029050602081019050919050565b600067ffffffffffffffff821115614b0257614b01614f14565b5b614b0b82614f43565b9050602081019050919050565b600067ffffffffffffffff821115614b3357614b32614f14565b5b614b3c82614f43565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000614bdb82614d23565b9150614be683614d23565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614c1b57614c1a614e87565b5b828201905092915050565b6000614c3182614d23565b9150614c3c83614d23565b925082614c4c57614c4b614eb6565b5b828204905092915050565b6000614c6282614d23565b9150614c6d83614d23565b925082821015614c8057614c7f614e87565b5b828203905092915050565b6000614c9682614d03565b9050919050565b6000614ca882614d03565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000614cfc82614c8b565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b83811015614d67578082015181840152602081019050614d4c565b83811115614d76576000848401525b50505050565b60006002820490506001821680614d9457607f821691505b60208210811415614da857614da7614ee5565b5b50919050565b614db782614f43565b810181811067ffffffffffffffff82111715614dd657614dd5614f14565b5b80604052505050565b6000614dea82614d23565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614e1d57614e1c614e87565b5b600182019050919050565b6000614e3382614e44565b9050919050565b6000819050919050565b6000614e4f82614f54565b9050919050565b6000614e6182614d23565b9150614e6c83614d23565b925082614e7c57614e7b614eb6565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f4552433732315061757361626c653a20746f6b656e207472616e73666572207760008201527f68696c6520706175736564000000000000000000000000000000000000000000602082015250565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b7f6f6e6c79206f70657261746f7273000000000000000000000000000000000000600082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f46756e6374696f6e2063616c6c206e6f74207375636365737366756c00000000600082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4e61746976654d6574615472616e73616374696f6e3a20494e56414c49445f5360008201527f49474e4552000000000000000000000000000000000000000000000000000000602082015250565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5369676e657220616e64207369676e617475726520646f206e6f74206d61746360008201527f6800000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f4e6f7420656e6f756768204554482073656e743b20636865636b20707269636560008201527f2100000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656400000000000000000000000000000000602082015250565b61566981614c8b565b811461567457600080fd5b50565b61568081614caf565b811461568b57600080fd5b50565b61569781614cbb565b81146156a257600080fd5b50565b6156ae81614cc5565b81146156b957600080fd5b50565b6156c581614cf1565b81146156d057600080fd5b50565b6156dc81614d23565b81146156e757600080fd5b50565b6156f381614d2d565b81146156fe57600080fd5b5056fe4d6574615472616e73616374696f6e2875696e74323536206e6f6e63652c616464726573732066726f6d2c62797465732066756e6374696f6e5369676e617475726529a264697066735822122091c136cd909f584e1dabd85567a9b55e603b9e30f86d74f19b651d125079e6e364736f6c63430008010033
Verified Source Code Partial Match
Compiler: v0.8.1+commit.df193b15
EVM: istanbul
Optimization: No
SuperBoonji.sol 65 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './jupiter/JupiterNFT.sol';
import './ISuperBoonji.sol';
interface BoonjiContract {
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(address from, address to, uint256 tokenId) external;
}
contract SuperBoonji is JupiterNFT, ISuperBoonji{
event BurnAndMint(address indexed to, uint256[] burnedTokens, uint256 indexed mintedTokenId);
address internal _boonjiAddress;
address internal _burnAddress;
uint256 public _mintPrice;
constructor(
address proxyRegistryAddress,
string memory name,
string memory symbol,
string memory baseTokenURI,
address[] memory operators,
address __boonjiAddress,
address __burnAddress,
uint256 mintPrice
) JupiterNFT(proxyRegistryAddress, name, symbol, baseTokenURI, operators){
_boonjiAddress = __boonjiAddress;
_burnAddress = __burnAddress;
_mintPrice = mintPrice;
}
function burnAndMint(uint256[] memory _boonjai) payable override external{
require(msg.value >= _mintPrice, "Not enough ETH sent; check price!");
BoonjiContract boonjiNft = BoonjiContract(_boonjiAddress);
for(uint i = 0; i < _boonjai.length; i++) {
require(boonjiNft.ownerOf(_boonjai[i]) == _msgSender());
boonjiNft.safeTransferFrom(_msgSender(), _burnAddress, _boonjai[i]);
}
currentTokenId++;
_safeMint(_msgSender(), currentTokenId);
emit BurnAndMint (_msgSender(), _boonjai, currentTokenId);
return;
}
function withdraw () external {
require(operators[msg.sender], "only operators");
payable(msg.sender).transfer(address(this).balance);
}
function getBalance() public view returns(uint){
return address(this).balance;
}
function getMintPrice() public view returns(uint){
return _mintPrice;
}
function setMintPrice(uint256 mintPrice) external{
require(operators[msg.sender], "only operators");
_mintPrice = mintPrice;
}
}
ISuperBoonji.sol 6 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ISuperBoonji {
function burnAndMint(uint256[] memory _boonjai) payable external;
}
EIP712Base.sol 84 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Initializable {
bool inited = false;
modifier initializer() {
require(!inited, "already inited");
_;
inited = true;
}
}
contract EIP712Base is Initializable {
struct EIP712Domain {
string name;
string version;
address verifyingContract;
bytes32 salt;
}
string constant public ERC712_VERSION = "1";
bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256(
bytes(
"EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)"
)
);
bytes32 internal domainSeperator;
// supposed to be called once while initializing.
// one of the contracts that inherits this contract follows proxy pattern
// so it is not possible to do this in a constructor
function _initializeEIP712(
string memory name
)
internal
initializer
{
_setDomainSeperator(name);
}
function _setDomainSeperator(string memory name) internal {
domainSeperator = keccak256(
abi.encode(
EIP712_DOMAIN_TYPEHASH,
keccak256(bytes(name)),
keccak256(bytes(ERC712_VERSION)),
address(this),
bytes32(getChainId())
)
);
}
function getDomainSeperator() public view returns (bytes32) {
return domainSeperator;
}
function getChainId() public view returns (uint256) {
uint256 id;
assembly {
id := chainid()
}
return id;
}
/**
* Accept message hash and returns hash message in EIP712 compatible form
* So that it can be used to recover signer from signature signed using EIP712 formatted data
* https://eips.ethereum.org/EIPS/eip-712
* "\\x19" makes the encoding deterministic
* "\\x01" is the version byte to make it compatible to EIP-191
*/
function toTypedMessageHash(bytes32 messageHash)
internal
view
returns (bytes32)
{
return
keccak256(
abi.encodePacked("\x19\x01", getDomainSeperator(), messageHash)
);
}
}
JupiterNFT.sol 147 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol';
import './IJupiterNFT.sol';
import '../common/ERC721Tradable.sol';
contract JupiterNFT is IJupiterNFT, ERC721Tradable, ERC721Burnable, ERC721Pausable {
uint public currentTokenId = 0;
mapping(address => bool) public operators;
string internal _baseTokenURI;
constructor(
address _proxyRegistryAddress,
string memory _name,
string memory _symbol,
string memory __baseTokenURI,
address[] memory _operators
) ERC721Tradable(_name, _symbol, _proxyRegistryAddress)
{
_baseTokenURI = __baseTokenURI;
for(uint i = 0; i < _operators.length; i++) {
operators[_operators[i]] = true;
}
}
/*
* @dev function to update base URI for NFT marketplaces
* @param __baseURI The new base URI
*/
function updateBaseURI(string memory __baseURI) public onlyOwner {
_baseTokenURI = __baseURI;
}
/*
* @dev set operator status
* @param _operatorAddress The address to which the changes will be applied
* @param _status Enabled or disabled (true/false)
*/
function updateOperator(address _operatorAddress, bool _status) public onlyOwner {
operators[_operatorAddress] = _status;
}
/*
* @dev function to mint 1 NFT
* @param _to To whom NFT will be minted
*/
function mint(address _to) public override {
require(operators[msg.sender], "only operators");
currentTokenId++;
_safeMint(_to, currentTokenId);
}
function pause () public {
require(operators[msg.sender], "only operators");
_pause();
}
function unpause () public {
require(operators[msg.sender], "only operators");
_unpause();
}
/*
* @dev function to mint batch NFT's
* @param _to To whom NFT will be minted
* @param _amount How much tokens will be minted
*/
function mintBatch(address _to, uint _amount) public override {
require(operators[msg.sender], "only operators");
uint buf = currentTokenId;
for(uint i = 0; i < _amount; i++) {
buf++;
_safeMint(_to, buf);
}
currentTokenId = buf;
}
function baseTokenURI() public view override returns(string memory) {
return _baseTokenURI;
}
function _baseURI() internal view override returns(string memory) {
return _baseTokenURI;
}
/**
* This is used instead of msg.sender as transactions won't be sent by the original token owner, but by OpenSea.
*/
function _msgSender()
internal
override (Context, ERC721Tradable)
view
returns (address sender)
{
return ERC721Tradable._msgSender();
}
function isApprovedForAll(address owner, address operator)
override (ERC721Tradable, ERC721)
public
view
returns (bool)
{
return super.isApprovedForAll(owner, operator);
}
/// @inheritdoc ERC165
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function tokenURI(uint256 _tokenId)
override (ERC721, ERC721Tradable)
public
view
returns (string memory)
{
return super.tokenURI(_tokenId);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
)
internal
virtual
override (ERC721Pausable, ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
}
ContextMixin.sol 25 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract ContextMixin {
function msgSender()
internal
view
returns (address payable sender)
{
if (msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
// Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
}
} else {
sender = payable(msg.sender);
}
return sender;
}
}
IJupiterNFT.sol 7 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IJupiterNFT {
function mint(address _to) external;
function mintBatch(address _to, uint _amount) external;
}
ERC721Tradable.sol 72 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import './ContextMixin.sol';
import './NativeMetaTransaction.sol';
contract OwnableDelegateProxy {}
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
/**
* @title ERC721Tradable
* ERC721Tradable - ERC721 contract that whitelists a trading address, and has minting functionality.
*/
abstract contract ERC721Tradable is ContextMixin, ERC721Enumerable, NativeMetaTransaction, Ownable {
using SafeMath for uint256;
address proxyRegistryAddress;
constructor(
string memory _name,
string memory _symbol,
address _proxyRegistryAddress
) ERC721(_name, _symbol) {
proxyRegistryAddress = _proxyRegistryAddress;
_initializeEIP712(_name);
}
function baseTokenURI() virtual public view returns (string memory);
function tokenURI(uint256 _tokenId) override public virtual view returns (string memory) {
return string(abi.encodePacked(baseTokenURI(), Strings.toString(_tokenId)));
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
override
public
virtual
view
returns (bool)
{
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
/**
* This is used instead of msg.sender as transactions won't be sent by the original token owner, but by OpenSea.
*/
function _msgSender()
internal
override
virtual
view
returns (address sender)
{
return ContextMixin.msgSender();
}
}
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);
}
}
NativeMetaTransaction.sol 106 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import './EIP712Base.sol';
contract NativeMetaTransaction is EIP712Base {
using SafeMath for uint256;
bytes32 private constant META_TRANSACTION_TYPEHASH = keccak256(
bytes(
"MetaTransaction(uint256 nonce,address from,bytes functionSignature)"
)
);
event MetaTransactionExecuted(
address userAddress,
address payable relayerAddress,
bytes functionSignature
);
mapping(address => uint256) nonces;
/*
* Meta transaction structure.
* No point of including value field here as if user is doing value transfer then he has the funds to pay for gas
* He should call the desired function directly in that case.
*/
struct MetaTransaction {
uint256 nonce;
address from;
bytes functionSignature;
}
function executeMetaTransaction(
address userAddress,
bytes memory functionSignature,
bytes32 sigR,
bytes32 sigS,
uint8 sigV
) public payable returns (bytes memory) {
MetaTransaction memory metaTx = MetaTransaction({
nonce: nonces[userAddress],
from: userAddress,
functionSignature: functionSignature
});
require(
verify(userAddress, metaTx, sigR, sigS, sigV),
"Signer and signature do not match"
);
// increase nonce for user (to avoid re-use)
nonces[userAddress] = nonces[userAddress].add(1);
emit MetaTransactionExecuted(
userAddress,
payable(msg.sender),
functionSignature
);
// Append userAddress and relayer address at the end to extract it from calling context
(bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
return returnData;
}
function hashMetaTransaction(MetaTransaction memory metaTx)
internal
pure
returns (bytes32)
{
return
keccak256(
abi.encode(
META_TRANSACTION_TYPEHASH,
metaTx.nonce,
metaTx.from,
keccak256(metaTx.functionSignature)
)
);
}
function getNonce(address user) public view returns (uint256 nonce) {
nonce = nonces[user];
}
function verify(
address signer,
MetaTransaction memory metaTx,
bytes32 sigR,
bytes32 sigS,
uint8 sigV
) internal view returns (bool) {
require(signer != address(0), "NativeMetaTransaction: INVALID_SIGNER");
return
signer ==
ecrecover(
toTypedMessageHash(hashMetaTransaction(metaTx)),
sigV,
sigR,
sigS
);
}
}
Pausable.sol 91 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
ERC721.sol 447 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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 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 {
_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 || 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);
_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 {}
}
SafeMath.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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`, 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 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 v4.4.1 (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 `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
ERC721Burnable.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "../../../utils/Context.sol";
/**
* @title ERC721 Burnable Token
* @dev ERC721 Token that can be irreversibly burned (destroyed).
*/
abstract contract ERC721Burnable is Context, ERC721 {
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
}
ERC721Pausable.sol 33 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol)
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "../../../security/Pausable.sol";
/**
* @dev ERC721 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
abstract contract ERC721Pausable is ERC721, Pausable {
/**
* @dev See {ERC721-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
require(!paused(), "ERC721Pausable: token transfer while paused");
}
}
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
ERC712_VERSION 0x0f7e5970 → string
_mintPrice 0x0387da42 → uint256
balanceOf 0x70a08231 → uint256
baseTokenURI 0xd547cfb7 → string
currentTokenId 0x009a9b7b → uint256
getApproved 0x081812fc → address
getBalance 0x12065fe0 → uint256
getChainId 0x3408e470 → uint256
getDomainSeperator 0x20379ee5 → bytes32
getMintPrice 0xa7f93ebd → uint256
getNonce 0x2d0335ab → uint256
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
operators 0x13e7c9d8 → bool
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 18 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 tokenId
burnAndMint 0xb007e188
uint256[] _boonjai
executeMetaTransaction 0x0c53c51c
address userAddress
bytes functionSignature
bytes32 sigR
bytes32 sigS
uint8 sigV
returns: bytes
mint 0x6a627842
address _to
mintBatch 0x248b71fc
address _to
uint256 _amount
pause 0x8456cb59
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
setMintPrice 0xf4a0a528
uint256 mintPrice
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updateBaseURI 0x931688cb
string __baseURI
updateOperator 0x6d44a3b2
address _operatorAddress
bool _status
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address