Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xBcA5D4f9C1B6D5C8E0BFfc8a5937948112CE3F19
Balance 0.836000 ETH
Nonce 1
Code Size 18203 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

18203 bytes
0x60806040526004361061023b5760003560e01c806364eed1c21161012e578063bef870ca116100ab578063e8a3d4851161006f578063e8a3d4851461062d578063e985e9c514610642578063f0503e8014610662578063f2fde38b14610682578063f676308a146106a25761023b565b8063bef870ca146105ae578063c81678bb146105ce578063c87b56dd146105e3578063d5abeb0114610603578063de7fcb1d146106185761023b565b806395d89b41116100f257806395d89b4114610526578063a0712d681461053b578063a22cb4651461054e578063b88d4fde1461056e578063bbee1def1461058e5761023b565b806364eed1c21461049c57806367034fbe146104bc57806370a08231146104dc578063715018a6146104fc5780638da5cb5b146105115761023b565b806342842e0e116101bc5780635ab52dc6116101805780635ab52dc61461041d5780635b70ea9f146104325780635c975abb14610447578063616cdb1e1461045c5780636352211e1461047c5761023b565b806342842e0e1461037b578063438b63001461039b57806344a0d68a146103c857806345374bf2146103e857806357b9aee4146104085761023b565b806313faede61161020357806313faede61461030757806318160ddd1461032957806323b872dd1461033e57806324a6ab0c1461035e5780633ccfd60b146103735761023b565b806301ffc9a71461024057806302329a291461027657806306fdde0314610298578063081812fc146102ba578063095ea7b3146102e7575b600080fd5b34801561024c57600080fd5b5061026061025b366004613400565b6106c2565b60405161026d9190613e28565b60405180910390f35b34801561028257600080fd5b506102966102913660046133e6565b61070a565b005b3480156102a457600080fd5b506102ad610765565b60405161026d9190613e33565b3480156102c657600080fd5b506102da6102d536600461347e565b6107f7565b60405161026d9190613d93565b3480156102f357600080fd5b506102966103023660046133bd565b61083a565b34801561031357600080fd5b5061031c6108d2565b60405161026d91906143e7565b34801561033557600080fd5b5061031c6108d8565b34801561034a57600080fd5b506102966103593660046132e0565b6108e9565b34801561036a57600080fd5b5061031c610921565b610296610927565b34801561038757600080fd5b506102966103963660046132e0565b6109d2565b3480156103a757600080fd5b506103bb6103b6366004613294565b6109ed565b60405161026d9190613de4565b3480156103d457600080fd5b506102966103e336600461347e565b610aea565b3480156103f457600080fd5b5061031c610403366004613294565b610b2e565b34801561041457600080fd5b506102ad610b40565b34801561042957600080fd5b506102ad610bce565b34801561043e57600080fd5b50610296610bdb565b34801561045357600080fd5b50610260610c90565b34801561046857600080fd5b5061029661047736600461347e565b610c99565b34801561048857600080fd5b506102da61049736600461347e565b610cdd565b3480156104a857600080fd5b506102966104b7366004613438565b610d12565b3480156104c857600080fd5b506102966104d7366004613438565b610d68565b3480156104e857600080fd5b5061031c6104f7366004613294565b610dba565b34801561050857600080fd5b50610296610dfe565b34801561051d57600080fd5b506102da610e49565b34801561053257600080fd5b506102ad610e58565b61029661054936600461347e565b610e67565b34801561055a57600080fd5b50610296610569366004613394565b610f26565b34801561057a57600080fd5b5061029661058936600461331b565b610f38565b34801561059a57600080fd5b506102966105a9366004613438565b610f77565b3480156105ba57600080fd5b506102966105c9366004613496565b610fc9565b3480156105da57600080fd5b506102ad611077565b3480156105ef57600080fd5b506102ad6105fe36600461347e565b611084565b34801561060f57600080fd5b5061031c6110c5565b34801561062457600080fd5b5061031c6110cb565b34801561063957600080fd5b506102ad6110d1565b34801561064e57600080fd5b5061026061065d3660046132ae565b6110f1565b34801561066e57600080fd5b5061031c61067d36600461347e565b611121565b34801561068e57600080fd5b5061029661069d366004613294565b611133565b3480156106ae57600080fd5b506102966106bd36600461347e565b6111a1565b60006001600160e01b031982166380ac58cd60e01b14806106f357506001600160e01b03198216635b5e139f60e01b145b80610702575061070282611222565b90505b919050565b61071261123b565b6001600160a01b0316610723610e49565b6001600160a01b0316146107525760405162461bcd60e51b815260040161074990614286565b60405180910390fd5b600e805460ff1916911515919091179055565b606060008054610774906145c1565b80601f01602080910402602001604051908101604052809291908181526020018280546107a0906145c1565b80156107ed5780601f106107c2576101008083540402835291602001916107ed565b820191906000526020600020905b8154815290600101906020018083116107d057829003601f168201915b5050505050905090565b60006108028261123f565b61081e5760405162461bcd60e51b81526004016107499061423a565b506000908152600460205260409020546001600160a01b031690565b600061084582610cdd565b9050806001600160a01b0316836001600160a01b031614156108795760405162461bcd60e51b8152600401610749906142bb565b806001600160a01b031661088b61123b565b6001600160a01b031614806108a757506108a78161065d61123b565b6108c35760405162461bcd60e51b8152600401610749906140eb565b6108cd838361125c565b505050565b600a5481565b60006108e46011611206565b905090565b6108fa6108f461123b565b826112ca565b6109165760405162461bcd60e51b8152600401610749906142fc565b6108cd83838361134f565b600c5481565b61092f61123b565b6001600160a01b0316610940610e49565b6001600160a01b0316146109665760405162461bcd60e51b815260040161074990614286565b6000336001600160a01b03164760405161097f90613d82565b60006040518083038185875af1925050503d80600081146109bc576040519150601f19603f3d011682016040523d82523d6000602084013e6109c1565b606091505b50509050806109cf57600080fd5b50565b6108cd83838360405180602001604052806000815250610f38565b606060006109fa83610dba565b905060008167ffffffffffffffff811115610a2557634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610a4e578160200160208202803683370190505b509050600160005b8381108015610a675750600b548211155b15610ae0576000610a7783610cdd565b9050866001600160a01b0316816001600160a01b03161415610acd5782848381518110610ab457634e487b7160e01b600052603260045260246000fd5b602090810291909101015281610ac9816145f6565b9250505b82610ad7816145f6565b93505050610a56565b5090949350505050565b610af261123b565b6001600160a01b0316610b03610e49565b6001600160a01b031614610b295760405162461bcd60e51b815260040161074990614286565b600a55565b600f6020526000908152604090205481565b60098054610b4d906145c1565b80601f0160208091040260200160405190810160405280929190818152602001828054610b79906145c1565b8015610bc65780601f10610b9b57610100808354040283529160200191610bc6565b820191906000526020600020905b815481529060010190602001808311610ba957829003601f168201915b505050505081565b60088054610b4d906145c1565b600e5460ff1615610bfe5760405162461bcd60e51b815260040161074990613e46565b600c54610c0b6011611206565b610c169060016143fc565b1115610c345760405162461bcd60e51b815260040161074990613ef4565b336000908152600f6020526040902054600111610c635760405162461bcd60e51b8152600401610749906143a5565b610c6e336001611482565b336000908152600f60205260408120805491610c89836145f6565b9190505550565b600e5460ff1681565b610ca161123b565b6001600160a01b0316610cb2610e49565b6001600160a01b031614610cd85760405162461bcd60e51b815260040161074990614286565b600d55565b6000818152600260205260408120546001600160a01b0316806107025760405162461bcd60e51b815260040161074990614192565b610d1a61123b565b6001600160a01b0316610d2b610e49565b6001600160a01b031614610d515760405162461bcd60e51b815260040161074990614286565b8051610d64906009906020840190612ef2565b5050565b610d7061123b565b6001600160a01b0316610d81610e49565b6001600160a01b031614610da75760405162461bcd60e51b815260040161074990614286565b8051610d64906008906020840190612ef2565b60006001600160a01b038216610de25760405162461bcd60e51b815260040161074990614148565b506001600160a01b031660009081526003602052604090205490565b610e0661123b565b6001600160a01b0316610e17610e49565b6001600160a01b031614610e3d5760405162461bcd60e51b815260040161074990614286565b610e476000611504565b565b6006546001600160a01b031690565b606060018054610774906145c1565b80600081118015610e7a5750600d548111155b610e965760405162461bcd60e51b81526004016107499061434d565b600b5481610ea46011611206565b610eae91906143fc565b1115610ecc5760405162461bcd60e51b815260040161074990613e6b565b600e5460ff1615610eef5760405162461bcd60e51b815260040161074990613e46565b81600a54610efd919061453c565b341015610f1c5760405162461bcd60e51b81526004016107499061437a565b610d643383611482565b610d64610f3161123b565b8383611556565b610f49610f4361123b565b836112ca565b610f655760405162461bcd60e51b8152600401610749906142fc565b610f71848484846115f9565b50505050565b610f7f61123b565b6001600160a01b0316610f90610e49565b6001600160a01b031614610fb65760405162461bcd60e51b815260040161074990614286565b8051610d64906007906020840190612ef2565b81600081118015610fdc5750600d548111155b610ff85760405162461bcd60e51b81526004016107499061434d565b600b54816110066011611206565b61101091906143fc565b111561102e5760405162461bcd60e51b815260040161074990613e6b565b61103661123b565b6001600160a01b0316611047610e49565b6001600160a01b03161461106d5760405162461bcd60e51b815260040161074990614286565b6108cd8284611482565b60078054610b4d906145c1565b606061108f8261123f565b6110ab5760405162461bcd60e51b815260040161074990614210565b60008281526010602052604090205461070290839061162c565b600b5481565b600d5481565b60606040518060600160405280602881526020016146be60289139905090565b6001600160a01b0380831660009081526005602090815260408083209385168352929052205460ff165b92915050565b60106020526000908152604090205481565b61113b61123b565b6001600160a01b031661114c610e49565b6001600160a01b0316146111725760405162461bcd60e51b815260040161074990614286565b6001600160a01b0381166111985760405162461bcd60e51b815260040161074990613f2b565b6109cf81611504565b6111a961123b565b6001600160a01b03166111ba610e49565b6001600160a01b0316146111e05760405162461bcd60e51b815260040161074990614286565b600b5481106112015760405162461bcd60e51b815260040161074990613fed565b600c55565b5490565b80546001019055565b6001600160a01b03163b151590565b6001600160e01b031981166301ffc9a760e01b14919050565b3390565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061129182610cdd565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006112d58261123f565b6112f15760405162461bcd60e51b81526004016107499061409f565b60006112fc83610cdd565b9050806001600160a01b0316846001600160a01b031614806113375750836001600160a01b031661132c846107f7565b6001600160a01b0316145b80611347575061134781856110f1565b949350505050565b826001600160a01b031661136282610cdd565b6001600160a01b0316146113885760405162461bcd60e51b815260040161074990613f71565b6001600160a01b0382166113ae5760405162461bcd60e51b815260040161074990614024565b6113b98383836108cd565b6113c460008261125c565b6001600160a01b03831660009081526003602052604081208054600192906113ed90849061455b565b90915550506001600160a01b038216600090815260036020526040812080546001929061141b9084906143fc565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a46108cd8383836108cd565b60015b8181116108cd57611496601161120a565b60006114a26011611206565b90506114ae8482612825565b6114b960014361455b565b6040516114cc9140908390602001613d85565b60408051601f1981840301815291815281516020928301206000938452601090925290912055806114fc816145f6565b915050611485565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156115885760405162461bcd60e51b815260040161074990614068565b6001600160a01b0383811660008181526005602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906115ec908590613e28565b60405180910390a3505050565b61160484848461134f565b6116108484848461283f565b610f715760405162461bcd60e51b815260040161074990613ea2565b6060611636612f76565b61163e612ff8565b60006116498561295a565b9050604051806101800160405280602860ff168152602001604860ff168152602001605c60ff168152602001606160ff168152602001606360ff168152602001606460ff168152602001606460ff168152602001606460ff168152602001606460ff168152602001606460ff168152602001606460ff168152602001606460ff1681525082600001819052506040518060c0016040528060405180604001604052806006815260200165139bdc9b585b60d21b815250815260200160405180604001604052806006815260200165536b696e6e7960d01b815250815260200160405180604001604052806006815260200165546174746f6f60d01b81525081526020016040518060400160405280600381526020016241706560e81b8152508152602001604051806040016040528060068152602001655a6f6d62696560d01b81525081526020016040518060400160405280600881526020016729b5b2b632ba37b760c11b8152508152508260200181905250604051806101800160405280601260ff168152602001602460ff168152602001603660ff168152602001604860ff168152602001605a60ff168152602001605f60ff168152602001606460ff168152602001606460ff168152602001606460ff168152602001606460ff168152602001606460ff168152602001606460ff1681525082604001819052506040518060e001604052806040518060400160405280600781526020016648756d616e203160c81b815250815260200160405180604001604052806007815260200166243ab6b0b7101960c91b81525081526020016040518060400160405280600781526020016648756d616e203360c81b815250815260200160405180604001604052806007815260200166121d5b585b880d60ca1b81525081526020016040518060400160405280600781526020016648756d616e203560c81b81525081526020016040518060400160405280600781526020016656616d7069726560c81b81525081526020016040518060400160405280600981526020016820b6b83434b134b0b760b91b8152508152508260600181905250604051806101800160405280600c60ff168152602001601960ff168152602001602560ff168152602001603260ff168152602001603e60ff168152602001604c60ff168152602001605060ff168152602001605460ff168152602001605860ff168152602001605c60ff168152602001606060ff168152602001606460ff168152508260800181905250604051806101800160405280604051806040016040528060048152602001634772617960e01b81525081526020016040518060400160405280600581526020016420b6b132b960d91b815250815260200160405180604001604052806005815260200164213937bbb760d91b815250815260200160405180604001604052806006815260200165426c6f6e646560d01b815250815260200160405180604001604052806005815260200164426c61636b60d81b8152508152602001604051806040016040528060038152602001622a30b760e91b81525081526020016040518060400160405280600381526020016214995960ea1b81525081526020016040518060400160405280600481526020016350696e6b60e01b815250815260200160405180604001604052806004815260200163426c756560e01b81525081526020016040518060400160405280600581526020016423b932b2b760d91b815250815260200160405180604001604052806006815260200165507572706c6560d01b815250815260200160405180604001604052806005815260200164576869746560d81b8152508152508260a00181905250604051806101200160405280606360ff168152602001603260ff168152602001601e60ff168152602001601e60ff168152602001601460ff168152602001601460ff168152602001600a60ff168152602001600a60ff168152602001600560ff168152508260c001819052506040518060800160405280600860ff168152602001601e60ff168152602001602860ff168152602001600460ff168152508260e001819052506040518060400160405280604051806101200160405280600c60ff168152602001602760ff168152602001601660ff168152602001602360ff168152602001600460ff168152602001600660ff168152602001600560ff168152602001600560ff168152602001600360ff168152508152602001604051806101200160405280600860ff168152602001601260ff168152602001601460ff168152602001601260ff168152602001600c60ff168152602001600a60ff168152602001600960ff168152602001600960ff168152602001600460ff1681525081525082610100018190525060405180604001604052806040518060800160405280600560ff168152602001601960ff168152602001601360ff168152602001600860ff1681525081526020016040518060800160405280600660ff168152602001601560ff168152602001601360ff168152602001600860ff1681525081525082610120018190525060405180608001604052806040518060400160405280600581526020016409adeeae8d60db1b81525081526020016040518060400160405280600381526020016212185d60ea1b81525081526020016040518060400160405280600781526020016622bcb2bbb2b0b960c91b81525081526020016040518060400160405280600781526020016614dc1958da585b60ca1b815250815250826101400181905250611e4c8160016002612a75565b8352611e5b8160026004612a75565b6020840152611e6d8160046006612a75565b6040840152611e7f8160066008612a75565b6060840152611e9181603c603e612a75565b6080840152611ea381603e6040612a75565b60a0840152611eb58160406042612a75565b60c0840152611ec78160426043612a75565b60e08401526007611ed78661295a565b604051602001611ee89291906138fd565b60408051601f198184030181529190526101008401526009611f098661295a565b604051602001611f1a9291906139b3565b60408051601f198184030181529190526101208401526008611f3b8761295a565b604051602001611f4c929190613b6f565b60408051601f19818403018152919052610140840152611f6b8661295a565b604051602001611f7b91906138c6565b60408051601f1981840301815291905261016084015282516000908190611fa190612b6e565b9150611fae600283614611565b9050611fc3611fbe600284614611565b61295a565b85526020850151611fd390612b6e565b9150611fe3828560000151612c04565b61016085018190526020850151906006811061200f57634e487b7160e01b600052603260045260246000fd5b602002015185602001819052506120298560400151612b6e565b9150836060015161203e838660400151612c04565b6007811061205c57634e487b7160e01b600052603260045260246000fd5b60200201516040860152606085015161207490612b6e565b91508360a00151612089838660800151612c04565b600c81106120a757634e487b7160e01b600052603260045260246000fd5b6020020151606086015260e08501516120bf90612b6e565b91506120cf611fbe600584614611565b60e086015260c08501516120e290612b6e565b91506120f2611fbe600c84614611565b60c0860152608085015161210590612b6e565b9150806121245761211a611fbe602484614611565b6080860152612138565b612132611fbe602384614611565b60808601525b6121458560a00151612b6e565b91508061216e576040805180820190915260018152600360fc1b602082015260a0860152612182565b61217c611fbe601a84614611565b60a08601525b600284610160015111156121b05760208501516040860181905260a0860181905260c0860181905260e08601525b6000805b60098110156124235761221b612216866121cf84600461453c565b6121da9060086143fc565b6121e59060026143fc565b6121f085600461453c565b6121fb9060086143fc565b6122069060026143fc565b6122119060026143fc565b612a75565b612b6e565b93508560c00151816009811061224157634e487b7160e01b600052603260045260246000fd5b602002015160ff16841015612345578161225a816145f6565b925061229190506122168661227084600461453c565b61227b9060086143fc565b61228685600461453c565b6122069060086143fc565b935086600001516122f687610100015185600281106122c057634e487b7160e01b600052603260045260246000fd5b602002015183600981106122e457634e487b7160e01b600052603260045260246000fd5b6020020151611fbe9060ff1687614611565b604051602001612307929190613c33565b604051602081830303815290604052876101800151826009811061233b57634e487b7160e01b600052603260045260246000fd5b602002015261238f565b60405180604001604052806006815260200165112737b7329160d11b815250876101800151826009811061238957634e487b7160e01b600052603260045260246000fd5b60200201525b61239d611fbe8260016143fc565b87610180015182600981106123c257634e487b7160e01b600052603260045260246000fd5b60200201516040516020016123d8929190613bb6565b604051602081830303815290604052876101800151826009811061240c57634e487b7160e01b600052603260045260246000fd5b60200201528061241b816145f6565b9150506121b4565b506000805b60048110156126935761246f6122168761244384600461453c565b61244e90602c6143fc565b6124599060026143fc565b61246485600461453c565b6121fb90602c6143fc565b94508660e00151816004811061249557634e487b7160e01b600052603260045260246000fd5b602002015160ff1685101561259957816124ae816145f6565b92506124e59050612216876124c484600461453c565b6124cf90602c6143fc565b6124da85600461453c565b61220690602c6143fc565b9450876000015161254a886101200151866002811061251457634e487b7160e01b600052603260045260246000fd5b6020020151836004811061253857634e487b7160e01b600052603260045260246000fd5b6020020151611fbe9060ff1688614611565b60405160200161255b929190613959565b604051602081830303815290604052886101a00151826004811061258f57634e487b7160e01b600052603260045260246000fd5b60200201526125e3565b60405180604001604052806006815260200165112737b7329160d11b815250886101a0015182600481106125dd57634e487b7160e01b600052603260045260246000fd5b60200201525b866101400151816004811061260857634e487b7160e01b600052603260045260246000fd5b6020020151886101a00151826004811061263257634e487b7160e01b600052603260045260246000fd5b60200201516040516020016126489291906139d9565b604051602081830303815290604052886101a00151826004811061267c57634e487b7160e01b600052603260045260246000fd5b60200201528061268b816145f6565b915050612428565b5061018087015180516020808301516040808501516060860151608087015160a088015160c089015160e08a0151610100909a015195516126e29a9798959794969395929491939192016136d0565b60408051808303601f190181529181526101c08901919091526101a088015180516020820151928201516060909201516000939192906127218761295a565b61272a8761295a565b8d604001518e600001518f60c0015160405160200161275199989796959493929190613790565b60405160208183030381529060405290506000886020015189600001518a608001518b606001518c60e001518d60a0015160405160200161279796959493929190613a49565b60405160208183030381529060405290506127f58961016001518a6101c0015184848d61010001518e61012001518f61014001516040516020016127e19796959493929190613c52565b604051602081830303815290604052612c63565b6040516020016128059190613d3d565b604051602081830303815290604052995050505050505050505092915050565b610d64828260405180602001604052806000815250612dd8565b6000612853846001600160a01b0316611213565b1561294f57836001600160a01b031663150b7a0261286f61123b565b8786866040518563ffffffff1660e01b81526004016128919493929190613da7565b602060405180830381600087803b1580156128ab57600080fd5b505af19250505080156128db575060408051601f3d908101601f191682019092526128d89181019061341c565b60015b612935573d808015612909576040519150601f19603f3d011682016040523d82523d6000602084013e61290e565b606091505b50805161292d5760405162461bcd60e51b815260040161074990613ea2565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611347565b506001949350505050565b60608161297f57506040805180820190915260018152600360fc1b6020820152610705565b8160005b81156129a95780612993816145f6565b91506129a29050600a83614414565b9150612983565b60008167ffffffffffffffff8111156129d257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156129fc576020820181803683370190505b5090505b841561134757612a1160018361455b565b9150612a1e600a86614611565b612a299060306143fc565b60f81b818381518110612a4c57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612a6e600a86614414565b9450612a00565b6060836000612a84858561455b565b67ffffffffffffffff811115612aaa57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612ad4576020820181803683370190505b509050845b84811015612b6257828181518110612b0157634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191682612b1b888461455b565b81518110612b3957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535080612b5a816145f6565b915050612ad9565b509150505b9392505050565b6000805b8251811015612bfe576001818451612b8a919061455b565b612b94919061455b565b612b9f90600a61446e565b6030848381518110612bc157634e487b7160e01b600052603260045260246000fd5b0160200151612bd3919060f81c614572565b60ff16612be0919061453c565b612bea90836143fc565b915080612bf6816145f6565b915050612b72565b50919050565b6000805b600c811015612c59578281600c8110612c3157634e487b7160e01b600052603260045260246000fd5b602002015160ff16841015612c4757905061111b565b80612c51816145f6565b915050612c08565b5060009392505050565b6060815160001415612c845750604080516020810190915260008152610705565b600060405180606001604052806040815260200161467e6040913990506000600384516002612cb391906143fc565b612cbd9190614414565b612cc890600461453c565b90506000612cd78260206143fc565b67ffffffffffffffff811115612cfd57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612d27576020820181803683370190505b509050818152600183018586518101602084015b81831015612d93576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101612d3b565b600389510660018114612dad5760028114612dbe57612dca565b613d3d60f01b600119830152612dca565b603d60f81b6000198301525b509398975050505050505050565b612de28383612e0b565b612def600084848461283f565b6108cd5760405162461bcd60e51b815260040161074990613ea2565b6001600160a01b038216612e315760405162461bcd60e51b8152600401610749906141db565b612e3a8161123f565b15612e575760405162461bcd60e51b815260040161074990613fb6565b612e63600083836108cd565b6001600160a01b0382166000908152600360205260408120805460019290612e8c9084906143fc565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4610d64600083836108cd565b828054612efe906145c1565b90600052602060002090601f016020900481019282612f205760008555612f66565b82601f10612f3957805160ff1916838001178555612f66565b82800160010185558215612f66579182015b82811115612f66578251825591602001919060010190612f4b565b50612f7292915061309b565b5090565b604051806101e00160405280606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081526020016060815260200160608152602001612fde6130b0565b8152602001612feb6130d8565b8152602001606081525090565b60405180610180016040528061300c6130f2565b8152602001613019613111565b81526020016130266130f2565b815260200161303361312b565b81526020016130406130f2565b815260200161304d613145565b815260200161305a613160565b815260200161306761317f565b815260200161307461319d565b81526020016130816131ca565b815260200161308e6130d8565b8152602001600081525090565b5b80821115612f72576000815560010161309c565b6040518061012001604052806009905b60608152602001906001900390816130c05790505090565b6040805160808101909152606081526003602082016130c0565b604051806101800160405280600c906020820280368337509192915050565b6040805160c08101909152606081526005602082016130c0565b6040805160e08101909152606081526006602082016130c0565b60408051610180810190915260608152600b602082016130c0565b6040518061012001604052806009906020820280368337509192915050565b60405180608001604052806004906020820280368337509192915050565b60405180604001604052806002905b6131b4613160565b8152602001906001900390816131ac5790505090565b60405180604001604052806002905b6131e161317f565b8152602001906001900390816131d95790505090565b600067ffffffffffffffff8084111561321257613212614651565b604051601f8501601f19908116603f0116810190828211818310171561323a5761323a614651565b8160405280935085815286868601111561325357600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b038116811461070557600080fd5b8035801515811461070557600080fd5b6000602082840312156132a5578081fd5b612b678261326d565b600080604083850312156132c0578081fd5b6132c98361326d565b91506132d76020840161326d565b90509250929050565b6000806000606084860312156132f4578081fd5b6132fd8461326d565b925061330b6020850161326d565b9150604084013590509250925092565b60008060008060808587031215613330578081fd5b6133398561326d565b93506133476020860161326d565b925060408501359150606085013567ffffffffffffffff811115613369578182fd5b8501601f81018713613379578182fd5b613388878235602084016131f7565b91505092959194509250565b600080604083850312156133a6578182fd5b6133af8361326d565b91506132d760208401613284565b600080604083850312156133cf578182fd5b6133d88361326d565b946020939093013593505050565b6000602082840312156133f7578081fd5b612b6782613284565b600060208284031215613411578081fd5b8135612b6781614667565b60006020828403121561342d578081fd5b8151612b6781614667565b600060208284031215613449578081fd5b813567ffffffffffffffff81111561345f578182fd5b8201601f8101841361346f578182fd5b611347848235602084016131f7565b60006020828403121561348f578081fd5b5035919050565b600080604083850312156134a8578182fd5b823591506132d76020840161326d565b600081518084526134d0816020860160208601614595565b601f01601f19169290920160200192915050565b600081516134f6818560208601614595565b9290920192915050565b80546000906002810460018083168061351a57607f831692505b602080841082141561353a57634e487b7160e01b86526022600452602486fd5b81801561354e576001811461355f5761358c565b60ff1986168952848901965061358c565b613568886143f0565b60005b868110156135845781548b82015290850190830161356b565b505084890196505b50505050505092915050565b7f227d2c7b2274726169745f74797065223a2246616365222c2276616c7565223a8152650112a3cb832960d51b602082015260260190565b7f227d2c7b2274726169745f74797065223a2246616369616c2048616972222c2281526d03b30b63ab2911d1129ba3cb632960951b6020820152602e0190565b7f227d2c7b2274726169745f74797065223a2248656164222c2276616c7565223a8152650112a3cb832960d51b602082015260260190565b62089f4b60ea1b815260030190565b7f227d2c7b2274726169745f74797065223a224944222c2276616c7565223a224981526244202360e81b602082015260230190565b61227d60f01b815260020190565b607d60f81b815260010190565b7f7d2c7b2274726169745f74797065223a22536b696e222c2276616c7565223a22815260200190565b60008a516136e2818460208f01614595565b8a516136f48183860160208f01614595565b8a519184010190613709818360208e01614595565b895161371b8183850160208e01614595565b8951929091010190613731818360208c01614595565b8751910190613744818360208b01614595565b86516137568183850160208b01614595565b865192909101019061376c818360208901614595565b845161377e8183850160208901614595565b9101019b9a5050505050505050505050565b60008a516137a2818460208f01614595565b8a51908301906137b6818360208f01614595565b8a519101906137c9818360208e01614595565b89519101906137dc818360208d01614595565b8082019150507f7b2274726169745f74797065223a22546f7020436f756e74222c2276616c7565815261111d60f11b60208201528751613823816022840160208c01614595565b7f7d2c7b2274726169745f74797065223a224163636573736f727920436f756e7460229290910191820152691116113b30b63ab2911d60b11b6042820152865161387481604c840160208b01614595565b6138b56138b06138aa6138a561389f61389a613894604c888a01016136a7565b8d6134e4565b613657565b8a6134e4565b613598565b876134e4565b613648565b9d9c50505050505050505050505050565b6d226e616d65223a2250454550202360901b815281516000906138f081600e850160208701614595565b91909101600e0192915050565b6f1132bc3a32b93730b62fbab936111d1160811b815260006139226010830185613500565b623f733d60e81b8152835161393e816003840160208801614595565b61088b60f21b60039290910191820152600501949350505050565b6222412360e81b81528251600090613978816003850160208801614595565b602d60f81b6003918401918201528351613999816004840160208801614595565b601160f91b60049290910191820152600501949350505050565b701130b734b6b0ba34b7b72fbab936111d1160791b815260006139226011830185613500565b6e3d913a3930b4ba2fba3cb832911d1160891b81528251600090613a0481600f850160208801614595565b691116113b30b63ab2911d60b11b600f918401918201528351613a2e816019840160208801614595565b611f4b60f21b60199290910191820152601b01949350505050565b60007f7b2274726169745f74797065223a2254797065222c2276616c7565223a22000082528751613a8181601e850160208c01614595565b7f227d2c7b2274726169745f74797065223a2248616972222c2276616c7565223a601e918401918201526601129ba3cb632960cd1b603e8201528751613ace816045840160208c01614595565b602d60f81b604592909101918201528651613af0816046840160208b01614595565b7f227d2c7b2274726169745f74797065223a224861697220436f6c6f72222c2276604692909101918201526630b63ab2911d1160c91b6066820152613b62613b5d613b57613b52613b4c613b47606d87018c6134e4565b613610565b896134e4565b6135d0565b866134e4565b61368c565b9998505050505050505050565b681134b6b0b3b2911d1160b91b81526000613b8d6009830185613500565b8351613b9d818360208801614595565b64173837339160d91b9101908152600501949350505050565b60007f7b2274726169745f74797065223a22546f70204c61796572200000000000000082528351613bee816019850160208801614595565b691116113b30b63ab2911d60b11b6019918401918201528351613c18816023840160208801614595565b611f4b60f21b60239290910191820152602501949350505050565b6222542360e81b81528251600090613978816003850160208801614595565b6000607b60f81b825288516020613c6f8260018601838e01614595565b7f222c226465736372697074696f6e223a22222c2261747472696275746573223a600192850192830152605b60f81b60218301528951613cb58160228501848e01614595565b8951920191613cca8160228501848d01614595565b8851920191613cdf8160228501848c01614595565b61174b60f21b602293909101928301528651613d018160248501848b01614595565b8651920191613d168160248501848a01614595565b613d2d613d28602483860101886134e4565b61369a565b9c9b505050505050505050505050565b60007f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000082528251613d7581601d850160208701614595565b91909101601d0192915050565b90565b918252602082015260400190565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613dda908301846134b8565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015613e1c57835183529284019291840191600101613e00565b50909695505050505050565b901515815260200190565b600060208252612b6760208301846134b8565b6020808252600b908201526a135a5b9d0814185d5cd95960aa1b604082015260600190565b60208082526017908201527f4d6178204e465420737570706c79206578636565646564000000000000000000604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252601c908201527f4d61782046726565204e465420737570706c7920657863656564656400000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b6020808252601f908201527f4d75737420626520736d616c6c6572207468616e204d617820537570706c7900604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201526832b73a103a37b5b2b760b91b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b60208082526010908201526f546f6b656e206e6f7420666f756e642160801b604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b602080825260139082015272125b9d985b1a59081b5a5b9d08185b5bdd5b9d606a1b604082015260600190565b602080825260119082015270125b9cdd59999a58da595b9d08199d5b99607a1b604082015260600190565b60208082526022908201527f4f6e6c7920312046726565204e4654207065722077616c6c657420616c6c6f77604082015261195960f21b606082015260800190565b90815260200190565b60009081526020902090565b6000821982111561440f5761440f614625565b500190565b6000826144235761442361463b565b500490565b80825b600180861161443a5750614465565b81870482111561444c5761444c614625565b8086161561445957918102915b9490941c93800261442b565b94509492505050565b6000612b67600019848460008261448757506001612b67565b8161449457506000612b67565b81600181146144aa57600281146144b4576144e1565b6001915050612b67565b60ff8411156144c5576144c5614625565b6001841b9150848211156144db576144db614625565b50612b67565b5060208310610133831016604e8410600b8410161715614514575081810a8381111561450f5761450f614625565b612b67565b6145218484846001614428565b80860482111561453357614533614625565b02949350505050565b600081600019048311821515161561455657614556614625565b500290565b60008282101561456d5761456d614625565b500390565b600060ff821660ff84168082101561458c5761458c614625565b90039392505050565b60005b838110156145b0578181015183820152602001614598565b83811115610f715750506000910152565b6002810460018216806145d557607f821691505b60208210811415612bfe57634e487b7160e01b600052602260045260246000fd5b600060001982141561460a5761460a614625565b5060010190565b6000826146205761462061463b565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b0319811681146109cf57600080fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f68747470733a2f2f7375706572636f6f6c70656570732e636f6d2f6d657461646174612e6a736f6ea26469706673582212205ae6601c891a760e50240b9beb28e95eeef45ff3762c9d68f9a2f9bd80e823ab64736f6c63430008010033

