Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x0C648F8d5bd5EeD6CE45A3081f4b1612715aaa07
Balance 0 ETH
Nonce 1
Code Size 11411 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

11411 bytes
0x6080604052600436106101d85760003560e01c8063715018a611610102578063a22cb46511610095578063d5abeb0111610064578063d5abeb01146104df578063e985e9c5146104f5578063ee1cc94414610515578063f2fde38b1461053557600080fd5b8063a22cb4651461046c578063b88d4fde1461048c578063c11feac11461049f578063c87b56dd146104bf57600080fd5b806395d89b41116100d157806395d89b411461040b578063996517cf146104205780639e6a1d7d14610436578063a035b1fe1461045657600080fd5b8063715018a6146103a25780637501f741146103b75780638da5cb5b146103cd57806391b7f5ed146103eb57600080fd5b8063378a93341161017a578063449a52f811610149578063449a52f814610322578063547520fe146103425780636352211e1461036257806370a082311461038257600080fd5b8063378a9334146102d15780633ccfd60b146102e45780634230baee146102f957806342842e0e1461030f57600080fd5b8063095ea7b3116101b6578063095ea7b31461026c57806318160ddd1461028157806323b872dd146102a457806325fd90f3146102b757600080fd5b806301ffc9a7146101dd57806306fdde0314610212578063081812fc14610234575b600080fd5b3480156101e957600080fd5b506101fd6101f8366004611ea7565b610555565b60405190151581526020015b60405180910390f35b34801561021e57600080fd5b506102276105a7565b6040516102099190611f14565b34801561024057600080fd5b5061025461024f366004611f27565b610639565b6040516001600160a01b039091168152602001610209565b61027f61027a366004611f57565b610674565b005b34801561028d57600080fd5b50610296610684565b604051908152602001610209565b61027f6102b2366004611f81565b610692565b3480156102c357600080fd5b506010546101fd9060ff1681565b61027f6102df366004611f27565b610813565b3480156102f057600080fd5b5061027f6108b9565b34801561030557600080fd5b50610296600f5481565b61027f61031d366004611f81565b610968565b34801561032e57600080fd5b5061027f61033d366004611f57565b610988565b34801561034e57600080fd5b5061027f61035d366004611f27565b61099a565b34801561036e57600080fd5b5061025461037d366004611f27565b6109a7565b34801561038e57600080fd5b5061029661039d366004611fbd565b6109b2565b3480156103ae57600080fd5b5061027f6109f8565b3480156103c357600080fd5b50610296600e5481565b3480156103d957600080fd5b50600a546001600160a01b0316610254565b3480156103f757600080fd5b5061027f610406366004611f27565b610a0c565b34801561041757600080fd5b50610227610a19565b34801561042c57600080fd5b50610296600c5481565b34801561044257600080fd5b5061027f610451366004611f27565b610a28565b34801561046257600080fd5b50610296600d5481565b34801561047857600080fd5b5061027f610487366004611fe8565b610a35565b61027f61049a366004612031565b610aa1565b3480156104ab57600080fd5b506102276104ba366004611f27565b610ae2565b3480156104cb57600080fd5b506102276104da366004611f27565b610b8f565b3480156104eb57600080fd5b50610296600b5481565b34801561050157600080fd5b506101fd61051036600461210d565b610c6f565b34801561052157600080fd5b5061027f610530366004612137565b610c9d565b34801561054157600080fd5b5061027f610550366004611fbd565b610cb8565b60006301ffc9a760e01b6001600160e01b03198316148061058657506380ac58cd60e01b6001600160e01b03198316145b806105a15750635b5e139f60e01b6001600160e01b03198316145b92915050565b6060600280546105b690612152565b80601f01602080910402602001604051908101604052809291908181526020018280546105e290612152565b801561062f5780601f106106045761010080835404028352916020019161062f565b820191906000526020600020905b81548152906001019060200180831161061257829003601f168201915b5050505050905090565b600061064482610cf3565b610658576106586333d1c03960e21b610d41565b506000908152600660205260409020546001600160a01b031690565b61068082826001610d4b565b5050565b600154600054036000190190565b600061069d82610dee565b6001600160a01b0394851694909150811684146106c3576106c362a1148160e81b610d41565b60008281526006602052604090208054338082146001600160a01b03881690911417610707576106f38633610c6f565b61070757610707632ce44b5f60e11b610d41565b801561071257600082555b6001600160a01b0380871660009081526005602052604080822080546000190190559187168152208054600101905561076b85610750888287610e8f565b600160e11b174260a01b176001600160a01b03919091161790565b600085815260046020526040812091909155600160e11b841690036107c0576001840160008181526004602052604081205490036107be5760005481146107be5760008181526004602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a48060000361080a5761080a633a954ecd60e21b610d41565b50505050505050565b600c548161081f610684565b61082991906121a2565b1115806108405750600a546001600160a01b031633145b6108ac5760405162461bcd60e51b815260206004820152603260248201527f5075626c6963206d696e74206c696d697420726561636865642c2063616e6e6f60448201527174206d696e74206d6f726520746f6b656e7360701b60648201526084015b60405180910390fd5b6108b63382610e99565b50565b6108c16110fc565b60006108d5600a546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d806000811461091f576040519150601f19603f3d011682016040523d82523d6000602084013e610924565b606091505b50509050806108b65760405162461bcd60e51b815260206004820152601060248201526f2bb4ba34323930bb903330b4b632b21760811b60448201526064016108a3565b61098383838360405180602001604052806000815250610aa1565b505050565b6109906110fc565b6106808282610e99565b6109a26110fc565b600e55565b60006105a182610dee565b60006001600160a01b0382166109d2576109d26323d3ad8160e21b610d41565b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b610a006110fc565b610a0a6000611129565b565b610a146110fc565b600d55565b6060600380546105b690612152565b610a306110fc565b600c55565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610aac848484610692565b6001600160a01b0383163b15610adc57610ac88484848461117b565b610adc57610adc6368d2bf6b60e11b610d41565b50505050565b6060600082118015610afb5750610af7610684565b8211155b610b3e5760405162461bcd60e51b8152602060048201526014602482015273151bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b60448201526064016108a3565b6000610b498361125e565b90506000610b56826113d2565b90506000610b6382611802565b905080604051602001610b7691906121d1565b6040516020818303038152906040529350505050919050565b6060600082118015610ba85750610ba4610684565b8211155b610beb5760405162461bcd60e51b8152602060048201526014602482015273151bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b60448201526064016108a3565b6000610bf68361125e565b90506000610c0382611828565b90506000610c5c610c13866119ee565b610c24610c1f866113d2565b611802565b610c348660e0015160ff166119ee565b85604051602001610c489493929190612216565b604051602081830303815290604052611802565b905080604051602001610b769190612418565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b610ca56110fc565b6010805460ff1916911515919091179055565b610cc06110fc565b6001600160a01b038116610cea57604051631e4fbdf760e01b8152600060048201526024016108a3565b6108b681611129565b600081600111610d3c57600054821015610d3c5760005b5060008281526004602052604081205490819003610d3257610d2b8361245d565b9250610d0a565b600160e01b161590505b919050565b8060005260046000fd5b6000610d56836109a7565b9050818015610d6e5750336001600160a01b03821614155b15610d9157610d7d8133610c6f565b610d9157610d916367d9dca160e11b610d41565b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b600081600111610e7f575060008181526004602052604090205480600003610e6c576000548210610e2957610e29636f96cda160e11b610d41565b5b50600019016000818152600460205260409020548015610e2a57600160e01b8116600003610e5757919050565b610e67636f96cda160e11b610d41565b610e2a565b600160e01b8116600003610e7f57919050565b610d3c636f96cda160e11b610d41565b60005b9392505050565b60105460ff1680610eb45750600a546001600160a01b031633145b610ef45760405162461bcd60e51b8152602060048201526011602482015270135a5b9d1a5b99c81a5cc81c185d5cd959607a1b60448201526064016108a3565b600b54610eff610684565b10610f4c5760405162461bcd60e51b815260206004820152601b60248201527f416c6c20746f6b656e732068617665206265656e206d696e746564000000000060448201526064016108a3565b600b5481610f58610684565b610f6291906121a2565b1115610fb05760405162461bcd60e51b815260206004820152601f60248201527f4d696e74696e6720776f756c6420657863656564206d617820737570706c790060448201526064016108a3565b600e5481111580610fcb5750600a546001600160a01b031633145b6110315760405162461bcd60e51b815260206004820152603160248201527f43616e6e6f742070757263686173652074686973206d616e7920746f6b656e736044820152701034b71030903a3930b739b0b1ba34b7b760791b60648201526084016108a3565b600081116110815760405162461bcd60e51b815260206004820152601c60248201527f4d757374206d696e74206174206c65617374206f6e6520746f6b656e0000000060448201526064016108a3565b3481600d546110909190612474565b14806110a65750600a546001600160a01b031633145b6110f25760405162461bcd60e51b815260206004820152601760248201527f45544820616d6f756e7420697320696e636f727265637400000000000000000060448201526064016108a3565b6106808282611aef565b600a546001600160a01b03163314610a0a5760405163118cdaa760e01b81523360048201526024016108a3565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906111b090339089908890889060040161248b565b6020604051808303816000875af19250505080156111eb575060408051601f3d908101601f191682019092526111e8918101906124c8565b60015b611240573d808015611219576040519150601f19603f3d011682016040523d82523d6000602084013e61121e565b606091505b508051600003611238576112386368d2bf6b60e11b610d41565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b611266611dfe565b6000611298611274846119ee565b60405160200161128491906124e5565b604051602081830303815290604052611b09565b90506112a2611dfe565b6112ad60058361252b565b60ff1681526112c16006600884901c61252b565b60ff1660208201526112d86009601084901c61252b565b60ff1660408201526112ef6005601884901c61252b565b60ff166060820152611306600e602084901c61252b565b60ff16608082015261131d600d602884901c61252b565b60ff1660a0820152611334600a603084901c61252b565b60ff1660c082015261134b6064603884901c61252b565b60ff1660e0820152611362600d604084901c61252b565b60ff1661010082015261137a600a604884901c61252b565b60ff166101208201526113926008605084901c61252b565b60ff166101408201526113aa6009605884901c61252b565b60ff166101608201526113c26009606084901c61252b565b60ff166101808201529392505050565b60606113dc611e6a565b604051602001611521907f3c7376672077696474683d2234303022206865696768743d223430302220766981527f6577426f783d2230203020343030203430302220786d6c6e733d22687474703a60208201527f2f2f7777772e77332e6f72672f323030302f737667223e00000000000000000060408201527f3c726563742077696474683d223130302522206865696768743d223130302522605782015270103334b6361e9111b21a321a321a11179f60791b60778201527f3c7465787420783d223139302220793d223133302220666f6e742d66616d696c60888201527f793d22417269616c2c2073616e732d73657269662220666f6e742d776569676860a88201527f743d223730302220666f6e742d73697a653d2233352220746578742d616e636860c88201526a37b91e9139ba30b93a111f60a91b60e882015260f30190565b60408051808303601f190181529190528152825160119060ff166005811061154b5761154b61253f565b016016846020015160ff16600681106115665761156661253f565b01601c856040015160ff16600981106115815761158161253f565b01601c866040015160ff166009811061159c5761159c61253f565b016025876060015160ff16600581106115b7576115b761253f565b016040516020016115cc9594939291906125f2565b60408051808303601f1901815291905260208201526080830151602a9060ff16600e81106115fc576115fc61253f565b0160388460a0015160ff16600d81106116175761161761253f565b0160458560c0015160ff16600a81106116325761163261253f565b0160458660c0015160ff16600a811061164d5761164d61253f565b0161165e8760e0015160ff166119ee565b604051602001611672959493929190612716565b60408051808303601f1901815291815282015261010083015160389060ff16600d81106116a1576116a161253f565b01604584610120015160ff16600a81106116bd576116bd61253f565b01604585610120015160ff16600a81106116d9576116d961253f565b01604586610120015160ff16600a81106116f5576116f561253f565b01604f87610140015160ff16600881106117115761171161253f565b0160405160200161172695949392919061284a565b60408051808303601f19018152919052606082015261016083015160579060ff16600981106117575761175761253f565b01605784610180015160ff16600981106117735761177361253f565b016040516020016117859291906128ab565b60408051601f198184030181529181526080830191825280518082018252600d81526c1e17ba32bc3a1f1e17b9bb339f60991b60208083019190915260a08501829052845181860151868501516060880151965195516117eb979396929591940161295a565b604051602081830303815290604052915050919050565b60606105a182604051806060016040528060408152602001612afd604091396001611b3a565b604080516020808201835260008083528351808301855281815284518084018652828152855193840190955290825261010085015160a086015160609592939160ff90811691160361189457604051806060016040528060358152602001612b766035913993506118b0565b604051806060016040528060398152602001612bab6039913993505b85610180015160ff1686610160015160ff16036118e757604051806060016040528060358152602001612be4603591399250611903565b604051806060016040528060398152602001612b3d6039913992505b85610120015160ff168660c0015160ff160361193957604051806060016040528060368152602001612ac7603691399150611955565b6040518060600160405280603a8152602001612a8d603a913991505b85610100015160ff168660a0015160ff16148015611982575085610180015160ff1686610160015160ff16145b801561199c575085610120015160ff168660c0015160ff16145b156119bd57604051806080016040528060458152602001612c196045913990505b838383836040516020016119d494939291906129d9565b604051602081830303815290604052945050505050919050565b606081600003611a155750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611a3f5780611a2981612a30565b9150611a389050600a83612a49565b9150611a19565b60008167ffffffffffffffff811115611a5a57611a5a61201b565b6040519080825280601f01601f191660200182016040528015611a84576020820181803683370190505b5090505b841561125657611a99600183612a5d565b9150611aa6600a8661252b565b611ab19060306121a2565b60f81b818381518110611ac657611ac661253f565b60200101906001600160f81b031916908160001a905350611ae8600a86612a49565b9450611a88565b610680828260405180602001604052806000815250611cba565b600081604051602001611b1c9190612a70565b60408051601f19818403018152919052805160209091012092915050565b60608351600003611b5a5750604080516020810190915260008152610e92565b600082611b8b57600385516004611b719190612474565b611b7c9060026121a2565b611b869190612a49565b611bb0565b600385516002611b9b91906121a2565b611ba59190612a49565b611bb0906004612474565b905060008167ffffffffffffffff811115611bcd57611bcd61201b565b6040519080825280601f01601f191660200182016040528015611bf7576020820181803683370190505b50905060018501602082018788518901602081018051600082525b82841015611c6d576003840193508351603f8160121c168701518653600186019550603f81600c1c168701518653600186019550603f8160061c168701518653600186019550603f8116870151865350600185019450611c12565b905250508515611cae57600388510660018114611c915760028114611ca457611cac565b603d6001830353603d6002830353611cac565b603d60018303535b505b50909695505050505050565b611cc48383611d1e565b6001600160a01b0383163b15610983576000548281035b611cee600086838060010194508661117b565b611d0257611d026368d2bf6b60e11b610d41565b818110611cdb578160005414611d1757600080fd5b5050505050565b6000805490829003611d3a57611d3a63b562e8dd60e01b610d41565b611d6883611d4b6000866000610e8f565b6001851460e11b174260a01b176001600160a01b03919091161790565b6000828152600460209081526040808320939093556001600160a01b03861680835260059091529181208054680100000000000000018602019055819003611db957611db9622e076360e81b610d41565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4818160010191508103611dbe575060005550505050565b604080516101a081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081019190915290565b6040518060c001604052806006905b6060815260200190600190039081611e795790505090565b6001600160e01b0319811681146108b657600080fd5b600060208284031215611eb957600080fd5b8135610e9281611e91565b60005b83811015611edf578181015183820152602001611ec7565b50506000910152565b60008151808452611f00816020860160208601611ec4565b601f01601f19169290920160200192915050565b602081526000610e926020830184611ee8565b600060208284031215611f3957600080fd5b5035919050565b80356001600160a01b0381168114610d3c57600080fd5b60008060408385031215611f6a57600080fd5b611f7383611f40565b946020939093013593505050565b600080600060608486031215611f9657600080fd5b611f9f84611f40565b9250611fad60208501611f40565b9150604084013590509250925092565b600060208284031215611fcf57600080fd5b610e9282611f40565b80358015158114610d3c57600080fd5b60008060408385031215611ffb57600080fd5b61200483611f40565b915061201260208401611fd8565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561204757600080fd5b61205085611f40565b935061205e60208601611f40565b925060408501359150606085013567ffffffffffffffff8082111561208257600080fd5b818701915087601f83011261209657600080fd5b8135818111156120a8576120a861201b565b604051601f8201601f19908116603f011681019083821181831017156120d0576120d061201b565b816040528281528a60208487010111156120e957600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561212057600080fd5b61212983611f40565b915061201260208401611f40565b60006020828403121561214957600080fd5b610e9282611fd8565b600181811c9082168061216657607f821691505b60208210810361218657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156105a1576105a161218c565b600081516121c7818560208601611ec4565b9290920192915050565b7f646174613a696d6167652f7376672b786d6c3b6261736536342c00000000000081526000825161220981601a850160208701611ec4565b91909101601a0192915050565b737b226e616d65223a2022576865656c426974202360601b81528451600090612246816014850160208a01611ec4565b6201116160ed1b6014918401918201527f226465736372697074696f6e223a2022576865656c626974732061726520342c60178201527f3434342063617273206d6164652077697468207479706f67726170686963207360378201527f796d626f6c7320616e6420636861726163746572732e2054686520617274776f60578201527f726b20616e64206d65746164617461206172652066756c6c79206f6e2d63686160778201527f696e20616e6420776572652072616e646f6d6c792067656e657261746564206160978201526903a1036b4b73a171116160b51b60b782015261240d6123ff6123f96123eb6123e56123ac61239161238261237c60c18a017f22696d616765223a2022646174613a696d6167652f7376672b786d6c3b626173815263194d8d0b60e21b602082015260240190565b8e6121b5565b6201116160ed1b815260030190565b6e2261747472696275746573223a205b60881b8152600f0190565b7f7b2274726169745f74797065223a2022436172204e756d626572222c20227661815266363ab2911d101160c91b602082015260270190565b896121b5565b61227d60f01b815260020190565b866121b5565b615d7d60f01b815260020190565b979650505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161245081601d850160208701611ec4565b91909101601d0192915050565b60008161246c5761246c61218c565b506000190190565b80820281158282048414176105a1576105a161218c565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906124be90830184611ee8565b9695505050505050565b6000602082840312156124da57600080fd5b8151610e9281611e91565b67434152204441544160c01b815260008251612508816008850160208701611ec4565b9190910160080192915050565b634e487b7160e01b600052601260045260246000fd5b60008261253a5761253a612515565b500690565b634e487b7160e01b600052603260045260246000fd5b8054600090600181811c908083168061256f57607f831692505b6020808410820361259057634e487b7160e01b600052602260045260246000fd5b8180156125a457600181146125b9576125e6565b60ff19861689528415158502890196506125e6565b60008881526020902060005b868110156125de5781548b8201529085019083016125c5565b505084890196505b50505050505092915050565b7f3c747370616e2064793d2231302220783d223138302220746578742d616e636881527f6f723d226d6964646c65222066696c6c3d2223333535353635223e00000000006020820152600061264a603b830188612555565b671e17ba39b830b71f60c11b8082527f3c747370616e2064793d2233352220783d22313830222066696c6c3d2223333560088301527f353536352220746578742d616e63686f723d226d6964646c65223e000000000060288301526126b26043830189612555565b741e3a39b830b71037b830b1b4ba3c9e9118171a911f60591b815291506126e56126df6015840189612555565b87612555565b9150693c2f747370616e3e7c5f60b01b8252612704600a830186612555565b90815260080198975050505050505050565b7f3c747370616e2064793d2233352220783d22323030222066696c6c3d2223353481527f353435342220746578742d616e63686f723d226d6964646c65223e00000000006020820152600061276e603b830188612555565b6c1e3a39b830b7103334b6361e9160991b815261278e600d820188612555565b61111f60f11b815290506127ae6127a86002830188612555565b86612555565b9050671e17ba39b830b71f60c11b81527f3c747370616e2066696c6c3d222366666666223e283c747370616e20666f6e7460088201527f2d73697a653d223330222066696c6c3d2223303030223e0000000000000000006028820152835161281d81603f840160208801611ec4565b701e17ba39b830b71f149e17ba39b830b71f60791b603f9290910191820152605001979650505050505050565b6c1e3a39b830b7103334b6361e9160991b8152600061286c600d830188612555565b61111f60f11b815261288d6127a8612887600284018a612555565b88612555565b9050671e17ba39b830b71f60c11b8082526127046008830186612555565b7f3c747370616e2064793d2232342220783d223133302220746578742d616e636881527f6f723d226d6964646c652220666f6e742d73697a653d223438222066696c6c3d6020820152691111991999199919911f60b11b60408201526000612916604a830185612555565b6e1e3a39b830b7103c1e91191a9a911f60891b8152612938600f820185612555565b6f1e17ba39b830b71f1e17ba39b830b71f60811b815260100195945050505050565b60008751602061296d8285838d01611ec4565b8851918401916129808184848d01611ec4565b88519201916129928184848c01611ec4565b87519201916129a48184848b01611ec4565b86519201916129b68184848a01611ec4565b85519201916129c88184848901611ec4565b919091019998505050505050505050565b600085516129eb818460208a01611ec4565b8551908301906129ff818360208a01611ec4565b8551910190612a12818360208901611ec4565b8451910190612a25818360208801611ec4565b019695505050505050565b600060018201612a4257612a4261218c565b5060010190565b600082612a5857612a58612515565b500490565b818103818111156105a1576105a161218c565b60008251612a82818460208701611ec4565b919091019291505056fe2c207b2274726169745f74797065223a20224d61746368696e672053796d626f6c73222c202276616c7565223a20224e6f74204d61746368227d2c207b2274726169745f74797065223a20224d61746368696e672053796d626f6c73222c202276616c7565223a20224d61746368227d4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f2c207b2274726169745f74797065223a20224d61746368696e6720576865656c73222c202276616c7565223a20224e6f74204d61746368227d2c207b2274726169745f74797065223a20224d61746368696e6720436f6c6f7273222c202276616c7565223a20224d61746368227d2c207b2274726169745f74797065223a20224d61746368696e6720436f6c6f7273222c202276616c7565223a20224e6f74204d61746368227d2c207b2274726169745f74797065223a20224d61746368696e6720576865656c73222c202276616c7565223a20224d61746368227d2c207b2274726169745f74797065223a2022416c676f726974686d6963616c6c792043757261746564222c202276616c7565223a202250657266656374204d61746368227da26469706673582212205d56786bfced08bc933c1711c6bcc4a533cbf6ad45cbc00e9983ae48490a31cc64736f6c63430008140033

