Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x84B1c4d805464fe4255Db2a0CB4Bf015a4657974
Balance 0 ETH
Nonce 1
Code Size 13055 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

13055 bytes
0x6080604052600436106102e45760003560e01c80637fa803c311610190578063bbc2986c116100dc578063c87b56dd11610095578063ef6187a41161006f578063ef6187a4146108b2578063f2fde38b146108e2578063fe1bbf9f14610902578063ff01dcfb1461091557600080fd5b8063c87b56dd14610829578063dde44b8914610849578063e985e9c51461086957600080fd5b8063bbc2986c14610783578063bc31c1c1146107a3578063bd9a548b146107c3578063c0fa7301146107e5578063c19d93fb146107fa578063c55ed6c11461081457600080fd5b806391dde6ea11610149578063a22cb46511610123578063a22cb46514610719578063a943be4e14610739578063acf8e8631461074e578063b88d4fde1461076357600080fd5b806391dde6ea146106c457806395d02116146106e457806395d89b411461070457600080fd5b80637fa803c31461061357806388d15d50146106405780638d55e983146106535780638da5cb5b14610666578063909f8e1314610684578063916433a6146106a457600080fd5b8063339f50871161024f57806368963df01161020857806370a08231116101e257806370a082311461059e578063715018a6146105be578063756af45f146105d35780637cb64759146105f357600080fd5b806368963df0146105535780636bdc96d2146105695780636c0360eb1461058957600080fd5b8063339f5087146104a057806342842e0e146104c057806356de96db146104e05780635c55a08514610500578063612c9665146105205780636352211e1461053357600080fd5b806313115328116102a157806313115328146103cd57806318160ddd146103f45780631933faac1461041757806319dbb38d1461043757806323b872dd1461046a5780632eb4a7ab1461048a57600080fd5b806301e0f5ab146102e957806301ffc9a7146102fe57806302fe53051461033357806306fdde0314610353578063081812fc14610375578063095ea7b3146103ad575b600080fd5b6102fc6102f7366004612a1a565b61092a565b005b34801561030a57600080fd5b5061031e610319366004612a95565b610bdf565b60405190151581526020015b60405180910390f35b34801561033f57600080fd5b506102fc61034e366004612b3e565b610c31565b34801561035f57600080fd5b50610368610c50565b60405161032a9190612bdf565b34801561038157600080fd5b50610395610390366004612bf2565b610ce2565b6040516001600160a01b03909116815260200161032a565b3480156103b957600080fd5b506102fc6103c8366004612c22565b610d09565b3480156103d957600080fd5b506103e2600481565b60405160ff909116815260200161032a565b34801561040057600080fd5b50610409610e1f565b60405190815260200161032a565b34801561042357600080fd5b5061031e610432366004612c4c565b610e58565b34801561044357600080fd5b50610457610452366004612bf2565b610edd565b60405161ffff909116815260200161032a565b34801561047657600080fd5b506102fc610485366004612ca0565b610f0b565b34801561049657600080fd5b5061040960105481565b3480156104ac57600080fd5b506104096104bb366004612cdc565b610f3c565b3480156104cc57600080fd5b506102fc6104db366004612ca0565b610f5e565b3480156104ec57600080fd5b506102fc6104fb366004612cf7565b610f79565b34801561050c57600080fd5b506102fc61051b366004612d1a565b610f97565b6102fc61052e366004612d1a565b6110be565b34801561053f57600080fd5b5061039561054e366004612bf2565b61117e565b34801561055f57600080fd5b5061040960115481565b34801561057557600080fd5b50610457610584366004612bf2565b6111de565b34801561059557600080fd5b506103686111ee565b3480156105aa57600080fd5b506104096105b9366004612d4d565b61127c565b3480156105ca57600080fd5b506102fc611302565b3480156105df57600080fd5b506102fc6105ee366004612d4d565b611316565b3480156105ff57600080fd5b506102fc61060e366004612bf2565b611408565b34801561061f57600080fd5b5061063361062e366004612d4d565b611415565b60405161032a9190612d68565b6102fc61064e366004612dac565b611534565b6102fc610661366004612dee565b611648565b34801561067257600080fd5b506006546001600160a01b0316610395565b34801561069057600080fd5b5061031e61069f366004612c4c565b611ac5565b3480156106b057600080fd5b506104096106bf366004612c22565b611af3565b3480156106d057600080fd5b506104576106df366004612bf2565b611b18565b3480156106f057600080fd5b506104576106ff366004612bf2565b611b28565b34801561071057600080fd5b50610368611b38565b34801561072557600080fd5b506102fc610734366004612e64565b611b47565b34801561074557600080fd5b50610457600081565b34801561075a57600080fd5b506103e2600281565b34801561076f57600080fd5b506102fc61077e366004612ea0565b611b52565b34801561078f57600080fd5b506102fc61079e366004612f1c565b611b84565b3480156107af57600080fd5b506104096107be366004612bf2565b611bb9565b3480156107cf57600080fd5b506107d8611bd0565b60405161032a9190612f38565b3480156107f157600080fd5b50610457600181565b34801561080657600080fd5b506008546103e29060ff1681565b34801561082057600080fd5b50610457600281565b34801561083557600080fd5b50610368610844366004612bf2565b611c0b565b34801561085557600080fd5b506102fc610864366004612bf2565b611c72565b34801561087557600080fd5b5061031e610884366004612f69565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b3480156108be57600080fd5b5061031e6108cd366004612d4d565b60136020526000908152604090205460ff1681565b3480156108ee57600080fd5b506102fc6108fd366004612d4d565b611c7f565b6102fc610910366004612f93565b611cf8565b34801561092157600080fd5b506103e2600181565b600854600290811615610b84578260038161ffff161015610b3d5760008361ffff16116109725760405162461bcd60e51b815260040161096990612fcd565b60405180910390fd5b61097d868633610e58565b6109c95760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206973206e6f742077686974656c69737465640000000000006044820152606401610969565b60098461ffff16600381106109e0576109e0612ff8565b601081049190910154336000908152601260205260409020600f9092166002026101000a900461ffff9081169185821691871660038110610a2357610a23612ff8565b0154610a2f9190613024565b1115610a7d5760405162461bcd60e51b815260206004820152601b60248201527f4d6178206d696e74732070657220736c6f7420657863656564656400000000006044820152606401610969565b610a8b848461ffff16611f07565b610aa75760405162461bcd60e51b81526004016109699061303c565b33600090815260126020526040902061ffff8085169190861660038110610ad057610ad0612ff8565b016000828254610ae09190613024565b925050819055508261ffff16600a8561ffff1660038110610b0357610b03612ff8565b0154610b0f919061306c565b3414610b2d5760405162461bcd60e51b81526004016109699061308b565b610b38338585611f5b565b610b7e565b60405162461bcd60e51b8152602060048201526016602482015275556e737570706f7274656420746f6b656e207479706560501b6044820152606401610969565b50610bd8565b60405162461bcd60e51b815260206004820152602360248201527f4f7065726174696f6e206e6f7420616c6c6f77656420696e207468697320737460448201526261746560e81b6064820152608401610969565b5050505050565b60006001600160e01b031982166380ac58cd60e01b1480610c1057506001600160e01b03198216635b5e139f60e01b145b80610c2b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b610c39612017565b8051610c4c906007906020840190612900565b5050565b606060008054610c5f906130bb565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8b906130bb565b8015610cd85780601f10610cad57610100808354040283529160200191610cd8565b820191906000526020600020905b815481529060010190602001808311610cbb57829003601f168201915b5050505050905090565b6000610ced82612071565b506000908152600460205260409020546001600160a01b031690565b6000610d148261117e565b9050806001600160a01b0316836001600160a01b03161415610d825760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610969565b336001600160a01b0382161480610d9e5750610d9e8133610884565b610e105760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610969565b610e1a83836120d0565b505050565b6000610e2b600261213e565b610e35600161213e565b610e3f600061213e565b610e499190613024565b610e539190613024565b905090565b6010546040516bffffffffffffffffffffffff19606084901b166020820152600091610ed5916034015b604051602081830303815290604052805190602001208686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506121b69050565b949350505050565b600e8160038110610eed57600080fd5b60109182820401919006600202915054906101000a900461ffff1681565b610f1533826121cc565b610f315760405162461bcd60e51b8152600401610969906130f0565b610e1a83838361224a565b60008160038161ffff161015610b3d57610f558361213e565b91505b50919050565b610e1a83838360405180602001604052806000815250611b52565b610f81612017565b6008805460ff191660ff92909216919091179055565b610f9f612017565b8160038161ffff161015610b3d57600d8361ffff1660048110610fc457610fc4612ff8565b601091828204019190066002029054906101000a900461ffff16600d846001610fed919061313e565b61ffff166004811061100157611001612ff8565b601091828204019190066002029054906101000a900461ffff166110259190613164565b61ffff168261ffff16111561107c5760405162461bcd60e51b815260206004820181905260248201527f56616c75652077696c6c206f766572666c6f7720746f206e65787420746965726044820152606401610969565b81600f8461ffff166003811061109457611094612ff8565b601091828204019190066002026101000a81548161ffff021916908361ffff160217905550505050565b600854600490811615610b84578260038161ffff161015610b3d5760008361ffff16116110fd5760405162461bcd60e51b815260040161096990612fcd565b61110b848461ffff16611f07565b6111275760405162461bcd60e51b81526004016109699061303c565b8261ffff16600a8561ffff166003811061114357611143612ff8565b015461114f919061306c565b341461116d5760405162461bcd60e51b81526004016109699061308b565b611178338585611f5b565b50505050565b6000818152600260205260408120546001600160a01b031680610c2b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610969565b600d8160048110610eed57600080fd5b600780546111fb906130bb565b80601f0160208091040260200160405190810160405280929190818152602001828054611227906130bb565b80156112745780601f1061124957610100808354040283529160200191611274565b820191906000526020600020905b81548152906001019060200180831161125757829003601f168201915b505050505081565b60006001600160a01b0382166112e65760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610969565b506001600160a01b031660009081526003602052604090205490565b61130a612017565b61131460006123e6565b565b61131e612017565b600047116113655760405162461bcd60e51b81526020600482015260146024820152734e6f2066756e647320746f20776974686472617760601b6044820152606401610969565b6000816001600160a01b03164760405160006040518083038185875af1925050503d80600081146113b2576040519150601f19603f3d011682016040523d82523d6000602084013e6113b7565b606091505b5050905080610c4c5760405162461bcd60e51b815260206004820152601860248201527f4661696c656420746f2077697468647261772066756e647300000000000000006044820152606401610969565b611410612017565b601055565b60408051600380825260808201909252606091600091906020820184803683375050506001600160a01b0384166000908152601260205260409020546009549192506114649161ffff16613187565b8160008151811061147757611477612ff8565b6020908102919091018101919091526001600160a01b0384166000908152601290915260409020600101546009546114b9919062010000900461ffff16613187565b816001815181106114cc576114cc612ff8565b6020908102919091018101919091526001600160a01b0384166000908152601290915260409020600201546009546115109190640100000000900461ffff16613187565b8160028151811061152357611523612ff8565b602090810291909101015292915050565b600854600190811615610b845761154c838333611ac5565b6115985760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656c696769626c6520666f722066726565206d696e740000000000006044820152606401610969565b6115a460006001611f07565b6115c05760405162461bcd60e51b81526004016109699061303c565b3360009081526013602052604090205460ff16156116205760405162461bcd60e51b815260206004820152601960248201527f46726565206d696e7420616c726561647920636c61696d6564000000000000006044820152606401610969565b336000818152601360205260408120805460ff19166001908117909155610e1a929190611f5b565b600854600290811615610b845760008461ffff16118061166c575060008361ffff16115b8061167b575060008261ffff16115b6116975760405162461bcd60e51b815260040161096990612fcd565b6116a2868633610e58565b6116ee5760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206973206e6f742077686974656c69737465640000000000006044820152606401610969565b600c546117009061ffff84169061306c565b600b546117129061ffff86169061306c565b600a546117249061ffff88169061306c565b61172e9190613024565b6117389190613024565b34146117565760405162461bcd60e51b81526004016109699061308b565b61ffff841615611859576009543360009081526012602052604090205461ffff918216916117879190871690613024565b11156117d55760405162461bcd60e51b815260206004820152601960248201527f4d61782062726f6e7a65206d696e7473206578636565646564000000000000006044820152606401610969565b6117e460008561ffff16611f07565b6118305760405162461bcd60e51b815260206004820152601d60248201527f42726f6e7a6520746f6b656e20616c726561647920736f6c64206f75740000006044820152606401610969565b336000908152601260205260408120805461ffff87169290611853908490613024565b90915550505b61ffff831615611969576009543360009081526012602052604090206001015461ffff620100009092048216916118939190861690613024565b11156118e15760405162461bcd60e51b815260206004820152601960248201527f4d61782073696c766572206d696e7473206578636565646564000000000000006044820152606401610969565b6118f060018461ffff16611f07565b61193c5760405162461bcd60e51b815260206004820152601d60248201527f53696c76657220746f6b656e20616c726561647920736f6c64206f75740000006044820152606401610969565b33600090815260126020526040902061ffff84169060010160008282546119639190613024565b90915550505b61ffff821615611a7b576009543360009081526012602052604090206002015464010000000090910461ffff908116916119a591851690613024565b11156119f35760405162461bcd60e51b815260206004820152601760248201527f4d617820676f6c64206d696e74732065786365656465640000000000000000006044820152606401610969565b611a0260028361ffff16611f07565b611a4e5760405162461bcd60e51b815260206004820152601b60248201527f476f6c6420746f6b656e20616c726561647920736f6c64206f757400000000006044820152606401610969565b33600090815260126020526040902061ffff8316906002016000828254611a759190613024565b90915550505b61ffff841615611a9157611a9133600086611f5b565b61ffff831615611aa757611aa733600185611f5b565b61ffff821615611abd57611abd33600284611f5b565b505050505050565b6011546040516bffffffffffffffffffffffff19606084901b166020820152600091610ed591603401610e82565b60126020528160005260406000208160038110611b0f57600080fd5b01549150829050565b60098160038110610eed57600080fd5b600f8160038110610eed57600080fd5b606060018054610c5f906130bb565b610c4c338383612438565b611b5c33836121cc565b611b785760405162461bcd60e51b8152600401610969906130f0565b61117884848484612507565b611b8c612017565b8160038161ffff161015610b3d5781600a8461ffff1660038110611bb257611bb2612ff8565b0155505050565b600a8160038110611bc957600080fd5b0154905081565b611bd8612984565b60408051606081019182905290600a9060039082845b815481526020019060010190808311611bee575050505050905090565b6060611c1682612071565b6000611c2061253a565b90506000815111611c405760405180602001604052806000815250611c6b565b80611c4a84612549565b604051602001611c5b92919061319e565b6040516020818303038152906040525b9392505050565b611c7a612017565b601155565b611c87612017565b6001600160a01b038116611cec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610969565b611cf5816123e6565b50565b600854600490811615610b845760008461ffff161180611d1c575060008361ffff16115b80611d2b575060008261ffff16115b611d475760405162461bcd60e51b815260040161096990612fcd565b600c54611d599061ffff84169061306c565b600b54611d6b9061ffff86169061306c565b600a54611d7d9061ffff88169061306c565b611d879190613024565b611d919190613024565b3414611daf5760405162461bcd60e51b81526004016109699061308b565b61ffff841615611e2057611dc860008561ffff16611f07565b611e145760405162461bcd60e51b815260206004820152601d60248201527f42726f6e7a6520746f6b656e20616c726561647920736f6c64206f75740000006044820152606401610969565b611e2033600086611f5b565b61ffff831615611e9157611e3960018461ffff16611f07565b611e855760405162461bcd60e51b815260206004820152601d60248201527f53696c76657220746f6b656e20616c726561647920736f6c64206f75740000006044820152606401610969565b611e9133600185611f5b565b61ffff821615611f0257611eaa60028361ffff16611f07565b611ef65760405162461bcd60e51b815260206004820152601b60248201527f476f6c6420746f6b656e20616c726561647920736f6c64206f757400000000006044820152606401610969565b611f0233600284611f5b565b611178565b6000600f8361ffff1660038110611f2057611f20612ff8565b601091828204019190066002029054906101000a900461ffff1661ffff1682611f488561213e565b611f529190613024565b11159392505050565b6000600e8361ffff1660038110611f7457611f74612ff8565b601091828204019190066002029054906101000a900461ffff1661ffff16905081600e8461ffff1660038110611fac57611fac612ff8565b601091828204019190066002028282829054906101000a900461ffff16611fd3919061313e565b92506101000a81548161ffff021916908361ffff16021790555060005b8261ffff16811015610bd85761200f8561200a8385613024565b612647565b600101611ff0565b6006546001600160a01b031633146113145760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610969565b6000818152600260205260409020546001600160a01b0316611cf55760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610969565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906121058261117e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000600d8261ffff166004811061215757612157612ff8565b601091828204019190066002029054906101000a900461ffff16600e8361ffff166003811061218857612188612ff8565b601091828204019190066002029054906101000a900461ffff166121ac9190613164565b61ffff1692915050565b6000826121c38584612789565b14949350505050565b6000806121d88361117e565b9050806001600160a01b0316846001600160a01b0316148061221f57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80610ed55750836001600160a01b031661223884610ce2565b6001600160a01b031614949350505050565b826001600160a01b031661225d8261117e565b6001600160a01b0316146122c15760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610969565b6001600160a01b0382166123235760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610969565b61232e6000826120d0565b6001600160a01b0383166000908152600360205260408120805460019290612357908490613187565b90915550506001600160a01b0382166000908152600360205260408120805460019290612385908490613024565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316141561249a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610969565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61251284848461224a565b61251e848484846127d6565b6111785760405162461bcd60e51b8152600401610969906131c4565b606060078054610c5f906130bb565b60608161256d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612597578061258181613216565b91506125909050600a83613247565b9150612571565b60008167ffffffffffffffff8111156125b2576125b2612ab2565b6040519080825280601f01601f1916602001820160405280156125dc576020820181803683370190505b5090505b8415610ed5576125f1600183613187565b91506125fe600a8661325b565b612609906030613024565b60f81b81838151811061261e5761261e612ff8565b60200101906001600160f81b031916908160001a905350612640600a86613247565b94506125e0565b6001600160a01b03821661269d5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610969565b6000818152600260205260409020546001600160a01b0316156127025760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610969565b6001600160a01b038216600090815260036020526040812080546001929061272b908490613024565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600081815b84518110156127ce576127ba828683815181106127ad576127ad612ff8565b60200260200101516128d4565b9150806127c681613216565b91505061278e565b509392505050565b60006001600160a01b0384163b156128c957604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061281a90339089908890889060040161326f565b6020604051808303816000875af1925050508015612855575060408051601f3d908101601f19168201909252612852918101906132ac565b60015b6128af573d808015612883576040519150601f19603f3d011682016040523d82523d6000602084013e612888565b606091505b5080516128a75760405162461bcd60e51b8152600401610969906131c4565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610ed5565b506001949350505050565b60008183106128f0576000828152602084905260409020611c6b565b5060009182526020526040902090565b82805461290c906130bb565b90600052602060002090601f01602090048101928261292e5760008555612974565b82601f1061294757805160ff1916838001178555612974565b82800160010185558215612974579182015b82811115612974578251825591602001919060010190612959565b506129809291506129a2565b5090565b60405180606001604052806003906020820280368337509192915050565b5b8082111561298057600081556001016129a3565b60008083601f8401126129c957600080fd5b50813567ffffffffffffffff8111156129e157600080fd5b6020830191508360208260051b85010111156129fc57600080fd5b9250929050565b803561ffff81168114612a1557600080fd5b919050565b60008060008060608587031215612a3057600080fd5b843567ffffffffffffffff811115612a4757600080fd5b612a53878288016129b7565b9095509350612a66905060208601612a03565b9150612a7460408601612a03565b905092959194509250565b6001600160e01b031981168114611cf557600080fd5b600060208284031215612aa757600080fd5b8135611c6b81612a7f565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612ae357612ae3612ab2565b604051601f8501601f19908116603f01168101908282118183101715612b0b57612b0b612ab2565b81604052809350858152868686011115612b2457600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612b5057600080fd5b813567ffffffffffffffff811115612b6757600080fd5b8201601f81018413612b7857600080fd5b610ed584823560208401612ac8565b60005b83811015612ba2578181015183820152602001612b8a565b838111156111785750506000910152565b60008151808452612bcb816020860160208601612b87565b601f01601f19169290920160200192915050565b602081526000611c6b6020830184612bb3565b600060208284031215612c0457600080fd5b5035919050565b80356001600160a01b0381168114612a1557600080fd5b60008060408385031215612c3557600080fd5b612c3e83612c0b565b946020939093013593505050565b600080600060408486031215612c6157600080fd5b833567ffffffffffffffff811115612c7857600080fd5b612c84868287016129b7565b9094509250612c97905060208501612c0b565b90509250925092565b600080600060608486031215612cb557600080fd5b612cbe84612c0b565b9250612ccc60208501612c0b565b9150604084013590509250925092565b600060208284031215612cee57600080fd5b611c6b82612a03565b600060208284031215612d0957600080fd5b813560ff81168114611c6b57600080fd5b60008060408385031215612d2d57600080fd5b612d3683612a03565b9150612d4460208401612a03565b90509250929050565b600060208284031215612d5f57600080fd5b611c6b82612c0b565b6020808252825182820181905260009190848201906040850190845b81811015612da057835183529284019291840191600101612d84565b50909695505050505050565b60008060208385031215612dbf57600080fd5b823567ffffffffffffffff811115612dd657600080fd5b612de2858286016129b7565b90969095509350505050565b600080600080600060808688031215612e0657600080fd5b853567ffffffffffffffff811115612e1d57600080fd5b612e29888289016129b7565b9096509450612e3c905060208701612a03565b9250612e4a60408701612a03565b9150612e5860608701612a03565b90509295509295909350565b60008060408385031215612e7757600080fd5b612e8083612c0b565b915060208301358015158114612e9557600080fd5b809150509250929050565b60008060008060808587031215612eb657600080fd5b612ebf85612c0b565b9350612ecd60208601612c0b565b925060408501359150606085013567ffffffffffffffff811115612ef057600080fd5b8501601f81018713612f0157600080fd5b612f1087823560208401612ac8565b91505092959194509250565b60008060408385031215612f2f57600080fd5b612c3e83612a03565b60608101818360005b6003811015612f60578151835260209283019290910190600101612f41565b50505092915050565b60008060408385031215612f7c57600080fd5b612f8583612c0b565b9150612d4460208401612c0b565b600080600060608486031215612fa857600080fd5b612fb184612a03565b9250612fbf60208501612a03565b9150612c9760408501612a03565b602080825260119082015270139bc81d1bdad95b9cc81d1bc81b5a5b9d607a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156130375761303761300e565b500190565b602080825260169082015275151bdad95b88185b1c9958591e481cdbdb19081bdd5d60521b604082015260600190565b60008160001904831182151516156130865761308661300e565b500290565b602080825260169082015275125b9d985b1a59081c185e5b595b9d08185b5bdd5b9d60521b604082015260600190565b600181811c908216806130cf57607f821691505b60208210811415610f5857634e487b7160e01b600052602260045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b600061ffff80831681851680830382111561315b5761315b61300e565b01949350505050565b600061ffff8381169083168181101561317f5761317f61300e565b039392505050565b6000828210156131995761319961300e565b500390565b600083516131b0818460208801612b87565b83519083019061315b818360208801612b87565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060001982141561322a5761322a61300e565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261325657613256613231565b500490565b60008261326a5761326a613231565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132a290830184612bb3565b9695505050505050565b6000602082840312156132be57600080fd5b8151611c6b81612a7f56fea26469706673582212205f8b650a04628f77f0af0be8f3202bfd9a0e64ae770badd0ca3f7bb5430354b664736f6c634300080b0033