Verified Source Code Partial Match

Compiler: v0.8.1+commit.df193b15 EVM: istanbul Optimization: Yes (200 runs)
SUPERCOOLPEEPS.sol 1657 lines
// File: base64-sol/base64.sol



pragma solidity >=0.6.0;

/// @title Base64
/// @author Brecht Devos - <[email protected]>
/// @notice Provides functions for encoding/decoding base64
library Base64 {
    string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    bytes  internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
                                            hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000"
                                            hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000"
                                            hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000";

    function encode(bytes memory data) internal pure returns (string memory) {
        if (data.length == 0) return '';

        // load the table into memory
        string memory table = TABLE_ENCODE;

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((data.length + 2) / 3);

        // add some extra buffer at the end required for the writing
        string memory result = new string(encodedLen + 32);

        assembly {
            // set the actual output length
            mstore(result, encodedLen)

            // prepare the lookup table
            let tablePtr := add(table, 1)

            // input ptr
            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))

            // result ptr, jump over length
            let resultPtr := add(result, 32)

            // run over the input, 3 bytes at a time
            for {} lt(dataPtr, endPtr) {}
            {
                // read 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // write 4 characters
                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1)
                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1)
                mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F))))
                resultPtr := add(resultPtr, 1)
                mstore8(resultPtr, mload(add(tablePtr, and(        input,  0x3F))))
                resultPtr := add(resultPtr, 1)
            }

            // padding with '='
            switch mod(mload(data), 3)
            case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
            case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
        }

        return result;
    }

    function decode(string memory _data) internal pure returns (bytes memory) {
        bytes memory data = bytes(_data);

        if (data.length == 0) return new bytes(0);
        require(data.length % 4 == 0, "invalid base64 decoder input");

        // load the table into memory
        bytes memory table = TABLE_DECODE;

        // every 4 characters represent 3 bytes
        uint256 decodedLen = (data.length / 4) * 3;

        // add some extra buffer at the end required for the writing
        bytes memory result = new bytes(decodedLen + 32);

        assembly {
            // padding with '='
            let lastBytes := mload(add(data, mload(data)))
            if eq(and(lastBytes, 0xFF), 0x3d) {
                decodedLen := sub(decodedLen, 1)
                if eq(and(lastBytes, 0xFFFF), 0x3d3d) {
                    decodedLen := sub(decodedLen, 1)
                }
            }

            // set the actual output length
            mstore(result, decodedLen)

            // prepare the lookup table
            let tablePtr := add(table, 1)

            // input ptr
            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))

            // result ptr, jump over length
            let resultPtr := add(result, 32)

            // run over the input, 4 characters at a time
            for {} lt(dataPtr, endPtr) {}
            {
               // read 4 characters
               dataPtr := add(dataPtr, 4)
               let input := mload(dataPtr)

               // write 3 bytes
               let output := add(
                   add(
                       shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)),
                       shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))),
                   add(
                       shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)),
                               and(mload(add(tablePtr, and(        input , 0xFF))), 0xFF)
                    )
                )
                mstore(resultPtr, shl(232, output))
                resultPtr := add(resultPtr, 3)
            }
        }

        return result;
    }
}