Verified Source Code Full Match

Compiler: v0.8.20+commit.a1b79de6 EVM: paris Optimization: Yes (200 runs)
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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);
    }
}
ReentrancyGuard.sol 77 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}
Base64.sol 123 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Base64.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     * See sections 4 and 5 of https://datatracker.ietf.org/doc/html/rfc4648
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    string internal constant _TABLE_URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        return _encode(data, _TABLE, true);
    }

    /**
     * @dev Converts a `bytes` to its Bytes64Url `string` representation.
     * Output is not padded with `=` as specified in https://www.rfc-editor.org/rfc/rfc4648[rfc4648].
     */
    function encodeURL(bytes memory data) internal pure returns (string memory) {
        return _encode(data, _TABLE_URL, false);
    }

    /**
     * @dev Internal table-agnostic conversion
     */
    function _encode(bytes memory data, string memory table, bool withPadding) private pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // If padding is enabled, the final length should be `bytes` data length divided by 3 rounded up and then
        // multiplied by 4 so that it leaves room for padding the last chunk
        // - `data.length + 2`  -> Prepare for division rounding up
        // - `/ 3`              -> Number of 3-bytes chunks (rounded up)
        // - `4 *`              -> 4 characters for each chunk
        // This is equivalent to: 4 * Math.ceil(data.length / 3)
        //
        // If padding is disabled, the final length should be `bytes` data length multiplied by 4/3 rounded up as
        // opposed to when padding is required to fill the last chunk.
        // - `4 * data.length`  -> 4 characters for each chunk
        // - ` + 2`             -> Prepare for division rounding up
        // - `/ 3`              -> Number of 3-bytes chunks (rounded up)
        // This is equivalent to: Math.ceil((4 * data.length) / 3)
        uint256 resultLength = withPadding ? 4 * ((data.length + 2) / 3) : (4 * data.length + 2) / 3;

        string memory result = new string(resultLength);

        assembly ("memory-safe") {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 0x20)
            let dataPtr := data
            let endPtr := add(data, mload(data))

            // In some cases, the last iteration will read bytes after the end of the data. We cache the value, and
            // set it to zero to make sure no dirty bytes are read in that section.
            let afterPtr := add(endPtr, 0x20)
            let afterCache := mload(afterPtr)
            mstore(afterPtr, 0x00)

            // Run over the input, 3 bytes at a time
            for {

            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 byte (24 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F to bitmask the least significant 6 bits.
                // Use this as an index into the lookup table, mload an entire word
                // so the desired character is in the least significant byte, and
                // mstore8 this least significant byte into the result and continue.

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // Reset the value that was cached
            mstore(afterPtr, afterCache)

            if withPadding {
                // When data `bytes` is not exactly 3 bytes long
                // it is padded with `=` characters at the end
                switch mod(mload(data), 3)
                case 1 {
                    mstore8(sub(resultPtr, 1), 0x3d)
                    mstore8(sub(resultPtr, 2), 0x3d)
                }
                case 2 {
                    mstore8(sub(resultPtr, 1), 0x3d)
                }
            }
        }

        return result;
    }
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
wheelbits.sol 279 lines
/// SPDX-License-Identifier: MIT
/*

▗▖ ▗▖▗▖ ▗▖▗▄▄▄▖▗▄▄▄▖▗▖   ▗▄▄▖ ▗▄▄▄▖▗▄▄▄▖▗▄▄▖
▐▌ ▐▌▐▌ ▐▌▐▌   ▐▌   ▐▌   ▐▌ ▐▌  █    █ ▐▌   
▐▌ ▐▌▐▛▀▜▌▐▛▀▀▘▐▛▀▀▘▐▌   ▐▛▀▚▖  █    █  ▝▀▚▖
▐▙█▟▌▐▌ ▐▌▐▙▄▄▖▐▙▄▄▖▐▙▄▄▖▐▙▄▞▘▗▄█▄▖  █ ▗▄▄▞▘
                                            
                                by Jr Casas 
--------------------------------------------- 
Wheelbits - On-chain ASCII cars. 
Artwork and metadata 100% generated on-chain.
---------------------------------------------
*/


