Address Contract Verified
Address
0x4135063DC85190660ed08790f59Bc711d8b404c0
Balance
0.264000 ETH
Nonce
1
Code Size
18116 bytes
Creator
0x2945e306...8570 at tx 0x01af5f0f...ee0783
Indexed Transactions
0
Contract Bytecode
18116 bytes
0x6080604052600436106103de5760003560e01c80636cb43d6d1161020d578063b1dd78f111610128578063d082e381116100bb578063e985e9c51161008a578063f16488fa1161006f578063f16488fa14610c62578063f2fde38b14610c82578063f3f7d4d514610ca257600080fd5b8063e985e9c514610bf9578063ed7e1dea14610c4257600080fd5b8063d082e38114610b81578063d9d3e39b14610b97578063e0bd3b7c14610bac578063e58306f914610bd957600080fd5b8063c002d23d116100f7578063c002d23d14610aea578063c23dc68f14610b1e578063c87b56dd14610b4b578063ca585f7c14610b6b57600080fd5b8063b1dd78f114610a71578063b88d4fde14610a87578063bb0c147b14610aa7578063bd6f667a14610abd57600080fd5b806389134762116101a057806399a2557a1161016f57806399a2557a146109f15780639af04f0d14610a115780639ccef3e214610a31578063a22cb46514610a5157600080fd5b8063891347621461097e5780638da5cb5b1461099e5780638dc56c3a146109bc57806395d89b41146109dc57600080fd5b8063717084e1116101dc578063717084e1146108f25780637eaeaa94146109115780638462151c14610931578063856c64301461095e57600080fd5b80636cb43d6d146108875780637099b7281461089d57806370a08231146108bd578063715018a6146108dd57600080fd5b8063395de242116102fd57806357ca339c1161029057806361f644571161025f57806361f644571461081a57806362a5af3b1461083c5780636352211e14610851578063651bb4a11461087157600080fd5b806357ca339c146107a45780635a5e5d58146107ba5780635bbb2177146107cd5780635e35353f146107fa57600080fd5b806342fe2bc6116102cc57806342fe2bc6146107215780634535f726146107375780634b0bddd21461076457806355f804b31461078457600080fd5b8063395de242146106ac5780633ccfd60b146106cc57806342842e0e146106e157806342c5e5ac1461070157600080fd5b806318160ddd1161037557806329ebbcd41161034457806329ebbcd41461060b578063313112ce1461063857806332cb6b0c1461065857806336c5fcca1461068c57600080fd5b806318160ddd146104fd5780631dbb2a221461052057806323b872dd146105d1578063247f5007146105f157600080fd5b8063095ea7b3116103b1578063095ea7b3146104935780630dccc9ad146104b557806310a60526146104ca57806316f60557146104dd57600080fd5b806301ffc9a7146103e3578063039feb441461041857806306fdde0314610439578063081812fc1461045b575b600080fd5b3480156103ef57600080fd5b506104036103fe366004613df5565b610cc2565b60405190151581526020015b60405180910390f35b34801561042457600080fd5b50600a54610403906301000000900460ff1681565b34801561044557600080fd5b5061044e610d5f565b60405161040f9190613e6a565b34801561046757600080fd5b5061047b610476366004613e7d565b610df1565b6040516001600160a01b03909116815260200161040f565b34801561049f57600080fd5b506104b36104ae366004613eb2565b610e4e565b005b3480156104c157600080fd5b5061044e610f14565b6104b36104d8366004613f28565b610fa2565b3480156104e957600080fd5b506104b36104f8366004613f74565b6112dd565b34801561050957600080fd5b50600154600054035b60405190815260200161040f565b34801561052c57600080fd5b5061059761053b366004613e7d565b601860205260009081526040902080546001909101546001600160a01b0382169174010000000000000000000000000000000000000000900467ffffffffffffffff908116919081169068010000000000000000900460ff1684565b604080516001600160a01b0395909516855267ffffffffffffffff938416602086015291909216908301521515606082015260800161040f565b3480156105dd57600080fd5b506104b36105ec366004613fc0565b6116ca565b3480156105fd57600080fd5b50600a546104039060ff1681565b34801561061757600080fd5b50610512610626366004613ffc565b60156020526000908152604090205481565b34801561064457600080fd5b506104b3610653366004613e7d565b6118b4565b34801561066457600080fd5b506105127f000000000000000000000000000000000000000000000000000000000000271081565b34801561069857600080fd5b506104b36106a7366004614017565b611952565b3480156106b857600080fd5b506104b36106c7366004613f74565b611a19565b3480156106d857600080fd5b506104b3611eb4565b3480156106ed57600080fd5b506104b36106fc366004613fc0565b611f56565b34801561070d57600080fd5b506104b361071c366004613eb2565b611f71565b34801561072d57600080fd5b50610512600c5481565b34801561074357600080fd5b50610512610752366004613ffc565b60196020526000908152604090205481565b34801561077057600080fd5b506104b361077f366004614043565b612139565b34801561079057600080fd5b506104b361079f36600461410b565b61216c565b3480156107b057600080fd5b50610512600f5481565b6104b36107c8366004613e7d565b612191565b3480156107d957600080fd5b506107ed6107e8366004614154565b6123ee565b60405161040f9190614196565b34801561080657600080fd5b506104b3610815366004613f28565b6124ba565b34801561082657600080fd5b50600a5461040390640100000000900460ff1681565b34801561084857600080fd5b506104b361275b565b34801561085d57600080fd5b5061047b61086c366004613e7d565b612772565b34801561087d57600080fd5b5061051260115481565b34801561089357600080fd5b50610512600d5481565b3480156108a957600080fd5b506104b36108b8366004614017565b61277d565b3480156108c957600080fd5b506105126108d8366004613ffc565b612834565b3480156108e957600080fd5b506104b361289c565b3480156108fe57600080fd5b50600a5461040390610100900460ff1681565b34801561091d57600080fd5b506104b361092c366004613f28565b6128b0565b34801561093d57600080fd5b5061095161094c366004613ffc565b612b71565b60405161040f9190614213565b34801561096a57600080fd5b5061040361097936600461424b565b612c79565b34801561098a57600080fd5b50600a546104039062010000900460ff1681565b3480156109aa57600080fd5b506008546001600160a01b031661047b565b3480156109c857600080fd5b506104b36109d73660046142a7565b612d9f565b3480156109e857600080fd5b5061044e612e9d565b3480156109fd57600080fd5b50610951610a0c366004614313565b612eac565b348015610a1d57600080fd5b506104b3610a2c366004613e7d565b613043565b348015610a3d57600080fd5b506104b3610a4c366004613e7d565b613050565b348015610a5d57600080fd5b506104b3610a6c366004614043565b61305d565b348015610a7d57600080fd5b50610512600e5481565b348015610a9357600080fd5b506104b3610aa2366004614346565b61310c565b348015610ab357600080fd5b5061051260105481565b348015610ac957600080fd5b50610512610ad8366004613ffc565b60166020526000908152604090205481565b348015610af657600080fd5b506105127f0000000000000000000000000000000000000000000000000138a388a43c000081565b348015610b2a57600080fd5b50610b3e610b39366004613e7d565b613156565b60405161040f91906143c2565b348015610b5757600080fd5b5061044e610b66366004613e7d565b6131ce565b348015610b7757600080fd5b50610512600b5481565b348015610b8d57600080fd5b5061051260125481565b348015610ba357600080fd5b506104b361326b565b348015610bb857600080fd5b50610512610bc7366004613ffc565b60146020526000908152604090205481565b348015610be557600080fd5b506104b3610bf4366004613eb2565b613296565b348015610c0557600080fd5b50610403610c14366004614407565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610c4e57600080fd5b506104b3610c5d3660046142a7565b6133c4565b348015610c6e57600080fd5b506104b3610c7d3660046142a7565b6134bb565b348015610c8e57600080fd5b506104b3610c9d366004613ffc565b6135b2565b348015610cae57600080fd5b50610512610cbd366004613eb2565b61363f565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480610d2557507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610d5957507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b606060028054610d6e9061443a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9a9061443a565b8015610de75780601f10610dbc57610100808354040283529160200191610de7565b820191906000526020600020905b815481529060010190602001808311610dca57829003601f168201915b5050505050905090565b6000610dfc826136d4565b610e32576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610e5982612772565b9050336001600160a01b03821614610eab57610e758133610c14565b610eab576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260066020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60098054610f219061443a565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4d9061443a565b8015610f9a5780601f10610f6f57610100808354040283529160200191610f9a565b820191906000526020600020905b815481529060010190602001808311610f7d57829003601f168201915b505050505081565b600a54610100900460ff16610ffe5760405162461bcd60e51b815260206004820152601c60248201527f50616964207072652d73616c65206d757374206265206163746976650000000060448201526064015b60405180910390fd5b61100b8383336001612c79565b6110635760405162461bcd60e51b8152602060048201526024808201527f43616c6c6572206e6f74207072652d73616c65207061696420616c6c6f776c696044820152631cdd195960e21b6064820152608401610ff5565b600081136110bf5760405162461bcd60e51b815260206004820152602360248201527f5175616e74697479206d757374206265206120706f73746974697665206e756d6044820152623132b960e91b6064820152608401610ff5565b336000908152601560205260409020546110da90600261448b565b81131561114f5760405162461bcd60e51b815260206004820152603160248201527f4d696e74696e67207175616e74697479206578636565647320616c6c6f63617460448201527f696f6e206c65667420666f7220757365720000000000000000000000000000006064820152608401610ff5565b600e54600f54601054611182907f00000000000000000000000000000000000000000000000000000000000027106144e3565b61118c91906144e3565b61119691906144e3565b816012546111a491906144fa565b11156112185760405162461bcd60e51b815260206004820152603560248201527f546f6b656e20636f756e742065786365656473206c696d697420666f7220707260448201527f652d73616c65207061696420616c6c6f776c69737400000000000000000000006064820152608401610ff5565b611242817f0000000000000000000000000000000000000000000000000138a388a43c0000614512565b3410156112915760405162461bcd60e51b815260206004820152601d60248201527f45746865722076616c75652073656e7420697320696e636f72726563740000006044820152606401610ff5565b61129b33826136fb565b33600090815260156020526040812080548392906112ba908490614531565b9250508190555080601260008282546112d391906144fa565b9091555050505050565b600a54640100000000900460ff166113375760405162461bcd60e51b815260206004820152601660248201527f5374616b696e67206d75737420626520616374697665000000000000000000006044820152606401610ff5565b8281146113ac5760405162461bcd60e51b815260206004820152603160248201527f5175616e7469747920646f6573206e6f74206d6174636820757020776974682060448201527f73697a65206f6620746f6b656e206964730000000000000000000000000000006064820152608401610ff5565b6113b533612834565b336000908152601960205260409020546113d09085906144fa565b111561146a5760405162461bcd60e51b815260206004820152604760248201527f5175616e746974792065786365656473206e756d62657273206f6620746f6b6560448201527f6e732068656c642062792073656e64657220617661696c61626c6520666f722060648201527f7374616b696e6700000000000000000000000000000000000000000000000000608482015260a401610ff5565b4260005b8281101561169f573361149885858481811061148c5761148c614589565b90506020020135612772565b6001600160a01b0316146115145760405162461bcd60e51b815260206004820152603860248201527f5374616b6572206973206e6f7420746865206f776e6572206f6620746865207460448201527f6f6b656e20747279696e6720746f206265207374616b656400000000000000006064820152608401610ff5565b6018600085858481811061152a5761152a614589565b90506020020135815260200190815260200160002060010160089054906101000a900460ff161561159d5760405162461bcd60e51b815260206004820152601d60248201527f546f6b656e20697320616c7265616479206265696e67207374616b65640000006044820152606401610ff5565b33601860008686858181106115b4576115b4614589565b90506020020135815260200190815260200160002060000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550816018600086868581811061160757611607614589565b90506020020135815260200190815260200160002060000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060016018600086868581811061165d5761165d614589565b90506020020135815260200190815260200160002060010160086101000a81548160ff02191690831515021790555080806116979061459f565b91505061146e565b5033600090815260196020526040812080548692906116bf9084906144fa565b909155505050505050565b60006116d582613715565b9050836001600160a01b0316816001600160a01b031614611722576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417611788576117528633610c14565b611788576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0385166117c8576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6117d5868686600161378f565b80156117e057600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b831661186b57600184016000818152600460205260409020546118695760005481146118695760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6118bc613825565b806118d657600a805460ff19811660ff9091161517905550565b80600114156118fd57600a805461ff001981166101009182900460ff161590910217905550565b806002141561192657600a805462ff0000198116620100009182900460ff161590910217905550565b806003141561194f57600a805463ff00000019811663010000009182900460ff16159091021790555b50565b61195a613825565b600d839055806119f957600f548111156119dc5760405162461bcd60e51b815260206004820152603d60248201527f5375627472616374696e6720616d6f756e74206973206772656174657220746860448201527f616e207468652063757272656e74207265736572766520616d6f756e740000006064820152608401610ff5565b81600f60008282546119ee91906144e3565b90915550611a149050565b8060011415611a145781600f60008282546112d391906144fa565b505050565b600a54640100000000900460ff16611a735760405162461bcd60e51b815260206004820152601660248201527f5374616b696e67206d75737420626520616374697665000000000000000000006044820152606401610ff5565b828114611ae85760405162461bcd60e51b815260206004820152603160248201527f5175616e7469747920646f6573206e6f74206d6174636820757020776974682060448201527f73697a65206f6620746f6b656e206964730000000000000000000000000000006064820152608401610ff5565b33600090815260196020526040902054831115611b6d5760405162461bcd60e51b815260206004820152603960248201527f5175616e74697479206973206c6172676572207468616e2074686520616d6f7560448201527f6e74206f6620746f6b656e73206265696e67207374616b6564000000000000006064820152608401610ff5565b4260005b82811015611e945733611b8f85858481811061148c5761148c614589565b6001600160a01b031614611c0b5760405162461bcd60e51b815260206004820152603a60248201527f5374616b6572206973206e6f7420746865206f776e6572206f6620746865207460448201527f6f6b656e20747279696e6720746f20626520756e7374616b65640000000000006064820152608401610ff5565b60186000858584818110611c2157611c21614589565b90506020020135815260200190815260200160002060010160089054906101000a900460ff16611cb95760405162461bcd60e51b815260206004820152602360248201527f546f6b656e206973206e6f742063757272656e746c79206265696e672073746160448201527f6b656400000000000000000000000000000000000000000000000000000000006064820152608401610ff5565b600060186000868685818110611cd157611cd1614589565b602090810292909201358352508101919091526040016000205474010000000000000000000000000000000000000000900467ffffffffffffffff169050611d1981846145ba565b60186000878786818110611d2f57611d2f614589565b90506020020135815260200190815260200160002060010160008282829054906101000a900467ffffffffffffffff16611d6991906145e3565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600060186000878786818110611da757611da7614589565b90506020020135815260200190815260200160002060000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600060186000878786818110611dfb57611dfb614589565b90506020020135815260200190815260200160002060000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600060186000878786818110611e5157611e51614589565b90506020020135815260200190815260200160002060010160086101000a81548160ff021916908315150217905550508080611e8c9061459f565b915050611b71565b5033600090815260196020526040812080548692906116bf9084906144e3565b33611ec76008546001600160a01b031690565b6001600160a01b03161480611eeb57503360009081526017602052604090205460ff165b611f235760405162461bcd60e51b81526020600482015260096024820152684e6f2041636365737360b81b6044820152606401610ff5565b6040514790339082156108fc029083906000818181858888f19350505050158015611f52573d6000803e3d6000fd5b5050565b611a148383836040518060200160405280600081525061310c565b33611f846008546001600160a01b031690565b6001600160a01b03161480611fa857503360009081526017602052604090205460ff165b611fe05760405162461bcd60e51b81526020600482015260096024820152684e6f2041636365737360b81b6044820152606401610ff5565b6010548111156120585760405162461bcd60e51b815260206004820152603060248201527f5175616e74697479206578636565647320616c6c6f636174696f6e206c65667460448201527f20666f722064706f702077616c6c6574000000000000000000000000000000006064820152608401610ff5565b7f00000000000000000000000000000000000000000000000000000000000027108160125461208791906144fa565b11156120fb5760405162461bcd60e51b815260206004820152602960248201527f546f6b656e20636f756e742065786365656473206c696d697420666f7220647060448201527f6f702077616c6c657400000000000000000000000000000000000000000000006064820152608401610ff5565b61210582826136fb565b806010600082825461211791906144e3565b92505081905550806012600082825461213091906144fa565b90915550505050565b612141613825565b6001600160a01b03919091166000908152601760205260409020805460ff1916911515919091179055565b612174613825565b60135460ff1661194f578051611f52906009906020840190613d46565b600a546301000000900460ff166121ea5760405162461bcd60e51b815260206004820152601f60248201527f50616964207075626c69632073616c65206d75737420626520616374697665006044820152606401610ff5565b6011548111156122885760405162461bcd60e51b815260206004820152604660248201527f5175616e74697479206973206c6172676572207468616e2074686520616c6c6f60448201527f776564206e756d626572206f66206d696e747320696e206f6e65207472616e7360648201527f616374696f6e0000000000000000000000000000000000000000000000000000608482015260a401610ff5565b6122b2817f0000000000000000000000000000000000000000000000000138a388a43c0000614512565b3410156123015760405162461bcd60e51b815260206004820152601d60248201527f45746865722076616c75652073656e7420697320696e636f72726563740000006044820152606401610ff5565b600e54600f54601054612334907f00000000000000000000000000000000000000000000000000000000000027106144e3565b61233e91906144e3565b61234891906144e3565b8160125461235691906144fa565b11156123ca5760405162461bcd60e51b815260206004820152602e60248201527f546f6b656e20636f756e742065786365656473206c696d697420666f7220707560448201527f626c69632073616c6520706169640000000000000000000000000000000000006064820152608401610ff5565b6123d433826136fb565b80601260008282546123e691906144fa565b909155505050565b60608160008167ffffffffffffffff81111561240c5761240c61407f565b60405190808252806020026020018201604052801561245e57816020015b60408051608081018252600080825260208083018290529282018190526060820152825260001990920191018161242a5790505b50905060005b8281146124b15761248c86868381811061248057612480614589565b90506020020135613156565b82828151811061249e5761249e614589565b6020908102919091010152600101612464565b50949350505050565b600a5460ff1661250c5760405162461bcd60e51b815260206004820152601c60248201527f46726565207072652d73616c65206d75737420626520616374697665000000006044820152606401610ff5565b6125198383336000612c79565b6125715760405162461bcd60e51b8152602060048201526024808201527f43616c6c6572206e6f74207072652d73616c65206672656520616c6c6f776c696044820152631cdd195960e21b6064820152608401610ff5565b600081136125cd5760405162461bcd60e51b815260206004820152602360248201527f5175616e74697479206d757374206265206120706f73746974697665206e756d6044820152623132b960e91b6064820152608401610ff5565b336000908152601460205260409020546125e890600161448b565b81131561265d5760405162461bcd60e51b815260206004820152603160248201527f4d696e74696e67207175616e74697479206578636565647320616c6c6f63617460448201527f696f6e206c65667420666f7220757365720000000000000000000000000000006064820152608401610ff5565b600f5460105461268d907f00000000000000000000000000000000000000000000000000000000000027106144e3565b61269791906144e3565b816012546126a591906144fa565b11156127195760405162461bcd60e51b815260206004820152603560248201527f546f6b656e20636f756e742065786365656473206c696d697420666f7220707260448201527f652d73616c65206672656520616c6c6f776c69737400000000000000000000006064820152608401610ff5565b61272333826136fb565b3360009081526014602052604081208054839290612742908490614531565b9250508190555080600e60008282546112ba91906144e3565b612763613825565b6013805460ff19166001179055565b6000610d5982613715565b612785613825565b600b8390558061281957600e548111156128075760405162461bcd60e51b815260206004820152603d60248201527f5375627472616374696e6720616d6f756e74206973206772656174657220746860448201527f616e207468652063757272656e74207265736572766520616d6f756e740000006064820152608401610ff5565b81600e60008282546119ee91906144e3565b8060011415611a145781600e60008282546112d391906144fa565b60006001600160a01b038216612876576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6128a4613825565b6128ae600061387f565b565b600a5462010000900460ff166129085760405162461bcd60e51b815260206004820152601f60248201527f46726565207075626c69632073616c65206d75737420626520616374697665006044820152606401610ff5565b6129158383336002612c79565b6129875760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206e6f74207075626c69632073616c65206672656520616c6c6f60448201527f776c6973746564000000000000000000000000000000000000000000000000006064820152608401610ff5565b600081136129e35760405162461bcd60e51b815260206004820152602360248201527f5175616e74697479206d757374206265206120706f73746974697665206e756d6044820152623132b960e91b6064820152608401610ff5565b336000908152601660205260409020546129fe90600161448b565b811315612a735760405162461bcd60e51b815260206004820152603160248201527f4d696e74696e67207175616e74697479206578636565647320616c6c6f63617460448201527f696f6e206c65667420666f7220757365720000000000000000000000000000006064820152608401610ff5565b600e54601054612aa3907f00000000000000000000000000000000000000000000000000000000000027106144e3565b612aad91906144e3565b81601254612abb91906144fa565b1115612b2f5760405162461bcd60e51b815260206004820152603860248201527f546f6b656e20636f756e742065786365656473206c696d697420666f7220707560448201527f626c69632073616c65206672656520616c6c6f776c69737400000000000000006064820152608401610ff5565b612b3933826136fb565b3360009081526016602052604081208054839290612b58908490614531565b9250508190555080600f60008282546112ba91906144e3565b60606000806000612b8185612834565b905060008167ffffffffffffffff811115612b9e57612b9e61407f565b604051908082528060200260200182016040528015612bc7578160200160208202803683370190505b5060408051608081018252600080825260208201819052918101829052606081018290529192505b838614612c6d57612bff816138de565b9150816040015115612c1057612c65565b81516001600160a01b031615612c2557815194505b876001600160a01b0316856001600160a01b03161415612c655780838780600101985081518110612c5857612c58614589565b6020026020010181815250505b600101612bef565b50909695505050505050565b6000811580612c885750816001145b80612c935750816002145b612cdf5760405162461bcd60e51b815260206004820152601f60248201527f4d65726b6c652074726565206e756d626572206973206e6f742076616c6964006044820152606401610ff5565b600082612cef5750600b54612d0f565b8260011415612d015750600c54612d0f565b8260021415612d0f5750600d545b612d82868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040516bffffffffffffffffffffffff1960608a901b16602082015285925060340190506040516020818303038152906040528051906020012061395d565b15612d91576001915050612d97565b60009150505b949350505050565b612da7613825565b828114612e0f5760405162461bcd60e51b815260206004820152603060248201527f41646472657373657320616e64207175616e746974696573206c656e6774687360448201526f020646f206e6f74206d617463682075760841b6064820152608401610ff5565b60005b83811015612e96576001838383818110612e2e57612e2e614589565b90506020020135612e3f9190614531565b60166000878785818110612e5557612e55614589565b9050602002016020810190612e6a9190613ffc565b6001600160a01b0316815260208101919091526040016000205580612e8e8161459f565b915050612e12565b5050505050565b606060038054610d6e9061443a565b6060818310612ee7576040517f32c1995a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080612ef360005490565b905080841115612f01578093505b6000612f0c87612834565b905084861015612f2b5785850381811015612f25578091505b50612f2f565b5060005b60008167ffffffffffffffff811115612f4a57612f4a61407f565b604051908082528060200260200182016040528015612f73578160200160208202803683370190505b50905081612f8657935061303c92505050565b6000612f9188613156565b905060008160400151612fa2575080515b885b888114158015612fb45750848714155b1561303057612fc2816138de565b9250826040015115612fd357613028565b82516001600160a01b031615612fe857825191505b8a6001600160a01b0316826001600160a01b03161415613028578084888060010199508151811061301b5761301b614589565b6020026020010181815250505b600101612fa4565b50505092835250909150505b9392505050565b61304b613825565b601155565b613058613825565b600c55565b6001600160a01b0382163314156130a0576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6131178484846116ca565b6001600160a01b0383163b156131505761313384848484613973565b613150576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060005483106131aa5792915050565b6131b3836138de565b90508060400151156131c55792915050565b61303c83613a67565b60606131d9826136d4565b61320f576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000613219613adf565b905080516000141561323a576040518060200160405280600081525061303c565b8061324484613aee565b60405160200161325592919061460f565b6040516020818303038152906040529392505050565b613273613825565b600a805464ff000000001981166401000000009182900460ff1615909102179055565b336132a96008546001600160a01b031690565b6001600160a01b031614806132cd57503360009081526017602052604090205460ff165b6133055760405162461bcd60e51b81526020600482015260096024820152684e6f2041636365737360b81b6044820152606401610ff5565b7f00000000000000000000000000000000000000000000000000000000000027108160125461333491906144fa565b11156133a85760405162461bcd60e51b815260206004820152602c60248201527f546f6b656e20636f756e742065786365656473206c696d697420666f7220616460448201527f6d696e2066756e6374696f6e00000000000000000000000000000000000000006064820152608401610ff5565b6133b282826136fb565b806012600082825461213091906144fa565b6133cc613825565b8281146134345760405162461bcd60e51b815260206004820152603060248201527f41646472657373657320616e64207175616e746974696573206c656e6774687360448201526f020646f206e6f74206d617463682075760841b6064820152608401610ff5565b60005b83811015612e9657600183838381811061345357613453614589565b905060200201356134649190614531565b6014600087878581811061347a5761347a614589565b905060200201602081019061348f9190613ffc565b6001600160a01b03168152602081019190915260400160002055806134b38161459f565b915050613437565b6134c3613825565b82811461352b5760405162461bcd60e51b815260206004820152603060248201527f41646472657373657320616e64207175616e746974696573206c656e6774687360448201526f020646f206e6f74206d617463682075760841b6064820152608401610ff5565b60005b83811015612e9657600283838381811061354a5761354a614589565b9050602002013561355b9190614531565b6015600087878581811061357157613571614589565b90506020020160208101906135869190613ffc565b6001600160a01b03168152602081019190915260400160002055806135aa8161459f565b91505061352e565b6135ba613825565b6001600160a01b0381166136365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610ff5565b61194f8161387f565b600081613671576001600160a01b03831660009081526014602052604090205461366a90600161448b565b9050610d59565b816001141561369e576001600160a01b03831660009081526015602052604090205461366a90600261448b565b81600214156136cb576001600160a01b03831660009081526016602052604090205461366a90600161448b565b50600019610d59565b6000805482108015610d59575050600090815260046020526040902054600160e01b161590565b611f52828260405180602001604052806000815250613b30565b60008160005481101561375d57600081815260046020526040902054600160e01b811661375b575b8061303c57506000190160008181526004602052604090205461373d565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260186020526040902060010154829068010000000000000000900460ff1615612e965760405162461bcd60e51b815260206004820152603960248201527f546f6b656e2069732063757272656e746c79206265696e67207374616b65642060448201527f616e642063616e6e6f74206265207472616e73666572726564000000000000006064820152608401610ff5565b6008546001600160a01b031633146128ae5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ff5565b600880546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610d5990604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b60008261396a8584613b96565b14949350505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906139a8903390899088908890600401614635565b602060405180830381600087803b1580156139c257600080fd5b505af19250505080156139f2575060408051601f3d908101601f191682019092526139ef91810190614671565b60015b613a4d573d808015613a20576040519150601f19603f3d011682016040523d82523d6000602084013e613a25565b606091505b508051613a45576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612d97565b604080516080810182526000808252602082018190529181018290526060810191909152610d59613a9783613715565b604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b606060098054610d6e9061443a565b604080516080019081905280825b600183039250600a81066030018353600a900480613b1957613b1e565b613afc565b50819003601f19909101908152919050565b613b3a8383613be3565b6001600160a01b0383163b15611a14576000548281035b613b646000868380600101945086613973565b613b81576040516368d2bf6b60e11b815260040160405180910390fd5b818110613b51578160005414612e9657600080fd5b600081815b8451811015613bdb57613bc782868381518110613bba57613bba614589565b6020026020010151613d1a565b915080613bd38161459f565b915050613b9b565b509392505050565b60005481613c1d576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613c2a600084838561378f565b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b818114613cd957808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101613ca1565b5081613d11576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005550505050565b6000818310613d3657600082815260208490526040902061303c565b5060009182526020526040902090565b828054613d529061443a565b90600052602060002090601f016020900481019282613d745760008555613dba565b82601f10613d8d57805160ff1916838001178555613dba565b82800160010185558215613dba579182015b82811115613dba578251825591602001919060010190613d9f565b50613dc6929150613dca565b5090565b5b80821115613dc65760008155600101613dcb565b6001600160e01b03198116811461194f57600080fd5b600060208284031215613e0757600080fd5b813561303c81613ddf565b60005b83811015613e2d578181015183820152602001613e15565b838111156131505750506000910152565b60008151808452613e56816020860160208601613e12565b601f01601f19169290920160200192915050565b60208152600061303c6020830184613e3e565b600060208284031215613e8f57600080fd5b5035919050565b80356001600160a01b0381168114613ead57600080fd5b919050565b60008060408385031215613ec557600080fd5b613ece83613e96565b946020939093013593505050565b60008083601f840112613eee57600080fd5b50813567ffffffffffffffff811115613f0657600080fd5b6020830191508360208260051b8501011115613f2157600080fd5b9250929050565b600080600060408486031215613f3d57600080fd5b833567ffffffffffffffff811115613f5457600080fd5b613f6086828701613edc565b909790965060209590950135949350505050565b600080600060408486031215613f8957600080fd5b83359250602084013567ffffffffffffffff811115613fa757600080fd5b613fb386828701613edc565b9497909650939450505050565b600080600060608486031215613fd557600080fd5b613fde84613e96565b9250613fec60208501613e96565b9150604084013590509250925092565b60006020828403121561400e57600080fd5b61303c82613e96565b60008060006060848603121561402c57600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561405657600080fd5b61405f83613e96565b91506020830135801515811461407457600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff808411156140b0576140b061407f565b604051601f8501601f19908116603f011681019082821181831017156140d8576140d861407f565b816040528093508581528686860111156140f157600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561411d57600080fd5b813567ffffffffffffffff81111561413457600080fd5b8201601f8101841361414557600080fd5b612d9784823560208401614095565b6000806020838503121561416757600080fd5b823567ffffffffffffffff81111561417e57600080fd5b61418a85828601613edc565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b81811015612c6d576142008385516001600160a01b03815116825267ffffffffffffffff602082015116602083015260408101511515604083015262ffffff60608201511660608301525050565b92840192608092909201916001016141b2565b6020808252825182820181905260009190848201906040850190845b81811015612c6d5783518352928401929184019160010161422f565b6000806000806060858703121561426157600080fd5b843567ffffffffffffffff81111561427857600080fd5b61428487828801613edc565b9095509350614297905060208601613e96565b9396929550929360400135925050565b600080600080604085870312156142bd57600080fd5b843567ffffffffffffffff808211156142d557600080fd5b6142e188838901613edc565b909650945060208701359150808211156142fa57600080fd5b5061430787828801613edc565b95989497509550505050565b60008060006060848603121561432857600080fd5b61433184613e96565b95602085013595506040909401359392505050565b6000806000806080858703121561435c57600080fd5b61436585613e96565b935061437360208601613e96565b925060408501359150606085013567ffffffffffffffff81111561439657600080fd5b8501601f810187136143a757600080fd5b6143b687823560208401614095565b91505092959194509250565b81516001600160a01b0316815260208083015167ffffffffffffffff169082015260408083015115159082015260608083015162ffffff169082015260808101610d59565b6000806040838503121561441a57600080fd5b61442383613e96565b915061443160208401613e96565b90509250929050565b600181811c9082168061444e57607f821691505b6020821081141561446f57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000808212827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038413811516156144c5576144c5614475565b82600160ff1b0384128116156144dd576144dd614475565b50500190565b6000828210156144f5576144f5614475565b500390565b6000821982111561450d5761450d614475565b500190565b600081600019048311821515161561452c5761452c614475565b500290565b600080831283600160ff1b0183128115161561454f5761454f614475565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01831381161561458357614583614475565b50500390565b634e487b7160e01b600052603260045260246000fd5b60006000198214156145b3576145b3614475565b5060010190565b600067ffffffffffffffff838116908316818110156145db576145db614475565b039392505050565b600067ffffffffffffffff80831681851680830382111561460657614606614475565b01949350505050565b60008351614621818460208801613e12565b835190830190614606818360208801613e12565b60006001600160a01b038087168352808616602084015250836040830152608060608301526146676080830184613e3e565b9695505050505050565b60006020828403121561468357600080fd5b815161303c81613ddf56fea2646970667358221220ded6bee513b31f9831c0d3d98d94cff1a9fc6fdb522c00e78ae14913ab13e0f464736f6c63430008090033
Verified Source Code Full Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: Yes (1200 runs)
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)
}
}
}
IERC721AQueryable.sol 79 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import '../IERC721A.sol';
/**
* @dev Interface of ERC721AQueryable.
*/
interface IERC721AQueryable is IERC721A {
/**
* Invalid query range (`start` >= `stop`).
*/
error InvalidQueryRange();
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view returns (uint256[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view returns (uint256[] memory);
}
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;
}
}
ERC721A.sol 1083 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// 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()`.
*
* 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 {
// Reference type for token approval.
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;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @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) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than `_currentIndex - _startTokenId()` times.
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return _burnCounter;
}
// =============================================================
// 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();
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();
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 Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
// 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, `curr` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
while (packed == 0) {
packed = _packedOwnerships[--curr];
}
return packed;
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @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.
* 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) public virtual override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
/**
* @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();
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 {
if (operator == _msgSenderERC721A()) revert ApproveToCaller();
_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) {
return
_startTokenId() <= tokenId &&
tokenId < _currentIndex && // If within bounds,
_packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not 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]`.
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 virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
(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();
if (to == address(0)) revert TransferToZeroAddress();
_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;
}
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public 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 virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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();
} else {
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();
_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:
// - `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)
);
uint256 toMasked;
uint256 end = startTokenId + quantity;
// Use assembly to loop and emit the `Transfer` event for gas savings.
assembly {
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
toMasked := and(to, _BITMASK_ADDRESS)
// 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`.
startTokenId // `tokenId`.
)
for {
let tokenId := add(startTokenId, 1)
} iszero(eq(tokenId, end)) {
tokenId := add(tokenId, 1)
} {
// Emit the `Transfer` event. Similar to above.
log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
}
}
if (toMasked == 0) revert MintToZeroAddress();
_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();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
_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)
);
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();
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) revert();
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
// =============================================================
// 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();
}
_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 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();
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 0x80 bytes to keep the free memory pointer 32-byte word aliged.
// We will need 1 32-byte word to store the length,
// and 3 32-byte words to store a maximum of 78 digits. Total: 0x20 + 3 * 0x20 = 0x80.
str := add(mload(0x40), 0x80)
// Update the free memory pointer to allocate.
mstore(0x40, str)
// 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)
}
}
}
ERC721AQueryable.sol 178 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721AQueryable.sol';
import '../ERC721A.sol';
/**
* @title ERC721AQueryable.
*
* @dev ERC721A subclass with convenience query functions.
*/
abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) {
TokenOwnership memory ownership;
if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) {
return ownership;
}
ownership = _ownershipAt(tokenId);
if (ownership.burned) {
return ownership;
}
return _ownershipOf(tokenId);
}
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(uint256[] calldata tokenIds)
external
view
virtual
override
returns (TokenOwnership[] memory)
{
unchecked {
uint256 tokenIdsLength = tokenIds.length;
TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength);
for (uint256 i; i != tokenIdsLength; ++i) {
ownerships[i] = explicitOwnershipOf(tokenIds[i]);
}
return ownerships;
}
}
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view virtual override returns (uint256[] memory) {
unchecked {
if (start >= stop) revert InvalidQueryRange();
uint256 tokenIdsIdx;
uint256 stopLimit = _nextTokenId();
// Set `start = max(start, _startTokenId())`.
if (start < _startTokenId()) {
start = _startTokenId();
}
// Set `stop = min(stop, stopLimit)`.
if (stop > stopLimit) {
stop = stopLimit;
}
uint256 tokenIdsMaxLength = balanceOf(owner);
// Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`,
// to cater for cases where `balanceOf(owner)` is too big.
if (start < stop) {
uint256 rangeLength = stop - start;
if (rangeLength < tokenIdsMaxLength) {
tokenIdsMaxLength = rangeLength;
}
} else {
tokenIdsMaxLength = 0;
}
uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength);
if (tokenIdsMaxLength == 0) {
return tokenIds;
}
// We need to call `explicitOwnershipOf(start)`,
// because the slot at `start` may not be initialized.
TokenOwnership memory ownership = explicitOwnershipOf(start);
address currOwnershipAddr;
// If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`.
// `ownership.address` will not be zero, as `start` is clamped to the valid token ID range.
if (!ownership.burned) {
currOwnershipAddr = ownership.addr;
}
for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) {
ownership = _ownershipAt(i);
if (ownership.burned) {
continue;
}
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
tokenIds[tokenIdsIdx++] = i;
}
}
// Downsize the array to fit.
assembly {
mstore(tokenIds, tokenIdsIdx)
}
return tokenIds;
}
}
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
unchecked {
uint256 tokenIdsIdx;
address currOwnershipAddr;
uint256 tokenIdsLength = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenIdsLength);
TokenOwnership memory ownership;
for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
ownership = _ownershipAt(i);
if (ownership.burned) {
continue;
}
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
tokenIds[tokenIdsIdx++] = i;
}
}
return tokenIds;
}
}
}
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);
}
}
}
}
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);
}
}
IERC721A.sol 287 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// 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();
/**
* The caller cannot approve to their own address.
*/
error ApproveToCaller();
/**
* 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();
// =============================================================
// 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;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @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;
/**
* @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);
// =============================================================
// 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);
}
NewHere.sol 568 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "erc721a/contracts/ERC721A.sol";
import "erc721a/contracts/extensions/ERC721AQueryable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
/**
* @title We'reNewHere
* @author maikir
*/
contract NewHere is ERC721A, ERC721AQueryable, Ownable {
// Base URI
string public _uri;
//Sale states
bool public isPreSaleFreeActive;
bool public isPreSalePaidActive;
bool public isPublicSaleFreeActive;
bool public isPublicSalePaidActive;
//Staking state
bool public isStakingActive;
// Merkle tree roots
bytes32 public preSaleFreeRoot;
bytes32 public preSalePaidRoot;
bytes32 public publicSaleFreeRoot;
// Max number of tokens
uint256 public immutable MAX_SUPPLY;
// Pre-sale free reserved supply //150
uint256 public oneToOneAddressReserve;
// Public sale free reserved supply (tier 3) //605
uint256 public publicSaleFreeAllowlistReserve;
// Dpop wallet reserved supply //50
uint256 public dPopReserve;
// Allowlist mint price -- 0.088 ETH
uint256 public immutable MINT_PRICE = 88000000000000000;
// Max number of mints per tx for public mint
uint256 public maxNumberMintsPerTx = 5;
uint256 public tokenCounter;
//token URI freezer
bool frozen = false;
// Track allocation remaining that is allowed to be minted by pre-sale free minters
mapping(address => int256) public preSaleFreeAllowlistQuantity;
// Track allocation remaining that is allowed to be minted by pre-sale paid minters
mapping(address => int256) public preSalePaidAllowlistQuantity;
// Track allocation remaining that is allowed to be minted by public sale free minters
mapping(address => int256) public publicSaleFreeAllowlistQuantity;
mapping(address => bool) private admins;
struct StakingInfo {
address stakerAddress;
uint64 startTime;
uint64 totalTime;
bool staked;
}
mapping(uint256 => StakingInfo) public staking;
mapping(address => uint256) public quantityStaked;
constructor(
string memory _baseURI_,
bytes32 _preSaleFreeRoot,
bytes32 _preSalePaidRoot,
bytes32 _publicSaleFreeRoot,
uint256 _MAX_SUPPLY,
uint256 _oneToOneAddressReserve,
uint256 _publicSaleFreeAllowlistReserve,
uint256 _dPopReserve
) ERC721A("NewHere", "NEWHERE") {
_uri = _baseURI_;
preSaleFreeRoot = _preSaleFreeRoot;
preSalePaidRoot = _preSalePaidRoot;
publicSaleFreeRoot = _publicSaleFreeRoot;
MAX_SUPPLY = _MAX_SUPPLY;
oneToOneAddressReserve = _oneToOneAddressReserve;
publicSaleFreeAllowlistReserve = _publicSaleFreeAllowlistReserve;
dPopReserve = _dPopReserve;
}
function setAdmin(address _addr, bool _status) public onlyOwner {
admins[_addr] = _status;
}
modifier onlyAdmin() {
require(owner() == msg.sender || admins[msg.sender], "No Access");
_;
}
modifier canTransfer(uint256 tokenId) {
require(
!staking[tokenId].staked,
"Token is currently being staked and cannot be transferred"
);
_;
}
/**
* @dev Flips the sale state for minting.
*/
function flipSaleState(uint256 _saleStateNum) external onlyOwner {
if (_saleStateNum == 0) {
isPreSaleFreeActive = !isPreSaleFreeActive;
} else if (_saleStateNum == 1) {
isPreSalePaidActive = !isPreSalePaidActive;
} else if (_saleStateNum == 2) {
isPublicSaleFreeActive = !isPublicSaleFreeActive;
} else if (_saleStateNum == 3) {
isPublicSalePaidActive = !isPublicSalePaidActive;
}
}
/**
* @dev Flips the staking state for staking.
*/
function flipStakingState() external onlyOwner {
isStakingActive = !isStakingActive;
}
/**
* @dev Merkle tree for the pre-sale free allowlist.
*/
function setMerkleTreePreSaleFreeAllowlist(
bytes32 _preSaleFreeRoot,
uint256 _preSaleFreeAllowlistReserveUpdate,
uint256 _add_sub
)
external
onlyOwner
{
preSaleFreeRoot = _preSaleFreeRoot;
if (_add_sub == 0) {
require(
_add_sub <= oneToOneAddressReserve,
"Subtracting amount is greater than the current reserve amount"
);
oneToOneAddressReserve -= _preSaleFreeAllowlistReserveUpdate;
} else if (_add_sub == 1) {
oneToOneAddressReserve += _preSaleFreeAllowlistReserveUpdate;
}
}
/**
* @dev Merkle tree for the pre-sale paid allowlist.
*/
function setMerkleTreePreSalePaidAllowlist(bytes32 _preSalePaidRoot)
external
onlyOwner
{
preSalePaidRoot = _preSalePaidRoot;
}
/**
* @dev Merkle tree for the public sale free allowlist.
*/
function setMerkleTreePublicSaleFreeAllowlist(
bytes32 _publicSaleFreeRoot,
uint256 _publicSaleFreeAllowlistReserveUpdate,
uint256 _add_sub
)
external
onlyOwner
{
publicSaleFreeRoot = _publicSaleFreeRoot;
if (_add_sub == 0) {
require(
_add_sub <= publicSaleFreeAllowlistReserve,
"Subtracting amount is greater than the current reserve amount"
);
publicSaleFreeAllowlistReserve -= _publicSaleFreeAllowlistReserveUpdate;
} else if (_add_sub == 1) {
publicSaleFreeAllowlistReserve += _publicSaleFreeAllowlistReserveUpdate;
}
}
/**
* @dev Function called to return if an address is allowlisted.
* @param proof Merkel tree proof.
* @param _address Address to check.
* @param _merkleTreeNum Merkle tree number to check.
*/
function isAllowlisted(
bytes32[] calldata proof,
address _address,
uint256 _merkleTreeNum
) public view returns (bool) {
require(
_merkleTreeNum == 0 || _merkleTreeNum == 1 || _merkleTreeNum == 2,
"Merkle tree number is not valid"
);
bytes32 root;
if (_merkleTreeNum == 0) {
root = preSaleFreeRoot;
} else if (_merkleTreeNum == 1) {
root = preSalePaidRoot;
} else if (_merkleTreeNum == 2) {
root = publicSaleFreeRoot;
}
if (
MerkleProof.verify(
proof,
root,
keccak256(abi.encodePacked(_address))
)
) {
return true;
}
return false;
}
/**
* @dev Free allowlist minting function for pre-sale. Default maximum of 1 free mint per user.
* @param proof Merkel tree proof.
* @param quantity Quantity to mint.
*/
function mintPreSaleFreeAllowlist(bytes32[] calldata proof, int256 quantity)
external
{
require(isPreSaleFreeActive, "Free pre-sale must be active");
require(
isAllowlisted(proof, msg.sender, 0),
"Caller not pre-sale free allowlisted"
);
require(quantity > 0, "Quantity must be a postitive number");
require(
quantity <= preSaleFreeAllowlistQuantity[msg.sender] + 1,
"Minting quantity exceeds allocation left for user"
);
require(
tokenCounter + uint256(quantity) <=
(MAX_SUPPLY - dPopReserve - publicSaleFreeAllowlistReserve),
"Token count exceeds limit for pre-sale free allowlist"
);
_safeMint(msg.sender, uint256(quantity));
preSaleFreeAllowlistQuantity[msg.sender] -= quantity;
oneToOneAddressReserve -= uint256(quantity);
tokenCounter += uint256(quantity);
}
/**
* @dev Paid allowlist minting function for pre-sale. Default maximum of 2 paid mints per user.
* @param proof Merkel tree proof.
* @param quantity Quantity to mint.
*/
function mintPreSalePaidAllowlist(bytes32[] calldata proof, int256 quantity)
external
payable
{
require(isPreSalePaidActive, "Paid pre-sale must be active");
require(
isAllowlisted(proof, msg.sender, 1),
"Caller not pre-sale paid allowlisted"
);
require(quantity > 0, "Quantity must be a postitive number");
require(
quantity <= preSalePaidAllowlistQuantity[msg.sender] + 2,
"Minting quantity exceeds allocation left for user"
);
require(
tokenCounter + uint256(quantity) <=
(MAX_SUPPLY -
dPopReserve -
publicSaleFreeAllowlistReserve -
oneToOneAddressReserve),
"Token count exceeds limit for pre-sale paid allowlist"
);
require(
msg.value >= (MINT_PRICE * uint256(quantity)),
"Ether value sent is incorrect"
);
_safeMint(msg.sender, uint256(quantity));
preSalePaidAllowlistQuantity[msg.sender] -= quantity;
tokenCounter += uint256(quantity);
}
/**
* @dev Free allowlist minting function for public sale. Default maximum of 1 free mint per user.
* @param proof Merkel tree proof.
* @param quantity Quantity to mint.
*/
function mintPublicSaleFreeAllowlist(
bytes32[] calldata proof,
int256 quantity
) external {
require(isPublicSaleFreeActive, "Free public sale must be active");
require(
isAllowlisted(proof, msg.sender, 2),
"Caller not public sale free allowlisted"
);
require(quantity > 0, "Quantity must be a postitive number");
require(
quantity <= publicSaleFreeAllowlistQuantity[msg.sender] + 1,
"Minting quantity exceeds allocation left for user"
);
require(
tokenCounter + uint256(quantity) <= (MAX_SUPPLY - dPopReserve - oneToOneAddressReserve),
"Token count exceeds limit for public sale free allowlist"
);
_safeMint(msg.sender, uint256(quantity));
publicSaleFreeAllowlistQuantity[msg.sender] -= quantity;
publicSaleFreeAllowlistReserve -= uint256(quantity);
tokenCounter += uint256(quantity);
}
/**
* @dev Minting function.
* @param quantity Quantity to mint.
*/
function mintPublicSale(uint256 quantity) external payable {
require(isPublicSalePaidActive, "Paid public sale must be active");
require(
quantity <= maxNumberMintsPerTx,
"Quantity is larger than the allowed number of mints in one transaction"
);
require(
msg.value >= (MINT_PRICE * quantity),
"Ether value sent is incorrect"
);
require(
tokenCounter + quantity <=
(MAX_SUPPLY -
dPopReserve -
publicSaleFreeAllowlistReserve -
oneToOneAddressReserve),
"Token count exceeds limit for public sale paid"
);
_safeMint(msg.sender, quantity);
tokenCounter += quantity;
}
/**
* @dev Minting function reserved for dpop wallet.
* @param _address Address to mint to.
* @param quantity Quantity to mint.
*/
function dpopMint(address _address, uint256 quantity) external onlyAdmin {
require(
quantity <= dPopReserve,
"Quantity exceeds allocation left for dpop wallet"
);
require(tokenCounter + quantity <= MAX_SUPPLY, "Token count exceeds limit for dpop wallet");
_safeMint(_address, quantity);
dPopReserve -= quantity;
tokenCounter += quantity;
}
/**
* @dev Admin mint function.
* @param _address Address to mint to.
* @param quantity Quantity to mint.
*/
function adminMint(address _address, uint256 quantity) external onlyAdmin {
require(tokenCounter + quantity <= MAX_SUPPLY, "Token count exceeds limit for admin function");
_safeMint(_address, quantity);
tokenCounter += quantity;
}
/**
* @dev Sets maximum number of mints in a single tx per caller for normal mint function.
*/
function setMaxNumberMintsPerTx(uint256 _maxNumberMintsPerTx)
external
onlyOwner
{
maxNumberMintsPerTx = _maxNumberMintsPerTx;
}
/**
* @dev Staking function.
* @param quantity Quantity to stake.
* @param tokenIds Token ids to stake.
*/
function stake(uint256 quantity, uint256[] calldata tokenIds) external {
require(isStakingActive, "Staking must be active");
require(
quantity == tokenIds.length,
"Quantity does not match up with size of token ids"
);
require(
quantityStaked[msg.sender] + quantity <= balanceOf(msg.sender),
"Quantity exceeds numbers of tokens held by sender available for staking"
);
uint64 currentTime = uint64(block.timestamp);
for (uint256 i = 0; i < tokenIds.length; i++) {
require(
ownerOf(tokenIds[i]) == msg.sender,
"Staker is not the owner of the token trying to be staked"
);
require(
!staking[tokenIds[i]].staked,
"Token is already being staked"
);
staking[tokenIds[i]].stakerAddress = msg.sender;
staking[tokenIds[i]].startTime = currentTime;
staking[tokenIds[i]].staked = true;
}
quantityStaked[msg.sender] += quantity;
}
/**
* @dev Unstaking function.
* @param quantity Quantity to unstake.
* @param tokenIds Token ids to unstake.
*/
function unstake(uint256 quantity, uint256[] calldata tokenIds) external {
require(isStakingActive, "Staking must be active");
require(
quantity == tokenIds.length,
"Quantity does not match up with size of token ids"
);
require(
quantityStaked[msg.sender] >= quantity,
"Quantity is larger than the amount of tokens being staked"
);
uint64 currentTime = uint64(block.timestamp);
for (uint256 i = 0; i < tokenIds.length; i++) {
require(
ownerOf(tokenIds[i]) == msg.sender,
"Staker is not the owner of the token trying to be unstaked"
);
require(
staking[tokenIds[i]].staked,
"Token is not currently being staked"
);
uint64 prevStartTime = staking[tokenIds[i]].startTime;
staking[tokenIds[i]].totalTime += (currentTime - prevStartTime);
staking[tokenIds[i]].stakerAddress = address(0);
staking[tokenIds[i]].startTime = 0;
staking[tokenIds[i]].staked = false;
}
quantityStaked[msg.sender] -= quantity;
}
/**
* @dev Sets the pre-sale free allowlist quantities. Default maximum of 1 free mint per user.
* @param addresses The addresses to set for the allowlist.
* @param quantities The quantities for each address to be able to mint in the allowlist.
*/
function setPreSaleFreeAllowlist(
address[] calldata addresses,
int256[] calldata quantities
) external onlyOwner {
require(
addresses.length == quantities.length,
"Addresses and quantities lengths do not match up"
);
for (uint256 i = 0; i < addresses.length; i++) {
preSaleFreeAllowlistQuantity[addresses[i]] = (quantities[i] - 1);
}
}
/**
* @dev Sets the pre-sale paid allowlist quantities. Default maximum of 2 paid mints per user.
* @param addresses The addresses to set for the allowlist.
* @param quantities The quantities for each address to be able to mint in the allowlist.
*/
function setPreSalePaidAllowlist(
address[] calldata addresses,
int256[] calldata quantities
) external onlyOwner {
require(
addresses.length == quantities.length,
"Addresses and quantities lengths do not match up"
);
for (uint256 i = 0; i < addresses.length; i++) {
preSalePaidAllowlistQuantity[addresses[i]] = (quantities[i] - 2);
}
}
/**
* @dev Sets the public sale free allowlist quantities. Default maximum of 1 free mint per user.
* @param addresses The addresses to set for the allowlist.
* @param quantities The quantities for each address to be able to mint in the allowlist.
*/
function setPublicSaleFreeAllowlist(
address[] calldata addresses,
int256[] calldata quantities
) external onlyOwner {
require(
addresses.length == quantities.length,
"Addresses and quantities lengths do not match up"
);
for (uint256 i = 0; i < addresses.length; i++) {
publicSaleFreeAllowlistQuantity[addresses[i]] = (quantities[i] - 1);
}
}
/**
* @dev Getter for the number of quantities left for various allowlists.
* @param _address Address to lookup.
* @param _allowlistNum Number specifying which allowlist to lookup.
*/
function getAllowlistQuantities(address _address, uint256 _allowlistNum)
external
view
returns (int256)
{
if (_allowlistNum == 0) {
return preSaleFreeAllowlistQuantity[_address] + 1;
} else if (_allowlistNum == 1) {
return preSalePaidAllowlistQuantity[_address] + 2;
} else if (_allowlistNum == 2) {
return publicSaleFreeAllowlistQuantity[_address] + 1;
} else {
return -1;
}
}
/**
* @dev Allows owner to set the baseURI dynamically.
* @param uri The base uri for the metadata store.
*/
function setBaseURI(string memory uri) external onlyOwner {
if (!frozen) {
_uri = uri;
}
}
/**
* @dev One way function. Freezes the uri state of the contract.
*/
function freeze() external onlyOwner {
frozen = true;
}
/**
* @dev Owner can withdraw funds.
*/
function withdraw() external onlyAdmin {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
/**
* @dev Override for allowing setting of a base URI.
*/
function _baseURI() internal view override returns (string memory) {
return _uri;
}
/**
* @dev Override _beforeTokenTransfers.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal override canTransfer(startTokenId) {}
}
Read Contract
MAX_SUPPLY 0x32cb6b0c → uint256
MINT_PRICE 0xc002d23d → uint256
_uri 0x0dccc9ad → string
balanceOf 0x70a08231 → uint256
dPopReserve 0xbb0c147b → uint256
explicitOwnershipOf 0xc23dc68f → tuple
explicitOwnershipsOf 0x5bbb2177 → tuple[]
getAllowlistQuantities 0xf3f7d4d5 → int256
getApproved 0x081812fc → address
isAllowlisted 0x856c6430 → bool
isApprovedForAll 0xe985e9c5 → bool
isPreSaleFreeActive 0x247f5007 → bool
isPreSalePaidActive 0x717084e1 → bool
isPublicSaleFreeActive 0x89134762 → bool
isPublicSalePaidActive 0x039feb44 → bool
isStakingActive 0x61f64457 → bool
maxNumberMintsPerTx 0x651bb4a1 → uint256
name 0x06fdde03 → string
oneToOneAddressReserve 0xb1dd78f1 → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
preSaleFreeAllowlistQuantity 0xe0bd3b7c → int256
preSaleFreeRoot 0xca585f7c → bytes32
preSalePaidAllowlistQuantity 0x29ebbcd4 → int256
preSalePaidRoot 0x42fe2bc6 → bytes32
publicSaleFreeAllowlistQuantity 0xbd6f667a → int256
publicSaleFreeAllowlistReserve 0x57ca339c → uint256
publicSaleFreeRoot 0x6cb43d6d → bytes32
quantityStaked 0x4535f726 → uint256
staking 0x1dbb2a22 → address, uint64, uint64, bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenCounter 0xd082e381 → uint256
tokenURI 0xc87b56dd → string
tokensOfOwner 0x8462151c → uint256[]
tokensOfOwnerIn 0x99a2557a → uint256[]
totalSupply 0x18160ddd → uint256
Write Contract 28 functions
These functions modify contract state and require a wallet transaction to execute.
adminMint 0xe58306f9
address _address
uint256 quantity
approve 0x095ea7b3
address to
uint256 tokenId
dpopMint 0x42c5e5ac
address _address
uint256 quantity
flipSaleState 0x313112ce
uint256 _saleStateNum
flipStakingState 0xd9d3e39b
No parameters
freeze 0x62a5af3b
No parameters
mintPreSaleFreeAllowlist 0x5e35353f
bytes32[] proof
int256 quantity
mintPreSalePaidAllowlist 0x10a60526
bytes32[] proof
int256 quantity
mintPublicSale 0x5a5e5d58
uint256 quantity
mintPublicSaleFreeAllowlist 0x7eaeaa94
bytes32[] proof
int256 quantity
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setAdmin 0x4b0bddd2
address _addr
bool _status
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string uri
setMaxNumberMintsPerTx 0x9af04f0d
uint256 _maxNumberMintsPerTx
setMerkleTreePreSaleFreeAllowlist 0x7099b728
bytes32 _preSaleFreeRoot
uint256 _preSaleFreeAllowlistReserveUpdate
uint256 _add_sub
setMerkleTreePreSalePaidAllowlist 0x9ccef3e2
bytes32 _preSalePaidRoot
setMerkleTreePublicSaleFreeAllowlist 0x36c5fcca
bytes32 _publicSaleFreeRoot
uint256 _publicSaleFreeAllowlistReserveUpdate
uint256 _add_sub
setPreSaleFreeAllowlist 0xed7e1dea
address[] addresses
int256[] quantities
setPreSalePaidAllowlist 0xf16488fa
address[] addresses
int256[] quantities
setPublicSaleFreeAllowlist 0x8dc56c3a
address[] addresses
int256[] quantities
stake 0x16f60557
uint256 quantity
uint256[] tokenIds
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
unstake 0x395de242
uint256 quantity
uint256[] tokenIds
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address