Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xF3f962d50501ECf4ac8463E48b623a5A6abF227a
Balance 0 ETH
Nonce 1
Code Size 11384 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

11384 bytes
0x6080604052600436106102675760003560e01c80636c0360eb11610144578063b88d4fde116100b6578063dd504bb71161007a578063dd504bb71461070c578063e268e4d31461072c578063e985e9c51461074c578063ee82e5a014610795578063f2fde38b146107b5578063f3993d11146107d557600080fd5b8063b88d4fde14610679578063bd32fb6614610699578063c0d4c307146106b9578063c4be5b59146106d9578063c87b56dd146106ec57600080fd5b80639d1b464a116101085780639d1b464a146105cb5780639ec00c95146105e1578063a22cb4651461060e578063a5a865dc1461062e578063aa98e0c61461064d578063b228d9251461066357600080fd5b80636c0360eb1461054e57806370a0823114610563578063715018a6146105835780638da5cb5b1461059857806395d89b41146105b657600080fd5b806342842e0e116101dd5780634f6ccce7116101a15780634f6ccce71461048157806354214f69146104a15780635a4fee30146104c15780636352211e146104e15780636364fa671461050157806366fddfa91461052e57600080fd5b806342842e0e146103da57806342966c68146103fa578063438b63001461041a5780634ced4734146104475780634d44660c1461046157600080fd5b806318b200711161022f57806318b200711461033c57806323b872dd1461035c5780632db115441461037c5780632f745c591461038f57806332cb6b0c146103af5780633ccfd60b146103c557600080fd5b806301ffc9a71461026c57806306fdde03146102a1578063081812fc146102c3578063095ea7b3146102fb57806318160ddd1461031d575b600080fd5b34801561027857600080fd5b5061028c61028736600461266c565b6107f5565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102b6610820565b6040516102989190612906565b3480156102cf57600080fd5b506102e36102de366004612653565b6108b2565b6040516001600160a01b039091168152602001610298565b34801561030757600080fd5b5061031b61031636600461257f565b61093f565b005b34801561032957600080fd5b506002545b604051908152602001610298565b34801561034857600080fd5b5061031b610357366004612653565b610a55565b34801561036857600080fd5b5061031b61037736600461246c565b610a84565b61031b61038a366004612653565b610ab6565b34801561039b57600080fd5b5061032e6103aa36600461257f565b610c53565b3480156103bb57600080fd5b5061032e61271081565b3480156103d157600080fd5b5061031b610d06565b3480156103e657600080fd5b5061031b6103f536600461246c565b610daf565b34801561040657600080fd5b5061031b610415366004612653565b610dca565b34801561042657600080fd5b5061043a61043536600461233d565b610e20565b60405161029891906128c2565b34801561045357600080fd5b5060095461028c9060ff1681565b34801561046d57600080fd5b5061028c61047c366004612503565b610ed8565b34801561048d57600080fd5b5061032e61049c366004612653565b610f5a565b3480156104ad57600080fd5b5060095461028c9062010000900460ff1681565b3480156104cd57600080fd5b5061031b6104dc3660046123e8565b610fc7565b3480156104ed57600080fd5b506102e36104fc366004612653565b611011565b34801561050d57600080fd5b5061032e61051c36600461233d565b600b6020526000908152604090205481565b34801561053a57600080fd5b5061032e6105493660046126a6565b61109d565b34801561055a57600080fd5b506102b6611149565b34801561056f57600080fd5b5061032e61057e36600461233d565b6111d7565b34801561058f57600080fd5b5061031b6112a5565b3480156105a457600080fd5b506005546001600160a01b03166102e3565b3480156105c257600080fd5b506102b66112db565b3480156105d757600080fd5b5061032e60085481565b3480156105ed57600080fd5b5061032e6105fc36600461233d565b600c6020526000908152604090205481565b34801561061a57600080fd5b5061031b610629366004612555565b6112ea565b34801561063a57600080fd5b5060095461028c90610100900460ff1681565b34801561065957600080fd5b5061032e600a5481565b34801561066f57600080fd5b5061032e60075481565b34801561068557600080fd5b5061031b6106943660046124a8565b6113af565b3480156106a557600080fd5b5061031b6106b4366004612653565b6113e7565b3480156106c557600080fd5b5061031b6106d43660046125a9565b611416565b61031b6106e7366004612701565b6114b5565b3480156106f857600080fd5b506102b6610707366004612653565b6116a5565b34801561071857600080fd5b5061031b610727366004612606565b6117c8565b34801561073857600080fd5b5061031b610747366004612653565b61181a565b34801561075857600080fd5b5061028c610767366004612358565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b3480156107a157600080fd5b5061031b6107b03660046125ea565b611849565b3480156107c157600080fd5b5061031b6107d036600461233d565b611897565b3480156107e157600080fd5b5061031b6107f036600461238b565b61192f565b60006001600160e01b0319821663780e9d6360e01b148061081a575061081a82611971565b92915050565b60606000805461082f90612b6a565b80601f016020809104026020016040519081016040528092919081815260200182805461085b90612b6a565b80156108a85780601f1061087d576101008083540402835291602001916108a8565b820191906000526020600020905b81548152906001019060200180831161088b57829003601f168201915b5050505050905090565b60006108bd826119c1565b6109235760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600360205260409020546001600160a01b031690565b600061094a82611011565b9050806001600160a01b0316836001600160a01b031614156109b85760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161091a565b336001600160a01b03821614806109d457506109d48133610767565b610a465760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161091a565b610a508383611a0b565b505050565b6005546001600160a01b03163314610a7f5760405162461bcd60e51b815260040161091a90612a26565b600855565b610a8f335b82611a79565b610aab5760405162461bcd60e51b815260040161091a90612a5b565b610a50838383611b63565b600254600954610100900460ff16610b105760405162461bcd60e51b815260206004820152601760248201527f5075626c69632073616c65206e6f742073746172746564000000000000000000604482015260640161091a565b612710610b1d8383612adc565b1115610b3b5760405162461bcd60e51b815260040161091a9061295c565b336000908152600c6020526040902054600754610b589190612b27565b821115610ba75760405162461bcd60e51b815260206004820152601760248201527f45786365656473206d6178207065722077616c6c65742e000000000000000000604482015260640161091a565b3460085483610bb69190612b08565b14610bfd5760405162461bcd60e51b815260206004820152601760248201527624b73b30b634b210333ab7323990383937bb34b232b21760491b604482015260640161091a565b336000908152600c602052604081208054849290610c1c908490612adc565b90915550600090505b82811015610a5057610c41335b610c3c8385612adc565b611cb9565b80610c4b81612ba5565b915050610c25565b6000610c5e836111d7565b8210610c7c5760405162461bcd60e51b815260040161091a90612989565b6000805b600254811015610ced5760028181548110610c9d57610c9d612c00565b6000918252602090912001546001600160a01b0386811691161415610cdb5783821415610ccd57915061081a9050565b81610cd781612ba5565b9250505b80610ce581612ba5565b915050610c80565b5060405162461bcd60e51b815260040161091a90612989565b6000610d1a6005546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610d64576040519150601f19603f3d011682016040523d82523d6000602084013e610d69565b606091505b5050905080610dac5760405162461bcd60e51b815260206004820152600f60248201526e2330b4b632b2103a379039b2b7321760891b604482015260640161091a565b50565b610a50838383604051806020016040528060008152506113af565b610dd333610a89565b610e175760405162461bcd60e51b81526020600482015260156024820152742737ba1030b8383937bb32b2103a3790313ab9371760591b604482015260640161091a565b610dac81611d35565b60606000610e2d836111d7565b905080610e4e5760408051600080825260208201909252905b509392505050565b6000816001600160401b03811115610e6857610e68612c16565b604051908082528060200260200182016040528015610e91578160200160208202803683370190505b50905060005b82811015610e4657610ea98582610c53565b828281518110610ebb57610ebb612c00565b602090810291909101015280610ed081612ba5565b915050610e97565b6000805b82811015610f4d57846001600160a01b03166002858584818110610f0257610f02612c00565b9050602002013581548110610f1957610f19612c00565b6000918252602090912001546001600160a01b031614610f3d576000915050610f53565b610f4681612ba5565b9050610edc565b50600190505b9392505050565b6002546000908210610fc35760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161091a565b5090565b60005b825181101561100a57610ff88585858481518110610fea57610fea612c00565b6020026020010151856113af565b8061100281612ba5565b915050610fca565b5050505050565b6000806002838154811061102757611027612c00565b6000918252602090912001546001600160a01b031690508061081a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161091a565b604080513360601b6bffffffffffffffffffffffff191660208201528151601481830301815260349091019091526000906111146110db8683611db7565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611dea92505050565b6111305760405162461bcd60e51b815260040161091a90612919565b5050336000908152600b60205260409020549392505050565b6006805461115690612b6a565b80601f016020809104026020016040519081016040528092919081815260200182805461118290612b6a565b80156111cf5780601f106111a4576101008083540402835291602001916111cf565b820191906000526020600020905b8154815290600101906020018083116111b257829003601f168201915b505050505081565b60006001600160a01b0382166112425760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161091a565b6000805b60025481101561129e576002818154811061126357611263612c00565b6000918252602090912001546001600160a01b038581169116141561128e5761128b82612ba5565b91505b61129781612ba5565b9050611246565b5092915050565b6005546001600160a01b031633146112cf5760405162461bcd60e51b815260040161091a90612a26565b6112d96000611df9565b565b60606001805461082f90612b6a565b6001600160a01b0382163314156113435760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161091a565b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6113b93383611a79565b6113d55760405162461bcd60e51b815260040161091a90612a5b565b6113e184848484611e4b565b50505050565b6005546001600160a01b031633146114115760405162461bcd60e51b815260040161091a90612a26565b600a55565b6005546001600160a01b031633146114405760405162461bcd60e51b815260040161091a90612a26565b6002546127106114508383612adc565b111561146e5760405162461bcd60e51b815260040161091a9061295c565b60005b828110156113e1576114a384848381811061148e5761148e612c00565b9050602002016020810190610c32919061233d565b806114ad81612ba5565b915050611471565b60025460095460ff166115015760405162461bcd60e51b81526020600482015260146024820152731c1c99481cd85b19481b9bdd081cdd185c9d195960621b604482015260640161091a565b61271061150e8683612adc565b111561152c5760405162461bcd60e51b815260040161091a9061295c565b604080513360601b6bffffffffffffffffffffffff1916602082015281516014818303018152603490910190915261156f6110db61156987611e7e565b83611db7565b61158b5760405162461bcd60e51b815260040161091a90612919565b336000908152600b602052604090205485906115a8908890612adc565b11156115f65760405162461bcd60e51b815260206004820152601860248201527f457863656564732077686974656c69737420737570706c790000000000000000604482015260640161091a565b34600854876116059190612b08565b1461164c5760405162461bcd60e51b815260206004820152601760248201527624b73b30b634b210333ab7323990383937bb34b232b21760491b604482015260640161091a565b336000908152600b60205260408120805488929061166b908490612adc565b90915550600090505b8681101561169c5761168a33610c3c8386612adc565b8061169481612ba5565b915050611674565b50505050505050565b60606116b0826119c1565b6116f45760405162461bcd60e51b81526020600482015260156024820152742a37b5b2b7103237b2b9903737ba1032bc34b9ba1760591b604482015260640161091a565b60095462010000900460ff16611796576006805461171190612b6a565b80601f016020809104026020016040519081016040528092919081815260200182805461173d90612b6a565b801561178a5780601f1061175f5761010080835404028352916020019161178a565b820191906000526020600020905b81548152906001019060200180831161176d57829003601f168201915b50505050509050919050565b60066117a183611e7e565b6040516020016117b29291906127ca565b6040516020818303038152906040529050919050565b6005546001600160a01b031633146117f25760405162461bcd60e51b815260040161091a90612a26565b6009805462ff0000191662010000841515021790558051610a50906006906020840190612142565b6005546001600160a01b031633146118445760405162461bcd60e51b815260040161091a90612a26565b600755565b6005546001600160a01b031633146118735760405162461bcd60e51b815260040161091a90612a26565b6009805461ffff191692151561ff0019169290921761010091151591909102179055565b6005546001600160a01b031633146118c15760405162461bcd60e51b815260040161091a90612a26565b6001600160a01b0381166119265760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161091a565b610dac81611df9565b60005b81518110156113e15761195f848484848151811061195257611952612c00565b6020026020010151610a84565b8061196981612ba5565b915050611932565b60006001600160e01b031982166380ac58cd60e01b14806119a257506001600160e01b03198216635b5e139f60e01b145b8061081a57506301ffc9a760e01b6001600160e01b031983161461081a565b6002546000908210801561081a575060006001600160a01b0316600283815481106119ee576119ee612c00565b6000918252602090912001546001600160a01b0316141592915050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611a4082611011565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611a84826119c1565b611ae55760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161091a565b6000611af083611011565b9050806001600160a01b0316846001600160a01b03161480611b2b5750836001600160a01b0316611b20846108b2565b6001600160a01b0316145b80611b5b57506001600160a01b0380821660009081526004602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611b7682611011565b6001600160a01b031614611bde5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161091a565b6001600160a01b038216611c405760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161091a565b611c4b600082611a0b565b8160028281548110611c5f57611c5f612c00565b6000918252602082200180546001600160a01b0319166001600160a01b03938416179055604051839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4505050565b6002805460018101825560009182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0385169081179091556040518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000611d4082611011565b9050611d4d600083611a0b565b600060028381548110611d6257611d62612c00565b6000918252602082200180546001600160a01b0319166001600160a01b0393841617905560405184928416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60008183604051602001611dcc92919061279b565b60405160208183030381529060405280519060200120905092915050565b6000610f5382600a5485611f7b565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611e56848484611b63565b611e6284848484611f91565b6113e15760405162461bcd60e51b815260040161091a906129d4565b606081611ea25750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611ecc5780611eb681612ba5565b9150611ec59050600a83612af4565b9150611ea6565b6000816001600160401b03811115611ee657611ee6612c16565b6040519080825280601f01601f191660200182016040528015611f10576020820181803683370190505b5090505b8415611b5b57611f25600183612b27565b9150611f32600a86612bc0565b611f3d906030612adc565b60f81b818381518110611f5257611f52612c00565b60200101906001600160f81b031916908160001a905350611f74600a86612af4565b9450611f14565b600082611f88858461209e565b14949350505050565b60006001600160a01b0384163b1561209357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611fd5903390899088908890600401612885565b602060405180830381600087803b158015611fef57600080fd5b505af192505050801561201f575060408051601f3d908101601f1916820190925261201c91810190612689565b60015b612079573d80801561204d576040519150601f19603f3d011682016040523d82523d6000602084013e612052565b606091505b5080516120715760405162461bcd60e51b815260040161091a906129d4565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611b5b565b506001949350505050565b600081815b8451811015610e465760008582815181106120c0576120c0612c00565b6020026020010151905080831161210257604080516020810185905290810182905260600160405160208183030381529060405280519060200120925061212f565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061213a81612ba5565b9150506120a3565b82805461214e90612b6a565b90600052602060002090601f01602090048101928261217057600085556121b6565b82601f1061218957805160ff19168380011785556121b6565b828001600101855582156121b6579182015b828111156121b657825182559160200191906001019061219b565b50610fc39291505b80821115610fc357600081556001016121be565b80356001600160a01b03811681146121e957600080fd5b919050565b60008083601f84011261220057600080fd5b5081356001600160401b0381111561221757600080fd5b6020830191508360208260051b850101111561223257600080fd5b9250929050565b600082601f83011261224a57600080fd5b813560206001600160401b0382111561226557612265612c16565b8160051b612274828201612aac565b83815282810190868401838801850189101561228f57600080fd5b600093505b858410156122b2578035835260019390930192918401918401612294565b50979650505050505050565b803580151581146121e957600080fd5b600082601f8301126122df57600080fd5b81356001600160401b038111156122f8576122f8612c16565b61230b601f8201601f1916602001612aac565b81815284602083860101111561232057600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561234f57600080fd5b610f53826121d2565b6000806040838503121561236b57600080fd5b612374836121d2565b9150612382602084016121d2565b90509250929050565b6000806000606084860312156123a057600080fd5b6123a9846121d2565b92506123b7602085016121d2565b915060408401356001600160401b038111156123d257600080fd5b6123de86828701612239565b9150509250925092565b600080600080608085870312156123fe57600080fd5b612407856121d2565b9350612415602086016121d2565b925060408501356001600160401b038082111561243157600080fd5b61243d88838901612239565b9350606087013591508082111561245357600080fd5b50612460878288016122ce565b91505092959194509250565b60008060006060848603121561248157600080fd5b61248a846121d2565b9250612498602085016121d2565b9150604084013590509250925092565b600080600080608085870312156124be57600080fd5b6124c7856121d2565b93506124d5602086016121d2565b92506040850135915060608501356001600160401b038111156124f757600080fd5b612460878288016122ce565b60008060006040848603121561251857600080fd5b612521846121d2565b925060208401356001600160401b0381111561253c57600080fd5b612548868287016121ee565b9497909650939450505050565b6000806040838503121561256857600080fd5b612571836121d2565b9150612382602084016122be565b6000806040838503121561259257600080fd5b61259b836121d2565b946020939093013593505050565b600080602083850312156125bc57600080fd5b82356001600160401b038111156125d257600080fd5b6125de858286016121ee565b90969095509350505050565b600080604083850312156125fd57600080fd5b612571836122be565b6000806040838503121561261957600080fd5b612622836122be565b915060208301356001600160401b0381111561263d57600080fd5b612649858286016122ce565b9150509250929050565b60006020828403121561266557600080fd5b5035919050565b60006020828403121561267e57600080fd5b8135610f5381612c2c565b60006020828403121561269b57600080fd5b8151610f5381612c2c565b6000806000604084860312156126bb57600080fd5b83356001600160401b03808211156126d257600080fd5b6126de878388016122ce565b945060208601359150808211156126f457600080fd5b50612548868287016121ee565b6000806000806060858703121561271757600080fd5b843593506020850135925060408501356001600160401b0381111561273b57600080fd5b612747878288016121ee565b95989497509550505050565b6000815180845261276b816020860160208601612b3e565b601f01601f19169290920160200192915050565b60008151612791818560208601612b3e565b9290920192915050565b600083516127ad818460208801612b3e565b8351908301906127c1818360208801612b3e565b01949350505050565b600080845481600182811c9150808316806127e657607f831692505b602080841082141561280657634e487b7160e01b86526022600452602486fd5b81801561281a576001811461282b57612858565b60ff19861689528489019650612858565b60008b81526020902060005b868110156128505781548b820152908501908301612837565b505084890196505b50505050505061287c61286b828661277f565b64173539b7b760d91b815260050190565b95945050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906128b890830184612753565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156128fa578351835292840192918401916001016128de565b50909695505050505050565b602081526000610f536020830184612753565b60208082526023908201527f496e76616c6964204d65726b6c6520547265652070726f6f6620737570706c6960408201526232b21760e91b606082015260800190565b60208082526013908201527222bc31b2b232b99036b0bc1039bab838363c9760691b604082015260600190565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f191681016001600160401b0381118282101715612ad457612ad4612c16565b604052919050565b60008219821115612aef57612aef612bd4565b500190565b600082612b0357612b03612bea565b500490565b6000816000190483118215151615612b2257612b22612bd4565b500290565b600082821015612b3957612b39612bd4565b500390565b60005b83811015612b59578181015183820152602001612b41565b838111156113e15750506000910152565b600181811c90821680612b7e57607f821691505b60208210811415612b9f57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612bb957612bb9612bd4565b5060010190565b600082612bcf57612bcf612bea565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610dac57600080fdfea26469706673582212204b171a62352e6e0dd4414a3a346b39aa7ed90afd30eb34ccff33145d93464ee264736f6c63430008070033