pragma solidity ^0.8.20;

import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Base64.sol";


contract Wheelbits is ERC721A, ReentrancyGuard, Ownable(msg.sender) {

  constructor() ERC721A("Wheelbits", "WBITS") {}

    uint256 public maxSupply = 4444;
    uint256 public mintLimit = 4000;  // Public mint limit (remaining supply reserved for owner's use)
    uint256 public price = 0.004 ether;
    uint256 public maxMint = 4;
    uint256 public numTokensMinted;
    bool public mintActive = false;

    

    string[5] private  symbolHood = ['____', '__._', '___, ', ',___', '_..__'];
    string[6] private  rearGlass = ['/', '|', '(', '[', 'A', '1'];
    string[9] private  rearWindow = ['#', '+', '=','x','_','0','"','L','/'];
    string[5] private  frontGlass = ['\\', '|', ')', ']', '.'];
    string[14] private  rearSymbol = ['"',':',',',';','[',']','1','4','7','l','!','^','\\','/'];
    string[13] private  pickColor = ['#fff', '#3b3b3b', '#6b218f', '#b82cac', '#009fad', '#74a4a8', '#59691d', '#a5c42f', '#295bab', '#e38f3b', '#edda00', '#a60202', '#6b0a0a'];
    string[10] private  bodySymbol = ['N','Z','X','H','E','#','K','O','B','8'];
    string[8] private  frontSymbol = [';', '.', '>','[',']','-',')','/'];
    string[9] private  wheelSymbol = [unicode'⊕', unicode'⊗', unicode'⊖', unicode'⊘', unicode'⊛', unicode'⊚', unicode'⊙', unicode'⦷', unicode'⧀'];



    struct carObject {
    uint8 lineHood;   
    uint8 backGlass;   
    uint8 window; 
    uint8 windScreen;
    uint8 rearEnd;
    uint8 colorOne;
    uint8 rearBody;
    uint8 carNumber;
    uint8 colorTwo;
    uint8 frontBody;
    uint8 hood;
    uint8 leftWheel;
    uint8 rightWheel;
    
}

function randomCar(uint256 tokenId) internal pure returns (carObject memory) {
    uint256 rand = random(string(abi.encodePacked("CAR DATA", toString(tokenId))));
    
    carObject memory car;
    
    car.lineHood = uint8(rand % 5);         
    car.backGlass = uint8((rand >> 8) % 6);  
    car.window = uint8((rand >> 16) % 9); 
    car.windScreen = uint8((rand >> 24) % 5);
    car.rearEnd = uint8((rand >> 32) % 14);
    car.colorOne = uint8((rand >> 40) % 13); 
    car.rearBody = uint8((rand >> 48) % 10); 
    car.carNumber = uint8((rand >> 56) % 100); 
    car.colorTwo = uint8((rand >> 64) % 13); 
    car.frontBody = uint8((rand >> 72) % 10); 
    car.hood = uint8((rand >> 80) % 8); 
    car.leftWheel = uint8((rand >> 88) % 9); 
    car.rightWheel = uint8((rand >> 96) % 9); 
    
    return car;
}


function random(string memory input) internal pure returns (uint256) {
    return uint256(keccak256(abi.encodePacked(input)));
}


/**
 * @dev Generates the car SVG. Designed for "Arial" font; may look different with fallback fonts 
 *      or due to variations in Unicode symbol rendering across different systems.
 *      Despite potential variations, the design ensures that a car is always recognizable—or so was the intention!
 */
function getSVG(carObject memory car) internal view returns (string memory) {
    string[6] memory parts; 

    parts[0] = string(abi.encodePacked(
        '<svg width="400" height="400" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg">',
        '<rect width="100%" height="100%" fill="#d4d4d4"/>',
        '<text x="190" y="130" font-family="Arial, sans-serif" font-weight="700" font-size="35" text-anchor="start">'
    ));
    
    parts[1] = string(abi.encodePacked(
        '<tspan dy="10" x="180" text-anchor="middle" fill="#355565">', symbolHood[car.lineHood], '</tspan>',
        '<tspan dy="35" x="180" fill="#355565" text-anchor="middle">', rearGlass[car.backGlass], 
        '<tspan opacity="0.5">', rearWindow[car.window], rearWindow[car.window], '</tspan>|_', frontGlass[car.windScreen], '</tspan>'
    ));
    
    parts[2] = string(abi.encodePacked(
        '<tspan dy="35" x="200" fill="#545454" text-anchor="middle">', rearSymbol[car.rearEnd], 
        '<tspan fill="', pickColor[car.colorOne], '">', bodySymbol[car.rearBody], bodySymbol[car.rearBody], '</tspan>',
        '<tspan fill="#ffff">(<tspan font-size="30" fill="#000">', toString(car.carNumber), '</tspan>)</tspan>'
    ));
    
    parts[3] = string(abi.encodePacked(
        '<tspan fill="', pickColor[car.colorTwo], '">', bodySymbol[car.frontBody], bodySymbol[car.frontBody], bodySymbol[car.frontBody], '</tspan>', 
        frontSymbol[car.hood], '</tspan>'
    ));

    parts[4] = string(abi.encodePacked(
        '<tspan dy="24" x="130" text-anchor="middle" font-size="48" fill="#232323">', wheelSymbol[car.leftWheel], 
        '<tspan x="255">', wheelSymbol[car.rightWheel], '</tspan></tspan>'
    ));
    
    parts[5] = '</text></svg>';  
    
    return string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5]));
}


