Address Contract Verified
Address
0x062E691c2054dE82F28008a8CCC6d7A1c8ce060D
Balance
0 ETH
Nonce
1
Code Size
20201 bytes
Creator
0xe9dA256a...EDa8 at tx 0x9fb1459f...a4cdf0
Indexed Transactions
0
Contract Bytecode
20201 bytes
0x6080604052600436106102255760003560e01c80636352211e11610123578063a22cb465116100ab578063d547cfb71161006f578063d547cfb71461080e578063de836ebd14610839578063e927fc5c14610855578063e985e9c514610880578063f2fde38b146108bd57610225565b8063a22cb46514610717578063a4f29c2414610740578063b88d4fde1461076b578063c87b56dd14610794578063c95c0d89146107d157610225565b8063853828b6116100f2578063853828b6146106615780638ad5de281461066b5780638da5cb5b1461069657806395d89b41146106c15780639db4b20b146106ec57610225565b80636352211e146105a757806370a08231146105e4578063713d987114610621578063715018a61461064a57610225565b80633502a716116101b15780634f6c998c116101755780634f6c998c146104c25780634f6ccce7146104eb57806355f804b31461052857806359a7715a146105515780635c975abb1461057c57610225565b80633502a716146103dd5780633ad10ef61461040857806342842e0e1461043357806342966c681461045c578063438b63001461048557610225565b8063095ea7b3116101f8578063095ea7b3146102f857806318160ddd1461032157806323b872dd1461034c5780632d93a44e146103755780632f745c59146103a057610225565b806301ffc9a71461022a57806302329a291461026757806306fdde0314610290578063081812fc146102bb575b600080fd5b34801561023657600080fd5b50610251600480360381019061024c91906137a8565b6108e6565b60405161025e9190613e72565b60405180910390f35b34801561027357600080fd5b5061028e6004803603810190610289919061377b565b6108f8565b005b34801561029c57600080fd5b506102a561099a565b6040516102b29190613ea8565b60405180910390f35b3480156102c757600080fd5b506102e260048036038101906102dd919061384b565b610a2c565b6040516102ef9190613de9565b60405180910390f35b34801561030457600080fd5b5061031f600480360381019061031a919061373b565b610ab1565b005b34801561032d57600080fd5b50610336610bc9565b604051610343919061422a565b60405180910390f35b34801561035857600080fd5b50610373600480360381019061036e91906135c9565b610bd6565b005b34801561038157600080fd5b5061038a610c36565b604051610397919061422a565b60405180910390f35b3480156103ac57600080fd5b506103c760048036038101906103c2919061373b565b610c40565b6040516103d4919061422a565b60405180910390f35b3480156103e957600080fd5b506103f2610ce5565b6040516103ff919061422a565b60405180910390f35b34801561041457600080fd5b5061041d610ceb565b60405161042a9190613de9565b60405180910390f35b34801561043f57600080fd5b5061045a600480360381019061045591906135c9565b610d03565b005b34801561046857600080fd5b50610483600480360381019061047e919061384b565b610d23565b005b34801561049157600080fd5b506104ac60048036038101906104a7919061352f565b610d7f565b6040516104b99190613e50565b60405180910390f35b3480156104ce57600080fd5b506104e960048036038101906104e4919061352f565b610e2d565b005b3480156104f757600080fd5b50610512600480360381019061050d919061384b565b610eed565b60405161051f919061422a565b60405180910390f35b34801561053457600080fd5b5061054f600480360381019061054a9190613802565b610f5e565b005b34801561055d57600080fd5b50610566610ff4565b604051610573919061422a565b60405180910390f35b34801561058857600080fd5b50610591611003565b60405161059e9190613e72565b60405180910390f35b3480156105b357600080fd5b506105ce60048036038101906105c9919061384b565b61101a565b6040516105db9190613de9565b60405180910390f35b3480156105f057600080fd5b5061060b6004803603810190610606919061352f565b6110cc565b604051610618919061422a565b60405180910390f35b34801561062d57600080fd5b506106486004803603810190610643919061384b565b611184565b005b34801561065657600080fd5b5061065f61120a565b005b610669611292565b005b34801561067757600080fd5b50610680611385565b60405161068d919061422a565b60405180910390f35b3480156106a257600080fd5b506106ab61138a565b6040516106b89190613de9565b60405180910390f35b3480156106cd57600080fd5b506106d66113b4565b6040516106e39190613ea8565b60405180910390f35b3480156106f857600080fd5b50610701611446565b60405161070e9190613e8d565b60405180910390f35b34801561072357600080fd5b5061073e600480360381019061073991906136fb565b61146c565b005b34801561074c57600080fd5b506107556115ed565b604051610762919061422a565b60405180910390f35b34801561077757600080fd5b50610792600480360381019061078d919061361c565b6115f3565b005b3480156107a057600080fd5b506107bb60048036038101906107b6919061384b565b611655565b6040516107c89190613ea8565b60405180910390f35b3480156107dd57600080fd5b506107f860048036038101906107f3919061384b565b6116fc565b6040516108059190613e72565b60405180910390f35b34801561081a57600080fd5b5061082361171b565b6040516108309190613ea8565b60405180910390f35b610853600480360381019061084e919061369f565b6117a9565b005b34801561086157600080fd5b5061086a611b43565b6040516108779190613de9565b60405180910390f35b34801561088c57600080fd5b506108a760048036038101906108a29190613589565b611b5b565b6040516108b49190613e72565b60405180910390f35b3480156108c957600080fd5b506108e460048036038101906108df919061352f565b611bef565b005b60006108f182611ce7565b9050919050565b610900611d61565b73ffffffffffffffffffffffffffffffffffffffff1661091e61138a565b73ffffffffffffffffffffffffffffffffffffffff1614610974576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096b9061412a565b60405180910390fd5b60011515811515141561098e57610989611d69565b610997565b610996611e0c565b5b50565b6060600080546109a990614580565b80601f01602080910402602001604051908101604052809291908181526020018280546109d590614580565b8015610a225780601f106109f757610100808354040283529160200191610a22565b820191906000526020600020905b815481529060010190602001808311610a0557829003601f168201915b5050505050905090565b6000610a3782611eae565b610a76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6d9061410a565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610abc8261101a565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b249061418a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b4c611d61565b73ffffffffffffffffffffffffffffffffffffffff161480610b7b5750610b7a81610b75611d61565b611b5b565b5b610bba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb19061406a565b60405180910390fd5b610bc48383611f1a565b505050565b6000600880549050905090565b610be7610be1611d61565b82611fd3565b610c26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1d906141ca565b60405180910390fd5b610c318383836120b1565b505050565b6000600c54905090565b6000610c4b836110cc565b8210610c8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8390613f2a565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b6122b881565b73cbcc84766f2950cf867f42d766c43fb2d2ba325681565b610d1e838383604051806020016040528060008152506115f3565b505050565b610d34610d2e611d61565b82611fd3565b610d73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6a9061420a565b60405180910390fd5b610d7c8161230d565b50565b60606000610d8c836110cc565b905060008167ffffffffffffffff811115610daa57610da9614748565b5b604051908082528060200260200182016040528015610dd85781602001602082028036833780820191505090505b50905060005b82811015610e2257610df08582610c40565b828281518110610e0357610e02614719565b5b6020026020010181815250508080610e1a906145e3565b915050610dde565b508092505050919050565b610e35611d61565b73ffffffffffffffffffffffffffffffffffffffff16610e5361138a565b73ffffffffffffffffffffffffffffffffffffffff1614610ea9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea09061412a565b60405180910390fd5b80600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610ef7610bc9565b8210610f38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2f906141ea565b60405180910390fd5b60088281548110610f4c57610f4b614719565b5b90600052602060002001549050919050565b610f66611d61565b73ffffffffffffffffffffffffffffffffffffffff16610f8461138a565b73ffffffffffffffffffffffffffffffffffffffff1614610fda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd19061412a565b60405180910390fd5b80600e9080519060200190610ff0929190613290565b5050565b6000610ffe61241e565b905090565b6000600a60149054906101000a900460ff16905090565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ba906140aa565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561113d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111349061408a565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61118c611d61565b73ffffffffffffffffffffffffffffffffffffffff166111aa61138a565b73ffffffffffffffffffffffffffffffffffffffff1614611200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f79061412a565b60405180910390fd5b80600c8190555050565b611212611d61565b73ffffffffffffffffffffffffffffffffffffffff1661123061138a565b73ffffffffffffffffffffffffffffffffffffffff1614611286576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127d9061412a565b60405180910390fd5b611290600061242f565b565b61129a611d61565b73ffffffffffffffffffffffffffffffffffffffff166112b861138a565b73ffffffffffffffffffffffffffffffffffffffff161461130e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113059061412a565b60405180910390fd5b60004790506000811161132057600080fd5b61136473cbcc84766f2950cf867f42d766c43fb2d2ba325661135f60646113516023866124f590919063ffffffff16565b61250b90919063ffffffff16565b612521565b611382736f84fa72ca4554e0eefcb9032e5a4f1fb41b726c47612521565b50565b600a81565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546113c390614580565b80601f01602080910402602001604051908101604052809291908181526020018280546113ef90614580565b801561143c5780601f106114115761010080835404028352916020019161143c565b820191906000526020600020905b81548152906001019060200180831161141f57829003601f168201915b5050505050905090565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611474611d61565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d990613fea565b60405180910390fd5b80600560006114ef611d61565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661159c611d61565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516115e19190613e72565b60405180910390a35050565b600c5481565b6116046115fe611d61565b83611fd3565b611643576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163a906141ca565b60405180910390fd5b61164f848484846125d2565b50505050565b606061166082611eae565b61169f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116969061416a565b60405180910390fd5b60006116a961262e565b905060008151116116c957604051806020016040528060008152506116f4565b806116d3846126c0565b6040516020016116e4929190613db0565b6040516020818303038152906040525b915050919050565b600080600d600084815260200190815260200160002054149050919050565b600e805461172890614580565b80601f016020809104026020016040519081016040528092919081815260200182805461175490614580565b80156117a15780601f10611776576101008083540402835291602001916117a1565b820191906000526020600020905b81548152906001019060200180831161178457829003601f168201915b505050505081565b600c544211156117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e5906140ca565b60405180910390fd5b6122b86117f961241e565b111561183a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611831906140ca565b60405180910390fd5b61184261138a565b73ffffffffffffffffffffffffffffffffffffffff16611860611d61565b73ffffffffffffffffffffffffffffffffffffffff16146118c457611883611003565b156118c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ba9061404a565b60405180910390fd5b5b60006118ce61241e565b90506122b8811115611915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190c906140ca565b60405180910390fd5b6122b8825182611925919061437f565b1115611966576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195d9061400a565b60405180910390fd5b600a825111156119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a290613f0a565b60405180910390fd5b60005b8251811015611b3d5760008382815181106119cc576119cb614719565b5b602002602001015190506119df816116fc565b8015611ac757506119ee611d61565b73ffffffffffffffffffffffffffffffffffffffff16600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b8152600401611a5f919061422a565b60206040518083038186803b158015611a7757600080fd5b505afa158015611a8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aaf919061355c565b73ffffffffffffffffffffffffffffffffffffffff16145b611b06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611afd90613faa565b60405180910390fd5b6001600d600083815260200190815260200160002081905550611b298582612821565b508080611b35906145e3565b9150506119ae565b50505050565b736f84fa72ca4554e0eefcb9032e5a4f1fb41b726c81565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611bf7611d61565b73ffffffffffffffffffffffffffffffffffffffff16611c1561138a565b73ffffffffffffffffffffffffffffffffffffffff1614611c6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c629061412a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611cdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd290613f6a565b60405180910390fd5b611ce48161242f565b50565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611d5a5750611d5982612866565b5b9050919050565b600033905090565b611d71611003565b15611db1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da89061404a565b60405180910390fd5b6001600a60146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611df5611d61565b604051611e029190613de9565b60405180910390a1565b611e14611003565b611e53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4a90613eea565b60405180910390fd5b6000600a60146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611e97611d61565b604051611ea49190613de9565b60405180910390a1565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611f8d8361101a565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611fde82611eae565b61201d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120149061402a565b60405180910390fd5b60006120288361101a565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061209757508373ffffffffffffffffffffffffffffffffffffffff1661207f84610a2c565b73ffffffffffffffffffffffffffffffffffffffff16145b806120a857506120a78185611b5b565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166120d18261101a565b73ffffffffffffffffffffffffffffffffffffffff1614612127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161211e9061414a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612197576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218e90613fca565b60405180910390fd5b6121a2838383612948565b6121ad600082611f1a565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546121fd9190614460565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612254919061437f565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006123188261101a565b905061232681600084612948565b612331600083611f1a565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546123819190614460565b925050819055506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600061242a600b612958565b905090565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081836125039190614406565b905092915050565b6000818361251991906143d5565b905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff168260405161254790613dd4565b60006040518083038185875af1925050503d8060008114612584576040519150601f19603f3d011682016040523d82523d6000602084013e612589565b606091505b50509050806125cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125c4906141aa565b60405180910390fd5b505050565b6125dd8484846120b1565b6125e984848484612966565b612628576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161261f90613f4a565b60405180910390fd5b50505050565b6060600e805461263d90614580565b80601f016020809104026020016040519081016040528092919081815260200182805461266990614580565b80156126b65780601f1061268b576101008083540402835291602001916126b6565b820191906000526020600020905b81548152906001019060200180831161269957829003601f168201915b5050505050905090565b60606000821415612708576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061281c565b600082905060005b6000821461273a578080612723906145e3565b915050600a8261273391906143d5565b9150612710565b60008167ffffffffffffffff81111561275657612755614748565b5b6040519080825280601f01601f1916602001820160405280156127885781602001600182028036833780820191505090505b5090505b60008514612815576001826127a19190614460565b9150600a856127b0919061462c565b60306127bc919061437f565b60f81b8183815181106127d2576127d1614719565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561280e91906143d5565b945061278c565b8093505050505b919050565b61282b600b612afd565b6128358282612b13565b807fdf0769872e7178409bf18f4c81d9d2c75e7729002aa806eccb640e280517496460405160405180910390a25050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061293157507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612941575061294082612b31565b5b9050919050565b612953838383612b9b565b505050565b600081600001549050919050565b60006129878473ffffffffffffffffffffffffffffffffffffffff16612c35565b15612af0578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026129b0611d61565b8786866040518563ffffffff1660e01b81526004016129d29493929190613e04565b602060405180830381600087803b1580156129ec57600080fd5b505af1925050508015612a1d57506040513d601f19601f82011682018060405250810190612a1a91906137d5565b60015b612aa0573d8060008114612a4d576040519150601f19603f3d011682016040523d82523d6000602084013e612a52565b606091505b50600081511415612a98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a8f90613f4a565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612af5565b600190505b949350505050565b6001816000016000828254019250508190555050565b612b2d828260405180602001604052806000815250612c48565b5050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612ba6838383612ca3565b612bae61138a565b73ffffffffffffffffffffffffffffffffffffffff16612bcc611d61565b73ffffffffffffffffffffffffffffffffffffffff1614612c3057612bef611003565b15612c2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c2690613eca565b60405180910390fd5b5b505050565b600080823b905060008111915050919050565b612c528383612db7565b612c5f6000848484612966565b612c9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c9590613f4a565b60405180910390fd5b505050565b612cae838383612f85565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612cf157612cec81612f8a565b612d30565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612d2f57612d2e8382612fd3565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612d7357612d6e81613140565b612db2565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612db157612db08282613211565b5b5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612e27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e1e906140ea565b60405180910390fd5b612e3081611eae565b15612e70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e6790613f8a565b60405180910390fd5b612e7c60008383612948565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612ecc919061437f565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001612fe0846110cc565b612fea9190614460565b90506000600760008481526020019081526020016000205490508181146130cf576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b600060016008805490506131549190614460565b905060006009600084815260200190815260200160002054905060006008838154811061318457613183614719565b5b9060005260206000200154905080600883815481106131a6576131a5614719565b5b9060005260206000200181905550816009600083815260200190815260200160002081905550600960008581526020019081526020016000206000905560088054806131f5576131f46146ea565b5b6001900381819060005260206000200160009055905550505050565b600061321c836110cc565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b82805461329c90614580565b90600052602060002090601f0160209004810192826132be5760008555613305565b82601f106132d757805160ff1916838001178555613305565b82800160010185558215613305579182015b828111156133045782518255916020019190600101906132e9565b5b5090506133129190613316565b5090565b5b8082111561332f576000816000905550600101613317565b5090565b60006133466133418461426a565b614245565b905080838252602082019050828560208602820111156133695761336861477c565b5b60005b85811015613399578161337f888261351a565b84526020840193506020830192505060018101905061336c565b5050509392505050565b60006133b66133b184614296565b614245565b9050828152602081018484840111156133d2576133d1614781565b5b6133dd84828561453e565b509392505050565b60006133f86133f3846142c7565b614245565b90508281526020810184848401111561341457613413614781565b5b61341f84828561453e565b509392505050565b60008135905061343681614e57565b92915050565b60008151905061344b81614e57565b92915050565b600082601f83011261346657613465614777565b5b8135613476848260208601613333565b91505092915050565b60008135905061348e81614e6e565b92915050565b6000813590506134a381614e85565b92915050565b6000815190506134b881614e85565b92915050565b600082601f8301126134d3576134d2614777565b5b81356134e38482602086016133a3565b91505092915050565b600082601f83011261350157613500614777565b5b81356135118482602086016133e5565b91505092915050565b60008135905061352981614e9c565b92915050565b6000602082840312156135455761354461478b565b5b600061355384828501613427565b91505092915050565b6000602082840312156135725761357161478b565b5b60006135808482850161343c565b91505092915050565b600080604083850312156135a05761359f61478b565b5b60006135ae85828601613427565b92505060206135bf85828601613427565b9150509250929050565b6000806000606084860312156135e2576135e161478b565b5b60006135f086828701613427565b935050602061360186828701613427565b92505060406136128682870161351a565b9150509250925092565b600080600080608085870312156136365761363561478b565b5b600061364487828801613427565b945050602061365587828801613427565b93505060406136668782880161351a565b925050606085013567ffffffffffffffff81111561368757613686614786565b5b613693878288016134be565b91505092959194509250565b600080604083850312156136b6576136b561478b565b5b60006136c485828601613427565b925050602083013567ffffffffffffffff8111156136e5576136e4614786565b5b6136f185828601613451565b9150509250929050565b600080604083850312156137125761371161478b565b5b600061372085828601613427565b92505060206137318582860161347f565b9150509250929050565b600080604083850312156137525761375161478b565b5b600061376085828601613427565b92505060206137718582860161351a565b9150509250929050565b6000602082840312156137915761379061478b565b5b600061379f8482850161347f565b91505092915050565b6000602082840312156137be576137bd61478b565b5b60006137cc84828501613494565b91505092915050565b6000602082840312156137eb576137ea61478b565b5b60006137f9848285016134a9565b91505092915050565b6000602082840312156138185761381761478b565b5b600082013567ffffffffffffffff81111561383657613835614786565b5b613842848285016134ec565b91505092915050565b6000602082840312156138615761386061478b565b5b600061386f8482850161351a565b91505092915050565b60006138848383613d92565b60208301905092915050565b61389981614494565b82525050565b60006138aa82614308565b6138b48185614336565b93506138bf836142f8565b8060005b838110156138f05781516138d78882613878565b97506138e283614329565b9250506001810190506138c3565b5085935050505092915050565b613906816144a6565b82525050565b600061391782614313565b6139218185614347565b935061393181856020860161454d565b61393a81614790565b840191505092915050565b61394e81614508565b82525050565b600061395f8261431e565b6139698185614363565b935061397981856020860161454d565b61398281614790565b840191505092915050565b60006139988261431e565b6139a28185614374565b93506139b281856020860161454d565b80840191505092915050565b60006139cb602b83614363565b91506139d6826147a1565b604082019050919050565b60006139ee601483614363565b91506139f9826147f0565b602082019050919050565b6000613a11600e83614363565b9150613a1c82614819565b602082019050919050565b6000613a34602b83614363565b9150613a3f82614842565b604082019050919050565b6000613a57603283614363565b9150613a6282614891565b604082019050919050565b6000613a7a602683614363565b9150613a85826148e0565b604082019050919050565b6000613a9d601c83614363565b9150613aa88261492f565b602082019050919050565b6000613ac0600a83614363565b9150613acb82614958565b602082019050919050565b6000613ae3602483614363565b9150613aee82614981565b604082019050919050565b6000613b06601983614363565b9150613b11826149d0565b602082019050919050565b6000613b29600983614363565b9150613b34826149f9565b602082019050919050565b6000613b4c602c83614363565b9150613b5782614a22565b604082019050919050565b6000613b6f601083614363565b9150613b7a82614a71565b602082019050919050565b6000613b92603883614363565b9150613b9d82614a9a565b604082019050919050565b6000613bb5602a83614363565b9150613bc082614ae9565b604082019050919050565b6000613bd8602983614363565b9150613be382614b38565b604082019050919050565b6000613bfb600983614363565b9150613c0682614b87565b602082019050919050565b6000613c1e602083614363565b9150613c2982614bb0565b602082019050919050565b6000613c41602c83614363565b9150613c4c82614bd9565b604082019050919050565b6000613c64602083614363565b9150613c6f82614c28565b602082019050919050565b6000613c87602983614363565b9150613c9282614c51565b604082019050919050565b6000613caa602f83614363565b9150613cb582614ca0565b604082019050919050565b6000613ccd602183614363565b9150613cd882614cef565b604082019050919050565b6000613cf0600083614358565b9150613cfb82614d3e565b600082019050919050565b6000613d13601083614363565b9150613d1e82614d41565b602082019050919050565b6000613d36603183614363565b9150613d4182614d6a565b604082019050919050565b6000613d59602c83614363565b9150613d6482614db9565b604082019050919050565b6000613d7c603083614363565b9150613d8782614e08565b604082019050919050565b613d9b816144fe565b82525050565b613daa816144fe565b82525050565b6000613dbc828561398d565b9150613dc8828461398d565b91508190509392505050565b6000613ddf82613ce3565b9150819050919050565b6000602082019050613dfe6000830184613890565b92915050565b6000608082019050613e196000830187613890565b613e266020830186613890565b613e336040830185613da1565b8181036060830152613e45818461390c565b905095945050505050565b60006020820190508181036000830152613e6a818461389f565b905092915050565b6000602082019050613e8760008301846138fd565b92915050565b6000602082019050613ea26000830184613945565b92915050565b60006020820190508181036000830152613ec28184613954565b905092915050565b60006020820190508181036000830152613ee3816139be565b9050919050565b60006020820190508181036000830152613f03816139e1565b9050919050565b60006020820190508181036000830152613f2381613a04565b9050919050565b60006020820190508181036000830152613f4381613a27565b9050919050565b60006020820190508181036000830152613f6381613a4a565b9050919050565b60006020820190508181036000830152613f8381613a6d565b9050919050565b60006020820190508181036000830152613fa381613a90565b9050919050565b60006020820190508181036000830152613fc381613ab3565b9050919050565b60006020820190508181036000830152613fe381613ad6565b9050919050565b6000602082019050818103600083015261400381613af9565b9050919050565b6000602082019050818103600083015261402381613b1c565b9050919050565b6000602082019050818103600083015261404381613b3f565b9050919050565b6000602082019050818103600083015261406381613b62565b9050919050565b6000602082019050818103600083015261408381613b85565b9050919050565b600060208201905081810360008301526140a381613ba8565b9050919050565b600060208201905081810360008301526140c381613bcb565b9050919050565b600060208201905081810360008301526140e381613bee565b9050919050565b6000602082019050818103600083015261410381613c11565b9050919050565b6000602082019050818103600083015261412381613c34565b9050919050565b6000602082019050818103600083015261414381613c57565b9050919050565b6000602082019050818103600083015261416381613c7a565b9050919050565b6000602082019050818103600083015261418381613c9d565b9050919050565b600060208201905081810360008301526141a381613cc0565b9050919050565b600060208201905081810360008301526141c381613d06565b9050919050565b600060208201905081810360008301526141e381613d29565b9050919050565b6000602082019050818103600083015261420381613d4c565b9050919050565b6000602082019050818103600083015261422381613d6f565b9050919050565b600060208201905061423f6000830184613da1565b92915050565b600061424f614260565b905061425b82826145b2565b919050565b6000604051905090565b600067ffffffffffffffff82111561428557614284614748565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156142b1576142b0614748565b5b6142ba82614790565b9050602081019050919050565b600067ffffffffffffffff8211156142e2576142e1614748565b5b6142eb82614790565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061438a826144fe565b9150614395836144fe565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156143ca576143c961465d565b5b828201905092915050565b60006143e0826144fe565b91506143eb836144fe565b9250826143fb576143fa61468c565b5b828204905092915050565b6000614411826144fe565b915061441c836144fe565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156144555761445461465d565b5b828202905092915050565b600061446b826144fe565b9150614476836144fe565b9250828210156144895761448861465d565b5b828203905092915050565b600061449f826144de565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006145138261451a565b9050919050565b60006145258261452c565b9050919050565b6000614537826144de565b9050919050565b82818337600083830152505050565b60005b8381101561456b578082015181840152602081019050614550565b8381111561457a576000848401525b50505050565b6000600282049050600182168061459857607f821691505b602082108114156145ac576145ab6146bb565b5b50919050565b6145bb82614790565b810181811067ffffffffffffffff821117156145da576145d9614748565b5b80604052505050565b60006145ee826144fe565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156146215761462061465d565b5b600182019050919050565b6000614637826144fe565b9150614642836144fe565b9250826146525761465161468c565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4552433732315061757361626c653a20746f6b656e207472616e73666572207760008201527f68696c6520706175736564000000000000000000000000000000000000000000602082015250565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b7f45786365656473206e756d626572000000000000000000000000000000000000600082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f426164206f776e65722100000000000000000000000000000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4d6178206c696d69740000000000000000000000000000000000000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f436c61696d20656e640000000000000000000000000000000000000000000000600082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f5472616e73666572206661696c65642e00000000000000000000000000000000600082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656400000000000000000000000000000000602082015250565b614e6081614494565b8114614e6b57600080fd5b50565b614e77816144a6565b8114614e8257600080fd5b50565b614e8e816144b2565b8114614e9957600080fd5b50565b614ea5816144fe565b8114614eb057600080fd5b5056fea2646970667358221220a424926e1b6d67fa14d49cf0abfb96563ee454c4233d27a533f6f4bc648c362464736f6c63430008070033
Verified Source Code Full Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: No
PudgyPresent.sol 137 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./ERC721Pausable.sol";
import "./PudgyPenguinsInterface.sol";
contract PudgyPresent is ERC721Enumerable, Ownable, ERC721Burnable, ERC721Pausable {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIdTracker;
uint256 public constant MAX_ELEMENTS = 8888;
uint256 public constant MAX_BY_MINT = 10;
uint256 public endClaim_timestamp = 1630958400; // Thu Sept 06 2021 20:00:00 UTC
mapping (uint256 => uint256) private _pudgyPenguinsUsed;
string public baseTokenURI;
event CreatePenguinPresent(uint256 indexed id);
PudgyPenguinsInterface public pudgyPenguins;
constructor(string memory baseURI) ERC721("PudgyPresent", "PP") {
setBaseURI(baseURI);
pause(true);
}
modifier claimIsOpen {
require(block.timestamp <= endClaim_timestamp, "Claim end");
require(_totalSupply() <= MAX_ELEMENTS, "Claim end");
if (_msgSender() != owner()) {
require(!paused(), "Pausable: paused");
}
_;
}
function _totalSupply() internal view returns (uint) {
return _tokenIdTracker.current();
}
function totalMint() public view returns (uint256) {
return _totalSupply();
}
function mint(address _to, uint256[] memory _tokensId) public payable claimIsOpen {
uint256 total = _totalSupply();
require(total <= MAX_ELEMENTS, "Claim end");
require(total + _tokensId.length <= MAX_ELEMENTS, "Max limit");
require(_tokensId.length <= MAX_BY_MINT, "Exceeds number");
for (uint256 i = 0; i < _tokensId.length; i++) {
uint256 _tokenId = _tokensId[i];
require(canClaim(_tokenId) && pudgyPenguins.ownerOf(_tokenId) == _msgSender(), "Bad owner!");
_pudgyPenguinsUsed[_tokenId] = 1;
_mintAnElement(_to, _tokenId);
}
}
function canClaim(uint256 _tokenId) public view returns(bool) {
return _pudgyPenguinsUsed[_tokenId] == 0;
}
function _mintAnElement(address _to, uint256 id) private {
_tokenIdTracker.increment();
_safeMint(_to, id);
emit CreatePenguinPresent(id);
}
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
function setBaseURI(string memory baseURI) public onlyOwner {
baseTokenURI = baseURI;
}
function walletOfOwner(address _owner) external view returns (uint256[] memory) {
uint256 tokenCount = balanceOf(_owner);
uint256[] memory tokensId = new uint256[](tokenCount);
for (uint256 i = 0; i < tokenCount; i++) {
tokensId[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokensId;
}
function pause(bool val) public onlyOwner {
if (val == true) {
_pause();
return;
}
_unpause();
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override(ERC721, ERC721Enumerable, ERC721Pausable) {
super._beforeTokenTransfer(from, to, tokenId);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC721Enumerable) returns (bool) {
return super.supportsInterface(interfaceId);
}
function setEndClaimDate(uint256 _end) public onlyOwner{
endClaim_timestamp = _end;
}
function getEndClaimDate() public view returns(uint256){
return endClaim_timestamp;
}
function setPudgyPenguins(address _pudgyPenguins) external onlyOwner {
pudgyPenguins = PudgyPenguinsInterface(_pudgyPenguins);
}
address public constant creatorAddress = 0x6F84Fa72Ca4554E0eEFcB9032e5A4F1FB41b726C;
address public constant devAddress = 0xcBCc84766F2950CF867f42D766c43fB2D2Ba3256;
function withdrawAll() public payable onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0);
_widthdraw(devAddress, balance.mul(35).div(100));
_widthdraw(creatorAddress, address(this).balance);
}
function _widthdraw(address _address, uint256 _amount) private {
(bool success, ) = _address.call{value: _amount}("");
require(success, "Transfer failed.");
}
}
ERC721Pausable.sol 34 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.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, Ownable, 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);
if (_msgSender() != owner()) {
require(!paused(), "ERC721Pausable: token transfer while paused");
}
}
}
Address.sol 210 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Counters.sol 42 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
Pausable.sol 90 lines
// SPDX-License-Identifier: MIT
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 411 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).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 {}
}
SafeMath.sol 226 lines
// SPDX-License-Identifier: MIT
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 no longer needed starting with Solidity 0.8. 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 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
PudgyPenguinsInterface.sol 6 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract PudgyPenguinsInterface{
function ownerOf(uint256 _token) public view returns(address){}
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
ERC721Burnable.sol 25 lines
// SPDX-License-Identifier: MIT
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);
}
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 162 lines
// SPDX-License-Identifier: MIT
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 28 lines
// SPDX-License-Identifier: MIT
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 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
MAX_BY_MINT 0x8ad5de28 → uint256
MAX_ELEMENTS 0x3502a716 → uint256
balanceOf 0x70a08231 → uint256
baseTokenURI 0xd547cfb7 → string
canClaim 0xc95c0d89 → bool
creatorAddress 0xe927fc5c → address
devAddress 0x3ad10ef6 → address
endClaim_timestamp 0xa4f29c24 → uint256
getApproved 0x081812fc → address
getEndClaimDate 0x2d93a44e → uint256
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
pudgyPenguins 0x9db4b20b → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalMint 0x59a7715a → uint256
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 tokenId
mint 0xde836ebd
address _to
uint256[] _tokensId
pause 0x02329a29
bool val
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string baseURI
setEndClaimDate 0x713d9871
uint256 _end
setPudgyPenguins 0x4f6c998c
address _pudgyPenguins
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdrawAll 0x853828b6
No parameters
Recent Transactions
No transactions found for this address