// File: @openzeppelin/contracts/utils/Counters.sol


// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

// File: @openzeppelin/contracts/utils/Strings.sol


// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

// File: @openzeppelin/contracts/utils/Context.sol


// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol


// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;


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

// File: @openzeppelin/contracts/utils/Address.sol


// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol


// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

// File: @openzeppelin/contracts/utils/introspection/IERC165.sol


// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// File: @openzeppelin/contracts/utils/introspection/ERC165.sol


// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;


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

// File: @openzeppelin/contracts/token/ERC721/IERC721.sol


// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;


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

// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol


// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;


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

// File: @openzeppelin/contracts/token/ERC721/ERC721.sol


// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;








/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

// File: contracts/SUPERCOOLPEEPS.sol


// SUPER COOL PEEPS
// by SuperCoolStyle

pragma solidity 0.8.1;





contract SUPERCOOLPEEPS is ERC721, Ownable {
  using Strings for uint256;
  using Counters for Counters.Counter;
  string public baseExtURI="https://supercoolpeeps.com/";
  string public baseImgURI="https://supercoolpeeps.com/img/";
  string public baseAniURI = "https://supercoolpeeps.com/app.html";
  uint256 public cost = 10 ether;
  uint256 public maxSupply = 10000;
  uint256 public freeSupply = 500;
  uint256 public maxMintPerTx = 10;
  bool public paused = true;
  mapping(address => uint256) public addressFreeMint;
  mapping(uint256 => uint256) public seeds;
  Counters.Counter private supply;

  
  constructor() ERC721("SUPERCOOLPEEPS", "PEEP") {
    privateMint(10,msg.sender);
  }

  function freeMint() public{
    require(!paused,"Mint Paused");
    require(supply.current() + 1 <= freeSupply,"Max Free NFT supply exceeded");
    require(addressFreeMint[msg.sender] < 1, "Only 1 Free NFT per wallet allowed");
    _mintCore(msg.sender,1);
    addressFreeMint[msg.sender]++;
  }

  function mint(uint256 _mintAmount) public payable mintMod(_mintAmount){
  
    require(!paused,"Mint Paused");
    require(msg.value >= cost * _mintAmount,"Insufficient fund");
    _mintCore(msg.sender,_mintAmount);

  }

  function privateMint(uint256 _mintAmount, address _receiver) public mintMod(_mintAmount) onlyOwner {
    _mintCore(_receiver,_mintAmount);
  }

  modifier mintMod(uint256 _mintAmount) {
    require(_mintAmount > 0 && _mintAmount <= maxMintPerTx, "Invalid mint amount");
    require(supply.current()+ _mintAmount <= maxSupply,"Max NFT supply exceeded");
    _;
  }

  function _mintCore(address _receiver, uint256 _mintAmount) internal {
     for (uint256 i = 1; i <= _mintAmount; i++) {
      supply.increment();
      uint256 tid = supply.current();
      _safeMint(_receiver, tid);
      seeds[tid] = uint256(keccak256(abi.encodePacked(uint256(bytes32(blockhash(block.number - 1))), tid)));
    }
  }

  function walletOfOwner(address _owner)
    public
    view
    returns (uint256[] memory)
  {
    uint256 ownerTokenCount = balanceOf(_owner);
    uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount);
    uint256 currentTokenId = 1;
    uint256 ownedTokenIndex = 0;

    while (ownedTokenIndex < ownerTokenCount && currentTokenId <= maxSupply) {
      address currentTokenOwner = ownerOf(currentTokenId);

      if (currentTokenOwner == _owner) {
        ownedTokenIds[ownedTokenIndex] = currentTokenId;
        ownedTokenIndex++;
      }
      currentTokenId++;
    }
    return ownedTokenIds;
  }
  
  function contractURI() public pure returns (string memory) {
         return "https://supercoolpeeps.com/metadata.json";
  }


  function tokenURI(uint256 tokenId)
    public
    view
    virtual
    override
    returns (string memory)
  {
    require(
      _exists(tokenId), "Token not found!"
    );
    return(genMeta(tokenId,seeds[tokenId]));
  }

  function totalSupply() public view returns (uint256) {
    return supply.current();
  }
  function setCost(uint256 _new) public onlyOwner() {
    cost = _new;
  }

  function setFreeSupply(uint256 _new) public onlyOwner() {
    require(_new < maxSupply, "Must be smaller than Max Supply");
    freeSupply = _new;
  }

  function setMaxMintPerTx(uint256 _new) public onlyOwner() {
    maxMintPerTx = _new;
  }

  function setBaseExtURI(string memory _new) public onlyOwner {
    baseExtURI = _new;
  }

  function setBaseAniURI(string memory _new) public onlyOwner {
    baseAniURI = _new;
  }
  function setBaseImgURI(string memory _new) public onlyOwner {
    baseImgURI = _new;
  }
  function pause(bool _state) public onlyOwner {
    paused = _state;
  }

  function withdraw() public payable onlyOwner {
    (bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
    require(success);
  }
  
  function substring(string memory str, uint startIndex, uint endIndex) private pure returns (string memory) {
    bytes memory strBytes = bytes(str);
    bytes memory result = new bytes(endIndex-startIndex);
    for(uint i = startIndex; i < endIndex; i++) {
        result[i-startIndex] = strBytes[i];
    }
    return string(result);
  }
    
    
  function strToUint(string memory _str) private pure returns(uint256 res) {
    for (uint256 i = 0; i < bytes(_str).length; i++) {
        res += (uint8(bytes(_str)[i]) - 48) * 10**(bytes(_str).length - i - 1);
    }
    return (res);
  }


  function getRanResult(uint256 num, uint8[12] memory chance) private pure returns(uint256 res) {
    for (uint256 i=0; i<chance.length; i++)
      if (num<chance[i]) return(i);  
    return(0);
  } 

  struct Metadata{
    string gender;
    string body;
    string skin;
    string hairColor;
    string hair;
    string beard;
    string face;
    string head;    

    string extURL;
    string aniURL;
    string imgURL;
    string name;

    string[9] tops;
    string[4] goodies;

    string topPacked;
  }

  struct CheckData{
     uint8[12] chanceBody;
     string[6] nameBody;

     uint8[12] chanceSkin;
     string[7] nameSkin;

     uint8[12] chanceHairColor;
     string[12] nameHairColor;

     uint8[9] chanceShowTop;
     uint8[4] chanceShowGoodie;

     uint8[9][2] topsTotal;
     uint8[4][2] goodiesTotal;

     string[4] nameGoodie;

     uint256 body;
  }
  
  
  function genMeta(uint256 tid, uint256 seed) private view returns (string memory) {
        Metadata memory attr;
        CheckData memory check;
        string memory seedStr = seed.toString();

        
        check.chanceBody=[40,72,92,97,99,100,100,100,100,100,100,100];
        check.nameBody=["Normal","Skinny","Tattoo","Ape","Zombie","Skeleton"];

        check.chanceSkin=[18,36,54,72,90,95,100,100,100,100,100,100];
        check.nameSkin=["Human 1","Human 2","Human 3","Human 4","Human 5","Vampire","Amphibian"];

        check.chanceHairColor=[12,25,37,50,62,76,80,84,88,92,96,100];
        check.nameHairColor=["Gray","Amber","Brown","Blonde","Black","Tan","Red","Pink","Blue","Green","Purple","White"];

     ...

// [truncated — 55765 bytes total]

Read Contract

addressFreeMint 0x45374bf2 → uint256
balanceOf 0x70a08231 → uint256
baseAniURI 0x57b9aee4 → string
baseExtURI 0xc81678bb → string
baseImgURI 0x5ab52dc6 → string
contractURI 0xe8a3d485 → string
cost 0x13faede6 → uint256
freeSupply 0x24a6ab0c → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxMintPerTx 0xde7fcb1d → uint256
maxSupply 0xd5abeb01 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
seeds 0xf0503e80 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]

Write Contract 18 functions

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

approve 0x095ea7b3
address to
uint256 tokenId
freeMint 0x5b70ea9f
No parameters
mint 0xa0712d68
uint256 _mintAmount
pause 0x02329a29
bool _state
privateMint 0xbef870ca
uint256 _mintAmount
address _receiver
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
setBaseAniURI 0x64eed1c2
string _new
setBaseExtURI 0xbbee1def
string _new
setBaseImgURI 0x67034fbe
string _new
setCost 0x44a0d68a
uint256 _new
setFreeSupply 0xf676308a
uint256 _new
setMaxMintPerTx 0x616cdb1e
uint256 _new
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters

Token Balances (1)

View Transfers →
WETH 0

Recent Transactions

No transactions found for this address