function tokenIdToSVG(uint256 tokenId) public view returns (string memory) {
    require(tokenId > 0 && tokenId <= totalSupply(), "Token does not exist"); 

    carObject memory myCar = randomCar(tokenId);
    string memory svg = getSVG(myCar);
    string memory svgBase64 = Base64.encode(bytes(svg));

    return string(abi.encodePacked("data:image/svg+xml;base64,", svgBase64));
}

/**
 * @dev Generates the traits for the car. 
 *      Traits are designed to highlight meaningful features (e.g., matching colors, wheels, or symbols)
 *      rather than being based on a symbol appearing only once due to random generation.
 *      This makes traits feel more intentional and special, focusing on design uniqueness over pure rarity.
 */
function getTraits(carObject memory myCar) internal pure returns (string memory) {
    string memory matchingColorTrait = "";
    string memory matchingWheels = "";
    string memory matchingSymbols = "";
    string memory perfectMatchTrait = "";

    
    if (myCar.colorOne == myCar.colorTwo) {
        matchingColorTrait = ', {"trait_type": "Matching Colors", "value": "Match"}';
    } else {
        matchingColorTrait = ', {"trait_type": "Matching Colors", "value": "Not Match"}';
    }

    
    if (myCar.leftWheel == myCar.rightWheel) {
        matchingWheels = ', {"trait_type": "Matching Wheels", "value": "Match"}';
    } else {
        matchingWheels = ', {"trait_type": "Matching Wheels", "value": "Not Match"}';
    }

    
    if (myCar.rearBody == myCar.frontBody) {
        matchingSymbols = ', {"trait_type": "Matching Symbols", "value": "Match"}';
    } else {
        matchingSymbols = ', {"trait_type": "Matching Symbols", "value": "Not Match"}';
    }

    
    if (myCar.colorOne == myCar.colorTwo && myCar.leftWheel == myCar.rightWheel && myCar.rearBody == myCar.frontBody) {
        perfectMatchTrait = ', {"trait_type": "Algorithmically Curated", "value": "Perfect Match"}';
    }

    return string(abi.encodePacked(matchingColorTrait, matchingWheels, matchingSymbols, perfectMatchTrait));
}