Verified Source Code Partial Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: Yes (200 runs)
TrumpyDumpy.sol 1214 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

library Address {
    function isContract(address account) internal view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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);
    }
}

/**
 * @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);
}

/**
 * @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 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 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;
}

/**
 * @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);
}

/**
 * @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 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;
    }
}

abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    string private _name;
    string private _symbol;

    // Mapping from token ID to owner address
    address[] internal _owners;

    mapping(uint256 => address) private _tokenApprovals;
    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"
        );

        uint256 count;
        for (uint256 i; i < _owners.length; ++i) {
            if (owner == _owners[i]) ++count;
        }
        return count;
    }

    /**
     * @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 {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 tokenId < _owners.length && _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);
        _owners.push(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);
        _owners[tokenId] = address(0);

        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);
        _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.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert(
                        "ERC721: transfer to non ERC721Receiver implementer"
                    );
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

/**
 * @dev 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 but rips out the core of the gas-wasting processing that comes from OpenZeppelin.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    /**
     * @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-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _owners.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index)
        public
        view
        virtual
        override
        returns (uint256)
    {
        require(
            index < _owners.length,
            "ERC721Enumerable: global index out of bounds"
        );
        return index;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index)
        public
        view
        virtual
        override
        returns (uint256 tokenId)
    {
        require(
            index < balanceOf(owner),
            "ERC721Enumerable: owner index out of bounds"
        );

        uint256 count;
        for (uint256 i; i < _owners.length; i++) {
            if (owner == _owners[i]) {
                if (count == index) return i;
                else count++;
            }
        }

        revert("ERC721Enumerable: owner index out of bounds");
    }
}

/**
 * @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);
    }
}

/**
 * @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;
    }
}

contract TrumpyDumpy is ERC721Enumerable, Ownable {
    string public baseURI;

    uint256 public constant MAX_SUPPLY = 10000;
    
    uint256 public maxMintPerWallet = 5;
    uint256 public currentPrice = 0 ether;
    bool public isPreSale = false;
    bool public isPublicSale = false;
    bool public isRevealed = false;

    bytes32 public whitelistMerkleRoot;
    
    mapping(address => uint256) public whitelistAddressToMinted;
    mapping(address => uint256) public addressToMinted;


    constructor(string memory _baseURI) ERC721("Trumpy Dumpy", "Trumpy") {
        baseURI = _baseURI;
    }

    function setReveal(bool reveal, string memory _baseURI) public onlyOwner {
        isRevealed = reveal;
        baseURI = _baseURI;
    }

    function setSale(bool preSale, bool publicSale) public onlyOwner {
        isPreSale = preSale;
        isPublicSale = publicSale;
    }
    function setCurrentPrice(uint256 _currentPrice) public onlyOwner {
        currentPrice = _currentPrice;
    }
    function setMaxPerWallet(uint256 _maxMintPerWallet) public onlyOwner {
        maxMintPerWallet = _maxMintPerWallet;
    }

    function setWhitelistMerkleRoot(bytes32 _whitelistMerkleRoot)
        external
        onlyOwner
    {
        whitelistMerkleRoot = _whitelistMerkleRoot;
    }

    function getAllowance(string memory allowance, bytes32[] calldata proof)
        public
        view
        returns (uint256)
    {
        string memory payload = string(abi.encodePacked(_msgSender()));
        require(
            _verify(_leaf(allowance, payload), proof),
            "Invalid Merkle Tree proof supplied."
        );
        return whitelistAddressToMinted[_msgSender()];
    }
    

    function tokenURI(uint256 _tokenId)
        public
        view
        override
        returns (string memory)
    {
        require(_exists(_tokenId), "Token does not exist.");
        if (!isRevealed) return baseURI;
        return string(abi.encodePacked(baseURI, Strings.toString(_tokenId), ".json"));
    }


    function giveAway(address[] calldata _users) external onlyOwner {
        uint256 totalSupply = _owners.length;
        require(totalSupply + _users.length <= MAX_SUPPLY, "Excedes max supply.");
        for (uint256 i; i < _users.length; i++) _mint(_users[i], totalSupply + i);
    }


    function publicMint(uint256 count) public payable {
        uint256 totalSupply = _owners.length;
        require(isPublicSale, "Public sale not started");
        require(totalSupply + count <= MAX_SUPPLY, "Excedes max supply.");
        require(count <= maxMintPerWallet - addressToMinted[_msgSender()], "Exceeds max per wallet.");
        require(count * currentPrice == msg.value, "Invalid funds provided.");
        
        addressToMinted[_msgSender()] += count;

        for (uint256 i; i < count; i++) {
            _mint(_msgSender(), totalSupply + i);
        }
    }

    function whitelistMint(
        uint256 count,
        uint256 allowance,
        bytes32[] calldata proof
    ) public payable {
        uint256 totalSupply = _owners.length;
        require(isPreSale, "pre sale not started");
        require(totalSupply + count <= MAX_SUPPLY, "Excedes max supply.");
        string memory payload = string(abi.encodePacked(_msgSender()));
        require(_verify(_leaf(Strings.toString(allowance), payload), proof),"Invalid Merkle Tree proof supplied.");
        require(whitelistAddressToMinted[_msgSender()] + count <= allowance, "Exceeds whitelist supply");
        require(count * currentPrice == msg.value, "Invalid funds provided.");

        whitelistAddressToMinted[_msgSender()] += count;
        
        for (uint256 i; i < count; i++) {
            _mint(_msgSender(), totalSupply + i);
        }
    }

    function burn(uint256 tokenId) public {
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "Not approved to burn."
        );
        _burn(tokenId);
    }

    function withdraw() public {
        (bool success, ) = payable(owner()).call{value: address(this).balance}(
            ""
        );
        require(success, "Failed to send.");
    }

    function walletOfOwner(address _owner)
        public
        view
        returns (uint256[] memory)
    {
        uint256 tokenCount = balanceOf(_owner);
        if (tokenCount == 0) return new uint256[](0);

        uint256[] memory tokensId = new uint256[](tokenCount);
        for (uint256 i; i < tokenCount; i++) {
            tokensId[i] = tokenOfOwnerByIndex(_owner, i);
        }
        return tokensId;
    }

    function batchTransferFrom(
        address _from,
        address _to,
        uint256[] memory _tokenIds
    ) public {
        for (uint256 i = 0; i < _tokenIds.length; i++) {
            transferFrom(_from, _to, _tokenIds[i]);
        }
    }

    function batchSafeTransferFrom(
        address _from,
        address _to,
        uint256[] memory _tokenIds,
        bytes memory data_
    ) public {
        for (uint256 i = 0; i < _tokenIds.length; i++) {
            safeTransferFrom(_from, _to, _tokenIds[i], data_);
        }
    }

    function isOwnerOf(address account, uint256[] calldata _tokenIds)
        external
        view
        returns (bool)
    {
        for (uint256 i; i < _tokenIds.length; ++i) {
            if (_owners[_tokenIds[i]] != account) return false;
        }

        return true;
    }

    function _mint(address to, uint256 tokenId) internal virtual override {
        _owners.push(to);
        emit Transfer(address(0), to, tokenId);
    }

    function _leaf(string memory allowance, string memory payload)
        internal
        pure
        returns (bytes32)
    {
        return keccak256(abi.encodePacked(payload, allowance));
    }

    function _verify(bytes32 leaf, bytes32[] memory proof)
        internal
        view
        returns (bool)
    {
        return MerkleProof.verify(proof, whitelistMerkleRoot, leaf);
    }
}

Read Contract

MAX_SUPPLY 0x32cb6b0c → uint256
addressToMinted 0x9ec00c95 → uint256
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
currentPrice 0x9d1b464a → uint256
getAllowance 0x66fddfa9 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
isOwnerOf 0x4d44660c → bool
isPreSale 0x4ced4734 → bool
isPublicSale 0xa5a865dc → bool
isRevealed 0x54214f69 → bool
maxMintPerWallet 0xb228d925 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
whitelistAddressToMinted 0x6364fa67 → uint256
whitelistMerkleRoot 0xaa98e0c6 → bytes32

Write Contract 19 functions

These functions modify contract state and require a wallet transaction to execute.

approve 0x095ea7b3
address to
uint256 tokenId
batchSafeTransferFrom 0x5a4fee30
address _from
address _to
uint256[] _tokenIds
bytes data_
batchTransferFrom 0xf3993d11
address _from
address _to
uint256[] _tokenIds
burn 0x42966c68
uint256 tokenId
giveAway 0xc0d4c307
address[] _users
publicMint 0x2db11544
uint256 count
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
setCurrentPrice 0x18b20071
uint256 _currentPrice
setMaxPerWallet 0xe268e4d3
uint256 _maxMintPerWallet
setReveal 0xdd504bb7
bool reveal
string _baseURI
setSale 0xee82e5a0
bool preSale
bool publicSale
setWhitelistMerkleRoot 0xbd32fb66
bytes32 _whitelistMerkleRoot
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistMint 0xc4be5b59
uint256 count
uint256 allowance
bytes32[] proof
withdraw 0x3ccfd60b
No parameters

Recent Transactions

No transactions found for this address