Verified Source Code Partial Match

Compiler: v0.8.11+commit.d7f03943 EVM: london Optimization: Yes (200 runs)
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
Strings.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

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

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

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

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

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

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

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev 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 have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev 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);
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev 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 {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
JoesImports.sol 242 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";

// Project by @312Labs
// Contract by @AsteriaLabs
// Audited by @SilikaStudio

/// @title Joe's Imports NFT
/// @author Skeith <[email protected]>
contract JoesImports is ERC721, Ownable {
    using MerkleProof for bytes32[];

    uint16 constant public BRONZE_TOKEN_TYPE = 0;
    uint16 constant public SILVER_TOKEN_TYPE = 1;
    uint16 constant public GOLD_TOKEN_TYPE = 2;

    uint8 constant public ALLOW_FREE_MINTS = 1;
    uint8 constant public ALLOW_WHITELIST_MINTS = 1 << 1;
    uint8 constant public ALLOW_PUBLIC_MINTS = 1 << 2;

    string public baseURI;

    uint8 public state;

    uint16[3] public maxMintsPerSlot = [6, 3, 1];
    uint256[3] public prices = [0.066 ether, 0.33 ether, 1.16 ether];

    uint16[4] public startingTokenIds = [1, 1001, 1101, 1111];
    uint16[3] public nextTokenId = [1, 1001, 1101];
    uint16[3] public maxTotalSupplies = [1000, 100, 10];

    bytes32 public merkleRoot;
    bytes32 public freeMintMerkleRoot;

    /// @dev Mint counts per whitelisted address
    mapping(address => uint[3]) public mintCounts;
    mapping(address => bool) public hasFreeMinted;

    constructor() ERC721("Joe's Imports", "WINE") {}

    modifier whenInState(uint8 _state) {
        if (state & _state > 0) {
            _;
        } else {
            revert("Operation not allowed in this state");
        }
    }

    modifier checkTokenType(uint16 tokenType) {
        if (tokenType < 3) {
            _;
        } else {
            revert("Unsupported token type");
        }
    }

    function _mint(address to, uint16 tokenType, uint16 amount) internal {
        uint256 baseTokenId = nextTokenId[tokenType];

        nextTokenId[tokenType] += amount;

        for (uint256 i; i < amount;) {
            _mint(to, baseTokenId + i);
            unchecked { ++i; }
        }
    }

    function _baseURI() internal view override returns (string memory) {
        return baseURI;
    }

    // @dev This does not consider burned tokens
    function _totalSupply(uint16 tokenType) internal view returns (uint256) {
        return nextTokenId[tokenType] - startingTokenIds[tokenType];
    }

    function _checkIfMintExceedsSupply(uint16 tokenType, uint256 amount) internal view returns (bool) {
        return _totalSupply(tokenType) + amount <= maxTotalSupplies[tokenType];
    }

    // === MANAGEMENT ===
    function totalSupplyOfType(uint16 tokenType) external view checkTokenType(tokenType) returns (uint256) {
        return _totalSupply(tokenType);
    }

    function totalSupply() external view returns (uint256) {
        return _totalSupply(BRONZE_TOKEN_TYPE) + _totalSupply(SILVER_TOKEN_TYPE) + _totalSupply(GOLD_TOKEN_TYPE);
    }

    function setState(uint8 _state) external onlyOwner {
        state = _state;
    }

    function setURI(string memory _uri) external onlyOwner {
        baseURI = _uri;
    }

    function setTotalSupply(uint16 tokenType, uint16 __totalSupply) external onlyOwner checkTokenType(tokenType) {
        require(__totalSupply <= startingTokenIds[tokenType + 1] - startingTokenIds[tokenType], "Value will overflow to next tier");
        maxTotalSupplies[tokenType] = __totalSupply;
    }

    function setPrice(uint16 tokenType, uint256 price) external onlyOwner checkTokenType(tokenType) {
        prices[tokenType] = price;
    }

    function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
        merkleRoot = _merkleRoot;
    }

    function setFreeMintMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
        freeMintMerkleRoot = _merkleRoot;
    }

    function checkWhitelist(bytes32[] calldata _proof, address _address) public view returns (bool) {
        return _proof.verify(merkleRoot, keccak256(abi.encodePacked(_address)));
    }

    function checkFreeMintWhitelist(bytes32[] calldata _proof, address _address) public view returns (bool) {
        return _proof.verify(freeMintMerkleRoot, keccak256(abi.encodePacked(_address)));
    }

    function withdrawBalance(address to) external onlyOwner {
        require(address(this).balance > 0, "No funds to withdraw");

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

    // === INFORMATION ===
    function getPrices() external view returns (uint256[3] memory) {
        return prices;
    }

    function getRemainingMints(address _address) external view returns (uint256[] memory) {
        uint256[] memory remainingMints = new uint256[](3);
        remainingMints[0] = maxMintsPerSlot[0] - mintCounts[_address][0];
        remainingMints[1] = maxMintsPerSlot[1] - mintCounts[_address][1];
        remainingMints[2] = maxMintsPerSlot[2] - mintCounts[_address][2];

        return remainingMints;
    }

    // === MINTING ===
    function freeMint(bytes32[] calldata proof) external whenInState(ALLOW_FREE_MINTS) payable {
        require(checkFreeMintWhitelist(proof, msg.sender), "Not eligible for free mint");
        require(_checkIfMintExceedsSupply(BRONZE_TOKEN_TYPE, 1), "Token already sold out");

        require(!hasFreeMinted[msg.sender], "Free mint already claimed");

        hasFreeMinted[msg.sender] = true;

        _mint(msg.sender, BRONZE_TOKEN_TYPE, 1);
    }

    function whitelistMint(bytes32[] calldata proof, uint16 tokenType, uint16 amount) external whenInState(ALLOW_WHITELIST_MINTS) checkTokenType(tokenType) payable {
        require(amount > 0, "No tokens to mint");
        require(checkWhitelist(proof, msg.sender), "Address is not whitelisted");
        require(mintCounts[msg.sender][tokenType] + amount <= maxMintsPerSlot[tokenType], "Max mints per slot exceeded");
        require(_checkIfMintExceedsSupply(tokenType, amount), "Token already sold out");

        mintCounts[msg.sender][tokenType] += amount;

        require(msg.value == prices[tokenType] * amount, "Invalid payment amount");

        _mint(msg.sender, tokenType, amount);
    }

    function batchWhitelistMint(bytes32[] calldata proof, uint16 bronze, uint16 silver, uint16 gold) external whenInState(ALLOW_WHITELIST_MINTS) payable {
        require(bronze > 0 || silver > 0 || gold > 0, "No tokens to mint");
        require(checkWhitelist(proof, msg.sender), "Address is not whitelisted");
        require(
            msg.value == prices[BRONZE_TOKEN_TYPE] * bronze
                + prices[SILVER_TOKEN_TYPE] * silver
                + prices[GOLD_TOKEN_TYPE] * gold,
            "Invalid payment amount"
        );

        if (bronze > 0) {
            require(mintCounts[msg.sender][BRONZE_TOKEN_TYPE] + bronze <= maxMintsPerSlot[BRONZE_TOKEN_TYPE], "Max bronze mints exceeded");
            require(_checkIfMintExceedsSupply(BRONZE_TOKEN_TYPE, bronze), "Bronze token already sold out");

            mintCounts[msg.sender][BRONZE_TOKEN_TYPE] += bronze;
        }

        if (silver > 0) {
            require(mintCounts[msg.sender][SILVER_TOKEN_TYPE] + silver <= maxMintsPerSlot[SILVER_TOKEN_TYPE], "Max silver mints exceeded");
            require(_checkIfMintExceedsSupply(SILVER_TOKEN_TYPE, silver), "Silver token already sold out");

            mintCounts[msg.sender][SILVER_TOKEN_TYPE] += silver;
        }

        if (gold > 0) {
            require(mintCounts[msg.sender][GOLD_TOKEN_TYPE] + gold <= maxMintsPerSlot[GOLD_TOKEN_TYPE], "Max gold mints exceeded");
            require(_checkIfMintExceedsSupply(GOLD_TOKEN_TYPE, gold), "Gold token already sold out");

            mintCounts[msg.sender][GOLD_TOKEN_TYPE] += gold;
        }

        if (bronze > 0) _mint(msg.sender, BRONZE_TOKEN_TYPE, bronze);
        if (silver > 0) _mint(msg.sender, SILVER_TOKEN_TYPE, silver);
        if (gold > 0) _mint(msg.sender, GOLD_TOKEN_TYPE, gold);
    }

    function publicMint(uint16 tokenType, uint16 amount) external payable whenInState(ALLOW_PUBLIC_MINTS) checkTokenType(tokenType) {
        require(amount > 0, "No tokens to mint");
        require(_checkIfMintExceedsSupply(tokenType, amount), "Token already sold out");

        require(msg.value == prices[tokenType] * amount, "Invalid payment amount");

        _mint(msg.sender, tokenType, amount);
    }

    function batchPublicMint(uint16 bronze, uint16 silver, uint16 gold) external whenInState(ALLOW_PUBLIC_MINTS) payable {
        require(bronze > 0 || silver > 0 || gold > 0, "No tokens to mint");
        require(
            msg.value == prices[BRONZE_TOKEN_TYPE] * bronze
                + prices[SILVER_TOKEN_TYPE] * silver
                + prices[GOLD_TOKEN_TYPE] * gold,
            "Invalid payment amount"
        );

        if (bronze > 0) {
            require(_checkIfMintExceedsSupply(BRONZE_TOKEN_TYPE, bronze), "Bronze token already sold out");
            _mint(msg.sender, BRONZE_TOKEN_TYPE, bronze);
        }

        if (silver > 0) {
            require(_checkIfMintExceedsSupply(SILVER_TOKEN_TYPE, silver), "Silver token already sold out");
            _mint(msg.sender, SILVER_TOKEN_TYPE, silver);
        }

        if (gold > 0) {
            require(_checkIfMintExceedsSupply(GOLD_TOKEN_TYPE, gold), "Gold token already sold out");
            _mint(msg.sender, GOLD_TOKEN_TYPE, gold);
        }
    }
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     *
     * _Available since v4.7._
     */
    function verifyCalldata(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     *
     * _Available since v4.7._
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,
     * consuming from one or the other at each step according to the instructions given by
     * `proofFlags`.
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

Read Contract

ALLOW_FREE_MINTS 0xff01dcfb → uint8
ALLOW_PUBLIC_MINTS 0x13115328 → uint8
ALLOW_WHITELIST_MINTS 0xacf8e863 → uint8
BRONZE_TOKEN_TYPE 0xa943be4e → uint16
GOLD_TOKEN_TYPE 0xc55ed6c1 → uint16
SILVER_TOKEN_TYPE 0xc0fa7301 → uint16
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
checkFreeMintWhitelist 0x909f8e13 → bool
checkWhitelist 0x1933faac → bool
freeMintMerkleRoot 0x68963df0 → bytes32
getApproved 0x081812fc → address
getPrices 0xbd9a548b → uint256[3]
getRemainingMints 0x7fa803c3 → uint256[]
hasFreeMinted 0xef6187a4 → bool
isApprovedForAll 0xe985e9c5 → bool
maxMintsPerSlot 0x91dde6ea → uint16
maxTotalSupplies 0x95d02116 → uint16
merkleRoot 0x2eb4a7ab → bytes32
mintCounts 0x916433a6 → uint256
name 0x06fdde03 → string
nextTokenId 0x19dbb38d → uint16
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
prices 0xbc31c1c1 → uint256
startingTokenIds 0x6bdc96d2 → uint16
state 0xc19d93fb → uint8
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
totalSupplyOfType 0x339f5087 → uint256

Write Contract 19 functions

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

approve 0x095ea7b3
address to
uint256 tokenId
batchPublicMint 0xfe1bbf9f
uint16 bronze
uint16 silver
uint16 gold
batchWhitelistMint 0x8d55e983
bytes32[] proof
uint16 bronze
uint16 silver
uint16 gold
freeMint 0x88d15d50
bytes32[] proof
publicMint 0x612c9665
uint16 tokenType
uint16 amount
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
setFreeMintMerkleRoot 0xdde44b89
bytes32 _merkleRoot
setMerkleRoot 0x7cb64759
bytes32 _merkleRoot
setPrice 0xbbc2986c
uint16 tokenType
uint256 price
setState 0x56de96db
uint8 _state
setTotalSupply 0x5c55a085
uint16 tokenType
uint16 __totalSupply
setURI 0x02fe5305
string _uri
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistMint 0x01e0f5ab
bytes32[] proof
uint16 tokenType
uint16 amount
withdrawBalance 0x756af45f
address to

Recent Transactions

No transactions found for this address