function tokenURI(uint256 tokenId) override public view returns (string memory) {
    require(tokenId > 0 && tokenId <= totalSupply(), "Token does not exist"); 
    carObject memory myCar = randomCar(tokenId);

    string memory traits = getTraits(myCar);
   
    string memory json = Base64.encode(
        bytes(
            string(
                abi.encodePacked(
                    '{"name": "WheelBit #', toString(tokenId), '", ',
                    '"description": "Wheelbits are 4,444 cars made with typographic symbols and characters. The artwork and metadata are fully on-chain and were randomly generated at mint.", ',
                    '"image": "data:image/svg+xml;base64,', Base64.encode(bytes(getSVG(myCar))), '", ', 
                    '"attributes": [',
                    '{"trait_type": "Car Number", "value": "', toString(myCar.carNumber), '"}',
                    traits, ']}'
                )
            )
        )
    );

    return string(abi.encodePacked('data:application/json;base64,', json));
}
 

function mint(address _to, uint256 amountOfTokens) private  {
        require(mintActive || msg.sender == owner(), "Minting is paused");
        require(totalSupply() < maxSupply, "All tokens have been minted");
        require(totalSupply() + amountOfTokens <= maxSupply, "Minting would exceed max supply");
        require(amountOfTokens <= maxMint || msg.sender == owner(), "Cannot purchase this many tokens in a transaction");
        require(amountOfTokens > 0, "Must mint at least one token");
        require(price * amountOfTokens == msg.value || msg.sender == owner(), "ETH amount is incorrect");

        
    _safeMint(_to, amountOfTokens);
    }

function mintCar(uint256 amountOfTokens) public payable {
    require(totalSupply() + amountOfTokens <= mintLimit || msg.sender == owner(), "Public mint limit reached, cannot mint more tokens");

    mint(msg.sender, amountOfTokens);
}

function mintTo(address _to, uint256 amountOfTokens) public onlyOwner {
    mint(_to, amountOfTokens);
}

    function setPrice(uint256 newPrice) public onlyOwner {
        price = newPrice;
    }

    function setMaxMint(uint256 newMaxMint) public onlyOwner {
        maxMint = newMaxMint;
    }

    function setMintActive(bool _state) external onlyOwner {
    mintActive = _state;
}

    function setMintLimit(uint256 newLimit) public onlyOwner {
    mintLimit = newLimit;
}
 function _startTokenId() internal view virtual override returns (uint256) {
        return 1;
    }

    function withdraw() public  onlyOwner {
    (bool success, ) = owner().call{value: address(this).balance}("");
    require(success, "Withdraw failed.");
}

    function toString(uint256 value) internal pure returns (string memory) {

        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);
    }
}

ERC721A.sol 1314 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721A.sol';

/**
 * @dev Interface of ERC721 token receiver.
 */
