Address Contract Partially Verified
Address
0x38Cd9992E44064Cb8bd68cDF17D164b82b25277c
Balance
0.005577 ETH
Nonce
1
Code Size
22127 bytes
Creator
0x07776B99...75dD at tx 0xf95387d5...ae2ddc
Indexed Transactions
0
Contract Bytecode
22127 bytes
0x6080604052600436106102c95760003560e01c80636ae2719d116101755780639a81cd91116100dc578063b819827711610095578063d06f97341161006f578063d06f9734146108c1578063e985e9c5146108e1578063f2fde38b1461092a578063fda49eb41461094a57600080fd5b8063b81982771461085f578063b88d4fde14610881578063c87b56dd146108a157600080fd5b80639a81cd911461077f578063a22cb46514610799578063ab0f9250146107b9578063b1aeaa78146107dd578063b22a6c82146107f2578063b810fb431461082957600080fd5b80638bef82b81161012e5780638bef82b8146106955780638da5cb5b146106f75780638ddba57a1461071557806395d89b411461073557806397bda41d1461074a578063985885781461076a57600080fd5b80636ae2719d146105ea57806370a0823114610600578063715018a614610620578063746a0af6146106355780638319129f1461065557806383804ab51461067557600080fd5b8063319c4ec7116102345780634d531bf4116101ed57806351a35b80116101c757806351a35b801461057f5780635c5ad967146105955780636352211e146105b5578063635cb59e146105d557600080fd5b80634d531bf4146105195780634e71d92d1461054a5780634f6ccce71461055f57600080fd5b8063319c4ec7146104845780633bbab874146104a45780633ccfd60b146104b9578063413d9c3a146104ce57806342842e0e146104e45780634b8e377d1461050457600080fd5b806317bac0521161028657806317bac052146103b357806318160ddd146103dc578063225d697f146103fb57806323b872dd1461041d5780632f745c591461043d5780632fdcbccd1461045d57600080fd5b806301ffc9a7146102ce57806306fdde0314610303578063081812fc14610325578063095ea7b31461035d57806310c333931461037f5780631693440e146103ab575b600080fd5b3480156102da57600080fd5b506102ee6102e9366004614516565b61099b565b60405190151581526020015b60405180910390f35b34801561030f57600080fd5b506103186109c6565b6040516102fa9190615045565b34801561033157600080fd5b506103456103403660046145c7565b610a58565b6040516001600160a01b0390911681526020016102fa565b34801561036957600080fd5b5061037d610378366004614475565b610af2565b005b34801561038b57600080fd5b506013546103999060ff1681565b60405160ff90911681526020016102fa565b61037d610c08565b3480156103bf57600080fd5b506103c961271081565b60405161ffff90911681526020016102fa565b3480156103e857600080fd5b506008545b6040519081526020016102fa565b34801561040757600080fd5b50610410610d38565b6040516102fa9190614ff8565b34801561042957600080fd5b5061037d610438366004614352565b610d99565b34801561044957600080fd5b506103ed610458366004614475565b610dca565b34801561046957600080fd5b5060135461034590600160381b90046001600160a01b031681565b34801561049057600080fd5b5061037d61049f3660046145f9565b610e60565b3480156104b057600080fd5b5061037d61124d565b3480156104c557600080fd5b5061037d611464565b3480156104da57600080fd5b506103c961438081565b3480156104f057600080fd5b5061037d6104ff366004614352565b611521565b34801561051057600080fd5b5061037d61153c565b34801561052557600080fd5b506105396105343660046142df565b6116c2565b6040516102fa959493929190615058565b34801561055657600080fd5b5061037d61188c565b34801561056b57600080fd5b506103ed61057a3660046145c7565b611a51565b34801561058b57600080fd5b506103ed60145481565b3480156105a157600080fd5b506103186105b03660046142df565b611ae4565b3480156105c157600080fd5b506103456105d03660046145c7565b611af8565b3480156105e157600080fd5b506103c9606481565b3480156105f657600080fd5b506103c961038481565b34801561060c57600080fd5b506103ed61061b3660046142df565b611b6f565b34801561062c57600080fd5b5061037d611bf6565b34801561064157600080fd5b506103456106503660046145c7565b611c2c565b34801561066157600080fd5b5061031861067036600461461e565b611c56565b34801561068157600080fd5b506013546103c990610100900461ffff1681565b3480156106a157600080fd5b50600c546106cd906001600160a01b03811690600160a01b810461ffff1690600160b01b900460ff1683565b604080516001600160a01b03909416845261ffff90921660208401521515908201526060016102fa565b34801561070357600080fd5b50600b546001600160a01b0316610345565b34801561072157600080fd5b506103ed6107303660046142df565b611e1e565b34801561074157600080fd5b50610318612067565b34801561075657600080fd5b5061037d6107653660046144a1565b612076565b34801561077657600080fd5b5061037d612478565b34801561078b57600080fd5b506010546102ee9060ff1681565b3480156107a557600080fd5b5061037d6107b4366004614442565b61262d565b3480156107c557600080fd5b506013546103c99065010000000000900461ffff1681565b3480156107e957600080fd5b5061037d6126f2565b3480156107fe57600080fd5b50610807612778565b604080516001600160a01b03909316835261ffff9091166020830152016102fa565b34801561083557600080fd5b506103456108443660046145c7565b6012602052600090815260409020546001600160a01b031681565b34801561086b57600080fd5b506013546103c9906301000000900461ffff1681565b34801561088d57600080fd5b5061037d61089c366004614393565b612874565b3480156108ad57600080fd5b506103186108bc3660046145c7565b6128ac565b3480156108cd57600080fd5b5061037d6108dc366004614442565b612d9a565b3480156108ed57600080fd5b506102ee6108fc366004614319565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561093657600080fd5b5061037d6109453660046142df565b612e59565b34801561095657600080fd5b50600d54600e54600f54610975926001600160a01b0390811692169083565b604080516001600160a01b039485168152939092166020840152908201526060016102fa565b60006001600160e01b0319821663780e9d6360e01b14806109c057506109c082612ef1565b92915050565b6060600080546109d5906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054610a01906153dc565b8015610a4e5780601f10610a2357610100808354040283529160200191610a4e565b820191906000526020600020905b815481529060010190602001808311610a3157829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610ad65760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610afd82611af8565b9050806001600160a01b0316836001600160a01b03161415610b6b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610acd565b336001600160a01b0382161480610b875750610b8781336108fc565b610bf95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610acd565b610c038383612f41565b505050565b6002600a541415610c2b5760405162461bcd60e51b8152600401610acd90615183565b6002600a5560145415801590610c4357506014544310155b6040518060400160405280600f81526020016e21b7b6b2903130b1b5903630ba32b960891b81525090610c895760405162461bcd60e51b8152600401610acd9190615045565b506013546040805180820190915260128152715365742061206869676865722076616c756560701b602082015290600160381b90046001600160a01b0316341015610ce75760405162461bcd60e51b8152600401610acd9190615045565b50610cf6600260056001612faf565b6013805465010000000000900461ffff16906005610d1383615417565b91906101000a81548161ffff021916908361ffff160217905550506001600a81905550565b60606016805480602002602001604051908101604052809291908181526020018280548015610a4e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610d72575050505050905090565b610da33382613016565b610dbf5760405162461bcd60e51b8152600401610acd90615132565b610c0383838361310d565b6000610dd583611b6f565b8210610e375760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610acd565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6002600a541415610e835760405162461bcd60e51b8152600401610acd90615183565b6002600a5560145415801590610e9b57506014544310155b6040518060400160405280600f81526020016e21b7b6b2903130b1b5903630ba32b960891b81525090610ee15760405162461bcd60e51b8152600401610acd9190615045565b50600c60000160169054906101000a900460ff16156040518060600160405280602b8152602001615569602b913990610f2d5760405162461bcd60e51b8152600401610acd9190615045565b506001600160a01b03811660009081526011602090815260409182902060048101548351606081019094526021808552919360ff909116929091906155229083013990610f8d5760405162461bcd60e51b8152600401610acd9190615045565b508183158015906110215750336040516331a9108f60e11b8152600481018690526001600160a01b0391821691831690636352211e9060240160206040518083038186803b158015610fde57600080fd5b505afa158015610ff2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101691906142fc565b6001600160a01b0316145b60405180606001604052806026815260200161554360269139906110585760405162461bcd60e51b8152600401610acd9190615045565b5060038201541580156110965750601660008154811061107a5761107a6154ca565b6000918252602090912001546001600160a01b03848116911614155b156110bb576110a36132b8565b80516110b99160028501916020909101906141a4565b505b60006110c961038486615474565b90506110d86001610384615333565b6013546301000000900461ffff908116911614156111cf576110f8612778565b600c8054600162ff000160a01b031961ffff909316600160a01b02929092166001600160b81b0319909216919091176001600160a01b0390921691909117600160b01b179055600460005260116020526002830180547f251164fe1d8864fe5e86082eae9c288bc2b58695a4d28538dfe86e9e4f175587919061117a906153dc565b611185929190614228565b50600460005260116020526001830180547f251164fe1d8864fe5e86082eae9c288bc2b58695a4d28538dfe86e9e4f17558691906111c2906153dc565b6111cd929190614228565b505b600061ffff8216156111e157816111e5565b6103845b90506111f88161ffff1686600180613515565b611207335b8261ffff16613617565b601380546301000000900461ffff1690600361122283615417565b91906101000a81548161ffff021916908361ffff16021790555050505050506001600a819055505050565b6002600a5414156112705760405162461bcd60e51b8152600401610acd90615183565b6002600a556014541580159061128857506014544310155b6040518060400160405280600f81526020016e21b7b6b2903130b1b5903630ba32b960891b815250906112ce5760405162461bcd60e51b8152600401610acd9190615045565b50600060166000815481106112e5576112e56154ca565b6000918252602090912001546001600160a01b03166370a08231336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561133f57600080fd5b505afa158015611353573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137791906145e0565b1160405180606001604052806026815260200161554360269139906113af5760405162461bcd60e51b8152600401610acd9190615045565b50600c60000160169054906101000a900460ff16156040518060600160405280602b8152602001615569602b9139906113fb5760405162461bcd60e51b8152600401610acd9190615045565b5060408051808201909152601f81527f4f6e6c792076616c69642074696c6c20446f6d277320343074682062646179006020820152636ab9adff4211156114555760405162461bcd60e51b8152600401610acd9190615045565b50610cf6600360056000612faf565b600b546001600160a01b0316331461148e5760405162461bcd60e51b8152600401610acd906150fd565b600f8054604080518082019091529182526e21b7b6b2903130b1b5903630ba32b960891b60208301524310156114d75760405162461bcd60e51b8152600401610acd9190615045565b506010805460ff19166001179055600e546040516001600160a01b03909116904780156108fc02916000818181858888f1935050505015801561151e573d6000803e3d6000fd5b50565b610c0383838360405180602001604052806000815250612874565b6002600a54141561155f5760405162461bcd60e51b8152600401610acd90615183565b6002600a55600b546001600160a01b0316331461158e5760405162461bcd60e51b8152600401610acd906150fd565b60006014541180156115a257506014544310155b6040518060400160405280600f81526020016e21b7b6b2903130b1b5903630ba32b960891b815250906115e85760405162461bcd60e51b8152600401610acd9190615045565b50601354600090610384906116019060ff16600161526a565b60ff1661160e9190615213565b905061161d6064610384615213565b61ffff168161ffff1611156040518060400160405280601081526020016f151bdad95b881251081a5b9d985b1a5960821b8152509061166f5760405162461bcd60e51b8152600401610acd9190615045565b506116828161ffff166000806001613515565b61168b336111fd565b6013805460ff1690600061169e83615454565b91906101000a81548160ff021916908360ff16021790555050506001600a81905550565b6011602052600090815260409020805481906116dd906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054611709906153dc565b80156117565780601f1061172b57610100808354040283529160200191611756565b820191906000526020600020905b81548152906001019060200180831161173957829003601f168201915b50505050509080600101805461176b906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054611797906153dc565b80156117e45780601f106117b9576101008083540402835291602001916117e4565b820191906000526020600020905b8154815290600101906020018083116117c757829003601f168201915b5050505050908060020180546117f9906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054611825906153dc565b80156118725780601f1061184757610100808354040283529160200191611872565b820191906000526020600020905b81548152906001019060200180831161185557829003601f168201915b50505050600383015460049093015491929160ff16905085565b6002600a5414156118af5760405162461bcd60e51b8152600401610acd90615183565b6002600a55601454158015906118c757506014544310155b6040518060400160405280600f81526020016e21b7b6b2903130b1b5903630ba32b960891b8152509061190d5760405162461bcd60e51b8152600401610acd9190615045565b50600b5460408051808201909152601a81527f55736520636c61696d42794f776e6572282920696e73746561640000000000006020820152906001600160a01b031633141561196f5760405162461bcd60e51b8152600401610acd9190615045565b506013546000906064906103849061199190610100900461ffff166001615213565b61199b9190615213565b6119a59190615213565b60408051808201909152601081526f151bdad95b881251081a5b9d985b1a5960821b602082015290915061271061ffff831611156119f65760405162461bcd60e51b8152600401610acd9190615045565b50611a098161ffff166001806000613515565b611a12336111fd565b60138054610100900461ffff16906001611a2b83615417565b91906101000a81548161ffff021916908361ffff16021790555050506001600a81905550565b6000611a5c60085490565b8210611abf5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610acd565b60088281548110611ad257611ad26154ca565b90600052602060002001549050919050565b60606109c0826001600160a01b03166128ac565b6000818152600260205260408120546001600160a01b0316806109c05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610acd565b60006001600160a01b038216611bda5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610acd565b506001600160a01b031660009081526003602052604090205490565b600b546001600160a01b03163314611c205760405162461bcd60e51b8152600401610acd906150fd565b611c2a6000613635565b565b60168181548110611c3c57600080fd5b6000918252602090912001546001600160a01b0316905081565b6060611e178360158460ff1681548110611c7257611c726154ca565b906000526020600020018054611c87906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054611cb3906153dc565b8015611d005780601f10611cd557610100808354040283529160200191611d00565b820191906000526020600020905b815481529060010190602001808311611ce357829003601f168201915b5050505050601760158660ff1681548110611d1d57611d1d6154ca565b90600052602060002001604051611d349190614bc3565b9081526020016040518091039020805480602002602001604051908101604052809291908181526020016000905b82821015611e0e578382906000526020600020018054611d81906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054611dad906153dc565b8015611dfa5780601f10611dcf57610100808354040283529160200191611dfa565b820191906000526020600020905b815481529060010190602001808311611ddd57829003601f168201915b505050505081526020019060010190611d62565b50505050613687565b9392505050565b6001600160a01b038116600090815260116020526040808220815160a0810190925280548392919082908290611e53906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054611e7f906153dc565b8015611ecc5780601f10611ea157610100808354040283529160200191611ecc565b820191906000526020600020905b815481529060010190602001808311611eaf57829003601f168201915b50505050508152602001600182018054611ee5906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054611f11906153dc565b8015611f5e5780601f10611f3357610100808354040283529160200191611f5e565b820191906000526020600020905b815481529060010190602001808311611f4157829003601f168201915b50505050508152602001600282018054611f77906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054611fa3906153dc565b8015611ff05780601f10611fc557610100808354040283529160200191611ff0565b820191906000526020600020905b815481529060010190602001808311611fd357829003601f168201915b50505050508152602001600382015481526020016004820160009054906101000a900460ff16151515158152505090508060800151604051806060016040528060218152602001615522602191399061205c5760405162461bcd60e51b8152600401610acd9190615045565b506060015192915050565b6060600180546109d5906153dc565b6002600a5414156120995760405162461bcd60e51b8152600401610acd90615183565b6002600a55600c546040805160608101909152602b808252600160b01b90920460ff1615916155696020830139906120e45760405162461bcd60e51b8152600401610acd9190615045565b5060005b60ff811682111561246e57600083838360ff1681811061210a5761210a6154ca565b905060200201602081019061211f91906142df565b60408051808201909152600c81526b4e6f7420706f737369626c6560a01b6020820152909150306001600160a01b038316141561216f5760405162461bcd60e51b8152600401610acd9190615045565b506032306370a08231336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156121b857600080fd5b505afa1580156121cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f091906145e0565b11806122135750336000908152600260205260409020546001600160a01b031615155b806122285750600b546001600160a01b031633145b604051806060016040528060248152602001615616602491399061225f5760405162461bcd60e51b8152600401610acd9190615045565b5060005b60165461ffff8216101561232257816001600160a01b031660168261ffff1681548110612292576122926154ca565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031614156040518060400160405280601a81526020017f4775696c6420616c72656164792077686974656c6973746564210000000000008152509061230f5760405162461bcd60e51b8152600401610acd9190615045565b508061231a81615417565b915050612263565b50601680546001810182556000919091527fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b51242890180546001600160a01b0319166001600160a01b0383161790556040805160e08101909152600560a082019081526411d552531160da1b60c083015281526020810161239f836137cc565b81526040805180820182526005815264626c61636b60d81b60208281019190915280840191909152600082840181905260016060909401939093526001600160a01b0385168352601181529120825180519192612401928492909101906141a4565b50602082810151805161241a92600185019201906141a4565b50604082015180516124369160028401916020909101906141a4565b50606082015160038201556080909101516004909101805460ff1916911515919091179055508061246681615454565b9150506120e8565b50506001600a5550565b6002600a54141561249b5760405162461bcd60e51b8152600401610acd90615183565b6002600a55601454158015906124b357506014544310155b6040518060400160405280600f81526020016e21b7b6b2903130b1b5903630ba32b960891b815250906124f95760405162461bcd60e51b8152600401610acd9190615045565b50600c5460408051808201909152601a81527f436f6e717565726f72206e6f742079657420656c656374656421000000000000602082015290600160b01b900460ff166125595760405162461bcd60e51b8152600401610acd9190615045565b50600c546000906001600160a01b03166370a08231336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b1580156125ae57600080fd5b505afa1580156125c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e691906145e0565b11604051806060016040528060268152602001615543602691399061261e5760405162461bcd60e51b8152600401610acd9190615045565b50610cf6600460026001612faf565b6001600160a01b0382163314156126865760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610acd565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600b546001600160a01b0316331461271c5760405162461bcd60e51b8152600401610acd906150fd565b601454604080518082019091526011815270105b1c9958591e481858dd1a5d985d1959607a1b602082015290156127665760405162461bcd60e51b8152600401610acd9190615045565b5061277361438043615252565b601455565b600c546000908190600160b01b900460ff16156127ae575050600c546001600160a01b03811691600160a01b90910461ffff1690565b600060166000815481106127c4576127c46154ca565b60009182526020808320909101546001600160a01b0316808352601190915260409091206003015490915060015b60165460ff8216101561286a57600060168260ff1681548110612817576128176154ca565b60009182526020808320909101546001600160a01b0316808352601190915260409091206003015490915061285190859085908490613843565b909450925081905061286281615454565b9150506127f2565b5090939092509050565b61287e3383613016565b61289a5760405162461bcd60e51b8152600401610acd90615132565b6128a68484848461386c565b50505050565b6000818152601260209081526040808320546001600160a01b031683526011909152808220815160a081019092528054606093929190829082906128ef906153dc565b80601f016020809104026020016040519081016040528092919081815260200182805461291b906153dc565b80156129685780601f1061293d57610100808354040283529160200191612968565b820191906000526020600020905b81548152906001019060200180831161294b57829003601f168201915b50505050508152602001600182018054612981906153dc565b80601f01602080910402602001604051908101604052809291908181526020018280546129ad906153dc565b80156129fa5780601f106129cf576101008083540402835291602001916129fa565b820191906000526020600020905b8154815290600101906020018083116129dd57829003601f168201915b50505050508152602001600282018054612a13906153dc565b80601f0160208091040260200160405190810160405280929190818152602001828054612a3f906153dc565b8015612a8c5780601f10612a6157610100808354040283529160200191612a8c565b820191906000526020600020905b815481529060010190602001808311612a6f57829003601f168201915b50505091835250506003820154602082015260049091015460ff1615156040909101529050612ab96142a3565b604051602001612bf6907f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323081527f30302f73766722207072657365727665417370656374526174696f3d22784d6960208201527f6e594d696e206d656574222076696577426f783d22302030203335302033353060408201527f223e3c7374796c653e2e62207b2066696c6c3a77686974653b20666f6e742d6660608201527f616d696c793a2073657269663b20666f6e742d73697a653a20313470783b207d60808201527f3c2f7374796c653e203c726563742077696474683d223130302522206865696760a08201527f68743d2231303025222066696c6c3d22626c61636b22202f3e3c74657874207860c08201527f3d2231302220793d2232302220636c6173733d2262223e00000000000000000060e082015260f70190565b60408051808303601f190181529190528152612c13846000611c56565b612c1e856001611c56565b612c29866002611c56565b612c34876003611c56565b612c3f886004611c56565b612c4a896005611c56565b604051602001612c5f969594939291906149d1565b60408051808303601f190181529190526020820152612c7f846006611c56565b612c8a856007611c56565b612c95866008611c56565b612ca0876009611c56565b604051602001612cb39493929190614e89565b60408051808303601f19018152918152828101919091528281015183519151612cdf9290602001614d58565b60408051808303601f19018152918152606083018290528251602080850151858401519351600095612d159592939091016147be565b60405160208183030381529060405290506000612d6d612d348761389f565b612d3d8461399d565b612d478988613b03565b604051602001612d5993929190614bcf565b60405160208183030381529060405261399d565b905080604051602001612d809190614e44565b604051602081830303815290604052945050505050919050565b600b546001600160a01b03163314612dc45760405162461bcd60e51b8152600401610acd906150fd565b6010546040805160808101909152604280825260ff90921691615594602083013990612e035760405162461bcd60e51b8152600401610acd9190615045565b508015612e15576010805460ff191690555b6000612e2361438043615252565b600e8054600d80546001600160a01b038084166001600160a01b0319928316179092559091169516949094179093555050600f55565b600b546001600160a01b03163314612e835760405162461bcd60e51b8152600401610acd906150fd565b6001600160a01b038116612ee85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610acd565b61151e81613635565b60006001600160e01b031982166380ac58cd60e01b1480612f2257506001600160e01b03198216635b5e139f60e01b145b806109c057506301ffc9a760e01b6001600160e01b03198316146109c0565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612f7682611af8565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b604080516060810190915260218082523391612710831191615522602083013990612fed5760405162461bcd60e51b8152600401610acd9190615045565b50613003816001600160a01b0316858585613515565b6128a633826001600160a01b0316613617565b6000818152600260205260408120546001600160a01b031661308f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610acd565b600061309a83611af8565b9050806001600160a01b0316846001600160a01b031614806130d55750836001600160a01b03166130ca84610a58565b6001600160a01b0316145b8061310557506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661312082611af8565b6001600160a01b0316146131885760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610acd565b6001600160a01b0382166131ea5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610acd565b6131f5838383613c9d565b613200600082612f41565b6001600160a01b0383166000908152600360205260408120805460019290613229908490615376565b90915550506001600160a01b0382166000908152600360205260408120805460019290613257908490615252565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b604080516102408101825260016102008201818152600360fc1b610220840152825282518084018452818152603160f81b6020828101919091528084019190915283518085018552828152601960f91b818301528385015283518085018552828152603360f81b8183015260608481019190915284518086018652838152600d60fa1b81840152608085015284518086018652838152603560f81b8184015260a085015284518086018652838152601b60f91b8184015260c085015284518086018652838152603760f81b8184015260e085015284518086018652838152600760fb1b8184015261010085015284518086018652838152603960f81b8184015261012085015284518086018652838152606160f81b8184015261014085015284518086018652838152603160f91b8184015261016085015284518086018652838152606360f81b8184015261018085015284518086018652838152601960fa1b818401526101a085015284518086018652838152606560f81b818401526101c085015284518086018652838152603360f91b818401526101e08501528451808601909552918452602360f81b908401529160005b60068160ff16101561350e576040805144602080830191909152428284015260f884901b6001600160f81b0319166060830152825160418184030181526061909201909252805191012082846134c3601084615474565b601081106134d3576134d36154ca565b60200201516040516020016134e992919061478f565b604051602081830303815290604052925050808061350690615454565b91505061346c565b5092915050565b60ff8216156135bb57600061352b8360646152c9565b60135461354b9160ff1690600160381b90046001600160a01b031661528f565b90508161357557601354613570908290600160381b90046001600160a01b0316615356565b613593565b601354613593908290600160381b90046001600160a01b0316615230565b601360076101000a8154816001600160a01b0302191690836001600160a01b03160217905550505b6001600160a01b03831660009081526011602052604081206003018054916135e283615439565b9091555050506000928352506012602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b613631828260405180602001604052806000815250613d55565b5050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b606060006136bd846136988761389f565b6040516020016136a992919061478f565b604051602081830303815290604052613d88565b905060006136cc606483615474565b90506000605f8260ff16116136f45760508260ff16116136ed5760036136f7565b60026136f7565b60015b855190915060006137096003836152c9565b90506000613717828561530a565b613721908461538d565b905060008261373160018761538d565b61373b919061530a565b61374660018661538d565b613750919061538d565b9050600060ff8316613762848461538d565b61376d90600161526a565b60ff16613788338a8f6040516020016136a99392919061472b565b6137929190615474565b61379c9190615252565b9050898160ff16815181106137b3576137b36154ca565b6020026020010151985050505050505050509392505050565b6060816001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561380757600080fd5b505afa15801561381b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109c09190810190614550565b6000808461ffff168361ffff161161385c57858561385f565b83835b9150915094509492505050565b61387784848461310d565b61388384848484613db9565b6128a65760405162461bcd60e51b8152600401610acd906150ab565b6060816138c35750506040805180820190915260018152600360fc1b602082015290565b8160005b81156138ed57806138d781615439565b91506138e69050600a836152b5565b91506138c7565b60008167ffffffffffffffff811115613908576139086154e0565b6040519080825280601f01601f191660200182016040528015613932576020820181803683370190505b5090505b841561310557613947600183615376565b9150613954600a86615474565b61395f906030615252565b60f81b818381518110613974576139746154ca565b60200101906001600160f81b031916908160001a905350613996600a866152b5565b9450613936565b8051606090806139bd575050604080516020810190915260008152919050565b600060036139cc836002615252565b6139d691906152b5565b6139e19060046152eb565b905060006139f0826020615252565b67ffffffffffffffff811115613a0857613a086154e0565b6040519080825280601f01601f191660200182016040528015613a32576020820181803683370190505b50905060006040518060600160405280604081526020016155d6604091399050600181016020830160005b86811015613abe576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b835260049092019101613a5d565b506003860660018114613ad85760028114613ae957613af5565b613d3d60f01b600119830152613af5565b603d60f81b6000198301525b505050918152949350505050565b60408051602081019091526000808252606091905b600a8160ff161015613b85578160158260ff1681548110613b3b57613b3b6154ca565b90600052602060002001613b4f8784611c56565b604051602001613b6193929190614867565b60405160208183030381529060405291508080613b7d90615454565b915050613b18565b5060405180604001604052806005815260200164626c61636b60d81b815250604051602001613bb49190614773565b604051602081830303815290604052805190602001208360400151604051602001613bdf9190614773565b6040516020818303038152906040528051906020012014613c74578251604051613c0d9183916020016148e3565b6040516020818303038152906040529050808360400151604051602001613c35929190614b4d565b60408051601f19818403018152908290528451602086810151929450613c5e938593910161494a565b6040516020818303038152906040529050611e17565b80604051602001613c859190614815565b60405160208183030381529060405290509392505050565b6001600160a01b038316613cf857613cf381600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b613d1b565b816001600160a01b0316836001600160a01b031614613d1b57613d1b8382613ec6565b6001600160a01b038216613d3257610c0381613f63565b826001600160a01b0316826001600160a01b031614610c0357610c038282614012565b613d5f8383614056565b613d6c6000848484613db9565b610c035760405162461bcd60e51b8152600401610acd906150ab565b600081604051602001613d9b9190614773565b60408051601f19818403018152919052805160209091012092915050565b60006001600160a01b0384163b15613ebb57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613dfd903390899088908890600401614fbb565b602060405180830381600087803b158015613e1757600080fd5b505af1925050508015613e47575060408051601f3d908101601f19168201909252613e4491810190614533565b60015b613ea1573d808015613e75576040519150601f19603f3d011682016040523d82523d6000602084013e613e7a565b606091505b508051613e995760405162461bcd60e51b8152600401610acd906150ab565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613105565b506001949350505050565b60006001613ed384611b6f565b613edd9190615376565b600083815260076020526040902054909150808214613f30576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090613f7590600190615376565b60008381526009602052604081205460088054939450909284908110613f9d57613f9d6154ca565b906000526020600020015490508060088381548110613fbe57613fbe6154ca565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480613ff657613ff66154b4565b6001900381819060005260206000200160009055905550505050565b600061401d83611b6f565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166140ac5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610acd565b6000818152600260205260409020546001600160a01b0316156141115760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610acd565b61411d60008383613c9d565b6001600160a01b0382166000908152600360205260408120805460019290614146908490615252565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546141b0906153dc565b90600052602060002090601f0160209004810192826141d25760008555614218565b82601f106141eb57805160ff1916838001178555614218565b82800160010185558215614218579182015b828111156142185782518255916020019190600101906141fd565b506142249291506142ca565b5090565b828054614234906153dc565b90600052602060002090601f0160209004810192826142565760008555614218565b82601f106142675780548555614218565b8280016001018555821561421857600052602060002091601f016020900482015b82811115614218578254825591600101919060010190614288565b60405180608001604052806004905b60608152602001906001900390816142b25790505090565b5b8082111561422457600081556001016142cb565b6000602082840312156142f157600080fd5b8135611e17816154f6565b60006020828403121561430e57600080fd5b8151611e17816154f6565b6000806040838503121561432c57600080fd5b8235614337816154f6565b91506020830135614347816154f6565b809150509250929050565b60008060006060848603121561436757600080fd5b8335614372816154f6565b92506020840135614382816154f6565b929592945050506040919091013590565b600080600080608085870312156143a957600080fd5b84356143b4816154f6565b935060208501356143c4816154f6565b925060408501359150606085013567ffffffffffffffff8111156143e757600080fd5b8501601f810187136143f857600080fd5b803561440b614406826151eb565b6151ba565b81815288602083850101111561442057600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000806040838503121561445557600080fd5b8235614460816154f6565b91506020830135801515811461434757600080fd5b6000806040838503121561448857600080fd5b8235614493816154f6565b946020939093013593505050565b600080602083850312156144b457600080fd5b823567ffffffffffffffff808211156144cc57600080fd5b818501915085601f8301126144e057600080fd5b8135818111156144ef57600080fd5b8660208260051b850101111561450457600080fd5b60209290920196919550909350505050565b60006020828403121561452857600080fd5b8135611e178161550b565b60006020828403121561454557600080fd5b8151611e178161550b565b60006020828403121561456257600080fd5b815167ffffffffffffffff81111561457957600080fd5b8201601f8101841361458a57600080fd5b8051614598614406826151eb565b8181528560208385010111156145ad57600080fd5b6145be8260208301602086016153b0565b95945050505050565b6000602082840312156145d957600080fd5b5035919050565b6000602082840312156145f257600080fd5b5051919050565b6000806040838503121561460c57600080fd5b823591506020830135614347816154f6565b6000806040838503121561463157600080fd5b82359150602083013560ff8116811461434757600080fd5b600081518084526146618160208601602086016153b0565b601f01601f19169290920160200192915050565b600081516146878185602086016153b0565b9290920192915050565b8054600090600181811c90808316806146ab57607f831692505b60208084108214156146cd57634e487b7160e01b600052602260045260246000fd5b8180156146e157600181146146f25761471f565b60ff1986168952848901965061471f565b60008881526020902060005b868110156147175781548b8201529085019083016146fe565b505084890196505b50505050505092915050565b6bffffffffffffffffffffffff198460601b16815260ff60f81b8360f81b166014820152600082516147648160158501602087016153b0565b91909101601501949350505050565b600082516147858184602087016153b0565b9190910192915050565b600083516147a18184602088016153b0565b8351908301906147b58183602088016153b0565b01949350505050565b600085516147d0818460208a016153b0565b8551908301906147e4818360208a016153b0565b85519101906147f78183602089016153b0565b845191019061480a8183602088016153b0565b019695505050505050565b600082516148278184602087016153b0565b7f7b2274726169745f74797065223a2254797065222c2276616c7565223a22455892019182525067504c4f524552227d60c01b6020820152602801919050565b600084516148798184602089016153b0565b6e3d913a3930b4ba2fba3cb832911d1160891b90830190815261489f600f820186614691565b6a1116113b30b63ab2911d1160a91b815284519091506148c681600b8401602088016153b0565b62089f4b60ea1b600b9290910191820152600e0195945050505050565b600083516148f58184602088016153b0565b7f7b2274726169745f74797065223a2254797065222c2276616c7565223a220000908301908152835161492f81601e8401602088016153b0565b61227d60f01b601e9290910191820152602001949350505050565b6000845161495c8184602089016153b0565b6f163d913a3930b4ba2fba3cb832911d1160811b90830190815284516149898160108401602089016153b0565b6a1116113b30b63ab2911d1160a91b6010929091019182015283516149b581601b8401602088016153b0565b61227d60f01b601b9290910191820152601d0195945050505050565b600087516149e3818460208c016153b0565b80830190507f3c2f746578743e3c7465787420783d2231302220793d2234302220636c6173738152641e9131111f60d91b8060208301528851614a2d816025850160208d016153b0565b8083019250507f3c2f746578743e3c7465787420783d2231302220793d2236302220636c61737360258301528060458301528751614a7281604a850160208c016153b0565b7f3c2f746578743e3c7465787420783d2231302220793d2238302220636c617373604a9390910192830152606a8201528551614ab581606f840160208a016153b0565b7f3c2f746578743e3c7465787420783d2231302220793d223130302220636c6173606f929091019182015265399e9131111f60d11b608f820152614b40614b3a614b026095840188614675565b7f3c2f746578743e3c7465787420783d2231302220793d223132302220636c6173815265399e9131111f60d11b602082015260260190565b85614675565b9998505050505050505050565b60008351614b5f8184602088016153b0565b80830190507f2c7b2274726169745f74797065223a22466c616720436f6c6f72222c2276616c8152643ab2911d1160d91b60208201528351614ba88160258401602088016153b0565b61227d60f01b60259290910191820152602701949350505050565b6000611e178284614691565b737b226e616d65223a202254726176656c6572202360601b81528351600090614bff8160148501602089016153b0565b7f222c20226465736372697074696f6e223a202254726176656c6572204c6f6f746014918401918201527f2069732061204c6f6f74206465726976617469766520666f722074686520547260348201527f6176656c20496e6475737472792c2067656e65726174656420616e642073746f60548201527f726564206f6e20636861696e2e204665656c206672656520746f20757365207460748201527f68652054726176656c6572204c6f6f7420696e20616e792077617920796f752060948201527f77616e74222c2022696d616765223a2022646174613a696d6167652f7376672b60b48201526a1e1b5b0ed8985cd94d8d0b60aa1b60d48201528451614d0e8160df8401602089016153b0565b614d4d614d3f614d3960df848601016f222c2261747472696275746573223a5b60801b815260100190565b87614675565b615d7d60f01b815260020190565b979650505050505050565b7f3c6c696e652078313d2230222078323d22333530222079313d2233303022207981526f191e91199818111039ba3937b5b29e9160811b602082015260008351614da98160308501602088016153b0565b73111039ba3937b5b296bbb4b23a341e911a11179f60611b6030918401918201527f3c7465787420783d223334302220793d223239342220746578742d616e63686f604482015271391e9132b732111031b630b9b99e9131111f60711b60648201528351614e1e8160768401602088016153b0565b6c1e17ba32bc3a1f1e17b9bb339f60991b60769290910191820152608301949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251614e7c81601d8501602087016153b0565b91909101601d0192915050565b7f3c2f746578743e3c7465787420783d2231302220793d223134302220636c61738152600065399e9131111f60d11b8060208401528651614ed1816026860160208b016153b0565b80840190507f3c2f746578743e3c7465787420783d2231302220793d223136302220636c617360268201528160468201528651614f1581604c840160208b016153b0565b8082019150507f3c2f746578743e3c7465787420783d2231302220793d223138302220636c6173604c82015281606c8201528551614f5a816072840160208a016153b0565b8082019150507f3c2f746578743e3c7465787420783d2231302220793d223230302220636c61736072820152816092820152614faf614f9c6098830187614675565b661e17ba32bc3a1f60c91b815260070190565b98975050505050505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614fee90830184614649565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156150395783516001600160a01b031683529284019291840191600101615014565b50909695505050505050565b602081526000611e176020830184614649565b60a08152600061506b60a0830188614649565b828103602084015261507d8188614649565b905082810360408401526150918187614649565b606084019590955250509015156080909101529392505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b604051601f8201601f1916810167ffffffffffffffff811182821017156151e3576151e36154e0565b604052919050565b600067ffffffffffffffff821115615205576152056154e0565b50601f01601f191660200190565b600061ffff8083168185168083038211156147b5576147b5615488565b60006001600160a01b038281168482168083038211156147b5576147b5615488565b6000821982111561526557615265615488565b500190565b600060ff821660ff84168060ff0382111561528757615287615488565b019392505050565b60006001600160a01b03838116806152a9576152a961549e565b92169190910492915050565b6000826152c4576152c461549e565b500490565b600060ff8316806152dc576152dc61549e565b8060ff84160491505092915050565b600081600019048311821515161561530557615305615488565b500290565b600060ff821660ff84168160ff048111821515161561532b5761532b615488565b029392505050565b600061ffff8381169083168181101561534e5761534e615488565b039392505050565b60006001600160a01b038381169083168181101561534e5761534e615488565b60008282101561538857615388615488565b500390565b600060ff821660ff8416808210156153a7576153a7615488565b90039392505050565b60005b838110156153cb5781810151838201526020016153b3565b838111156128a65750506000910152565b600181811c908216806153f057607f821691505b6020821081141561541157634e487b7160e01b600052602260045260246000fd5b50919050565b600061ffff8083168181141561542f5761542f615488565b6001019392505050565b600060001982141561544d5761544d615488565b5060010190565b600060ff821660ff81141561546b5761546b615488565b60010192915050565b6000826154835761548361549e565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461151e57600080fd5b6001600160e01b03198116811461151e57600080fdfe41646472657373206e6f742076657269666965642e2054727920616e6f74686572596f7520646f206e6f74206f776e20746f6b656e287329206f66207468652061646472657373436f6d7065746974696f6e2068617320656e6465642e20436865636b2074686520436f6e717565726f722154726561737572657220616c7265616479206368616e6765642e20506572666f726d2061207769746864726177616c206265666f7265206368616e67696e672069744142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f436865636b20636f6e646974696f6e73206265666f72652077686974656c697374696e67a2646970667358221220f9ba961c0a8317e01a33ce922951c680df596dc2a41540b34cecd8393478fec164736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (200 runs)
TravelerLoot.sol 1795 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/**
* @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);
}
/**
* @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;
}
/**
* @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);
}
}
/*
* @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;
}
}
/**
* @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);
}
}
/**
* @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 make 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;
}
}
/**
* @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);
}
/**
* @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);
}
/**
* @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);
}
}
}
}
/**
* @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;
}
}
/**
* @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 {}
}
/**
* @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);
}
/**
* @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();
}
}
/// @title A Loot-Derivative Project for the Travel Industry
/// @author jacmos3 - TripsCommunity
/// @notice Text-based NFTs thought for the Travel Industry appannage. Hotels, restaurants, hospitality etc can use them both in the real or metaverse worlds
contract TravelerLoot is ERC721Enumerable, ReentrancyGuard, Ownable {
uint256 private constant DISCOUNT_EXPIRATION = 1790553599; //Sun 27 Sep 2026 21:59:59 UTC
string private constant WHITE = "white";
string private constant BLACK = "black";
string private constant GOLD = "gold";
string private constant PLATINUM = "#D5D6D8";
string private constant GUILD = "GUILD";
string private constant PATRON = "PATRON";
string private constant CONQUEROR = "CONQUEROR";
uint160 private constant INITIAL_PRICE_FOR_PATRONS = 1 ether;
string private constant ERROR_TOKEN_ID_INVALID = "Token ID invalid";
string private constant ERROR_ADDRESS_NOT_VERIFIED = "Address not verified. Try another";
string private constant ERROR_NOT_THE_OWNER = "You do not own token(s) of the address";
string private constant ERROR_DOM_40TH_BIRTHDAY = "Only valid till Dom's 40th bday";
string private constant ERROR_LOW_VALUE = "Set a higher value";
string private constant ERROR_COMPETITION_ENDED = "Competition has ended. Check the Conqueror!";
string private constant ERROR_COMPETITION_ONGOING = "Conqueror not yet elected!";
string private constant ERROR_OWNER_NOT_ALLOWED = "Use claimByOwner() instead";
string private constant ERROR_ALREADY_ACTIVATED = "Already activated";
string private constant ERROR_COME_BACK_LATER = "Come back later";
string private constant ERROR_WITHDRAW_NEEDED = "Treasurer already changed. Perform a withdrawal before changing it";
string private constant ERROR_GUILD_ALREADY_WHITELISTED = "Guild already whitelisted!";
string private constant ERROR_CANNOT_ADD_THIS_CONTRACT = "Not possible";
string private constant ERROR_NOT_ENTITLED = "Check conditions before whitelisting";
address private constant INITIAL_TREASURER = 0xce73904422880604e78591fD6c758B0D5106dD50; //TripsCommunity address
address private constant ADDRESS_OG_LOOT = 0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7;
address private constant PH_USERS = address(1);
address private constant PH_PATRONS = address(2);
address private constant PH_OG_LOOT = address(3);
address private constant PH_CONQUERORS = address(4);
address private constant PH_OWNER = address(0);
uint16 public constant MAX_ID = 10000;
uint16 public constant MAX_FOR_OWNER = 100;
uint16 public constant MAX_FOR_GUILDS = 900;
uint16 public constant LOCK_TIME = 5760 * 3; //it's three days
struct Traveler {
string familyType;
string familyName;
string color;
uint256 counter;
bool verified;
}
struct Conqueror {
address addr;
uint16 count;
bool elected;
}
struct Treasurer {
address old;
address current;
uint256 blockNumber;
}
struct Initial{
address addr;
string symbol;
}
Conqueror public conqueror;
Treasurer public treasurer;
bool public canChangeTreasurer = true;
mapping(address => Traveler) public detailsByAddress;
mapping(uint256 => address) public addressList;
uint8 public counterOwner = 0;
uint16 public counterStandard = 0;
uint16 public counterGuild = 0;
uint16 public counterPatrons = 0;
uint160 public priceForPatrons = INITIAL_PRICE_FOR_PATRONS;
uint256 public blockActivation = 0;
string[] private categories = ["ENVIRONMENT","TALENT","PLACE","CHARACTER","TRANSPORT","LANGUAGE","EXPERIENCE","OCCUPATION","ACCOMMODATION","BAG"];
address[] public whiteListedGuilds;
mapping(string => string[]) elements;
constructor() ERC721("TravelerLoot", "TRVLR") Ownable(){
uint256 blockNumber = block.number;
treasurer.old = address(0);
treasurer.current = INITIAL_TREASURER;
treasurer.blockNumber = blockNumber;
elements[categories[0]] = ["Beaches", "Mountains", "Urban", "Countrysides", "Lakes", "Rivers", "Farms", "Tropical areas", "Snowy places", "Forests", "Historical cities", "Islands", "Wilderness", "Deserts", "Natural parks", "Old towns", "Lakes", "Villages", "Forests", "Coral Reefs", "Wetlands", "Rainforests", "Grasslands", "Chaparral"];
elements[categories[1]] = ["Cooking", "Painting", "Basketball", "Tennis", "Football", "Soccer", "Climbing", "Surfing", "Photographer", "Fishing", "Painting", "Writing", "Dancing", "Architecture", "Singing", "Dancing", "Baking", "Running", "Sword-fighting", "Boxing", "Jumping", "Climbing", "Hiking", "Kitesurfing", "Sailing", "Comforting others", "Flipping NFTs", "Katana sword fighter", "Programming Solidity", "Creating Memes"];
elements[categories[2]] = ["Eiffel Tower", "Colosseum", "Taj Mahal", "Forbidden City", "Las Vegas", "Sagrada Familia", "Statue of Liberty", "Pompeii", "Tulum", "St. Peter's Basilica", "Bangkok", "Tower of London", "Alhambra", "San Marco Square", "Ciudad de las Artes y las Ciencias", "Moscow Kremlin", "Copacabana", "Great Wall of China", "Havana", "Arc de Triomphe", "Neuschwanstein Castle", "Machu Picchu", "Gili Islands", "Maya Bay", "Etherscan", "0x0000000000000000000000000000000000000000", "::1", "42.452483,-6.051345","Parcel 0, CityDAO", "Wyoming"];
e...
// [truncated — 75790 bytes total]
Read Contract
LOCK_TIME 0x413d9c3a → uint16
MAX_FOR_GUILDS 0x6ae2719d → uint16
MAX_FOR_OWNER 0x635cb59e → uint16
MAX_ID 0x17bac052 → uint16
addressList 0xb810fb43 → address
addressURI 0x5c5ad967 → string
balanceOf 0x70a08231 → uint256
blockActivation 0x51a35b80 → uint256
canChangeTreasurer 0x9a81cd91 → bool
conqueror 0x8bef82b8 → address, uint16, bool
counterGuild 0xb8198277 → uint16
counterOwner 0x10c33393 → uint8
counterPatrons 0xab0f9250 → uint16
counterStandard 0x83804ab5 → uint16
detailsByAddress 0x4d531bf4 → string, string, string, uint256, bool
getApproved 0x081812fc → address
getCounterForAddress 0x8ddba57a → uint256
getElement 0x8319129f → string
getWhiteListedGuilds 0x225d697f → address[]
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
priceForPatrons 0x2fdcbccd → uint160
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
treasurer 0xfda49eb4 → address, address, uint256
whiteListedGuilds 0x746a0af6 → address
whoIsWinning 0xb22a6c82 → address, uint16
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
activateClaims 0xb1aeaa78
No parameters
addNewGuildToWhiteList 0x97bda41d
address[] addresses
approve 0x095ea7b3
address to
uint256 tokenId
claim 0x4e71d92d
No parameters
claimByConquerors 0x98588578
No parameters
claimByGuilds 0x319c4ec7
uint256 tokenId
address contractAddress
claimByOGLooters 0x3bbab874
No parameters
claimByOwner 0x4b8e377d
No parameters
claimByPatrons 0x1693440e
No parameters
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setTreasurer 0xd06f9734
address newAddress
bool lockTreasurer
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address