Address Contract Verified
Address
0x9861aDd6B2C5Ce1F02bD48a86fE4154A93be7d1b
Balance
0 ETH
Nonce
1
Code Size
19869 bytes
Creator
0xc8523aD5...e136 at tx 0xb34d8bf0...3947d3
Indexed Transactions
0
Contract Bytecode
19869 bytes
0x60806040526004361061020f5760003560e01c80636352211e1161011857806395d89b41116100a0578063ba0b8fee1161006f578063ba0b8fee14610754578063c87b56dd14610770578063d547cfb7146107ad578063e985e9c5146107d8578063f2fde38b146108155761020f565b806395d89b41146106ac578063a22cb465146106d7578063a82524b214610700578063b88d4fde1461072b5761020f565b806378e97925116100e757806378e97925146105d95780637e738f631461060457806387ce1f801461062d5780638da5cb5b146106585780639466565d146106835761020f565b80636352211e1461051d57806367a47c741461055a57806370a0823114610585578063715018a6146105c25761020f565b80632e4ba31c1161019b5780633ccfd60b1161016a5780633ccfd60b1461044e5780633e0a322d1461046557806342842e0e1461048e578063438b6300146104b75780634783f0ef146104f45761020f565b80632e4ba31c146103a45780632eb4a7ab146103cf5780632fad5916146103fa57806330176e13146104255761020f565b80631171bda9116101e25780631171bda9146102e257806318160ddd1461030b5780631e93d30d1461033657806323b872dd14610352578063296cab551461037b5761020f565b806301ffc9a71461021457806306fdde0314610251578063081812fc1461027c578063095ea7b3146102b9575b600080fd5b34801561022057600080fd5b5061023b6004803603810190610236919061359c565b61083e565b60405161024891906143eb565b60405180910390f35b34801561025d57600080fd5b50610266610850565b6040516102739190614421565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190613658565b6108e2565b6040516102b09190614339565b60405180910390f35b3480156102c557600080fd5b506102e060048036038101906102db919061350e565b610967565b005b3480156102ee57600080fd5b5061030960048036038101906103049190613408565b610a7f565b005b34801561031757600080fd5b50610320610b2b565b60405161032d91906147e3565b60405180910390f35b610350600480360381019061034b9190613681565b610b48565b005b34801561035e57600080fd5b5061037960048036038101906103749190613408565b610e18565b005b34801561038757600080fd5b506103a2600480360381019061039d9190613658565b610e78565b005b3480156103b057600080fd5b506103b9610efe565b6040516103c691906147e3565b60405180910390f35b3480156103db57600080fd5b506103e4610f03565b6040516103f19190614406565b60405180910390f35b34801561040657600080fd5b5061040f610f09565b60405161041c91906147e3565b60405180910390f35b34801561043157600080fd5b5061044c60048036038101906104479190613617565b610f0f565b005b34801561045a57600080fd5b50610463610fa5565b005b34801561047157600080fd5b5061048c60048036038101906104879190613658565b611070565b005b34801561049a57600080fd5b506104b560048036038101906104b09190613408565b6110f6565b005b3480156104c357600080fd5b506104de60048036038101906104d991906133a3565b611116565b6040516104eb91906143c9565b60405180910390f35b34801561050057600080fd5b5061051b60048036038101906105169190613573565b611273565b005b34801561052957600080fd5b50610544600480360381019061053f9190613658565b6112f9565b6040516105519190614339565b60405180910390f35b34801561056657600080fd5b5061056f6113ab565b60405161057c91906147e3565b60405180910390f35b34801561059157600080fd5b506105ac60048036038101906105a791906133a3565b6113b0565b6040516105b991906147e3565b60405180910390f35b3480156105ce57600080fd5b506105d7611468565b005b3480156105e557600080fd5b506105ee6114f0565b6040516105fb91906147e3565b60405180910390f35b34801561061057600080fd5b5061062b6004803603810190610626919061350e565b6114f6565b005b34801561063957600080fd5b506106426116de565b60405161064f91906147e3565b60405180910390f35b34801561066457600080fd5b5061066d6116e4565b60405161067a9190614339565b60405180910390f35b34801561068f57600080fd5b506106aa60048036038101906106a59190613658565b61170e565b005b3480156106b857600080fd5b506106c1611794565b6040516106ce9190614421565b60405180910390f35b3480156106e357600080fd5b506106fe60048036038101906106f991906134d2565b611826565b005b34801561070c57600080fd5b5061071561183c565b60405161072291906147e3565b60405180910390f35b34801561073757600080fd5b50610752600480360381019061074d9190613457565b611842565b005b61076e60048036038101906107699190613658565b6118a4565b005b34801561077c57600080fd5b5061079760048036038101906107929190613658565b611a9c565b6040516107a49190614421565b60405180910390f35b3480156107b957600080fd5b506107c2611bfd565b6040516107cf9190614421565b60405180910390f35b3480156107e457600080fd5b506107ff60048036038101906107fa91906133cc565b611c8b565b60405161080c91906143eb565b60405180910390f35b34801561082157600080fd5b5061083c600480360381019061083791906133a3565b611d8d565b005b600061084982611e9b565b9050919050565b60606000805461085f90614b29565b80601f016020809104026020016040519081016040528092919081815260200182805461088b90614b29565b80156108d85780601f106108ad576101008083540402835291602001916108d8565b820191906000526020600020905b8154815290600101906020018083116108bb57829003601f168201915b5050505050905090565b60006108ed82611f7d565b61092c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092390614663565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610972826112f9565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109da90614703565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610a02611fe9565b73ffffffffffffffffffffffffffffffffffffffff161480610a315750610a3081610a2b611fe9565b611c8b565b5b610a70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a67906145a3565b60405180910390fd5b610a7a8383611ff1565b505050565b610a87611fe9565b73ffffffffffffffffffffffffffffffffffffffff16610aa56116e4565b73ffffffffffffffffffffffffffffffffffffffff1614610afb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af290614683565b60405180910390fd5b610b2682828573ffffffffffffffffffffffffffffffffffffffff166120aa9092919063ffffffff16565b505050565b60006001610b396011612130565b610b439190614a23565b905090565b60026008541415610b8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b85906147a3565b60405180910390fd5b600260088190555060006001610ba46011612130565b610bae9190614a23565b90506000600d54118015610bc45750600d544210155b610c03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfa906144a3565b60405180910390fd5b6000801b600a541415610c4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4290614623565b60405180910390fd5b600083118015610c6f57506005610c61336113b0565b84610c6c9190614942565b11155b610cae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca590614523565b60405180910390fd5b610ceb600a5433604051602001610cc591906142aa565b604051602081830303815290604052805190602001208461213e9092919063ffffffff16565b610d2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d21906147c3565b60405180910390fd5b82600b54610d3891906149c9565b341015610d7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7190614543565b60405180910390fd5b6122b88382610d899190614942565b1115610dca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc1906146e3565b60405180910390fd5b6000600190505b838111610e0a57610ded338284610de89190614942565b612155565b610df76011611e85565b8080610e0290614b5b565b915050610dd1565b505060016008819055505050565b610e29610e23611fe9565b82612173565b610e68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5f90614723565b60405180910390fd5b610e73838383612251565b505050565b610e80611fe9565b73ffffffffffffffffffffffffffffffffffffffff16610e9e6116e4565b73ffffffffffffffffffffffffffffffffffffffff1614610ef4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eeb90614683565b60405180910390fd5b80600d8190555050565b600581565b600a5481565b600b5481565b610f17611fe9565b73ffffffffffffffffffffffffffffffffffffffff16610f356116e4565b73ffffffffffffffffffffffffffffffffffffffff1614610f8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8290614683565b60405180910390fd5b8060099080519060200190610fa19291906130f2565b5050565b610fad611fe9565b73ffffffffffffffffffffffffffffffffffffffff16610fcb6116e4565b73ffffffffffffffffffffffffffffffffffffffff1614611021576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101890614683565b60405180910390fd5b60004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561106c573d6000803e3d6000fd5b5050565b611078611fe9565b73ffffffffffffffffffffffffffffffffffffffff166110966116e4565b73ffffffffffffffffffffffffffffffffffffffff16146110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e390614683565b60405180910390fd5b80600e8190555050565b61111183838360405180602001604052806000815250611842565b505050565b60606000611123836113b0565b905060008167ffffffffffffffff811115611167577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156111955781602001602082028036833780820191505090505b50905060006001905060005b83811080156111b857506111b56011612130565b82105b156112675760006111c8836112f9565b90508673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156112535782848381518110611238577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018181525050818061124f90614b5b565b9250505b828061125e90614b5b565b935050506111a1565b82945050505050919050565b61127b611fe9565b73ffffffffffffffffffffffffffffffffffffffff166112996116e4565b73ffffffffffffffffffffffffffffffffffffffff16146112ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e690614683565b60405180910390fd5b80600a8190555050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611399906145e3565b60405180910390fd5b80915050919050565b600a81565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611421576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611418906145c3565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611470611fe9565b73ffffffffffffffffffffffffffffffffffffffff1661148e6116e4565b73ffffffffffffffffffffffffffffffffffffffff16146114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90614683565b60405180910390fd5b6114ee60006124ad565b565b600e5481565b6114fe611fe9565b73ffffffffffffffffffffffffffffffffffffffff1661151c6116e4565b73ffffffffffffffffffffffffffffffffffffffff1614611572576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156990614683565b60405180910390fd5b600060016115806011612130565b61158a9190614a23565b90506000600e5490506000811180156115a35750804210155b6115e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d990614763565b60405180910390fd5b6000831180156115f45750600c548311155b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a906144c3565b60405180910390fd5b6122b883836116429190614942565b1115611683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167a906146e3565b60405180910390fd5b6000600190505b8381116116c3576116a68582856116a19190614942565b612155565b6116b06011611e85565b80806116bb90614b5b565b91505061168a565b5082600c546116d29190614a23565b600c8190555050505050565b6122b881565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611716611fe9565b73ffffffffffffffffffffffffffffffffffffffff166117346116e4565b73ffffffffffffffffffffffffffffffffffffffff161461178a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178190614683565b60405180910390fd5b80600b8190555050565b6060600180546117a390614b29565b80601f01602080910402602001604051908101604052809291908181526020018280546117cf90614b29565b801561181c5780601f106117f15761010080835404028352916020019161181c565b820191906000526020600020905b8154815290600101906020018083116117ff57829003601f168201915b5050505050905090565b611838611831611fe9565b8383612573565b5050565b600d5481565b61185361184d611fe9565b83612173565b611892576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188990614723565b60405180910390fd5b61189e848484846126e0565b50505050565b600260085414156118ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e1906147a3565b60405180910390fd5b6002600881905550600060016119006011612130565b61190a9190614a23565b90506000600e541180156119205750600e544210155b61195f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195690614763565b60405180910390fd5b6000821180156119705750600a8211155b6119af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a690614603565b60405180910390fd5b6122b882826119be9190614942565b11156119ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f6906146e3565b60405180910390fd5b81600b54611a0d91906149c9565b341015611a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4690614543565b60405180910390fd5b6000600190505b828111611a8f57611a72338284611a6d9190614942565b612155565b611a7c6011611e85565b8080611a8790614b5b565b915050611a56565b5050600160088190555050565b6060611aa782611f7d565b611ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611add906146c3565b60405180910390fd5b600060098054611af590614b29565b80601f0160208091040260200160405190810160405280929190818152602001828054611b2190614b29565b8015611b6e5780601f10611b4357610100808354040283529160200191611b6e565b820191906000526020600020905b815481529060010190602001808311611b5157829003601f168201915b505050505090506000815111611b935760405180602001604052806000815250611bf5565b80611b9d8461273c565b6040518060400160405280600581526020017f2e6a736f6e000000000000000000000000000000000000000000000000000000815250604051602001611be593929190614308565b6040516020818303038152906040525b915050919050565b60098054611c0a90614b29565b80601f0160208091040260200160405190810160405280929190818152602001828054611c3690614b29565b8015611c835780601f10611c5857610100808354040283529160200191611c83565b820191906000526020600020905b815481529060010190602001808311611c6657829003601f168201915b505050505081565b600080600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1663c4552791866040518263ffffffff1660e01b8152600401611d039190614339565b60206040518083038186803b158015611d1b57600080fd5b505afa158015611d2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5391906135ee565b73ffffffffffffffffffffffffffffffffffffffff161415611d79576001915050611d87565b611d8384846128e9565b9150505b92915050565b611d95611fe9565b73ffffffffffffffffffffffffffffffffffffffff16611db36116e4565b73ffffffffffffffffffffffffffffffffffffffff1614611e09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0090614683565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611e79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7090614463565b60405180910390fd5b611e82816124ad565b50565b6001816000016000828254019250508190555050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611f6657507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611f765750611f758261297d565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612064836112f9565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b61212b8363a9059cbb60e01b84846040516024016120c99291906143a0565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506129e7565b505050565b600081600001549050919050565b60008261214b8584612aae565b1490509392505050565b61216f828260405180602001604052806000815250612b87565b5050565b600061217e82611f7d565b6121bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b490614583565b60405180910390fd5b60006121c8836112f9565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061223757508373ffffffffffffffffffffffffffffffffffffffff1661221f846108e2565b73ffffffffffffffffffffffffffffffffffffffff16145b8061224857506122478185611c8b565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612271826112f9565b73ffffffffffffffffffffffffffffffffffffffff16146122c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122be906146a3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612337576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161232e906144e3565b60405180910390fd5b612342838383612be2565b61234d600082611ff1565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461239d9190614a23565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546123f49190614942565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156125e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d990614503565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516126d391906143eb565b60405180910390a3505050565b6126eb848484612251565b6126f784848484612be7565b612736576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161272d90614443565b60405180910390fd5b50505050565b60606000821415612784576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506128e4565b600082905060005b600082146127b657808061279f90614b5b565b915050600a826127af9190614998565b915061278c565b60008167ffffffffffffffff8111156127f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561282a5781602001600182028036833780820191505090505b5090505b600085146128dd576001826128439190614a23565b9150600a856128529190614bd2565b603061285e9190614942565b60f81b81838151811061289a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856128d69190614998565b945061282e565b8093505050505b919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6000612a49826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d7e9092919063ffffffff16565b9050600081511115612aa95780806020019051810190612a69919061354a565b612aa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a9f90614783565b60405180910390fd5b5b505050565b60008082905060005b8451811015612b7c576000858281518110612afb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050808311612b3c578281604051602001612b1f9291906142c5565b604051602081830303815290604052805190602001209250612b68565b8083604051602001612b4f9291906142c5565b6040516020818303038152906040528051906020012092505b508080612b7490614b5b565b915050612ab7565b508091505092915050565b612b918383612d96565b612b9e6000848484612be7565b612bdd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bd490614443565b60405180910390fd5b505050565b505050565b6000612c088473ffffffffffffffffffffffffffffffffffffffff16612f64565b15612d71578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612c31611fe9565b8786866040518563ffffffff1660e01b8152600401612c539493929190614354565b602060405180830381600087803b158015612c6d57600080fd5b505af1925050508015612c9e57506040513d601f19601f82011682018060405250810190612c9b91906135c5565b60015b612d21573d8060008114612cce576040519150601f19603f3d011682016040523d82523d6000602084013e612cd3565b606091505b50600081511415612d19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d1090614443565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612d76565b600190505b949350505050565b6060612d8d8484600085612f77565b90509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612e06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dfd90614643565b60405180910390fd5b612e0f81611f7d565b15612e4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e4690614483565b60405180910390fd5b612e5b60008383612be2565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612eab9190614942565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b606082471015612fbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fb390614563565b60405180910390fd5b612fc585612f64565b613004576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ffb90614743565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161302d91906142f1565b60006040518083038185875af1925050503d806000811461306a576040519150601f19603f3d011682016040523d82523d6000602084013e61306f565b606091505b509150915061307f82828661308b565b92505050949350505050565b6060831561309b578290506130eb565b6000835111156130ae5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130e29190614421565b60405180910390fd5b9392505050565b8280546130fe90614b29565b90600052602060002090601f0160209004810192826131205760008555613167565b82601f1061313957805160ff1916838001178555613167565b82800160010185558215613167579182015b8281111561316657825182559160200191906001019061314b565b5b5090506131749190613178565b5090565b5b80821115613191576000816000905550600101613179565b5090565b60006131a86131a38461482f565b6147fe565b905080838252602082019050828560208602820111156131c757600080fd5b60005b858110156131f757816131dd88826132e6565b8452602084019350602083019250506001810190506131ca565b5050509392505050565b600061321461320f8461485b565b6147fe565b90508281526020810184848401111561322c57600080fd5b613237848285614ae7565b509392505050565b600061325261324d8461488b565b6147fe565b90508281526020810184848401111561326a57600080fd5b613275848285614ae7565b509392505050565b60008135905061328c81614cdd565b92915050565b600082601f8301126132a357600080fd5b81356132b3848260208601613195565b91505092915050565b6000813590506132cb81614cf4565b92915050565b6000815190506132e081614cf4565b92915050565b6000813590506132f581614d0b565b92915050565b60008135905061330a81614d22565b92915050565b60008151905061331f81614d22565b92915050565b600082601f83011261333657600080fd5b8135613346848260208601613201565b91505092915050565b60008151905061335e81614d39565b92915050565b600082601f83011261337557600080fd5b813561338584826020860161323f565b91505092915050565b60008135905061339d81614d50565b92915050565b6000602082840312156133b557600080fd5b60006133c38482850161327d565b91505092915050565b600080604083850312156133df57600080fd5b60006133ed8582860161327d565b92505060206133fe8582860161327d565b9150509250929050565b60008060006060848603121561341d57600080fd5b600061342b8682870161327d565b935050602061343c8682870161327d565b925050604061344d8682870161338e565b9150509250925092565b6000806000806080858703121561346d57600080fd5b600061347b8782880161327d565b945050602061348c8782880161327d565b935050604061349d8782880161338e565b925050606085013567ffffffffffffffff8111156134ba57600080fd5b6134c687828801613325565b91505092959194509250565b600080604083850312156134e557600080fd5b60006134f38582860161327d565b9250506020613504858286016132bc565b9150509250929050565b6000806040838503121561352157600080fd5b600061352f8582860161327d565b92505060206135408582860161338e565b9150509250929050565b60006020828403121561355c57600080fd5b600061356a848285016132d1565b91505092915050565b60006020828403121561358557600080fd5b6000613593848285016132e6565b91505092915050565b6000602082840312156135ae57600080fd5b60006135bc848285016132fb565b91505092915050565b6000602082840312156135d757600080fd5b60006135e584828501613310565b91505092915050565b60006020828403121561360057600080fd5b600061360e8482850161334f565b91505092915050565b60006020828403121561362957600080fd5b600082013567ffffffffffffffff81111561364357600080fd5b61364f84828501613364565b91505092915050565b60006020828403121561366a57600080fd5b60006136788482850161338e565b91505092915050565b6000806040838503121561369457600080fd5b60006136a28582860161338e565b925050602083013567ffffffffffffffff8111156136bf57600080fd5b6136cb85828601613292565b9150509250929050565b60006136e1838361428c565b60208301905092915050565b6136f681614a57565b82525050565b61370d61370882614a57565b614ba4565b82525050565b600061371e826148cb565b61372881856148f9565b9350613733836148bb565b8060005b8381101561376457815161374b88826136d5565b9750613756836148ec565b925050600181019050613737565b5085935050505092915050565b61377a81614a69565b82525050565b61378981614a75565b82525050565b6137a061379b82614a75565b614bb6565b82525050565b60006137b1826148d6565b6137bb818561490a565b93506137cb818560208601614af6565b6137d481614cbf565b840191505092915050565b60006137ea826148d6565b6137f4818561491b565b9350613804818560208601614af6565b80840191505092915050565b600061381b826148e1565b6138258185614926565b9350613835818560208601614af6565b61383e81614cbf565b840191505092915050565b6000613854826148e1565b61385e8185614937565b935061386e818560208601614af6565b80840191505092915050565b6000613887603283614926565b91507f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008301527f63656976657220696d706c656d656e74657200000000000000000000000000006020830152604082019050919050565b60006138ed602683614926565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613953601c83614926565b91507f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006000830152602082019050919050565b6000613993602583614926565b91507f50726573616c65206d7573742062652061637469766520746f206d696e74204160008301527f6c666965730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006139f9602083614926565b91507f4e6f7420656e6f7567682072657365727665206c65667420666f72207465616d6000830152602082019050919050565b6000613a39602483614926565b91507f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613a9f601983614926565b91507f4552433732313a20617070726f766520746f2063616c6c6572000000000000006000830152602082019050919050565b6000613adf602583614926565b91507f43616e206f6e6c79206d696e74203520416c6669657320647572696e6720707260008301527f6573616c650000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613b45601f83614926565b91507f45746865722076616c75652073656e74206973206e6f7420636f7272656374006000830152602082019050919050565b6000613b85602683614926565b91507f416464726573733a20696e73756666696369656e742062616c616e636520666f60008301527f722063616c6c00000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613beb602c83614926565b91507f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b6000613c51603883614926565b91507f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008301527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006020830152604082019050919050565b6000613cb7602a83614926565b91507f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008301527f726f2061646472657373000000000000000000000000000000000000000000006020830152604082019050919050565b6000613d1d602983614926565b91507f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008301527f656e7420746f6b656e00000000000000000000000000000000000000000000006020830152604082019050919050565b6000613d83602783614926565b91507f43616e206f6e6c79206d696e7420313020416c6669657320706572207472616e60008301527f73616374696f6e000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613de9601c83614926565b91507f4e6f206578697374656e7420574c20617420746865206d6f6d656e74000000006000830152602082019050919050565b6000613e29602083614926565b91507f4552433732313a206d696e7420746f20746865207a65726f20616464726573736000830152602082019050919050565b6000613e69602c83614926565b91507f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b6000613ecf602083614926565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000613f0f602983614926565b91507f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008301527f73206e6f74206f776e00000000000000000000000000000000000000000000006020830152604082019050919050565b6000613f75602f83614926565b91507f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008301527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006020830152604082019050919050565b6000613fdb602a83614926565b91507f507572636861736520776f756c6420657863656564206d617820737570706c7960008301527f206f6620416c66696573000000000000000000000000000000000000000000006020830152604082019050919050565b6000614041602183614926565b91507f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008301527f72000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006140a7603183614926565b91507f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008301527f776e6572206e6f7220617070726f7665640000000000000000000000000000006020830152604082019050919050565b600061410d601d83614926565b91507f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006000830152602082019050919050565b600061414d602283614926565b91507f53616c65206d7573742062652061637469766520746f206d696e7420416c666960008301527f65730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006141b3602a83614926565b91507f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008301527f6f742073756363656564000000000000000000000000000000000000000000006020830152604082019050919050565b6000614219601f83614926565b91507f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006000830152602082019050919050565b6000614259602083614926565b91507f4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f666000830152602082019050919050565b61429581614add565b82525050565b6142a481614add565b82525050565b60006142b682846136fc565b60148201915081905092915050565b60006142d1828561378f565b6020820191506142e1828461378f565b6020820191508190509392505050565b60006142fd82846137df565b915081905092915050565b60006143148286613849565b91506143208285613849565b915061432c8284613849565b9150819050949350505050565b600060208201905061434e60008301846136ed565b92915050565b600060808201905061436960008301876136ed565b61437660208301866136ed565b614383604083018561429b565b818103606083015261439581846137a6565b905095945050505050565b60006040820190506143b560008301856136ed565b6143c2602083018461429b565b9392505050565b600060208201905081810360008301526143e38184613713565b905092915050565b60006020820190506144006000830184613771565b92915050565b600060208201905061441b6000830184613780565b92915050565b6000602082019050818103600083015261443b8184613810565b905092915050565b6000602082019050818103600083015261445c8161387a565b9050919050565b6000602082019050818103600083015261447c816138e0565b9050919050565b6000602082019050818103600083015261449c81613946565b9050919050565b600060208201905081810360008301526144bc81613986565b9050919050565b600060208201905081810360008301526144dc816139ec565b9050919050565b600060208201905081810360008301526144fc81613a2c565b9050919050565b6000602082019050818103600083015261451c81613a92565b9050919050565b6000602082019050818103600083015261453c81613ad2565b9050919050565b6000602082019050818103600083015261455c81613b38565b9050919050565b6000602082019050818103600083015261457c81613b78565b9050919050565b6000602082019050818103600083015261459c81613bde565b9050919050565b600060208201905081810360008301526145bc81613c44565b9050919050565b600060208201905081810360008301526145dc81613caa565b9050919050565b600060208201905081810360008301526145fc81613d10565b9050919050565b6000602082019050818103600083015261461c81613d76565b9050919050565b6000602082019050818103600083015261463c81613ddc565b9050919050565b6000602082019050818103600083015261465c81613e1c565b9050919050565b6000602082019050818103600083015261467c81613e5c565b9050919050565b6000602082019050818103600083015261469c81613ec2565b9050919050565b600060208201905081810360008301526146bc81613f02565b9050919050565b600060208201905081810360008301526146dc81613f68565b9050919050565b600060208201905081810360008301526146fc81613fce565b9050919050565b6000602082019050818103600083015261471c81614034565b9050919050565b6000602082019050818103600083015261473c8161409a565b9050919050565b6000602082019050818103600083015261475c81614100565b9050919050565b6000602082019050818103600083015261477c81614140565b9050919050565b6000602082019050818103600083015261479c816141a6565b9050919050565b600060208201905081810360008301526147bc8161420c565b9050919050565b600060208201905081810360008301526147dc8161424c565b9050919050565b60006020820190506147f8600083018461429b565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561482557614824614c90565b5b8060405250919050565b600067ffffffffffffffff82111561484a57614849614c90565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561487657614875614c90565b5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff8211156148a6576148a5614c90565b5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061494d82614add565b915061495883614add565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561498d5761498c614c03565b5b828201905092915050565b60006149a382614add565b91506149ae83614add565b9250826149be576149bd614c32565b5b828204905092915050565b60006149d482614add565b91506149df83614add565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614a1857614a17614c03565b5b828202905092915050565b6000614a2e82614add565b9150614a3983614add565b925082821015614a4c57614a4b614c03565b5b828203905092915050565b6000614a6282614abd565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000614ab682614a57565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015614b14578082015181840152602081019050614af9565b83811115614b23576000848401525b50505050565b60006002820490506001821680614b4157607f821691505b60208210811415614b5557614b54614c61565b5b50919050565b6000614b6682614add565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614b9957614b98614c03565b5b600182019050919050565b6000614baf82614bc0565b9050919050565b6000819050919050565b6000614bcb82614cd0565b9050919050565b6000614bdd82614add565b9150614be883614add565b925082614bf857614bf7614c32565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b614ce681614a57565b8114614cf157600080fd5b50565b614cfd81614a69565b8114614d0857600080fd5b50565b614d1481614a75565b8114614d1f57600080fd5b50565b614d2b81614a7f565b8114614d3657600080fd5b50565b614d4281614aab565b8114614d4d57600080fd5b50565b614d5981614add565b8114614d6457600080fd5b5056fea264697066735822122099f12ab937e65b82c615d779514f6c5d28344e43ea0e15aba9141cf57384278e64736f6c63430008000033
Verified Source Code Full Match
Compiler: v0.8.0+commit.c7dfd78e
EVM: istanbul
Optimization: No
ALFIE.sol 224 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import {MerkleProof} from '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';
import './ERC721Tradable.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
/**
* @title Alfie
* @author Alfie Core Team
* @notice ERC721 contract that supports Alfie World Co.
*/
contract ALFIE is ERC721Tradable, ReentrancyGuard {
using Address for address;
using Counters for Counters.Counter;
using MerkleProof for bytes32[];
using SafeERC20 for IERC20;
using Strings for uint256;
string public baseTokenURI;
/**
* @notice Root of the merkle tree used for presale access
*/
bytes32 public merkleRoot;
/**
* @notice Alfie mint price
*/
uint256 public AlfiePrice = .05 ether;
/**
* @notice Max number of Alfies that can be purchased during presale
*/
uint256 public constant maxAlfiePurchasePresale = 5;
/**
* @notice Max number of Alfies that can be purchased during sale
*/
uint256 public constant maxAlfiePurchase = 10;
/**
* @notice Total Alfies supply
*/
uint256 public constant maxAlfies = 8888;
uint256 private alfieReserve = 500;
/**
* @notice Presale start time
*/
uint256 public presaleStartTime = 1653242400;
/**
* @notice Sale start time
*/
uint256 public startTime = 1653249600;
string private _name;
string private _symbol;
Counters.Counter private _alfiesId;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(address _proxyRegistryAddress) ERC721Tradable('Alfie World Co.', 'ALFIE', _proxyRegistryAddress) {
_alfiesId.increment();
}
/**
* @notice Update merkle root for presale access
*/
function updateMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
merkleRoot = _merkleRoot;
}
/**
* @notice Recover function
*/
function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
/**
* @notice ERC20 Recover function
*/
function recoverERC20(
address tokenAddress,
address to,
uint256 amountToRecover
) external onlyOwner {
IERC20(tokenAddress).safeTransfer(to, amountToRecover);
}
/**
* @notice Getter to access Alfie current supply
*/
function totalSupply() external view returns (uint256) {
return _alfiesId.current() - 1;
}
/**
* @notice Function to mint Alfies for the core team
*/
function reserveAlfies(address _to, uint256 _reserveAmount) public onlyOwner {
uint256 currentSupply = _alfiesId.current() - 1;
uint256 _startTime = startTime;
require(_startTime > 0 && block.timestamp >= _startTime, 'Sale must be active to mint Alfies');
require(_reserveAmount > 0 && _reserveAmount <= alfieReserve, 'Not enough reserve left for team');
require(currentSupply + _reserveAmount <= maxAlfies, 'Purchase would exceed max supply of Alfies');
for (uint256 i = 1; i <= _reserveAmount; i++) {
_safeMint(_to, currentSupply + i);
_alfiesId.increment();
}
alfieReserve = alfieReserve - _reserveAmount;
}
/**
* @notice Set the sale start time
*/
function setStartTime(uint256 _startTime) public onlyOwner {
// require(_startTime > block.timestamp - 1000, 'Sale should start in the future');
startTime = _startTime;
}
/**
* @notice Set the presale start time
*/
function setPresaleStartTime(uint256 _presaleStartTime) public onlyOwner {
presaleStartTime = _presaleStartTime;
}
/**
* @notice Set the price of Alfie
*/
function setAlfiePrice(uint256 _AlfiePrice) public onlyOwner {
AlfiePrice = _AlfiePrice;
}
/**
* @notice Mint Alfies during presale
*/
function presaleMintAlfie(uint256 numberOfTokens, bytes32[] memory proof) public payable nonReentrant {
uint256 supply = _alfiesId.current() - 1;
require(presaleStartTime > 0 && block.timestamp >= presaleStartTime, 'Presale must be active to mint Alfies');
require(merkleRoot != 0, 'No existent WL at the moment');
require(
numberOfTokens > 0 && numberOfTokens + balanceOf(msg.sender) <= maxAlfiePurchasePresale,
'Can only mint 5 Alfies during presale'
);
require(proof.verify(merkleRoot, keccak256(abi.encodePacked(msg.sender))), 'MerkleDistributor: Invalid proof');
require(msg.value >= AlfiePrice * numberOfTokens, 'Ether value sent is not correct');
require(supply + numberOfTokens <= maxAlfies, 'Purchase would exceed max supply of Alfies');
for (uint256 i = 1; i <= numberOfTokens; i++) {
_safeMint(msg.sender, supply + i);
_alfiesId.increment();
}
}
/**
* @notice Mint Alfies during main sale
*/
function mintAlfie(uint256 numberOfTokens) public payable nonReentrant {
uint256 supply = _alfiesId.current() - 1;
require(startTime > 0 && block.timestamp >= startTime, 'Sale must be active to mint Alfies');
require(numberOfTokens > 0 && numberOfTokens <= maxAlfiePurchase, 'Can only mint 10 Alfies per transaction');
require(supply + numberOfTokens <= maxAlfies, 'Purchase would exceed max supply of Alfies');
require(msg.value >= AlfiePrice * numberOfTokens, 'Ether value sent is not correct');
for (uint256 i = 1; i <= numberOfTokens; i++) {
_safeMint(msg.sender, supply + i);
_alfiesId.increment();
}
}
/**
* @notice Access the Alfies'id(s) owned by an `address`
*/
function walletOfOwner(address _owner) public view returns (uint256[] memory) {
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory ownedTokensId = new uint256[](ownerTokenCount);
uint256 curTokenId = 1;
uint256 ownedTokenIndex = 0;
while (ownedTokenIndex < ownerTokenCount && curTokenId < _alfiesId.current()) {
address curTokenOwner = ownerOf(curTokenId);
if (curTokenOwner == _owner) {
ownedTokensId[ownedTokenIndex] = curTokenId;
ownedTokenIndex++;
}
curTokenId++;
}
return ownedTokensId;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721) returns (bool) {
return super.supportsInterface(interfaceId);
}
/**
* @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 = baseTokenURI;
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), string('.json'))) : '';
}
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
function setBaseTokenURI(string memory _baseTokenURI) public onlyOwner {
baseTokenURI = _baseTokenURI;
}
}
ERC721Tradable.sol 43 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
contract OwnableDelegateProxy {}
/**
* Used to delegate ownership of a contract to another address, to save on unneeded transactions to approve contract use for users
*/
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
/**
* @title ERC721Tradable
* ERC721Tradable - ERC721 contract that whitelists a trading address, and has minting functionality.
*/
abstract contract ERC721Tradable is ERC721, Ownable {
address proxyRegistryAddress;
constructor(
string memory _name,
string memory _symbol,
address _proxyRegistryAddress
) ERC721(_name, _symbol) {
proxyRegistryAddress = _proxyRegistryAddress;
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator) public view override returns (bool) {
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Counters.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
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;
}
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
ERC721.sol 424 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @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 Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
MerkleProof.sol 52 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
return computedHash;
}
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
Read Contract
AlfiePrice 0x2fad5916 → uint256
balanceOf 0x70a08231 → uint256
baseTokenURI 0xd547cfb7 → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxAlfiePurchase 0x67a47c74 → uint256
maxAlfiePurchasePresale 0x2e4ba31c → uint256
maxAlfies 0x87ce1f80 → uint256
merkleRoot 0x2eb4a7ab → bytes32
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
presaleStartTime 0xa82524b2 → uint256
startTime 0x78e97925 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
mintAlfie 0xba0b8fee
uint256 numberOfTokens
presaleMintAlfie 0x1e93d30d
uint256 numberOfTokens
bytes32[] proof
recoverERC20 0x1171bda9
address tokenAddress
address to
uint256 amountToRecover
renounceOwnership 0x715018a6
No parameters
reserveAlfies 0x7e738f63
address _to
uint256 _reserveAmount
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setAlfiePrice 0x9466565d
uint256 _AlfiePrice
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseTokenURI 0x30176e13
string _baseTokenURI
setPresaleStartTime 0x296cab55
uint256 _presaleStartTime
setStartTime 0x3e0a322d
uint256 _startTime
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateMerkleRoot 0x4783f0ef
bytes32 _merkleRoot
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address