interface ERC721A__IERC721Receiver {
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @title ERC721A
 *
 * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
 * Non-Fungible Token Standard, including the Metadata extension.
 * Optimized for lower gas during batch mints.
 *
 * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
 * starting from `_startTokenId()`.
 *
 * The `_sequentialUpTo()` function can be overriden to enable spot mints
 * (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`.
 *
 * Assumptions:
 *
 * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721A is IERC721A {
    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
    struct TokenApprovalRef {
        address value;
    }

    // =============================================================
    //                           CONSTANTS
    // =============================================================

    // Mask of an entry in packed address data.
    uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

    // The bit position of `numberMinted` in packed address data.
    uint256 private constant _BITPOS_NUMBER_MINTED = 64;

    // The bit position of `numberBurned` in packed address data.
    uint256 private constant _BITPOS_NUMBER_BURNED = 128;

    // The bit position of `aux` in packed address data.
    uint256 private constant _BITPOS_AUX = 192;

    // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
    uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;

    // The bit position of `startTimestamp` in packed ownership.
    uint256 private constant _BITPOS_START_TIMESTAMP = 160;

    // The bit mask of the `burned` bit in packed ownership.
    uint256 private constant _BITMASK_BURNED = 1 << 224;

    // The bit position of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;

    // The bit mask of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;

    // The bit position of `extraData` in packed ownership.
    uint256 private constant _BITPOS_EXTRA_DATA = 232;

    // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
    uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;

    // The mask of the lower 160 bits for addresses.
    uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;

    // The maximum `quantity` that can be minted with {_mintERC2309}.
    // This limit is to prevent overflows on the address data entries.
    // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
    // is required to cause an overflow, which is unrealistic.
    uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;

    // The `Transfer` event signature is given by:
    // `keccak256(bytes("Transfer(address,address,uint256)"))`.
    bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    // =============================================================
    //                            STORAGE
    // =============================================================

    // The next token ID to be minted.
    uint256 private _currentIndex;

    // The number of tokens burned.
    uint256 private _burnCounter;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to ownership details
    // An empty struct value does not necessarily mean the token is unowned.
    // See {_packedOwnershipOf} implementation for details.
    //
    // Bits Layout:
    // - [0..159]   `addr`
    // - [160..223] `startTimestamp`
    // - [224]      `burned`
    // - [225]      `nextInitialized`
    // - [232..255] `extraData`
    mapping(uint256 => uint256) private _packedOwnerships;

    // Mapping owner address to address data.
    //
    // Bits Layout:
    // - [0..63]    `balance`
    // - [64..127]  `numberMinted`
    // - [128..191] `numberBurned`
    // - [192..255] `aux`
    mapping(address => uint256) private _packedAddressData;

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

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

    // The amount of tokens minted above `_sequentialUpTo()`.
    // We call these spot mints (i.e. non-sequential mints).
    uint256 private _spotMinted;

    // =============================================================
    //                          CONSTRUCTOR
    // =============================================================

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();

        if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector);
    }

    // =============================================================
    //                   TOKEN COUNTING OPERATIONS
    // =============================================================

    /**
     * @dev Returns the starting token ID for sequential mints.
     *
     * Override this function to change the starting token ID for sequential mints.
     *
     * Note: The value returned must never change after any tokens have been minted.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev Returns the maximum token ID (inclusive) for sequential mints.
     *
     * Override this function to return a value less than 2**256 - 1,
     * but greater than `_startTokenId()`, to enable spot (non-sequential) mints.
     *
     * Note: The value returned must never change after any tokens have been minted.
     */
    function _sequentialUpTo() internal view virtual returns (uint256) {
        return type(uint256).max;
    }

    /**
     * @dev Returns the next token ID to be minted.
     */
    function _nextTokenId() internal view virtual returns (uint256) {
        return _currentIndex;
    }

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() public view virtual override returns (uint256 result) {
        // Counter underflow is impossible as `_burnCounter` cannot be incremented
        // more than `_currentIndex + _spotMinted - _startTokenId()` times.
        unchecked {
            // With spot minting, the intermediate `result` can be temporarily negative,
            // and the computation must be unchecked.
            result = _currentIndex - _burnCounter - _startTokenId();
            if (_sequentialUpTo() != type(uint256).max) result += _spotMinted;
        }
    }

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view virtual returns (uint256 result) {
        // Counter underflow is impossible as `_currentIndex` does not decrement,
        // and it is initialized to `_startTokenId()`.
        unchecked {
            result = _currentIndex - _startTokenId();
            if (_sequentialUpTo() != type(uint256).max) result += _spotMinted;
        }
    }

    /**
     * @dev Returns the total number of tokens burned.
     */
    function _totalBurned() internal view virtual returns (uint256) {
        return _burnCounter;
    }

    /**
     * @dev Returns the total number of tokens that are spot-minted.
     */
    function _totalSpotMinted() internal view virtual returns (uint256) {
        return _spotMinted;
    }

    // =============================================================
    //                    ADDRESS DATA OPERATIONS
    // =============================================================

    /**
     * @dev Returns the number of tokens in `owner`'s account.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector);
        return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    function _getAux(address owner) internal view returns (uint64) {
        return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
    }

    /**
     * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    function _setAux(address owner, uint64 aux) internal virtual {
        uint256 packed = _packedAddressData[owner];
        uint256 auxCasted;
        // Cast `aux` with assembly to avoid redundant masking.
        assembly {
            auxCasted := aux
        }
        packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
        _packedAddressData[owner] = packed;
    }

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes
        // of the XOR of all function selectors in the interface.
        // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
        // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

    /**
     * @dev Returns the token collection name.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
    }

    /**
     * @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, it can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return '';
    }

    // =============================================================
    //                     OWNERSHIPS OPERATIONS
    // =============================================================

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }

    /**
     * @dev Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around over time.
     */
    function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnershipOf(tokenId));
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct at `index`.
     */
    function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnerships[index]);
    }

    /**
     * @dev Returns whether the ownership slot at `index` is initialized.
     * An uninitialized slot does not necessarily mean that the slot has no owner.
     */
    function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) {
        return _packedOwnerships[index] != 0;
    }

    /**
     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
     */
    function _initializeOwnershipAt(uint256 index) internal virtual {
        if (_packedOwnerships[index] == 0) {
            _packedOwnerships[index] = _packedOwnershipOf(index);
        }
    }

    /**
     * @dev Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
        if (_startTokenId() <= tokenId) {
            packed = _packedOwnerships[tokenId];

            if (tokenId > _sequentialUpTo()) {
                if (_packedOwnershipExists(packed)) return packed;
                _revert(OwnerQueryForNonexistentToken.selector);
            }

            // If the data at the starting slot does not exist, start the scan.
            if (packed == 0) {
                if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector);
                // Invariant:
                // There will always be an initialized ownership slot
                // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                // before an unintialized ownership slot
                // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                // Hence, `tokenId` will not underflow.
                //
                // We can directly compare the packed value.
                // If the address is zero, packed will be zero.
                for (;;) {
                    unchecked {
                        packed = _packedOwnerships[--tokenId];
                    }
                    if (packed == 0) continue;
                    if (packed & _BITMASK_BURNED == 0) return packed;
                    // Otherwise, the token is burned, and we must revert.
                    // This handles the case of batch burned tokens, where only the burned bit
                    // of the starting slot is set, and remaining slots are left uninitialized.
                    _revert(OwnerQueryForNonexistentToken.selector);
                }
            }
            // Otherwise, the data exists and we can skip the scan.
            // This is possible because we have already achieved the target condition.
            // This saves 2143 gas on transfers of initialized tokens.
            // If the token is not burned, return `packed`. Otherwise, revert.
            if (packed & _BITMASK_BURNED == 0) return packed;
        }
        _revert(OwnerQueryForNonexistentToken.selector);
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
     */
    function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
        ownership.addr = address(uint160(packed));
        ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
        ownership.burned = packed & _BITMASK_BURNED != 0;
        ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
    }

    /**
     * @dev Packs ownership data into a single uint256.
     */
    function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
            result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
        }
    }

    /**
     * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
     */
    function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
        // For branchless setting of the `nextInitialized` flag.
        assembly {
            // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
            result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
        }
    }

    // =============================================================
    //                      APPROVAL OPERATIONS
    // =============================================================

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     */
    function approve(address to, uint256 tokenId) public payable virtual override {
        _approve(to, tokenId, true);
    }

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector);

        return _tokenApprovals[tokenId].value;
    }

    /**
     * @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) public virtual override {
        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @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. See {_mint}.
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool result) {
        if (_startTokenId() <= tokenId) {
            if (tokenId > _sequentialUpTo()) return _packedOwnershipExists(_packedOwnerships[tokenId]);

            if (tokenId < _currentIndex) {
                uint256 packed;
                while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId;
                result = packed & _BITMASK_BURNED == 0;
            }
        }
    }

    /**
     * @dev Returns whether `packed` represents a token that exists.
     */
    function _packedOwnershipExists(uint256 packed) private pure returns (bool result) {
        assembly {
            // The following is equivalent to `owner != address(0) && burned == false`.
            // Symbolically tested.
            result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED))
        }
    }

    /**
     * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
     */
    function _isSenderApprovedOrOwner(
        address approvedAddress,
        address owner,
        address msgSender
    ) private pure returns (bool result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
            msgSender := and(msgSender, _BITMASK_ADDRESS)
            // `msgSender == owner || msgSender == approvedAddress`.
            result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
        }
    }

    /**
     * @dev Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedSlotAndAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
        assembly {
            approvedAddressSlot := tokenApproval.slot
            approvedAddress := sload(approvedAddressSlot)
        }
    }

    // =============================================================
    //                      TRANSFER OPERATIONS
    // =============================================================

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * 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
    ) public payable virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
        from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));

        if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        // The nested ifs save around 20+ gas over a compound boolean condition.
        if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
            if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // We can directly increment and decrement the balances.
            --_packedAddressData[from]; // Updates: `balance -= 1`.
            ++_packedAddressData[to]; // Updates: `balance += 1`.

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                to,
                _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
        uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
        assembly {
            // Emit the `Transfer` event.
            log4(
                0, // Start of data (0, since no data).
                0, // End of data (0, since no data).
                _TRANSFER_EVENT_SIGNATURE, // Signature.
                from, // `from`.
                toMasked, // `to`.
                tokenId // `tokenId`.
            )
        }
        if (toMasked == 0) _revert(TransferToZeroAddress.selector);

        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @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 memory _data
    ) public payable virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                _revert(TransferToNonERC721ReceiverImplementer.selector);
            }
    }

    /**
     * @dev Hook that is called before a set of serially-ordered token IDs
     * are about to be transferred. This includes minting.
     * And also called before burning one token.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * 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, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Hook that is called after a set of serially-ordered token IDs
     * have been transferred. This includes minting.
     * And also called after one token has been burned.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
     * transferred to `to`.
     * - When `from` is zero, `tokenId` has been minted for `to`.
     * - When `to` is zero, `tokenId` has been burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * `from` - Previous owner of the given token ID.
     * `to` - Target address that will receive the token.
     * `tokenId` - Token ID to be transferred.
     * `_data` - Optional data to send along with the call.
     *
     * Returns whether the call correctly returned the expected magic value.
     */
    function _checkContractOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
            bytes4 retval
        ) {
            return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                _revert(TransferToNonERC721ReceiverImplementer.selector);
            }
            assembly {
                revert(add(32, reason), mload(reason))
            }
        }
    }

    // =============================================================
    //                        MINT OPERATIONS
    // =============================================================

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mint(address to, uint256 quantity) internal virtual {
        uint256 startTokenId = _currentIndex;
        if (quantity == 0) _revert(MintZeroQuantity.selector);

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are incredibly unrealistic.
        // `balance` and `numberMinted` have a maximum limit of 2**64.
        // `tokenId` has a maximum limit of 2**256.
        unchecked {
            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
            uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;

            if (toMasked == 0) _revert(MintToZeroAddress.selector);

            uint256 end = startTokenId + quantity;
            uint256 tokenId = startTokenId;

            if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);

            do {
                assembly {
                    // Emit the `Transfer` event.
                    log4(
                        0, // Start of data (0, since no data).
                        0, // End of data (0, since no data).
                        _TRANSFER_EVENT_SIGNATURE, // Signature.
                        0, // `address(0)`.
                        toMasked, // `to`.
                        tokenId // `tokenId`.
                    )
                }
                // The `!=` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
            } while (++tokenId != end);

            _currentIndex = end;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * This function is intended for efficient minting only during contract creation.
     *
     * It emits only one {ConsecutiveTransfer} as defined in
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
     * instead of a sequence of {Transfer} event(s).
     *
     * Calling this function outside of contract creation WILL make your contract
     * non-compliant with the ERC721 standard.
     * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
     * {ConsecutiveTransfer} event is only permissible during contract creation.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {ConsecutiveTransfer} event.
     */
    function _mintERC2309(address to, uint256 quantity) internal virtual {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) _revert(MintToZeroAddress.selector);
        if (quantity == 0) _revert(MintZeroQuantity.selector);
        if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector);

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);

            emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);

            _currentIndex = startTokenId + quantity;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Safely mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
     * - `quantity` must be greater than 0.
     *
     * See {_mint}.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal virtual {
        _mint(to, quantity);

        unchecked {
            if (to.code.length != 0) {
                uint256 end = _currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        _revert(TransferToNonERC721ReceiverImplementer.selector);
                    }
                } while (index < end);
                // This prevents reentrancy to `_safeMint`.
                // It does not prevent reentrancy to `_safeMintSpot`.
                if (_currentIndex != end) revert();
            }
        }
    }

    /**
     * @dev Equivalent to `_safeMint(to, quantity, '')`.
     */
    function _safeMint(address to, uint256 quantity) internal virtual {
        _safeMint(to, quantity, '');
    }

    /**
     * @dev Mints a single token at `tokenId`.
     *
     * Note: A spot-minted `tokenId` that has been burned can be re-minted again.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` must be greater than `_sequentialUpTo()`.
     * - `tokenId` must not exist.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mintSpot(address to, uint256 tokenId) internal virtual {
        if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector);
        uint256 prevOwnershipPacked = _packedOwnerships[tokenId];
        if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector);

