Address Contract Verified
Address
0x0Fbf892788A3737d6d0914F5E7E1882015BeC0DC
Balance
0 ETH
Nonce
1
Code Size
18387 bytes
Creator
0x065Ad5cB...857c at tx 0x8304b4c5...b47851
Indexed Transactions
0
Contract Bytecode
18387 bytes
0x6080604052600436106104945760003560e01c80637bc9200e11610260578063b88d4fde11610144578063dbddd5b7116100c1578063f19a0b5411610085578063f19a0b5414610e02578063f254933d14610e22578063f2fde38b14610e42578063f375b7c714610e62578063f6b69ff314610e78578063fd922a4214610ea857600080fd5b8063dbddd5b714610d1b578063dbe7e3bd14610d3c578063e0a8085314610d6c578063e5dd994314610d8c578063e985e9c514610db957600080fd5b8063c87b56dd11610108578063c87b56dd14610c8f578063c9c6bc1c14610caf578063cabadaa014610ccf578063d48a3d3d14610ce5578063d5abeb0114610d0557600080fd5b8063b88d4fde14610bf8578063b921caf914610c0b578063bcb49d9e14610c2b578063bf219a9514610c41578063c23dc68f14610c6257600080fd5b806395d89b41116101dd578063a0712d68116101a1578063a0712d6814610b42578063a22cb46514610b55578063a2309ff814610b75578063a4de5c2a14610b8b578063b071401b14610bab578063b592d04414610bcb57600080fd5b806395d89b4114610aa0578063987c014414610ab557806398d5b9c414610ad557806398f002b414610af557806399a2557a14610b2257600080fd5b80638462151c116102245780638462151c14610a0a578063891b96ac14610a375780638cc54e7f14610a575780638da5cb5b14610a6c57806394354fd014610a8a57600080fd5b80637bc9200e146109775780637cb647591461098a578063817cc12d146109aa578063818668d7146109ca5780638438cccb146109ea57600080fd5b806331776478116103875780635bbb21771161030457806370a08231116102c857806370a08231146108d057806371324e82146108f0578063715018a61461090357806371a94340146109185780637564a48b1461093857806379de186a1461095857600080fd5b80635bbb21771461082d5780635c975abb1461085a5780636352211e1461087b5780636c0360eb1461089b5780636f8b44b0146108b057600080fd5b806345c944401161034b57806345c94440146107955780634dd1bf8b146107b557806351830227146107d55780635503a0e8146107f857806355f804b31461080d57600080fd5b806331776478146107175780633ccfd60b1461072d57806340476ed71461074257806342842e0e1461076257806344a0d68a1461077557600080fd5b8063144e079c116104155780631f0953b6116103d95780631f0953b6146106a657806323b872dd146106bb578063270ab52c146106ce5780632b314dc6146106ee5780632eb4a7ab1461070157600080fd5b8063144e079c1461060f57806316ba10e01461062f57806316c38b3c1461064f57806318160ddd1461066f578063184daa1c1461068c57600080fd5b8063095ea7b31161045c578063095ea7b31461056b5780630f4161aa1461057e5780631067fcc71461059e57806312fed8ac146105be57806313faede6146105f957600080fd5b806301ffc9a7146104995780630406aa61146104ce578063055a7249146104ef57806306fdde0314610511578063081812fc14610533575b600080fd5b3480156104a557600080fd5b506104b96104b4366004613cf4565b610ec8565b60405190151581526020015b60405180910390f35b3480156104da57600080fd5b50601a546104b990600160381b900460ff1681565b3480156104fb57600080fd5b5061050f61050a366004613d11565b610f1a565b005b34801561051d57600080fd5b50610526610f56565b6040516104c59190613d7a565b34801561053f57600080fd5b5061055361054e366004613d11565b610fe8565b6040516001600160a01b0390911681526020016104c5565b61050f610579366004613da9565b61102c565b34801561058a57600080fd5b50601a546104b99062010000900460ff1681565b3480156105aa57600080fd5b5061050f6105b9366004613e5e565b6110cc565b3480156105ca57600080fd5b506105eb6105d9366004613d11565b601d6020526000908152604090205481565b6040519081526020016104c5565b34801561060557600080fd5b506105eb60125481565b34801561061b57600080fd5b5061050f61062a366004613ea6565b6110e4565b34801561063b57600080fd5b5061050f61064a366004613e5e565b611126565b34801561065b57600080fd5b5061050f61066a366004613ed6565b61113a565b34801561067b57600080fd5b5060015460005403600019016105eb565b34801561069857600080fd5b50601a546104b99060ff1681565b3480156106b257600080fd5b50610526611161565b61050f6106c9366004613ef3565b6111ef565b3480156106da57600080fd5b5061050f6106e9366004613d11565b611350565b61050f6106fc366004613f7a565b61135d565b34801561070d57600080fd5b506105eb600a5481565b34801561072357600080fd5b506105eb60175481565b34801561073957600080fd5b5061050f6115fe565b34801561074e57600080fd5b5061050f61075d366004613ed6565b611716565b61050f610770366004613ef3565b61173f565b34801561078157600080fd5b5061050f610790366004613d11565b611890565b3480156107a157600080fd5b5061050f6107b0366004613fe5565b61189d565b3480156107c157600080fd5b5061050f6107d0366004614057565b611c61565b3480156107e157600080fd5b50601a546104b99065010000000000900460ff1681565b34801561080457600080fd5b50610526611c94565b34801561081957600080fd5b5061050f610828366004613e5e565b611ca1565b34801561083957600080fd5b5061084d61084836600461408e565b611cb5565b6040516104c5919061410b565b34801561086657600080fd5b50601a546104b990600160201b900460ff1681565b34801561088757600080fd5b50610553610896366004613d11565b611d80565b3480156108a757600080fd5b50610526611d8b565b3480156108bc57600080fd5b5061050f6108cb366004613d11565b611d98565b3480156108dc57600080fd5b506105eb6108eb36600461414d565b611e08565b61050f6108fe366004613d11565b611e56565b34801561090f57600080fd5b5061050f611ff9565b34801561092457600080fd5b5061050f610933366004613ed6565b61200d565b34801561094457600080fd5b5061050f610953366004613ed6565b61202f565b34801561096457600080fd5b50601a546104b990610100900460ff1681565b61050f610985366004613f7a565b612059565b34801561099657600080fd5b5061050f6109a5366004613d11565b6122b4565b3480156109b657600080fd5b5061050f6109c5366004613d11565b6122c1565b3480156109d657600080fd5b5061050f6109e5366004613ed6565b6122ce565b3480156109f657600080fd5b5061050f610a05366004613ed6565b6122f2565b348015610a1657600080fd5b50610a2a610a2536600461414d565b612318565b6040516104c59190614168565b348015610a4357600080fd5b5061050f610a52366004613ea6565b612420565b348015610a6357600080fd5b5061052661243c565b348015610a7857600080fd5b506008546001600160a01b0316610553565b348015610a9657600080fd5b506105eb60165481565b348015610aac57600080fd5b50610526612449565b348015610ac157600080fd5b5061050f610ad0366004613da9565b612458565b348015610ae157600080fd5b5061050f610af0366004613e5e565b6125d8565b348015610b0157600080fd5b506105eb610b1036600461414d565b600c6020526000908152604090205481565b348015610b2e57600080fd5b50610a2a610b3d3660046141a0565b6125ec565b61050f610b50366004613d11565b612773565b348015610b6157600080fd5b5061050f610b70366004614057565b61299c565b348015610b8157600080fd5b506105eb60155481565b348015610b9757600080fd5b5061050f610ba6366004613d11565b612a08565b348015610bb757600080fd5b5061050f610bc6366004613d11565b612a15565b348015610bd757600080fd5b506105eb610be636600461414d565b600d6020526000908152604090205481565b61050f610c063660046141d3565b612a22565b348015610c1757600080fd5b5061050f610c26366004613ea6565b612b81565b348015610c3757600080fd5b506105eb60185481565b348015610c4d57600080fd5b50601a546104b990600160301b900460ff1681565b348015610c6e57600080fd5b50610c82610c7d366004613d11565b612b9b565b6040516104c5919061422e565b348015610c9b57600080fd5b50610526610caa366004613d11565b612c23565b348015610cbb57600080fd5b5061050f610cca366004613ed6565b612e46565b348015610cdb57600080fd5b506105eb60195481565b348015610cf157600080fd5b5061050f610d0036600461423c565b612e61565b348015610d1157600080fd5b506105eb60145481565b348015610d2757600080fd5b50601a546104b9906301000000900460ff1681565b348015610d4857600080fd5b506104b9610d57366004613d11565b601c6020526000908152604090205460ff1681565b348015610d7857600080fd5b5061050f610d87366004613ed6565b6131c7565b348015610d9857600080fd5b506105eb610da736600461414d565b600b6020526000908152604090205481565b348015610dc557600080fd5b506104b9610dd43660046142a4565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610e0e57600080fd5b5061050f610e1d36600461414d565b6131f1565b348015610e2e57600080fd5b5061050f610e3d366004613da9565b61321b565b348015610e4e57600080fd5b5061050f610e5d36600461414d565b6132ce565b348015610e6e57600080fd5b506105eb60135481565b348015610e8457600080fd5b506104b9610e9336600461414d565b601b6020526000908152604090205460ff1681565b348015610eb457600080fd5b50601e54610553906001600160a01b031681565b60006301ffc9a760e01b6001600160e01b031983161480610ef957506380ac58cd60e01b6001600160e01b03198316145b80610f145750635b5e139f60e01b6001600160e01b03198316145b92915050565b610f22613344565b610f2c60016122ce565b610f36600061200d565b610f406000612e46565b610f4a600061113a565b610f5381611890565b50565b606060028054610f65906142d7565b80601f0160208091040260200160405190810160405280929190818152602001828054610f91906142d7565b8015610fde5780601f10610fb357610100808354040283529160200191610fde565b820191906000526020600020905b815481529060010190602001808311610fc157829003601f168201915b5050505050905090565b6000610ff38261339e565b611010576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061103782611d80565b9050336001600160a01b03821614611070576110538133610dd4565b611070576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6110d4613344565b60106110e08282614357565b5050565b6110ec613344565b6110f66001612e46565b611100600061200d565b61110a60006122ce565b611114600061113a565b61111d82611890565b6110e0816122b4565b61112e613344565b600e6110e08282614357565b611142613344565b601a8054911515600160201b0264ff0000000019909216919091179055565b6011805461116e906142d7565b80601f016020809104026020016040519081016040528092919081815260200182805461119a906142d7565b80156111e75780601f106111bc576101008083540402835291602001916111e7565b820191906000526020600020905b8154815290600101906020018083116111ca57829003601f168201915b505050505081565b826daaeb6d7670e522a718067333cd4e3b1561133f57336001600160a01b03821603611225576112208484846133d3565b61134a565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112989190614416565b801561131b5750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156112f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131b9190614416565b61133f57604051633b79c77360e21b81523360048201526024015b60405180910390fd5b61134a8484846133d3565b50505050565b611358613344565b601955565b601a54600160201b900460ff16156113875760405162461bcd60e51b815260040161133690614433565b826013546014546113989190614473565b816015546113a69190614486565b11156113c45760405162461bcd60e51b815260040161133690614499565b6016548111156113e65760405162461bcd60e51b8152600401611336906144d0565b83806012546113f591906144ff565b3410156114145760405162461bcd60e51b815260040161133690614516565b601a5460ff1661145b5760405162461bcd60e51b815260206004820152601260248201527127a39026b4b73a1d102234b9b0b13632b21760711b6044820152606401611336565b336000908152600b60205260409020546017546114788783614486565b11156114d05760405162461bcd60e51b815260206004820152602160248201527f4f47204d696e743a204d696e7420416c6c6f77616e63652045786365656465646044820152601760f91b6064820152608401611336565b6040516bffffffffffffffffffffffff193360601b16602082015260009060340160405160208183030381529060405280519060200120905061154a86868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050600a549150849050613564565b6115965760405162461bcd60e51b815260206004820152601760248201527f4f47204d696e743a20496e76616c69642070726f6f662e0000000000000000006044820152606401611336565b86600b6000335b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546115cc9190614486565b9250508190555086601560008282546115e59190614486565b909155506115f59050338861357a565b50505050505050565b611606613344565b6002600954036116585760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611336565b60026009556040514790600090735999d8ab90a1c460fb63fba06bbbbe3d6af641839083908381818185875af1925050503d80600081146116b5576040519150601f19603f3d011682016040523d82523d6000602084013e6116ba565b606091505b5050809150508061170d5760405162461bcd60e51b815260206004820152601860248201527f5472616e73616374696f6e20556e7375636365737366756c00000000000000006044820152606401611336565b50506001600955565b61171e613344565b601a8054911515600160301b0266ff00000000000019909216919091179055565b826daaeb6d7670e522a718067333cd4e3b1561188557336001600160a01b0382160361177057611220848484613594565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156117bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117e39190614416565b80156118665750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611842573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118669190614416565b61188557604051633b79c77360e21b8152336004820152602401611336565b61134a848484613594565b611898613344565b601255565b601a54600160201b900460ff16156118c75760405162461bcd60e51b815260040161133690614433565b601a54600160301b900460ff166119135760405162461bcd60e51b815260206004820152601060248201526f212622a7221d102234b9b0b13632b21760811b6044820152606401611336565b60018410158015611925575060058411155b61196a5760405162461bcd60e51b8152602060048201526016602482015275212622a7221d1024b73b30b634b2102932b1b4b8329760511b6044820152606401611336565b6000848152601d60205260409020546119bc5760405162461bcd60e51b8152602060048201526014602482015273212622a7221d1021b0b81022bc31b2b2b232b21760611b6044820152606401611336565b6000338585856040516020016119d59493929190614576565b604051602081830303815290604052805190602001209050600081604051602001611a2c91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b6040516020818303038152906040528051906020012090506000806000611a52866135af565b601e546040805160008152602081018083528a905260ff841691810191909152606081018590526080810184905293965091945092506001600160a01b03169060019060a0016020604051602081039080840390855afa158015611aba573d6000803e3d6000fd5b505050602060405103516001600160a01b031614611b1a5760405162461bcd60e51b815260206004820152601960248201527f424c454e443a20496e76616c6964205369676e61747572652e000000000000006044820152606401611336565b60005b87811015611bd05733611b478a8a84818110611b3b57611b3b6145ab565b90506020020135611d80565b6001600160a01b031614611b9d5760405162461bcd60e51b815260206004820152601d60248201527f424c454e443a2043616c6c6572204e6f7420417574686f72697a65642e0000006044820152606401611336565b611bbe898983818110611bb257611bb26145ab565b90506020020135613623565b80611bc8816145c1565b915050611b1d565b50600160156000828254611be49190614486565b90915550506000898152601d60205260408120805460019290611c08908490614473565b90915550611c19905033600161357a565b601554604080518b815233602082015281517f393d0571d7e382b62eb72e19f9552b1645344427d64586caafa619e9d68789fe929181900390910190a2505050505050505050565b611c69613344565b6001600160a01b03919091166000908152601b60205260409020805460ff1916911515919091179055565b600e805461116e906142d7565b611ca9613344565b600f6110e08282614357565b6060816000816001600160401b03811115611cd257611cd2613dd3565b604051908082528060200260200182016040528015611d2457816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181611cf05790505b50905060005b828114611d7757611d52868683818110611d4657611d466145ab565b90506020020135612b9b565b828281518110611d6457611d646145ab565b6020908102919091010152600101611d2a565b50949350505050565b6000610f148261362e565b600f805461116e906142d7565b611da0613344565b601354601554611db09190614486565b8110158015611dc157506014548111155b611e035760405162461bcd60e51b815260206004820152601360248201527224b73b30b634b21026b0bc1029bab838363c9760691b6044820152606401611336565b601455565b60006001600160a01b038216611e31576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b601a54600160201b900460ff1615611e805760405162461bcd60e51b815260040161133690614433565b80601354601454611e919190614473565b81601554611e9f9190614486565b1115611ebd5760405162461bcd60e51b815260040161133690614499565b601654811115611edf5760405162461bcd60e51b8152600401611336906144d0565b8180601254611eee91906144ff565b341015611f0d5760405162461bcd60e51b815260040161133690614516565b601a546301000000900460ff16611f5f5760405162461bcd60e51b815260206004820152601660248201527521b932b234ba1026b4b73a1d102234b9b0b13632b21760511b6044820152606401611336565b336000908152601b602052604090205460ff16611fd25760405162461bcd60e51b815260206004820152602b60248201527f437265646974204d696e743a2043616c6c65722041646472657373204e6f742060448201526a20baba3437b934bd32b21760a91b6064820152608401611336565b8260156000828254611fe49190614486565b90915550611ff49050338461357a565b505050565b612001613344565b61200b600061369d565b565b612015613344565b601a80549115156101000261ff0019909216919091179055565b612037613344565b601a8054911515600160381b0267ff0000000000000019909216919091179055565b601a54600160201b900460ff16156120835760405162461bcd60e51b815260040161133690614433565b826013546014546120949190614473565b816015546120a29190614486565b11156120c05760405162461bcd60e51b815260040161133690614499565b6016548111156120e25760405162461bcd60e51b8152600401611336906144d0565b83806012546120f191906144ff565b3410156121105760405162461bcd60e51b815260040161133690614516565b601a54610100900460ff166121675760405162461bcd60e51b815260206004820152601960248201527f416c6c6f776c697374204d696e743a2044697361626c65642e000000000000006044820152606401611336565b336000908152600c60205260409020546018546121848783614486565b11156121e35760405162461bcd60e51b815260206004820152602860248201527f416c6c6f776c697374204d696e743a204d696e7420416c6c6f77616e636520456044820152673c31b2b2b232b21760c11b6064820152608401611336565b6040516bffffffffffffffffffffffff193360601b16602082015260009060340160405160208183030381529060405280519060200120905061225d86868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050600a549150849050613564565b6122a95760405162461bcd60e51b815260206004820152601e60248201527f416c6c6f776c697374204d696e743a20496e76616c69642070726f6f662e00006044820152606401611336565b86600c60003361159d565b6122bc613344565b600a55565b6122c9613344565b601855565b6122d6613344565b601a8054911515620100000262ff000019909216919091179055565b6122fa613344565b601a805491151563010000000263ff00000019909216919091179055565b6060600080600061232885611e08565b90506000816001600160401b0381111561234457612344613dd3565b60405190808252806020026020018201604052801561236d578160200160208202803683370190505b50905061239a60408051608081018252600080825260208201819052918101829052606081019190915290565b60015b838614612414576123ad816136ef565b9150816040015161240c5781516001600160a01b0316156123cd57815194505b876001600160a01b0316856001600160a01b03160361240c57808387806001019850815181106123ff576123ff6145ab565b6020026020010181815250505b60010161239d565b50909695505050505050565b612428613344565b612432600161200d565b6111006000612e46565b6010805461116e906142d7565b606060038054610f65906142d7565b601a54600160201b900460ff16156124825760405162461bcd60e51b815260040161133690614433565b61248a613344565b6014548160155461249b9190614486565b11156124e95760405162461bcd60e51b815260206004820152601f60248201527f5445414d204d494e543a204d617820537570706c792045786365656465642e006044820152606401611336565b60165481111561253b5760405162461bcd60e51b815260206004820152601a60248201527f5445414d204d494e543a20496e76616c696420416d6f756e742e0000000000006044820152606401611336565b60135481111561259d5760405162461bcd60e51b815260206004820152602760248201527f5445414d204d494e543a2045786365656473207265736572766564204e46547360448201526620737570706c7960c81b6064820152608401611336565b80601360008282546125af9190614473565b9250508190555080601560008282546125c89190614486565b909155506110e09050828261357a565b6125e0613344565b60116110e08282614357565b606081831061260e57604051631960ccad60e11b815260040160405180910390fd5b60008061261a60005490565b9050600185101561262a57600194505b80841115612636578093505b600061264187611e08565b905084861015612660578585038181101561265a578091505b50612664565b5060005b6000816001600160401b0381111561267e5761267e613dd3565b6040519080825280602002602001820160405280156126a7578160200160208202803683370190505b509050816000036126bd57935061276c92505050565b60006126c888612b9b565b9050600081604001516126d9575080515b885b8881141580156126eb5750848714155b15612760576126f9816136ef565b925082604001516127585782516001600160a01b03161561271957825191505b8a6001600160a01b0316826001600160a01b031603612758578084888060010199508151811061274b5761274b6145ab565b6020026020010181815250505b6001016126db565b50505092835250909150505b9392505050565b601a54600160201b900460ff161561279d5760405162461bcd60e51b815260040161133690614433565b806013546014546127ae9190614473565b816015546127bc9190614486565b11156127da5760405162461bcd60e51b815260040161133690614499565b6016548111156127fc5760405162461bcd60e51b8152600401611336906144d0565b818060125461280b91906144ff565b34101561282a5760405162461bcd60e51b815260040161133690614516565b601a5462010000900460ff1661287b5760405162461bcd60e51b8152602060048201526016602482015275283ab13634b19026b4b73a1d102234b9b0b13632b21760511b6044820152606401611336565b3233146128db5760405162461bcd60e51b815260206004820152602860248201527f5055424c4943204d696e743a2043616c6c657220697320616e6f74686572206360448201526737b73a3930b1ba1760c11b6064820152608401611336565b336000908152600d60205260409020546019546128f88583614486565b11156129545760405162461bcd60e51b815260206004820152602560248201527f5075626c6963204d696e743a204d696e7420416c6c6f77616e6365204578636560448201526432b232b21760d91b6064820152608401611336565b336000908152600d602052604081208054869290612973908490614486565b92505081905550836015600082825461298c9190614486565b9091555061134a9050338561357a565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b612a10613344565b601755565b612a1d613344565b601655565b836daaeb6d7670e522a718067333cd4e3b15612b6e57336001600160a01b03821603612a5957612a548585858561372b565b612b7a565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612aa8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612acc9190614416565b8015612b4f5750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612b2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b4f9190614416565b612b6e57604051633b79c77360e21b8152336004820152602401611336565b612b7a8585858561372b565b5050505050565b612b89613344565b6000918252601d602052604090912055565b6040805160808101825260008082526020820181905291810182905260608101919091526040805160808101825260008082526020820181905291810182905260608101919091526001831080612bf457506000548310155b15612bff5792915050565b612c08836136ef565b9050806040015115612c1a5792915050565b61276c8361376f565b6060612c2e8261339e565b612c7a5760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e006044820152606401611336565b601a5465010000000000900460ff161515600003612d245760108054612c9f906142d7565b80601f0160208091040260200160405190810160405280929190818152602001828054612ccb906142d7565b8015612d185780601f10612ced57610100808354040283529160200191612d18565b820191906000526020600020905b815481529060010190602001808311612cfb57829003601f168201915b50505050509050919050565b6000828152601c602052604090205460ff1615612e1c57600060118054612d4a906142d7565b80601f0160208091040260200160405190810160405280929190818152602001828054612d76906142d7565b8015612dc35780601f10612d9857610100808354040283529160200191612dc3565b820191906000526020600020905b815481529060010190602001808311612da657829003601f168201915b505050505090506000815111612de8576040518060200160405280600081525061276c565b80612df2846137a4565b600e604051602001612e06939291906145da565b6040516020818303038152906040529392505050565b6000612e266138ac565b90506000815111612de8576040518060200160405280600081525061276c565b612e4e613344565b601a805460ff1916911515919091179055565b601a54600160201b900460ff1615612e8b5760405162461bcd60e51b815260040161133690614433565b601a54600160381b900460ff16612ed75760405162461bcd60e51b815260206004820152601060248201526f21a620a4a69d102234b9b0b13632b21760811b6044820152606401611336565b6000338484604051602001612eee9392919061467a565b604051602081830303815290604052805190602001209050600081604051602001612f4591907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b6040516020818303038152906040528051906020012090506000806000612f6b866135af565b601e546040805160008152602081018083528a905260ff841691810191909152606081018590526080810184905293965091945092506001600160a01b03169060019060a0016020604051602081039080840390855afa158015612fd3573d6000803e3d6000fd5b505050602060405103516001600160a01b0316146130335760405162461bcd60e51b815260206004820152601960248201527f434c41494d3a20496e76616c6964205369676e61747572652e000000000000006044820152606401611336565b60005b8781101561318157336130548a8a84818110611b3b57611b3b6145ab565b6001600160a01b0316146130aa5760405162461bcd60e51b815260206004820152601d60248201527f434c41494d3a2043616c6c6572204e6f7420417574686f72697a65642e0000006044820152606401611336565b601c60008a8a848181106130c0576130c06145ab565b602090810292909201358352508101919091526040016000205460ff161561312a5760405162461bcd60e51b815260206004820152601d60248201527f434c41494d3a20546f6b656e20416c726561647920436c61696d65642e0000006044820152606401611336565b6001601c60008b8b85818110613142576131426145ab565b90506020020135815260200190815260200160002060006101000a81548160ff0219169083151502179055508080613179906145c1565b915050613036565b507fd8c88ca71e50321643b95caeaef009a6248d4b04471da35e8d333b013d247b838888336040516131b5939291906146a8565b60405180910390a15050505050505050565b6131cf613344565b601a8054911515650100000000000265ff000000000019909216919091179055565b6131f9613344565b601e80546001600160a01b0319166001600160a01b0392909216919091179055565b601a54600160201b900460ff16156132455760405162461bcd60e51b815260040161133690614433565b806013546014546132569190614473565b816015546132649190614486565b11156132825760405162461bcd60e51b815260040161133690614499565b6016548111156132a45760405162461bcd60e51b8152600401611336906144d0565b6132ac613344565b81601560008282546132be9190614486565b90915550611ff49050838361357a565b6132d6613344565b6001600160a01b03811661333b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611336565b610f538161369d565b6008546001600160a01b0316331461200b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611336565b6000816001111580156133b2575060005482105b8015610f14575050600090815260046020526040902054600160e01b161590565b60006133de8261362e565b9050836001600160a01b0316816001600160a01b0316146134115760405162a1148160e81b815260040160405180910390fd5b6000828152600660205260409020805461343d8187335b6001600160a01b039081169116811491141790565b6134685761344b8633610dd4565b61346857604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661348f57604051633a954ecd60e21b815260040160405180910390fd5b801561349a57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b8416900361352c5760018401600081815260046020526040812054900361352a57600054811461352a5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b031660008051602061477e83398151915260405160405180910390a45b505050505050565b60008261357185846138bb565b14949350505050565b6110e0828260405180602001604052806000815250613908565b611ff483838360405180602001604052806000815250612a22565b600080600083516041146136055760405162461bcd60e51b815260206004820152601960248201527f496e76616c6964205369676e6174757265204c656e6774682e000000000000006044820152606401611336565b50505060208101516040820151606090920151909260009190911a90565b610f5381600061396e565b60008180600111613684576000548110156136845760008181526004602052604081205490600160e01b82169003613682575b8060000361276c575060001901600081815260046020526040902054613661565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610f1490613aa6565b6137368484846111ef565b6001600160a01b0383163b1561134a5761375284848484613aed565b61134a576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610f1461379f8361362e565b613aa6565b6060816000036137cb5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156137f557806137df816145c1565b91506137ee9050600a83614705565b91506137cf565b6000816001600160401b0381111561380f5761380f613dd3565b6040519080825280601f01601f191660200182016040528015613839576020820181803683370190505b5090505b84156138a45761384e600183614473565b915061385b600a86614719565b613866906030614486565b60f81b81838151811061387b5761387b6145ab565b60200101906001600160f81b031916908160001a90535061389d600a86614705565b945061383d565b949350505050565b6060600f8054610f65906142d7565b600081815b8451811015613900576138ec828683815181106138df576138df6145ab565b6020026020010151613bd8565b9150806138f8816145c1565b9150506138c0565b509392505050565b6139128383613c04565b6001600160a01b0383163b15611ff4576000548281035b61393c6000868380600101945086613aed565b613959576040516368d2bf6b60e11b815260040160405180910390fd5b818110613929578160005414612b7a57600080fd5b60006139798361362e565b90508060008061399786600090815260066020526040902080549091565b9150915084156139d7576139ac818433613428565b6139d7576139ba8333610dd4565b6139d757604051632ce44b5f60e11b815260040160405180910390fd5b80156139e257600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b85169003613a7057600186016000818152600460205260408120549003613a6e576000548114613a6e5760008181526004602052604090208590555b505b60405186906000906001600160a01b0386169060008051602061477e833981519152908390a45050600180548101905550505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613b2290339089908890889060040161472d565b6020604051808303816000875af1925050508015613b5d575060408051601f3d908101601f19168201909252613b5a91810190614760565b60015b613bbb573d808015613b8b576040519150601f19603f3d011682016040523d82523d6000602084013e613b90565b606091505b508051600003613bb3576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6000818310613bf457600082815260208490526040902061276c565b5060009182526020526040902090565b6000805490829003613c295760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b1783179055828401908390839060008051602061477e8339815191528180a4600183015b818114613cb4578083600060008051602061477e833981519152600080a4600101613c8e565b5081600003613cd557604051622e076360e81b815260040160405180910390fd5b60005550505050565b6001600160e01b031981168114610f5357600080fd5b600060208284031215613d0657600080fd5b813561276c81613cde565b600060208284031215613d2357600080fd5b5035919050565b60005b83811015613d45578181015183820152602001613d2d565b50506000910152565b60008151808452613d66816020860160208601613d2a565b601f01601f19169290920160200192915050565b60208152600061276c6020830184613d4e565b80356001600160a01b0381168114613da457600080fd5b919050565b60008060408385031215613dbc57600080fd5b613dc583613d8d565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b0380841115613e0357613e03613dd3565b604051601f8501601f19908116603f01168101908282118183101715613e2b57613e2b613dd3565b81604052809350858152868686011115613e4457600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215613e7057600080fd5b81356001600160401b03811115613e8657600080fd5b8201601f81018413613e9757600080fd5b6138a484823560208401613de9565b60008060408385031215613eb957600080fd5b50508035926020909101359150565b8015158114610f5357600080fd5b600060208284031215613ee857600080fd5b813561276c81613ec8565b600080600060608486031215613f0857600080fd5b613f1184613d8d565b9250613f1f60208501613d8d565b9150604084013590509250925092565b60008083601f840112613f4157600080fd5b5081356001600160401b03811115613f5857600080fd5b6020830191508360208260051b8501011115613f7357600080fd5b9250929050565b600080600060408486031215613f8f57600080fd5b8335925060208401356001600160401b03811115613fac57600080fd5b613fb886828701613f2f565b9497909650939450505050565b600082601f830112613fd657600080fd5b61276c83833560208501613de9565b60008060008060608587031215613ffb57600080fd5b8435935060208501356001600160401b038082111561401957600080fd5b61402588838901613f2f565b9095509350604087013591508082111561403e57600080fd5b5061404b87828801613fc5565b91505092959194509250565b6000806040838503121561406a57600080fd5b61407383613d8d565b9150602083013561408381613ec8565b809150509250929050565b600080602083850312156140a157600080fd5b82356001600160401b038111156140b757600080fd5b6140c385828601613f2f565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b818110156124145761413a8385516140cf565b9284019260809290920191600101614127565b60006020828403121561415f57600080fd5b61276c82613d8d565b6020808252825182820181905260009190848201906040850190845b8181101561241457835183529284019291840191600101614184565b6000806000606084860312156141b557600080fd5b6141be84613d8d565b95602085013595506040909401359392505050565b600080600080608085870312156141e957600080fd5b6141f285613d8d565b935061420060208601613d8d565b92506040850135915060608501356001600160401b0381111561422257600080fd5b61404b87828801613fc5565b60808101610f1482846140cf565b60008060006040848603121561425157600080fd5b83356001600160401b038082111561426857600080fd5b61427487838801613f2f565b9095509350602086013591508082111561428d57600080fd5b5061429a86828701613fc5565b9150509250925092565b600080604083850312156142b757600080fd5b6142c083613d8d565b91506142ce60208401613d8d565b90509250929050565b600181811c908216806142eb57607f821691505b60208210810361430b57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115611ff457600081815260208120601f850160051c810160208610156143385750805b601f850160051c820191505b8181101561355c57828155600101614344565b81516001600160401b0381111561437057614370613dd3565b6143848161437e84546142d7565b84614311565b602080601f8311600181146143b957600084156143a15750858301515b600019600386901b1c1916600185901b17855561355c565b600085815260208120601f198616915b828110156143e8578886015182559484019460019091019084016143c9565b50858210156144065787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561442857600080fd5b815161276c81613ec8565b60208082526010908201526f21b7b73a3930b1ba102830bab9b2b21760811b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b81810381811115610f1457610f1461445d565b80820180821115610f1457610f1461445d565b6020808252601a908201527f4d494e543a204d617820537570706c792045786365656465642e000000000000604082015260600190565b60208082526015908201527426a4a72a1d1024b73b30b634b21020b6b7bab73a1760591b604082015260600190565b8082028115828204841417610f1457610f1461445d565b60208082526019908201527f4d494e543a20496e73756666696369656e742066756e64732e00000000000000604082015260600190565b60006001600160fb1b0383111561456357600080fd5b8260051b80838637939093019392505050565b6bffffffffffffffffffffffff198560601b16815283601482015260006145a160348301848661454d565b9695505050505050565b634e487b7160e01b600052603260045260246000fd5b6000600182016145d3576145d361445d565b5060010190565b6000845160206145ed8285838a01613d2a565b8551918401916146008184848a01613d2a565b8554920191600090614611816142d7565b60018281168015614629576001811461463e5761466a565b60ff198416875282151583028701945061466a565b896000528560002060005b8481101561466257815489820152908301908701614649565b505082870194505b50929a9950505050505050505050565b6bffffffffffffffffffffffff198460601b168152600061469f60148301848661454d565b95945050505050565b6040808252810183905260006001600160fb1b038411156146c857600080fd5b8360051b808660608501376001600160a01b03939093166020830152500160600192915050565b634e487b7160e01b600052601260045260246000fd5b600082614714576147146146ef565b500490565b600082614728576147286146ef565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906145a190830184613d4e565b60006020828403121561477257600080fd5b815161276c81613cde56feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212206f4d3e54471f476be914572a24015b31a9195fb3037fd89747cf980895a0f7c664736f6c63430008110033
Verified Source Code Full Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: Yes (200 runs)
DefaultOperatorFilterer.sol 10 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {OperatorFilterer} from "./OperatorFilterer.sol";
abstract contract DefaultOperatorFilterer is OperatorFilterer {
address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {}
}
OperatorFilterer.sol 50 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
abstract contract OperatorFilterer {
error OperatorNotAllowed(address operator);
IOperatorFilterRegistry constant operatorFilterRegistry =
IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for the modifier to filter addresses.
if (address(operatorFilterRegistry).code.length > 0) {
if (subscribe) {
operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
} else {
operatorFilterRegistry.register(address(this));
}
}
}
}
modifier onlyAllowedOperator(address from) virtual {
// Check registry code length to facilitate testing in environments without a deployed registry.
if (address(operatorFilterRegistry).code.length > 0) {
// Allow spending tokens from addresses with balance
// Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
// from an EOA.
if (from == msg.sender) {
_;
return;
}
if (
!(
operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)
&& operatorFilterRegistry.isOperatorAllowed(address(this), from)
)
) {
revert OperatorNotAllowed(msg.sender);
}
}
_;
}
}
IERC721A.sol 282 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the
* ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() external view returns (uint256);
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
// =============================================================
// IERC721
// =============================================================
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables
* (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`,
* checking first that contract recipients are aware of the ERC721 protocol
* to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move
* this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external payable;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom}
* whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the
* zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external payable;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
// =============================================================
// IERC2309
// =============================================================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId`
* (inclusive) is transferred from `from` to `to`, as defined in the
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}
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)
}
}
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
Strings.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
ERC721AQueryable.sol 178 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// 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;
}
}
}
ERC721A.sol 1091 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// 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 {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =============================================================
// Mask of an entry in packed address data.
uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant _BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant _BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant _BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant _BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant _BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// STORAGE
// =============================================================
// The next token ID to be minted.
uint256 private _currentIndex;
// The number of tokens burned.
uint256 private _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned.
// See {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
// - [232..255] `extraData`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// Mapping from token ID to approved address.
mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// =============================================================
// 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 payable 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 {
_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].value`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
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 payable virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public payable virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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.
// The duplicated `log4` removes an extra check and reduces stack juggling.
// The assembly, together with the surrounding Solidity code, have been
// delicately arranged to nudge the compiler into producing optimized opcodes.
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`.
)
// The `iszero(eq(,))` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
// The compiler will optimize the `iszero` away for performance.
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 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
// We will need 1 word for the trailing zeros padding, 1 word for the length,
// and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
let m := add(mload(0x40), 0xa0)
// Update the free memory pointer to allocate.
mstore(0x40, m)
// Assign the `str` to the end.
str := sub(m, 0x20)
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end of the memory to calculate the length later.
let end := str
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// prettier-ignore
for { let temp := value } 1 {} {
str := sub(str, 1)
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
// prettier-ignore
if iszero(temp) { break }
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
}
IERC721AQueryable.sol 79 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// 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;
}
}
BugattiGenesis.sol 407 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "erc721a/contracts/extensions/ERC721AQueryable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {DefaultOperatorFilterer} from "./DefaultOperatorFilterer.sol";
// ██████╗░██╗░░░██╗░██████╗░░█████╗░████████╗████████╗██╗ ░██████╗░██████╗░░█████╗░██╗░░░██╗██████╗░
// ██╔══██╗██║░░░██║██╔════╝░██╔══██╗╚══██╔══╝╚══██╔══╝██║ ██╔════╝░██╔══██╗██╔══██╗██║░░░██║██╔══██╗
// ██████╦╝██║░░░██║██║░░██╗░███████║░░░██║░░░░░░██║░░░██║ ██║░░██╗░██████╔╝██║░░██║██║░░░██║██████╔╝
// ██╔══██╗██║░░░██║██║░░╚██╗██╔══██║░░░██║░░░░░░██║░░░██║ ██║░░╚██╗██╔══██╗██║░░██║██║░░░██║██╔═══╝░
// ██████╦╝╚██████╔╝╚██████╔╝██║░░██║░░░██║░░░░░░██║░░░██║ ╚██████╔╝██║░░██║╚█████╔╝╚██████╔╝██║░░░░░
// ╚═════╝░░╚═════╝░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░░░░╚═╝░░░╚═╝ ░╚═════╝░╚═╝░░╚═╝░╚════╝░░╚═════╝░╚═╝░░░░░
// ██████╗░██╗░░██╗██╗░░░██╗░██████╗░██╗████████╗░█████╗░██╗░░░░░
// ██╔══██╗██║░░██║╚██╗░██╔╝██╔════╝░██║╚══██╔══╝██╔══██╗██║░░░░░
// ██████╔╝███████║░╚████╔╝░██║░░██╗░██║░░░██║░░░███████║██║░░░░░
// ██╔═══╝░██╔══██║░░╚██╔╝░░██║░░╚██╗██║░░░██║░░░██╔══██║██║░░░░░
// ██║░░░░░██║░░██║░░░██║░░░╚██████╔╝██║░░░██║░░░██║░░██║███████╗
// ╚═╝░░░░░╚═╝░░╚═╝░░░╚═╝░░░░╚═════╝░╚═╝░░░╚═╝░░░╚═╝░░╚═╝╚══════╝
// ░██████╗░███████╗███╗░░██╗███████╗░██████╗██╗░██████╗
// ██╔════╝░██╔════╝████╗░██║██╔════╝██╔════╝██║██╔════╝
// ██║░░██╗░█████╗░░██╔██╗██║█████╗░░╚█████╗░██║╚█████╗░
// ██║░░╚██╗██╔══╝░░██║╚████║██╔══╝░░░╚═══██╗██║░╚═══██╗
// ╚██████╔╝███████╗██║░╚███║███████╗██████╔╝██║██████╔╝
// ░╚═════╝░╚══════╝╚═╝░░╚══╝╚══════╝╚═════╝░╚═╝╚═════╝░
// Powered by https://nalikes.com
contract BugattiGenesis is ERC721AQueryable, DefaultOperatorFilterer, Ownable, ReentrancyGuard {
using Strings for uint256;
bytes32 public merkleRoot;
mapping(address => uint256) public ogMintedBalance;
mapping(address => uint256) public allowlistMintedBalance;
mapping(address => uint256) public publicMintedBalance;
string public uriSuffix = "";
string public baseURI;
string public hiddenURI;
string public claimedURI;
uint256 public cost;
uint256 public remainingTeamMints = 150;
uint256 public maxSupply = 7780;
uint256 public totalMinted = 0;
uint256 public maxMintAmountPerTx = 5;
uint256 public maxOgMint = 5;
uint256 public maxAllowlistMint = 5;
uint256 public maxPublicMint = 5;
bool public ogMintEnabled = false;
bool public allowlistMintEnabled = false;
bool public publicMintEnabled = false;
bool public creditMintEnabled = false;
bool public paused = false;
bool public revealed = false;
bool public blendsEnabled = false;
bool public claimsEnabled = false;
mapping(address=>bool) public authorizedCreditGateways;
mapping(uint256 => bool) public claimed;
// 1: Uncommon, 2: Rare, 3: Epic, 4: Legendary, 5: Mythic
mapping(uint256 => uint256) public recipeCaps;
address public server;
event TokenClaimed(uint256[] _tokenIds, address _address);
event TokenBlended(uint256 indexed _newTokenId, uint256 _newTokenType, address _address);
constructor(string memory _hiddenURI, address _server) ERC721A("Bugatti Group Phygital Genesis", "BGPGC") {
setHiddenUri(_hiddenURI);
setServer(_server);
}
//******************************* MODIFIERS
modifier mintCompliance(uint256 _mintAmount) {
require(totalMinted + _mintAmount <= maxSupply - remainingTeamMints, "MINT: Max Supply Exceeded.");
require(_mintAmount <= maxMintAmountPerTx, "MINT: Invalid Amount.");
_;
}
modifier mintPriceCompliance(uint256 _mintAmount) {
require(msg.value >= cost * _mintAmount, "MINT: Insufficient funds.");
_;
}
modifier notPaused() {
require(!paused, "Contract Paused.");
_;
}
//******************************* MINT
function ogMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable notPaused mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
require(ogMintEnabled, "OG Mint: Disabled.");
uint256 ownerMintedCount = ogMintedBalance[_msgSender()];
require(ownerMintedCount + _mintAmount <= maxOgMint, "OG Mint: Mint Allowance Exceeded.");
bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "OG Mint: Invalid proof.");
ogMintedBalance[_msgSender()] += _mintAmount;
totalMinted += _mintAmount;
_safeMint(_msgSender(), _mintAmount);
}
function allowlistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable notPaused mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
require(allowlistMintEnabled, "Allowlist Mint: Disabled.");
uint256 ownerMintedCount = allowlistMintedBalance[_msgSender()];
require(ownerMintedCount + _mintAmount <= maxAllowlistMint, "Allowlist Mint: Mint Allowance Exceeded.");
bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "Allowlist Mint: Invalid proof.");
allowlistMintedBalance[_msgSender()] += _mintAmount;
totalMinted += _mintAmount;
_safeMint(_msgSender(), _mintAmount);
}
function mint(uint256 _mintAmount) public payable notPaused mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
require(publicMintEnabled, "Public Mint: Disabled.");
require(tx.origin == msg.sender, "PUBLIC Mint: Caller is another contract.");
uint256 ownerMintedCount = publicMintedBalance[_msgSender()];
require(ownerMintedCount + _mintAmount <= maxPublicMint, "Public Mint: Mint Allowance Exceeded.");
publicMintedBalance[_msgSender()] += _mintAmount;
totalMinted += _mintAmount;
_safeMint(_msgSender(), _mintAmount);
}
// @dev Credit-payment provider's addresses
function creditMint(uint256 _mintAmount) public payable notPaused mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
require(creditMintEnabled, "Credit Mint: Disabled.");
require(authorizedCreditGateways[_msgSender()], "Credit Mint: Caller Address Not Authorized.");
totalMinted += _mintAmount;
_safeMint(_msgSender(), _mintAmount);
}
// @dev Admin mint
function mintForAddress(address _receiver, uint256 _mintAmount) public notPaused mintCompliance(_mintAmount) onlyOwner {
totalMinted += _mintAmount;
_safeMint(_receiver, _mintAmount);
}
function mintToTeamMember(address _receiver, uint256 _mintAmount) public notPaused onlyOwner {
require(totalMinted + _mintAmount <= maxSupply, "TEAM MINT: Max Supply Exceeded.");
require(_mintAmount <= maxMintAmountPerTx, "TEAM MINT: Invalid Amount.");
require(_mintAmount <= remainingTeamMints, "TEAM MINT: Exceeds reserved NFTs supply");
remainingTeamMints -= _mintAmount;
totalMinted += _mintAmount;
_safeMint(_receiver, _mintAmount);
}
//******************************* OVERRIDES
function _startTokenId() internal view virtual override returns (uint256) {
return 1;
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function tokenURI(uint256 _tokenId) public view virtual override (ERC721A, IERC721A) returns (string memory) {
require(_exists(_tokenId), "URI query for nonexistent token");
if (revealed == false) {
return hiddenURI;
}
if (claimed[_tokenId]) {
string memory currentClaimedURI = claimedURI;
return bytes(currentClaimedURI).length > 0 ? string(abi.encodePacked(currentClaimedURI, _tokenId.toString(), uriSuffix)) : "";
}
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriSuffix)) : "";
}
function transferFrom(address from, address to, uint256 tokenId) public payable override (ERC721A, IERC721A) onlyAllowedOperator(from) {
super.transferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public payable override (ERC721A, IERC721A) onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public payable override (ERC721A, IERC721A) onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId, data);
}
//******************************* CRUD
// MERKLE ROOT
function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner {
merkleRoot = _merkleRoot;
}
// SERVER
function setServer(address _server) public onlyOwner {
server = _server;
}
// URI'S
function setBaseURI(string memory _metadataURI) public onlyOwner {
baseURI = _metadataURI;
}
function setUriSuffix(string memory _uriSuffix) public onlyOwner {
uriSuffix = _uriSuffix;
}
function setHiddenUri(string memory _hiddenURI) public onlyOwner {
hiddenURI = _hiddenURI;
}
function setClaimedUri(string memory _claimedURI) public onlyOwner {
claimedURI = _claimedURI;
}
// UINT'S
function setCost(uint256 _cost) public onlyOwner {
cost = _cost;
}
function setMaxSupply(uint256 _newMaxSupply) public onlyOwner {
require(_newMaxSupply >= totalMinted + remainingTeamMints && _newMaxSupply <= maxSupply, "Invalid Max Supply.");
maxSupply = _newMaxSupply;
}
function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner {
maxMintAmountPerTx = _maxMintAmountPerTx;
}
function setMaxOgMint(uint256 _maxOgMint) public onlyOwner {
maxOgMint = _maxOgMint;
}
function setMaxAllowlistMint(uint256 _maxAllowlistMint) public onlyOwner {
maxAllowlistMint = _maxAllowlistMint;
}
function setMaxPublicMint(uint256 _maxPublicMint) public onlyOwner {
maxPublicMint = _maxPublicMint;
}
// BOOL's
function setOgMintEnabled(bool _state) public onlyOwner {
ogMintEnabled = _state;
}
function setAllowlistMintEnabled(bool _state) public onlyOwner {
allowlistMintEnabled = _state;
}
function setPublicMintEnabled(bool _state) public onlyOwner {
publicMintEnabled = _state;
}
function setCreditMintEnabled(bool _state) public onlyOwner {
creditMintEnabled = _state;
}
function setPaused(bool _state) public onlyOwner {
paused = _state;
}
function setRevealed(bool _state) public onlyOwner {
revealed = _state;
}
function setBlendsEnabled(bool _state) public onlyOwner {
blendsEnabled = _state;
}
function setClaimsEnabled(bool _state) public onlyOwner {
claimsEnabled = _state;
}
// MINT CONTROLS
function setCreditGateway(address _address, bool _state) public onlyOwner {
authorizedCreditGateways[_address] = _state;
}
function enableOGMint(uint256 _cost, bytes32 _merkleRoot) public onlyOwner {
setOgMintEnabled(true);
setAllowlistMintEnabled(false);
setPublicMintEnabled(false);
setPaused(false);
setCost(_cost);
setMerkleRoot(_merkleRoot);
}
function enableAllowlistMint(uint256 _cost, bytes32 _merkleRoot) public onlyOwner {
setAllowlistMintEnabled(true);
setOgMintEnabled(false);
setPublicMintEnabled(false);
setPaused(false);
setCost(_cost);
setMerkleRoot(_merkleRoot);
}
function enablePublicMint(uint256 _cost) public onlyOwner {
setPublicMintEnabled(true);
setAllowlistMintEnabled(false);
setOgMintEnabled(false);
setPaused(false);
setCost(_cost);
}
// SIGNATURES
function splitSignature(bytes memory sig) internal pure returns (bytes32 r, bytes32 s, uint8 v) {
require(sig.length == 65, "Invalid Signature Length.");
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
}
//******************************* BLEND
function blend(uint256 _recipeId, uint256[] calldata _tokenIds, bytes memory _signature) external notPaused {
require(blendsEnabled, "BLEND: Disabled.");
require(_recipeId >= 1 && _recipeId <= 5, "BLEND: Invalid Recipe.");
require(recipeCaps[_recipeId] > 0, "BLEND: Cap Exceeded.");
bytes32 hashedMessage = keccak256(abi.encodePacked(_msgSender(), _recipeId, _tokenIds));
bytes32 prefixedHashMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hashedMessage));
(bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);
require(ecrecover(prefixedHashMessage, v, r, s) == server, "BLEND: Invalid Signature.");
for (uint256 i = 0; i < _tokenIds.length; i ++) {
require(ownerOf(_tokenIds[i]) == _msgSender(), "BLEND: Caller Not Authorized.");
_burn(_tokenIds[i]);
}
totalMinted += 1;
recipeCaps[_recipeId] -= 1;
_safeMint(_msgSender(), 1);
emit TokenBlended(totalMinted, _recipeId, _msgSender());
}
function setRecipeCaps(uint256 _recipeId, uint256 _newCap) public onlyOwner {
recipeCaps[_recipeId] = _newCap;
}
//******************************* CLAIM
function claim(uint256[] calldata _tokenIds, bytes memory _signature) external notPaused {
require(claimsEnabled, "CLAIM: Disabled.");
bytes32 hashedMessage = keccak256(abi.encodePacked(_msgSender(), _tokenIds));
bytes32 prefixedHashMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hashedMessage));
(bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);
require(ecrecover(prefixedHashMessage, v, r, s) == server, "CLAIM: Invalid Signature.");
for (uint256 i = 0; i < _tokenIds.length; i ++) {
require(ownerOf(_tokenIds[i]) == _msgSender(), "CLAIM: Caller Not Authorized.");
require(!claimed[_tokenIds[i]], "CLAIM: Token Already Claimed.");
claimed[_tokenIds[i]] = true;
}
emit TokenClaimed(_tokenIds, _msgSender());
}
//******************************* WITHDRAW
function withdraw() public onlyOwner nonReentrant {
uint256 balance = address(this).balance;
bool success;
(success, ) = payable(0x5999d8aB90A1C460fB63fbA06bbBbe3D6aF64183).call{value: balance}("");
require(success, "Transaction Unsuccessful");
}
}
IOperatorFilterRegistry.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IOperatorFilterRegistry {
function isOperatorAllowed(address registrant, address operator) external view returns (bool);
function register(address registrant) external;
function registerAndSubscribe(address registrant, address subscription) external;
function registerAndCopyEntries(address registrant, address registrantToCopy) external;
function updateOperator(address registrant, address operator, bool filtered) external;
function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
function subscribe(address registrant, address registrantToSubscribe) external;
function unsubscribe(address registrant, bool copyExistingEntries) external;
function subscriptionOf(address addr) external returns (address registrant);
function subscribers(address registrant) external returns (address[] memory);
function subscriberAt(address registrant, uint256 index) external returns (address);
function copyEntriesOf(address registrant, address registrantToCopy) external;
function isOperatorFiltered(address registrant, address operator) external returns (bool);
function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
function filteredOperators(address addr) external returns (address[] memory);
function filteredCodeHashes(address addr) external returns (bytes32[] memory);
function filteredOperatorAt(address registrant, uint256 index) external returns (address);
function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
function isRegistered(address addr) external returns (bool);
function codeHashOf(address addr) external returns (bytes32);
}
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);
}
}
Read Contract
allowlistMintEnabled 0x79de186a → bool
allowlistMintedBalance 0x98f002b4 → uint256
authorizedCreditGateways 0xf6b69ff3 → bool
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
blendsEnabled 0xbf219a95 → bool
claimed 0xdbe7e3bd → bool
claimedURI 0x1f0953b6 → string
claimsEnabled 0x0406aa61 → bool
cost 0x13faede6 → uint256
creditMintEnabled 0xdbddd5b7 → bool
explicitOwnershipOf 0xc23dc68f → tuple
explicitOwnershipsOf 0x5bbb2177 → tuple[]
getApproved 0x081812fc → address
hiddenURI 0x8cc54e7f → string
isApprovedForAll 0xe985e9c5 → bool
maxAllowlistMint 0xbcb49d9e → uint256
maxMintAmountPerTx 0x94354fd0 → uint256
maxOgMint 0x31776478 → uint256
maxPublicMint 0xcabadaa0 → uint256
maxSupply 0xd5abeb01 → uint256
merkleRoot 0x2eb4a7ab → bytes32
name 0x06fdde03 → string
ogMintEnabled 0x184daa1c → bool
ogMintedBalance 0xe5dd9943 → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
publicMintEnabled 0x0f4161aa → bool
publicMintedBalance 0xb592d044 → uint256
recipeCaps 0x12fed8ac → uint256
remainingTeamMints 0xf375b7c7 → uint256
revealed 0x51830227 → bool
server 0xfd922a42 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
tokensOfOwner 0x8462151c → uint256[]
tokensOfOwnerIn 0x99a2557a → uint256[]
totalMinted 0xa2309ff8 → uint256
totalSupply 0x18160ddd → uint256
uriSuffix 0x5503a0e8 → string
Write Contract 41 functions
These functions modify contract state and require a wallet transaction to execute.
allowlistMint 0x7bc9200e
uint256 _mintAmount
bytes32[] _merkleProof
approve 0x095ea7b3
address to
uint256 tokenId
blend 0x45c94440
uint256 _recipeId
uint256[] _tokenIds
bytes _signature
claim 0xd48a3d3d
uint256[] _tokenIds
bytes _signature
creditMint 0x71324e82
uint256 _mintAmount
enableAllowlistMint 0x891b96ac
uint256 _cost
bytes32 _merkleRoot
enableOGMint 0x144e079c
uint256 _cost
bytes32 _merkleRoot
enablePublicMint 0x055a7249
uint256 _cost
mint 0xa0712d68
uint256 _mintAmount
mintForAddress 0xf254933d
address _receiver
uint256 _mintAmount
mintToTeamMember 0x987c0144
address _receiver
uint256 _mintAmount
ogMint 0x2b314dc6
uint256 _mintAmount
bytes32[] _merkleProof
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes data
setAllowlistMintEnabled 0x71a94340
bool _state
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _metadataURI
setBlendsEnabled 0x40476ed7
bool _state
setClaimedUri 0x98d5b9c4
string _claimedURI
setClaimsEnabled 0x7564a48b
bool _state
setCost 0x44a0d68a
uint256 _cost
setCreditGateway 0x4dd1bf8b
address _address
bool _state
setCreditMintEnabled 0x8438cccb
bool _state
setHiddenUri 0x1067fcc7
string _hiddenURI
setMaxAllowlistMint 0x817cc12d
uint256 _maxAllowlistMint
setMaxMintAmountPerTx 0xb071401b
uint256 _maxMintAmountPerTx
setMaxOgMint 0xa4de5c2a
uint256 _maxOgMint
setMaxPublicMint 0x270ab52c
uint256 _maxPublicMint
setMaxSupply 0x6f8b44b0
uint256 _newMaxSupply
setMerkleRoot 0x7cb64759
bytes32 _merkleRoot
setOgMintEnabled 0xc9c6bc1c
bool _state
setPaused 0x16c38b3c
bool _state
setPublicMintEnabled 0x818668d7
bool _state
setRecipeCaps 0xb921caf9
uint256 _recipeId
uint256 _newCap
setRevealed 0xe0a80853
bool _state
setServer 0xf19a0b54
address _server
setUriSuffix 0x16ba10e0
string _uriSuffix
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address