        _beforeTokenTransfers(address(0), to, tokenId, 1);

        // Overflows are incredibly unrealistic.
        // The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1.
        // `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1.
        unchecked {
            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `true` (as `quantity == 1`).
            _packedOwnerships[tokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked)
            );

            // Updates:
            // - `balance += 1`.
            // - `numberMinted += 1`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1;

            // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
            uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;

            if (toMasked == 0) _revert(MintToZeroAddress.selector);

            assembly {
                // Emit the `Transfer` event.
                log4(
                    0, // Start of data (0, since no data).
                    0, // End of data (0, since no data).
                    _TRANSFER_EVENT_SIGNATURE, // Signature.
                    0, // `address(0)`.
                    toMasked, // `to`.
                    tokenId // `tokenId`.
                )
            }

            ++_spotMinted;
        }

        _afterTokenTransfers(address(0), to, tokenId, 1);
    }

    /**
     * @dev Safely mints a single token at `tokenId`.
     *
     * Note: A spot-minted `tokenId` that has been burned can be re-minted again.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}.
     * - `tokenId` must be greater than `_sequentialUpTo()`.
     * - `tokenId` must not exist.
     *
     * See {_mintSpot}.
     *
     * Emits a {Transfer} event.
     */
    function _safeMintSpot(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mintSpot(to, tokenId);

        unchecked {
            if (to.code.length != 0) {
                uint256 currentSpotMinted = _spotMinted;
                if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) {
                    _revert(TransferToNonERC721ReceiverImplementer.selector);
                }
                // This prevents reentrancy to `_safeMintSpot`.
                // It does not prevent reentrancy to `_safeMint`.
                if (_spotMinted != currentSpotMinted) revert();
            }
        }
    }

    /**
     * @dev Equivalent to `_safeMintSpot(to, tokenId, '')`.
     */
    function _safeMintSpot(address to, uint256 tokenId) internal virtual {
        _safeMintSpot(to, tokenId, '');
    }

    // =============================================================
    //                       APPROVAL OPERATIONS
    // =============================================================

    /**
     * @dev Equivalent to `_approve(to, tokenId, false)`.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _approve(to, tokenId, false);
    }

    /**
     * @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:
     *
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function _approve(
        address to,
        uint256 tokenId,
        bool approvalCheck
    ) internal virtual {
        address owner = ownerOf(tokenId);

        if (approvalCheck && _msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                _revert(ApprovalCallerNotOwnerNorApproved.selector);
            }

        _tokenApprovals[tokenId].value = to;
        emit Approval(owner, to, tokenId);
    }

    // =============================================================
    //                        BURN OPERATIONS
    // =============================================================

    /**
     * @dev Equivalent to `_burn(tokenId, false)`.
     */
    function _burn(uint256 tokenId) internal virtual {
        _burn(tokenId, false);
    }

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

        address from = address(uint160(prevOwnershipPacked));

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        if (approvalCheck) {
            // The nested ifs save around 20+ gas over a compound boolean condition.
            if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);
        }

        _beforeTokenTransfers(from, address(0), tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // Updates:
            // - `balance -= 1`.
            // - `numberBurned += 1`.
            //
            // We can directly decrement the balance, and increment the number burned.
            // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
            _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;

            // Updates:
            // - `address` to the last owner.
            // - `startTimestamp` to the timestamp of burning.
            // - `burned` to `true`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                from,
                (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, address(0), tokenId);
        _afterTokenTransfers(from, address(0), tokenId, 1);

        // Overflow not possible, as `_burnCounter` cannot be exceed `_currentIndex + _spotMinted` times.
        unchecked {
            _burnCounter++;
        }
    }

    // =============================================================
    //                     EXTRA DATA OPERATIONS
    // =============================================================

    /**
     * @dev Directly sets the extra data for the ownership data `index`.
     */
    function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
        uint256 packed = _packedOwnerships[index];
        if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector);
        uint256 extraDataCasted;
        // Cast `extraData` with assembly to avoid redundant masking.
        assembly {
            extraDataCasted := extraData
        }
        packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
        _packedOwnerships[index] = packed;
    }

    /**
     * @dev Called during each token transfer to set the 24bit `extraData` field.
     * Intended to be overridden by the cosumer contract.
     *
     * `previousExtraData` - the value of `extraData` before transfer.
     *
     * 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, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _extraData(
        address from,
        address to,
        uint24 previousExtraData
    ) internal view virtual returns (uint24) {}

    /**
     * @dev Returns the next extra data for the packed ownership data.
     * The returned result is shifted into position.
     */
    function _nextExtraData(
        address from,
        address to,
        uint256 prevOwnershipPacked
    ) private view returns (uint256) {
        uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
        return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
    }

    // =============================================================
    //                       OTHER OPERATIONS
    // =============================================================

    /**
     * @dev Returns the message sender (defaults to `msg.sender`).
     *
     * If you are writing GSN compatible contracts, you need to override this function.
     */
    function _msgSenderERC721A() internal view virtual returns (address) {
        return msg.sender;
    }

    /**
     * @dev Converts a uint256 to its ASCII string decimal representation.
     */
    function _toString(uint256 value) internal pure virtual returns (string memory str) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
            let m := add(mload(0x40), 0xa0)
            // Update the free memory pointer to allocate.
            mstore(0x40, m)
            // Assign the `str` to the end.
            str := sub(m, 0x20)
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end of the memory to calculate the length later.
            let end := str

            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            // prettier-ignore
            for { let temp := value } 1 {} {
                str := sub(str, 1)
                // Write the character to the pointer.
                // The ASCII index of the '0' character is 48.
                mstore8(str, add(48, mod(temp, 10)))
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
                // prettier-ignore
                if iszero(temp) { break }
            }

            let length := sub(end, str)
            // Move the pointer 32 bytes leftwards to make room for the length.
            str := sub(str, 0x20)
            // Store the length.
            mstore(str, length)
        }
    }

    /**
     * @dev For more efficient reverts.
     */
    function _revert(bytes4 errorSelector) internal pure {
        assembly {
            mstore(0x00, errorSelector)
            revert(0x00, 0x04)
        }
    }
}
IERC721A.sol 307 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of ERC721A.
 */
interface IERC721A {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

    /**
     * The token does not exist.
     */
    error ApprovalQueryForNonexistentToken();

    /**
     * Cannot query the balance for the zero address.
     */
    error BalanceQueryForZeroAddress();

    /**
     * Cannot mint to the zero address.
     */
    error MintToZeroAddress();

    /**
     * The quantity of tokens minted must be more than zero.
     */
    error MintZeroQuantity();

    /**
     * The token does not exist.
     */
    error OwnerQueryForNonexistentToken();

    /**
     * The caller must own the token or be an approved operator.
     */
    error TransferCallerNotOwnerNorApproved();

    /**
     * The token must be owned by `from`.
     */
    error TransferFromIncorrectOwner();

    /**
     * Cannot safely transfer to a contract that does not implement the
     * ERC721Receiver interface.
     */
    error TransferToNonERC721ReceiverImplementer();

    /**
     * Cannot transfer to the zero address.
     */
    error TransferToZeroAddress();

    /**
     * The token does not exist.
     */
    error URIQueryForNonexistentToken();

    /**
     * The `quantity` minted with ERC2309 exceeds the safety limit.
     */
    error MintERC2309QuantityExceedsLimit();

    /**
     * The `extraData` cannot be set on an unintialized ownership slot.
     */
    error OwnershipNotInitializedForExtraData();

    /**
     * `_sequentialUpTo()` must be greater than `_startTokenId()`.
     */
    error SequentialUpToTooSmall();

    /**
     * The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`.
     */
    error SequentialMintExceedsLimit();

    /**
     * Spot minting requires a `tokenId` greater than `_sequentialUpTo()`.
     */
    error SpotMintTokenIdTooSmall();

    /**
     * Cannot mint over a token that already exists.
     */
    error TokenAlreadyExists();

    /**
     * The feature is not compatible with spot mints.
     */
    error NotCompatibleWithSpotMints();

    // =============================================================
    //                            STRUCTS
    // =============================================================

    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Stores the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
        // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
        uint24 extraData;
    }

    // =============================================================
    //                         TOKEN COUNTERS
    // =============================================================

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() external view returns (uint256);

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);

    // =============================================================
    //                            IERC721
    // =============================================================

    /**
     * @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,
        bytes calldata data
    ) external payable;

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

    /**
     * @dev Transfers `tokenId` 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 payable;

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

    /**
     * @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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

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

    // =============================================================
    //                           IERC2309
    // =============================================================

    /**
     * @dev Emitted when tokens in `fromTokenId` to `toTokenId`
     * (inclusive) is transferred from `from` to `to`, as defined in the
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
     *
     * See {_mintERC2309} for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}

Read Contract

balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxMint 0x7501f741 → uint256
maxSupply 0xd5abeb01 → uint256
mintActive 0x25fd90f3 → bool
mintLimit 0x996517cf → uint256
name 0x06fdde03 → string
numTokensMinted 0x4230baee → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
price 0xa035b1fe → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenIdToSVG 0xc11feac1 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256

Write Contract 14 functions

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

approve 0x095ea7b3
address to
uint256 tokenId
mintCar 0x378a9334
uint256 amountOfTokens
mintTo 0x449a52f8
address _to
uint256 amountOfTokens
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
setMaxMint 0x547520fe
uint256 newMaxMint
setMintActive 0xee1cc944
bool _state
setMintLimit 0x9e6a1d7d
uint256 newLimit
setPrice 0x91b7f5ed
uint256 newPrice
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters

Recent Transactions

No transactions found for this address