Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x5BAf83F67A0FEe4748bb97786353072668fe14bA
Balance 0 ETH
Nonce 1
Code Size 19513 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

19513 bytes
0x6080604052600436106103a15760003560e01c80637a6e4457116101e7578063ba41b0c61161010d578063e13a0399116100a0578063ebc0cb011161006f578063ebc0cb0114610aff578063f242432a14610b14578063f2fde38b14610b34578063fc1a1c3614610b5457600080fd5b8063e13a039914610a49578063e41fb1ce14610a76578063e549fe7714610a96578063e985e9c514610ab657600080fd5b8063ca69e323116100dc578063ca69e323146109cd578063d5abeb01146109e2578063d7e45cd7146109f7578063daea4cb314610a1857600080fd5b8063ba41b0c614610964578063c060215214610977578063c30f4a5a14610997578063c40bb60b146109b757600080fd5b8063989bdbb611610185578063a945bf8011610154578063a945bf80146108f5578063ae4c4fff1461090b578063af426f1114610938578063b7a1aa9d1461094e57600080fd5b8063989bdbb61461087e5780639a18b26914610893578063a22cb465146108c0578063a475b5dd146108e057600080fd5b80638482add0116101c15780638482add01461080157806384bbce3f146108175780638da5cb5b1461083757806395d89b411461086957600080fd5b80637a6e4457146107915780637caa481b146107b15780637d0c152e146107d157600080fd5b8063327bbc47116102cc5780634ecb1f291161026a57806368963df01161023957806368963df01461073e578063696f2bd114610754578063715018a61461075c57806379d35eea1461077157600080fd5b80634ecb1f29146106a9578063531fd9a7146106c957806354214f69146106f65780635bc34f711461071757600080fd5b80633c62b27e116102a65780633c62b27e146106275780633ccfd60b14610647578063410583611461065c5780634e1273f41461067c57600080fd5b8063327bbc47146105d157806337dcd25e146105f15780633b94fdb81461061157600080fd5b80630e89341c116103445780631d7e4708116103135780631d7e47081461051857806327accd5a146105455780632a55205a146105725780632eb2c2d6146105b157600080fd5b80630e89341c146104a35780630fc562af146104c357806316e0a200146104e357806318160ddd1461050357600080fd5b806304634d8d1161038057806304634d8d1461042b57806305e755131461044b57806306fdde03146104615780630cec19441461048357600080fd5b8062fdd58e146103a657806301ffc9a7146103d957806303f7f9a414610409575b600080fd5b3480156103b257600080fd5b506103c66103c1366004613b05565b610b6a565b6040519081526020015b60405180910390f35b3480156103e557600080fd5b506103f96103f4366004613b45565b610c03565b60405190151581526020016103d0565b34801561041557600080fd5b50610429610424366004613b69565b610c0e565b005b34801561043757600080fd5b50610429610446366004613b82565b610c3d565b34801561045757600080fd5b506103c6600f5481565b34801561046d57600080fd5b50610476610c75565b6040516103d09190613c15565b34801561048f57600080fd5b506103c661049e366004613b69565b610d03565b3480156104af57600080fd5b506104766104be366004613b69565b610d4a565b3480156104cf57600080fd5b506104296104de366004613dfb565b61100e565b3480156104ef57600080fd5b506104296104fe366004613b69565b6111dd565b34801561050f57600080fd5b506103c661120c565b34801561052457600080fd5b506103c6610533366004613ecc565b60176020526000908152604090205481565b34801561055157600080fd5b506103c6610560366004613ecc565b60166020526000908152604090205481565b34801561057e57600080fd5b5061059261058d366004613ee7565b61124d565b604080516001600160a01b0390931683526020830191909152016103d0565b3480156105bd57600080fd5b506104296105cc366004613f09565b6112fb565b3480156105dd57600080fd5b506104296105ec366004613fa5565b611347565b3480156105fd57600080fd5b5061042961060c366004613b69565b61157f565b34801561061d57600080fd5b506103c6600b5481565b34801561063357600080fd5b50610429610642366004613b69565b6116a3565b34801561065357600080fd5b50610429611895565b34801561066857600080fd5b50610429610677366004613ecc565b6118ee565b34801561068857600080fd5b5061069c610697366004613feb565b611990565b6040516103d091906140e6565b3480156106b557600080fd5b506104296106c4366004613b69565b611ab9565b3480156106d557600080fd5b506103c66106e4366004613ecc565b60186020526000908152604090205481565b34801561070257600080fd5b50601b546103f990600160a81b900460ff1681565b34801561072357600080fd5b506009546107319060ff1681565b6040516103d0919061410f565b34801561074a57600080fd5b506103c660105481565b610429611ae8565b34801561076857600080fd5b50610429611cc9565b34801561077d57600080fd5b5061042961078c366004613b69565b611cff565b34801561079d57600080fd5b506104296107ac366004613b69565b611d2e565b3480156107bd57600080fd5b506104296107cc366004614137565b611d5d565b3480156107dd57600080fd5b506103f96107ec366004613ecc565b60156020526000908152604090205460ff1681565b34801561080d57600080fd5b506103c6600e5481565b34801561082357600080fd5b506103f961083236600461419c565b611ded565b34801561084357600080fd5b506005546001600160a01b03165b6040516001600160a01b0390911681526020016103d0565b34801561087557600080fd5b50610476611ef5565b34801561088a57600080fd5b50610429611f02565b34801561089f57600080fd5b506103c66108ae366004613b69565b60146020526000908152604090205481565b3480156108cc57600080fd5b506104296108db3660046141f5565b611f41565b3480156108ec57600080fd5b50610429611f4c565b34801561090157600080fd5b506103c6600d5481565b34801561091757600080fd5b506103c6610926366004613b69565b601a6020526000908152604090205481565b34801561094457600080fd5b506103c6600a5481565b34801561095a57600080fd5b506103c660115481565b610429610972366004614226565b611f8b565b34801561098357600080fd5b50601b54610851906001600160a01b031681565b3480156109a357600080fd5b506104296109b2366004614271565b61289a565b3480156109c357600080fd5b506103c660125481565b3480156109d957600080fd5b506103c6601581565b3480156109ee57600080fd5b506103c6602581565b348015610a0357600080fd5b50601b546103f990600160a01b900460ff1681565b348015610a2457600080fd5b50610a38610a33366004613b69565b61291c565b6040516103d09594939291906142a5565b348015610a5557600080fd5b506103c6610a64366004613ecc565b60196020526000908152604090205481565b348015610a8257600080fd5b50610429610a91366004613b69565b612b6b565b348015610aa257600080fd5b50610429610ab1366004613b69565b612b9a565b348015610ac257600080fd5b506103f9610ad1366004614304565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b348015610b0b57600080fd5b506103c6612bc9565b348015610b2057600080fd5b50610429610b2f366004614337565b612c0b565b348015610b4057600080fd5b50610429610b4f366004613ecc565b612c50565b348015610b6057600080fd5b506103c6600c5481565b60006001600160a01b038316610bda5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b6000610bfd82612ce8565b6005546001600160a01b03163314610c385760405162461bcd60e51b8152600401610bd19061439b565b601255565b6005546001600160a01b03163314610c675760405162461bcd60e51b8152600401610bd19061439b565b610c718282612d0d565b5050565b60078054610c82906143d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610cae906143d0565b8015610cfb5780601f10610cd057610100808354040283529160200191610cfb565b820191906000526020600020905b815481529060010190602001808311610cde57829003601f168201915b505050505081565b6000818152601460205260408120548103610d2057506000919050565b600082815260146020908152604080832054601a90925290912054610bfd9190614430565b919050565b60606001821015610d6d5760405162461bcd60e51b8152600401610bd190614444565b6015821115610d8e5760405162461bcd60e51b8152600401610bd190614444565b601b54600160a81b900460ff16610e315760028054610dac906143d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610dd8906143d0565b8015610e255780601f10610dfa57610100808354040283529160200191610e25565b820191906000526020600020905b815481529060010190602001808311610e0857829003601f168201915b50505050509050919050565b60008281526013602052604081206004018054610e4d906143d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610e79906143d0565b8015610ec65780601f10610e9b57610100808354040283529160200191610ec6565b820191906000526020600020905b815481529060010190602001808311610ea957829003601f168201915b505050505090506000601360008581526020019081526020016000206002018054610ef0906143d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1c906143d0565b8015610f695780601f10610f3e57610100808354040283529160200191610f69565b820191906000526020600020905b815481529060010190602001808311610f4c57829003601f168201915b505050600087815260136020526040812093945092610fe2925084915085906001810190600301610fa1610f9c8b610d03565b612e0a565b60008b815260146020526040902054610fb990612e0a565b604051602001610fce969594939291906144fb565b604051602081830303815290604052612f0a565b905080604051602001610ff59190614686565b6040516020818303038152906040529350505050919050565b6005546001600160a01b031633146110385760405162461bcd60e51b8152600401610bd19061439b565b601b54600160a01b900460ff16156110845760405162461bcd60e51b815260206004820152600f60248201526e13595d1859185d18481b1bd8dad959608a1b6044820152606401610bd1565b60005b85518110156111d5576040518060a001604052808783815181106110ad576110ad6146cb565b602002602001015181526020018683815181106110cc576110cc6146cb565b602002602001015181526020018583815181106110eb576110eb6146cb565b6020026020010151815260200184838151811061110a5761110a6146cb565b60200260200101518152602001838381518110611129576111296146cb565b60200260200101518152506013600088848151811061114a5761114a6146cb565b6020026020010151815260200190815260200160002060008201518160000155602082015181600101908161117f919061472c565b5060408201516002820190611194908261472c565b50606082015160038201906111a9908261472c565b50608082015160048201906111be908261472c565b5090505080806111cd906147eb565b915050611087565b505050505050565b6005546001600160a01b031633146112075760405162461bcd60e51b8152600401610bd19061439b565b600d55565b60008060015b60158111611247576000818152601460205260409020546112339083614804565b91508061123f816147eb565b915050611212565b50919050565b60008281526004602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916112c25750604080518082019091526003546001600160a01b0381168252600160a01b90046001600160601b031660208201525b6020810151600090612710906112e1906001600160601b031687614817565b6112eb9190614430565b91519350909150505b9250929050565b6001600160a01b03851633148061131757506113178533610ad1565b6113335760405162461bcd60e51b8152600401610bd19061482e565b611340858585858561305c565b5050505050565b6002600654036113695760405162461bcd60e51b8152600401610bd19061487c565b6002600655600182101561138f5760405162461bcd60e51b8152600401610bd190614444565b60158211156113b05760405162461bcd60e51b8152600401610bd190614444565b600760095460ff1660078111156113c9576113c96140f9565b146114165760405162461bcd60e51b815260206004820152601d60248201527f596f752063616e27742072656465656d207361746f73686973207965740000006044820152606401610bd1565b60016114223384610b6a565b10156114705760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420656e6f756768204d61726d6f74746f7368697320746f206275726e006044820152606401610bd1565b61147c3383600161325c565b600061148783610d03565b9050600081116114d05760405162461bcd60e51b81526020600482015260146024820152734e6f207361746f73686920746f2072656465656d60601b6044820152606401610bd1565b80600e546114de91906148b3565b600e556000838152601a60205260409020546114fb9082906148b3565b6000848152601a6020908152604080832093909355601490522054611522906001906148b3565b60008481526014602052604090819020919091555133907fa01b4e5a7698692e73e183782d5121dadcd527aeced1629c4616975ab00e3a4a9061156d908690600190879087906148c6565b60405180910390a25050600160065550565b601b546001600160a01b031633146115d95760405162461bcd60e51b815260206004820152601860248201527f4f6e6c79204d61726d6f74742063616e206164642042544300000000000000006044820152606401610bd1565b80600e546115e79190614804565b600e5560006115f4612bc9565b9050600081116116345760405162461bcd60e51b815260206004820152600b60248201526a139bc8139195081b19599d60aa1b6044820152606401610bd1565b60006116408284614430565b905060015b6015811161169d576000818152601460205260409020541561168b576000818152601a602052604090205461167b908390614804565b6000828152601a60205260409020555b80611695816147eb565b915050611645565b50505050565b601b546001600160a01b031633146116fd5760405162461bcd60e51b815260206004820152601860248201527f4f6e6c79204d61726d6f74742063616e207375622042544300000000000000006044820152606401610bd1565b80600e54101561175d5760405162461bcd60e51b815260206004820152602560248201527f4e6f7420656e6f756768207361746f7368697320696e2062616c616e63652074604482015264379039bab160d91b6064820152608401610bd1565b80600e5461176b91906148b3565b600e556000611778612bc9565b9050600081116117b85760405162461bcd60e51b815260206004820152600b60248201526a139bc8139195081b19599d60aa1b6044820152606401610bd1565b60006117c48284614430565b905060015b6015811161169d5760008181526014602052604090205415611883576000818152601a60205260409020548211156118595760405162461bcd60e51b815260206004820152602d60248201527f4e6f7420656e6f756768207361746f7368697320696e2062616c616e6365207460448201526c6f20737562202862792069642960981b6064820152608401610bd1565b6000818152601a60205260409020546118739083906148b3565b6000828152601a60205260409020555b8061188d816147eb565b9150506117c9565b6005546001600160a01b031633146118bf5760405162461bcd60e51b8152600401610bd19061439b565b60405133904780156108fc02916000818181858888f193505050501580156118eb573d6000803e3d6000fd5b50565b601b546001600160a01b031633148061191157506005546001600160a01b031633145b61196e5760405162461bcd60e51b815260206004820152602860248201527f4f6e6c79204d61726d6f7474206f72206f776e65722063616e207570646174656044820152670813585c9b5bdd1d60c21b6064820152608401610bd1565b601b80546001600160a01b0319166001600160a01b0392909216919091179055565b606081518351146119f55760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610bd1565b600083516001600160401b03811115611a1057611a10613c28565b604051908082528060200260200182016040528015611a39578160200160208202803683370190505b50905060005b8451811015611ab157611a84858281518110611a5d57611a5d6146cb565b6020026020010151858381518110611a7757611a776146cb565b6020026020010151610b6a565b828281518110611a9657611a966146cb565b6020908102919091010152611aaa816147eb565b9050611a3f565b509392505050565b6005546001600160a01b03163314611ae35760405162461bcd60e51b8152600401610bd19061439b565b600b55565b600260065403611b0a5760405162461bcd60e51b8152600401610bd19061487c565b6002600655600160095460ff166007811115611b2857611b286140f9565b14611b835760405162461bcd60e51b815260206004820152602560248201527f5265736572766174696f6e20666f722077686974656c697374206973206e6f746044820152641037b832b760d91b6064820152608401610bd1565b600a54341015611ba55760405162461bcd60e51b8152600401610bd1906148f6565b3360009081526015602052604090205460ff1615611c115760405162461bcd60e51b8152602060048201526024808201527f596f752061726520616c726561647920696e20746865207072652d77686974656044820152631b1a5cdd60e21b6064820152608401610bd1565b610190600f546001611c239190614804565b1115611c715760405162461bcd60e51b815260206004820152601960248201527f4d6178207072652d77686974656c6973742072656163686564000000000000006044820152606401610bd1565b600f54611c7f906001614804565b600f5533600081815260156020526040808220805460ff19166001179055517fdb87cdc43350a857db8d1ac93a63b8ed255e1676c1ad246522e0ec262cccdbda9190a26001600655565b6005546001600160a01b03163314611cf35760405162461bcd60e51b8152600401610bd19061439b565b611cfd60006133dd565b565b6005546001600160a01b03163314611d295760405162461bcd60e51b8152600401610bd19061439b565b600a55565b6005546001600160a01b03163314611d585760405162461bcd60e51b8152600401610bd19061439b565b601155565b6005546001600160a01b03163314611d875760405162461bcd60e51b8152600401610bd19061439b565b6009805482919060ff19166001836007811115611da657611da66140f9565b02179055506009546040517f6681b482253041a793a0d9c11f85c74822e7f2774e90b5ddfcb9090c33b098c591611de29160ff9091169061410f565b60405180910390a150565b600081600003611e4757611e40611e038661342f565b85858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050601054915061346e9050565b9050611eed565b81600103611e9857611e40611e5b8661342f565b85858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050601154915061346e9050565b81600203611ee957611e40611eac8661342f565b85858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050601254915061346e9050565b5060005b949350505050565b60088054610c82906143d0565b6005546001600160a01b03163314611f2c5760405162461bcd60e51b8152600401610bd19061439b565b601b805460ff60a01b1916600160a01b179055565b610c7133838361347b565b6005546001600160a01b03163314611f765760405162461bcd60e51b8152600401610bd19061439b565b601b805460ff60a81b1916600160a81b179055565b600260065403611fad5760405162461bcd60e51b8152600401610bd19061487c565b6002600681905560095460ff166007811115611fcb57611fcb6140f9565b1480611fed5750600360095460ff166007811115611feb57611feb6140f9565b145b8061200e5750600460095460ff16600781111561200c5761200c6140f9565b145b8061202f5750600560095460ff16600781111561202d5761202d6140f9565b145b806120505750600660095460ff16600781111561204e5761204e6140f9565b145b61208f5760405162461bcd60e51b815260206004820152601060248201526f29b0b6329034b9903737ba1037b832b760811b6044820152606401610bd1565b60018310156120b05760405162461bcd60e51b8152600401610bd190614444565b60158311156120d15760405162461bcd60e51b8152600401610bd190614444565b6000838152601460205260409020546025906120ee906001614804565b111561213c5760405162461bcd60e51b815260206004820152601f60248201527f4d617820737570706c7920657863656564656420666f722074686973206964006044820152606401610bd1565b600260095460ff166007811115612155576121556140f9565b036122c1576121673383836000611ded565b6121ab5760405162461bcd60e51b8152602060048201526015602482015274139bdd081bdb88199c9959481b5a5b9d081b1a5cdd605a1b6044820152606401610bd1565b604d6121b561120c565b6121c0906001614804565b111561220e5760405162461bcd60e51b815260206004820152601d60248201527f4d61782066726565206d696e7420737570706c792065786365656465640000006044820152606401610bd1565b3360009081526016602052604090205460019061222b9082614804565b11156122795760405162461bcd60e51b815260206004820181905260248201527f596f7520616c7265616479206d696e74656420796f75722066726565204e46546044820152606401610bd1565b336000908152601660205260408120805460019290612299908490614804565b925050819055506122bc338460016040518060200160405280600081525061355b565b612849565b600360095460ff1660078111156122da576122da6140f9565b03612467573360009081526015602052604090205460ff1661233e5760405162461bcd60e51b815260206004820152601760248201527f4e6f74206f6e207265736572766174696f6e206c6973740000000000000000006044820152606401610bd1565b600b543410156123605760405162461bcd60e51b8152600401610bd1906148f6565b6101dd61236b61120c565b612376906001614804565b11156123d05760405162461bcd60e51b8152602060048201526024808201527f4d6178207265736572766174696f6e206d696e7420737570706c7920657863656044820152631959195960e21b6064820152608401610bd1565b336000908152601760205260409020546001906123ed9082614804565b11156124475760405162461bcd60e51b8152602060048201526024808201527f596f7520616c7265616479206d696e74656420796f75722072657365727665646044820152630813919560e21b6064820152608401610bd1565b336000908152601760205260408120805460019290612299908490614804565b600460095460ff166007811115612480576124806140f9565b0361260d576124923383836001611ded565b6124d75760405162461bcd60e51b8152602060048201526016602482015275139bdd081bdb88199a5c9cdd081dda1a5d195b1a5cdd60521b6044820152606401610bd1565b600c543410156124f95760405162461bcd60e51b8152600401610bd1906148f6565b61024161250461120c565b61250f906001614804565b111561256e5760405162461bcd60e51b815260206004820152602860248201527f4d61782066697273742077686974656c697374206d696e7420737570706c7920604482015267195e18d95959195960c21b6064820152608401610bd1565b3360009081526018602052604090205460019061258b9082614804565b11156125ed5760405162461bcd60e51b815260206004820152602b60248201527f596f7520616c7265616479206d696e74656420796f757220666972737420776860448201526a1a5d195b1a5cdd0813919560aa1b6064820152608401610bd1565b336000908152601860205260408120805460019290612299908490614804565b600560095460ff166007811115612626576126266140f9565b036127bc576126383383836002611ded565b6126845760405162461bcd60e51b815260206004820152601760248201527f4e6f74206f6e207365636f6e642077686974656c6973740000000000000000006044820152606401610bd1565b600c543410156126a65760405162461bcd60e51b8152600401610bd1906148f6565b6103096126b161120c565b6126bc906001614804565b111561271c5760405162461bcd60e51b815260206004820152602960248201527f4d6178207365636f6e642077686974656c697374206d696e7420737570706c7960448201526808195e18d95959195960ba1b6064820152608401610bd1565b336000908152601960205260409020546001906127399082614804565b111561279c5760405162461bcd60e51b815260206004820152602c60248201527f596f7520616c7265616479206d696e74656420796f7572207365636f6e64207760448201526b1a1a5d195b1a5cdd0813919560a21b6064820152608401610bd1565b336000908152601960205260408120805460019290612299908490614804565b600d543410156127de5760405162461bcd60e51b8152600401610bd1906148f6565b6103096127e961120c565b6127f4906001614804565b111561282d5760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b6044820152606401610bd1565b612849338460016040518060200160405280600081525061355b565b6000838152601460205260408120805491612863836147eb565b909155505060405183815233907fee5277ca3c2df86637558acbb52afd98da9dd7301f93486b0e1b47b4a45f9aaa9060200161156d565b6005546001600160a01b031633146128c45760405162461bcd60e51b8152600401610bd19061439b565b601b54600160a01b900460ff16156129105760405162461bcd60e51b815260206004820152600f60248201526e13595d1859185d18481b1bd8dad959608a1b6044820152606401610bd1565b6002610c71828261472c565b6013602052600090815260409020805460018201805491929161293e906143d0565b80601f016020809104026020016040519081016040528092919081815260200182805461296a906143d0565b80156129b75780601f1061298c576101008083540402835291602001916129b7565b820191906000526020600020905b81548152906001019060200180831161299a57829003601f168201915b5050505050908060020180546129cc906143d0565b80601f01602080910402602001604051908101604052809291908181526020018280546129f8906143d0565b8015612a455780601f10612a1a57610100808354040283529160200191612a45565b820191906000526020600020905b815481529060010190602001808311612a2857829003601f168201915b505050505090806003018054612a5a906143d0565b80601f0160208091040260200160405190810160405280929190818152602001828054612a86906143d0565b8015612ad35780601f10612aa857610100808354040283529160200191612ad3565b820191906000526020600020905b815481529060010190602001808311612ab657829003601f168201915b505050505090806004018054612ae8906143d0565b80601f0160208091040260200160405190810160405280929190818152602001828054612b14906143d0565b8015612b615780601f10612b3657610100808354040283529160200191612b61565b820191906000526020600020905b815481529060010190602001808311612b4457829003601f168201915b5050505050905085565b6005546001600160a01b03163314612b955760405162461bcd60e51b8152600401610bd19061439b565b601055565b6005546001600160a01b03163314612bc45760405162461bcd60e51b8152600401610bd19061439b565b600c55565b60008060015b601581116112475760008181526014602052604090205415612bf957612bf6826001614804565b91505b80612c03816147eb565b915050612bcf565b6001600160a01b038516331480612c275750612c278533610ad1565b612c435760405162461bcd60e51b8152600401610bd19061482e565b6113408585858585613666565b6005546001600160a01b03163314612c7a5760405162461bcd60e51b8152600401610bd19061439b565b6001600160a01b038116612cdf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610bd1565b6118eb816133dd565b60006001600160e01b0319821663152a902d60e11b1480610bfd5750610bfd826137bb565b6127106001600160601b0382161115612d7b5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610bd1565b6001600160a01b038216612dd15760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610bd1565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600355565b606081600003612e315750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612e5b5780612e45816147eb565b9150612e549050600a83614430565b9150612e35565b6000816001600160401b03811115612e7557612e75613c28565b6040519080825280601f01601f191660200182016040528015612e9f576020820181803683370190505b5090505b8415611eed57612eb46001836148b3565b9150612ec1600a86614920565b612ecc906030614804565b60f81b818381518110612ee157612ee16146cb565b60200101906001600160f81b031916908160001a905350612f03600a86614430565b9450612ea3565b60608151600003612f2957505060408051602081019091526000815290565b6000604051806060016040528060408152602001614bc46040913990506000600384516002612f589190614804565b612f629190614430565b612f6d906004614817565b6001600160401b03811115612f8457612f84613c28565b6040519080825280601f01601f191660200182016040528015612fae576020820181803683370190505b509050600182016020820185865187015b8082101561301a576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250612fbf565b5050600386510660018114613036576002811461304957613051565b603d6001830353603d6002830353613051565b603d60018303535b509195945050505050565b81518351146130be5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610bd1565b6001600160a01b0384166130e45760405162461bcd60e51b8152600401610bd190614934565b61deac196001600160a01b0385160161310f5760405162461bcd60e51b8152600401610bd190614979565b3360005b84518110156131f6576000858281518110613130576131306146cb565b60200260200101519050600085838151811061314e5761314e6146cb565b602090810291909101810151600084815280835260408082206001600160a01b038e16835290935291909120549091508181101561319e5760405162461bcd60e51b8152600401610bd1906149be565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906131db908490614804565b92505081905550505050806131ef906147eb565b9050613113565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613246929190614a08565b60405180910390a46111d581878787878761380b565b6001600160a01b0383166132be5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610bd1565b3360006132ca84613966565b905060006132d784613966565b60408051602080820183526000918290528882528181528282206001600160a01b038b16835290522054909150848110156133605760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608401610bd1565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516bffffffffffffffffffffffff19606083901b166020820152600090603401604051602081830303815290604052805190602001209050919050565b6000611eed8383866139b1565b816001600160a01b0316836001600160a01b0316036134ee5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610bd1565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166135bb5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610bd1565b3360006135c785613966565b905060006135d485613966565b90506000868152602081815260408083206001600160a01b038b16845290915281208054879290613606908490614804565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46133d4836000898989896139c7565b6001600160a01b03841661368c5760405162461bcd60e51b8152600401610bd190614934565b61deac196001600160a01b038516016136b75760405162461bcd60e51b8152600401610bd190614979565b3360006136c385613966565b905060006136d085613966565b90506000868152602081815260408083206001600160a01b038c168452909152902054858110156137135760405162461bcd60e51b8152600401610bd1906149be565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290613750908490614804565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46137b0848a8a8a8a8a6139c7565b505050505050505050565b60006001600160e01b03198216636cdb3d1360e11b14806137ec57506001600160e01b031982166303a24d0760e21b145b80610bfd57506301ffc9a760e01b6001600160e01b0319831614610bfd565b6001600160a01b0384163b156111d55760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061384f9089908990889088908890600401614a36565b6020604051808303816000875af192505050801561388a575060408051601f3d908101601f1916820190925261388791810190614a74565b60015b61393657613896614a91565b806308c379a0036138cf57506138aa614aad565b806138b557506138d1565b8060405162461bcd60e51b8152600401610bd19190613c15565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610bd1565b6001600160e01b0319811663bc197c8160e01b146133d45760405162461bcd60e51b8152600401610bd190614b36565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106139a0576139a06146cb565b602090810291909101015292915050565b6000826139be8584613a82565b14949350505050565b6001600160a01b0384163b156111d55760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190613a0b9089908990889088908890600401614b7e565b6020604051808303816000875af1925050508015613a46575060408051601f3d908101601f19168201909252613a4391810190614a74565b60015b613a5257613896614a91565b6001600160e01b0319811663f23a6e6160e01b146133d45760405162461bcd60e51b8152600401610bd190614b36565b600081815b8451811015611ab1576000858281518110613aa457613aa46146cb565b60200260200101519050808311613aca5760008381526020829052604090209250613adb565b600081815260208490526040902092505b5080613ae6816147eb565b915050613a87565b80356001600160a01b0381168114610d4557600080fd5b60008060408385031215613b1857600080fd5b613b2183613aee565b946020939093013593505050565b6001600160e01b0319811681146118eb57600080fd5b600060208284031215613b5757600080fd5b8135613b6281613b2f565b9392505050565b600060208284031215613b7b57600080fd5b5035919050565b60008060408385031215613b9557600080fd5b613b9e83613aee565b915060208301356001600160601b0381168114613bba57600080fd5b809150509250929050565b60005b83811015613be0578181015183820152602001613bc8565b50506000910152565b60008151808452613c01816020860160208601613bc5565b601f01601f19169290920160200192915050565b602081526000613b626020830184613be9565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715613c6357613c63613c28565b6040525050565b60006001600160401b03821115613c8357613c83613c28565b5060051b60200190565b600082601f830112613c9e57600080fd5b81356020613cab82613c6a565b604051613cb88282613c3e565b83815260059390931b8501820192828101915086841115613cd857600080fd5b8286015b84811015613cf35780358352918301918301613cdc565b509695505050505050565b600082601f830112613d0f57600080fd5b81356001600160401b03811115613d2857613d28613c28565b604051613d3f601f8301601f191660200182613c3e565b818152846020838601011115613d5457600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112613d8257600080fd5b81356020613d8f82613c6a565b604051613d9c8282613c3e565b83815260059390931b8501820192828101915086841115613dbc57600080fd5b8286015b84811015613cf35780356001600160401b03811115613ddf5760008081fd5b613ded8986838b0101613cfe565b845250918301918301613dc0565b600080600080600060a08688031215613e1357600080fd5b85356001600160401b0380821115613e2a57600080fd5b613e3689838a01613c8d565b96506020880135915080821115613e4c57600080fd5b613e5889838a01613d71565b95506040880135915080821115613e6e57600080fd5b613e7a89838a01613d71565b94506060880135915080821115613e9057600080fd5b613e9c89838a01613d71565b93506080880135915080821115613eb257600080fd5b50613ebf88828901613d71565b9150509295509295909350565b600060208284031215613ede57600080fd5b613b6282613aee565b60008060408385031215613efa57600080fd5b50508035926020909101359150565b600080600080600060a08688031215613f2157600080fd5b613f2a86613aee565b9450613f3860208701613aee565b935060408601356001600160401b0380821115613f5457600080fd5b613f6089838a01613c8d565b94506060880135915080821115613f7657600080fd5b613f8289838a01613c8d565b93506080880135915080821115613f9857600080fd5b50613ebf88828901613cfe565b60008060408385031215613fb857600080fd5b8235915060208301356001600160401b03811115613fd557600080fd5b613fe185828601613cfe565b9150509250929050565b60008060408385031215613ffe57600080fd5b82356001600160401b038082111561401557600080fd5b818501915085601f83011261402957600080fd5b8135602061403682613c6a565b6040516140438282613c3e565b83815260059390931b850182019282810191508984111561406357600080fd5b948201945b838610156140885761407986613aee565b82529482019490820190614068565b9650508601359250508082111561409e57600080fd5b50613fe185828601613c8d565b600081518084526020808501945080840160005b838110156140db578151875295820195908201906001016140bf565b509495945050505050565b602081526000613b6260208301846140ab565b634e487b7160e01b600052602160045260246000fd5b602081016008831061413157634e487b7160e01b600052602160045260246000fd5b91905290565b60006020828403121561414957600080fd5b813560088110613b6257600080fd5b60008083601f84011261416a57600080fd5b5081356001600160401b0381111561418157600080fd5b6020830191508360208260051b85010111156112f457600080fd5b600080600080606085870312156141b257600080fd5b6141bb85613aee565b935060208501356001600160401b038111156141d657600080fd5b6141e287828801614158565b9598909750949560400135949350505050565b6000806040838503121561420857600080fd5b61421183613aee565b915060208301358015158114613bba57600080fd5b60008060006040848603121561423b57600080fd5b8335925060208401356001600160401b0381111561425857600080fd5b61426486828701614158565b9497909650939450505050565b60006020828403121561428357600080fd5b81356001600160401b0381111561429957600080fd5b611eed84828501613cfe565b85815260a0602082015260006142be60a0830187613be9565b82810360408401526142d08187613be9565b905082810360608401526142e48186613be9565b905082810360808401526142f88185613be9565b98975050505050505050565b6000806040838503121561431757600080fd5b61432083613aee565b915061432e60208401613aee565b90509250929050565b600080600080600060a0868803121561434f57600080fd5b61435886613aee565b945061436660208701613aee565b9350604086013592506060860135915060808601356001600160401b0381111561438f57600080fd5b613ebf88828901613cfe565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c908216806143e457607f821691505b60208210810361124757634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008261443f5761443f614404565b500490565b6020808252600e908201526d139bdb995e1a5cdd195b9d081a5960921b604082015260600190565b6000815161447e818560208601613bc5565b9290920192915050565b60008154614495816143d0565b600182811680156144ad57600181146144c2576144f1565b60ff19841687528215158302870194506144f1565b8560005260208060002060005b858110156144e85781548a8201529084019082016144cf565b50505082870194505b5050505092915050565b693d913730b6b2911d101160b11b8152865160009061452181600a850160208c01613bc5565b6c1116101134b6b0b3b2911d101160991b600a91840191820152875161454e816017840160208c01613bc5565b7f222c20226465736372697074696f6e223a20225265616c697365642062792000601792909101918201526145866036820188614488565b90507f2e20596f752063616e20736565206d6f72652068657265203a2000000000000081526145b8601a820187614488565b90507f202e222c202261747472696275746573223a205b7b2274726169745f7479706581527f223a20225361746f73686973222c202276616c7565223a20220000000000000060208201528451614616816039840160208901613bc5565b7f227d2c207b2274726169745f74797065223a202252656d61696e696e6720436f603992909101918201526e383c911610113b30b63ab2911d101160891b6059820152614679614669606883018661446c565b63227d5d7d60e01b815260040190565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516146be81601d850160208701613bc5565b91909101601d0192915050565b634e487b7160e01b600052603260045260246000fd5b601f82111561472757600081815260208120601f850160051c810160208610156147085750805b601f850160051c820191505b818110156111d557828155600101614714565b505050565b81516001600160401b0381111561474557614745613c28565b6147598161475384546143d0565b846146e1565b602080601f83116001811461478e57600084156147765750858301515b600019600386901b1c1916600185901b1785556111d5565b600085815260208120601f198616915b828110156147bd5788860151825594840194600190910190840161479e565b50858210156147db5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000600182016147fd576147fd61441a565b5060010190565b80820180821115610bfd57610bfd61441a565b8082028115828204841417610bfd57610bfd61441a565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b81810381811115610bfd57610bfd61441a565b8481528360208201526080604082015260006148e56080830185613be9565b905082606083015295945050505050565b60208082526010908201526f2737ba1032b737bab3b41032ba3432b960811b604082015260600190565b60008261492f5761492f614404565b500690565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526025908201527f596f752073686f756c6420757365206275726e416e6452656465656d2066756e60408201526431ba34b7b760d91b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b604081526000614a1b60408301856140ab565b8281036020840152614a2d81856140ab565b95945050505050565b6001600160a01b0386811682528516602082015260a060408201819052600090614a62908301866140ab565b82810360608401526142e481866140ab565b600060208284031215614a8657600080fd5b8151613b6281613b2f565b600060033d1115614aaa5760046000803e5060005160e01c5b90565b600060443d1015614abb5790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715614aea57505050505090565b8285019150815181811115614b025750505050505090565b843d8701016020828501011115614b1c5750505050505090565b614b2b60208286010187613c3e565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090614bb890830184613be9565b97965050505050505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212208c89b2bbd31ee3338baf7eab6dc3f0be2e9df4ed949440690a9c1b73b63c310364736f6c63430008110033

Verified Source Code Full Match

Compiler: v0.8.17+commit.8df45f5f EVM: london Optimization: Yes (200 runs)
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

interface IMarmottoshisIsERC1155 {

    // @notice Structure to store artist's infos (by token ID)
    struct Metadata {
        uint id;
        string artist_name;
        string marmot_name;
        string link;
        string uri;
    }

    // @notice Enum of different steps of the contract process
    enum Step {
        SaleNotStarted,
        WLReservation,
        FreeMint,
        ReservationMint,
        FirstWhitelistMint,
        SecondWhitelistMint,
        PublicMint,
        SoldOut
    }

    event newReservation(address indexed sender); // New reservation
    event newRedeemRequest(address indexed sender, uint256 nftIdRedeemed, uint256 burnAmount, string btcAddress, uint256 satoshisAmount); // Redeem event (user want to claim sats)
    event newMint(address indexed sender, uint256 nftIdMinted); // New mint
    event stepUpdated(Step currentStep); // Step updated

    // @notice Returns the sum of all supplies for each NFT ID
    function totalSupply() external view returns (uint256);

    // @notice return max supply of NFTs
    function maxSupply() external view returns (uint256);

    // @notice return max token by NFT Id
    function maxToken() external view returns (uint256);

    /*
    * @notice return supply by ID of NFT
    * @param _tokenId : id of NFT
    */
    function supplyByID(uint256) external view returns (uint256);

    /*
    * @notice get number of Satoshis redeemable by NFT ID
    * @param uint : id of NFT
    */
    function redeemableById(uint256 _id) external view returns (uint256);

    /*
    * @notice get number of NFT's ID with supply left
    */
    function getNumberOfIdLeft() external view returns (uint256);

    // @notice return free mint merkle root
    function freeMintMerkleRoot() external view returns (bytes32);

    // @notice return first whitelist merkle root
    function firstMerkleRoot() external view returns (bytes32);

    // @notice return second whitelist merkle root
    function secondMerkleRoot() external view returns (bytes32);

    /*
    * @notice return if a user is in reservation list (true/false)
    * @param _account : address of user
    */
    function reservationList(address) external view returns (bool);

    /*
    * @notice return number of NFTs minted by user for reservation step
    * @param _account : address of user
    */
    function reservationMintByWallet(address) external view returns (uint256);

    /*
    * @notice return number of NFTs minted by user for free mint step
    * @param _account : address of user
    */
    function freeMintByWallet(address) external view returns (uint256);

    /*
    * @notice return number of NFTs minted by user for first whitelist step
    * @param _account : address of user
    */
    function firstWhitelistMintByWallet(address) external view returns (uint256);

    /*
    * @notice return number of NFTs minted by user for second whitelist step
    * @param _account : address of user
    */
    function secondWhitelistMintByWallet(address) external view returns (uint256);

    /*
    * @notice know if user is on a list
    * @param _account : address of user
    * @param _proof : Merkle proof
    * @param _step : step of the list (0 = free mint, 1 = first whitelist, 2 = second whitelist)
    */
    function isOnList(address _account, bytes32[] calldata _proof, uint256 _step) external view returns (bool);

    // @notice return reservation price
    function reservationPrice() external view returns (uint256);

    // @notice return reservation mint price
    function reservationNFTPrice() external view returns (uint256);

    // @notice return whitelist mint price (first and second)
    function whitelistPrice() external view returns (uint256);

    // @notice return public mint price
    function publicPrice() external view returns (uint256);

    // @notice return current reservation number
    function currentReservationNumber() external view returns (uint256);

    // @notice return balance of Satoshis of this contract
    function balanceOfSatoshis() external view returns (uint256);

    /*
    * @notice return balance infos by NFT Id
    * @param _tokenId : id of NFT
    */
    function balanceOfSatoshiByID(uint256) external view returns (uint256);

    /*
    * @notice return metadata infos by NFT Id
    * @param _tokenId : id of NFT
    */
    function metadataById(uint256) external view returns (uint id, string memory artist_name, string memory marmot_name, string memory link, string memory uri);

    // @notice return current step
    function currentStep() external view returns (Step);

    // @notice return if metadata are locked (true/false)
    function isMetadataLocked() external view returns (bool);

    // @notice return if NFT are revealed (true/false)
    function isRevealed() external view returns (bool);

    // @notice return marmott address
    function marmott() external view returns (address);

    ////////// Functions //////////
    /// Setter functions ///

    /*
    * @notice Mints a new token to msg.sender
    * @param uint : Id of NFT to mint.
    * @param bytes32[] : Proof of whitelist (could be empty []).
    */
    function mint(uint256 idToMint, bytes32[] calldata _proof) external payable;

    /*
    * @notice update step
    * @param _step step to update
    */
    function updateStep(Step _step) external;

    /*
    * @notice update Marmott's address
    * @param address : new Marmott's address
    */
    function updateMarmott(address _marmott) external;

    /*
    * @notice lock metadata
    */
    function lockMetadata() external;

    /*
    * @notice reveal NFTs
    */
    function reveal() external;

    /*
    * @notice update URI
    * @param string : new URI
    */
    function updateURI(string memory _newUri) external;

    /*
    * @notice create Metadata struct of an NFT and add it in metadataById mapping
    * @param uint[] : array of NFT Ids
    * @param string[] : array of artist names
    * @param string[] : array of marmot names
    * @param string[] : array of links
    * @param string[] : array of URIs
    */
    function addMetadata(uint[] calldata _id, string[] calldata _artists_names, string[] calldata _marmot_name, string[] calldata _links, string[] calldata _uri) external;

    /*
    * @notice add satoshis to balanceOfSatoshis
    * @param uint : amount of satoshis to add
    */
    function addSats(uint256 satoshis) external;

    /*
    * @notice remove satoshis from balanceOfSatoshis
    * @param uint : amount of satoshis to remove
    */
    function subSats(uint256 satoshis) external;

    /*
    * @notice redeem satoshis and burn NFT
    * @param uint : id of NFT to burn/redeem
    * @param string : bitcoin address to send satoshis to
    */
    function burnAndRedeem(uint256 _idToRedeem, string memory _btcAddress) external;

    /*
    * @notice function for user to be preWhitelist
    */
    function reservationForWhitelist() external payable;

    /*
    * @notice update first whitelist merkle root
    * @param _merkleRoot : new merkle root
    */
    function updateFirstWhitelistMerkleRoot(bytes32 _merkleRoot) external;

    /*
    * @notice update free mint merkle root
    * @param _merkleRoot : new merkle root
    */
    function updateFreeMintMerkleRoot(bytes32 _merkleRoot) external;

    /*
    * @notice update public price
    * @param _publicPrice : new public price
    */
    function updatePublicPrice(uint256 _publicPrice) external;

    /*
    * @notice update reservation NFT price
    * @param _reservationNFTPrice : new reservation NFT price
    */
    function updateReservationNFTPrice(uint256 _reservationNFTPrice) external;

    /*
    * @notice update reservation price
    * @param _reservationPrice : new reservation price
    */
    function updateReservationPrice(uint256 _reservationPrice) external;

    /*
    * @notice update second whitelist merkle root
    * @param _merkleRoot : new merkle root
    */
    function updateSecondWhitelistMerkleRoot(bytes32 _merkleRoot) external;

    /*
    * @notice update whitelist price
    * @param _whitelistPrice : new whitelist price
    */
    function updateWLPrice(uint256 _whitelistPrice) external;

    /*
    * @notice withdraw ether from contract
    */
    function withdraw() external;

    // @notice EIP2981 royalties
    function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;
}
IERC1155.sol 125 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
    external
    view
    returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
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;
    }
}
Base64.sol 91 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

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

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

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

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

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

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

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

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

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

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

        return result;
    }
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}
ERC1155.sol 519 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

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

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string internal _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: address zero is not a valid owner");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
    public
    view
    virtual
    override
    returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");
        require(to != address(0x000000000000000000000000000000000000dEaD), "You should use burnAndRedeem function");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
    unchecked {
        _balances[id][from] = fromBalance - amount;
    }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");
        require(to != address(0x000000000000000000000000000000000000dEaD), "You should use burnAndRedeem function");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
    unchecked {
        _balances[id][from] = fromBalance - amount;
    }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `ids` and `amounts` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}
ERC2981.sol 112 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `tokenId` must be already minted.
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}
IERC1155MetadataURI.sol 22 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string 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;
    }
}
MarmottoshisIsERC1155.sol 327 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "./IMarmottoshisIsERC1155.sol";
import "./ERC1155/ERC1155.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 "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";

contract MarmottoshisIsERC1155 is IMarmottoshisIsERC1155, ERC1155, ERC2981, Ownable, ReentrancyGuard {

    string public name = "Marmottoshis";
    string public symbol = "WASAT";

    using Strings for uint;

    Step public currentStep;

    uint public constant maxToken = 21; // 21 different NFTs
    uint public constant maxSupply = 37; // 37 copies of each NFT

    uint public reservationPrice = 0.01727 ether; // Price of the reservation (21 USD ATM)
    uint public reservationNFTPrice = 0.04663 ether; // Price of the NFT for reservation list (56.7 USD ATM)
    uint public whitelistPrice = 0.0639 ether; // Price of whitelist mint (77.7 USD ATM)
    uint public publicPrice = 0.0639 ether; // Price of public mint (77.7 USD ATM)

    uint public balanceOfSatoshis = 0; // Balance of Satoshis (100000000 Satoshis = 1 Bitcoin)

    uint public currentReservationNumber = 0; // Current number of reservations purchased

    bytes32 public freeMintMerkleRoot; // Merkle root of the free mint
    bytes32 public firstMerkleRoot; // Merkle root of the first whitelist
    bytes32 public secondMerkleRoot; // Merkle root of the second whitelist

    mapping(uint => Metadata) public metadataById; // Artist by ID
    mapping(uint => uint) public supplyByID; // Number of NFTs minted by ID
    mapping(address => bool) public reservationList; // List of addresses that reserved (true = reserved)

    mapping(address => uint) public freeMintByWallet; // Number of NFTs minted by wallet for free mint
    mapping(address => uint) public reservationMintByWallet; // Number of reserved NFT mint by wallet
    mapping(address => uint) public firstWhitelistMintByWallet; // Number of first whitelist NFT mint by wallet
    mapping(address => uint) public secondWhitelistMintByWallet; // Number of second whitelist NFT mint by wallet

    mapping(uint => uint) public balanceOfSatoshiByID; // Balance of Satoshi by token ID

    address public marmott; // Marmott's address

    bool public isMetadataLocked = false; // Locks the metadata URI
    bool public isRevealed = false; // Reveal the NFTs

    constructor(address _marmott, string memory _uri) ERC1155(_uri) {
        marmott = _marmott;
    }

    // @dev see {IMarmottoshisIsERC1155-mint}
    function mint(uint idToMint, bytes32[] calldata _proof) public payable nonReentrant {
        require(
            currentStep == Step.FreeMint ||
            currentStep == Step.ReservationMint ||
            currentStep == Step.FirstWhitelistMint ||
            currentStep == Step.SecondWhitelistMint ||
            currentStep == Step.PublicMint
        , "Sale is not open");
        require(idToMint >= 1, "Nonexistent id");
        require(idToMint <= maxToken, "Nonexistent id");
        require(supplyByID[idToMint] + 1 <= maxSupply, "Max supply exceeded for this id");

        if (currentStep == Step.FreeMint) {
            require(isOnList(msg.sender, _proof, 0), "Not on free mint list");
            require(totalSupply() + 1 <= 77, "Max free mint supply exceeded");
            require(freeMintByWallet[msg.sender] + 1 <= 1, "You already minted your free NFT");
            freeMintByWallet[msg.sender] += 1;
            _mint(msg.sender, idToMint, 1, "");
        } else if (currentStep == Step.ReservationMint) {
            require(reservationList[msg.sender], "Not on reservation list");
            require(msg.value >= reservationNFTPrice, "Not enough ether");
            require(totalSupply() + 1 <= 477, "Max reservation mint supply exceeded");
            require(reservationMintByWallet[msg.sender] + 1 <= 1, "You already minted your reserved NFT");
            reservationMintByWallet[msg.sender] += 1;
            _mint(msg.sender, idToMint, 1, "");
        } else if (currentStep == Step.FirstWhitelistMint) {
            require(isOnList(msg.sender, _proof, 1), "Not on first whitelist");
            require(msg.value >= whitelistPrice, "Not enough ether");
            require(totalSupply() + 1 <= 577, "Max first whitelist mint supply exceeded");
            require(firstWhitelistMintByWallet[msg.sender] + 1 <= 1, "You already minted your first whitelist NFT");
            firstWhitelistMintByWallet[msg.sender] += 1;
            _mint(msg.sender, idToMint, 1, "");
        } else if (currentStep == Step.SecondWhitelistMint) {
            require(isOnList(msg.sender, _proof, 2), "Not on second whitelist");
            require(msg.value >= whitelistPrice, "Not enough ether");
            require(totalSupply() + 1 <= 777, "Max second whitelist mint supply exceeded");
            require(secondWhitelistMintByWallet[msg.sender] + 1 <= 1, "You already minted your second whitelist NFT");
            secondWhitelistMintByWallet[msg.sender] += 1;
            _mint(msg.sender, idToMint, 1, "");
        } else {
            require(msg.value >= publicPrice, "Not enough ether");
            require(totalSupply() + 1 <= 777, "Sold out");
            _mint(msg.sender, idToMint, 1, "");
        }
        supplyByID[idToMint]++;
        emit newMint(msg.sender, idToMint);
    }

    // @dev see {IMarmottoshisIsERC1155-updateStep}
    function updateStep(Step _step) external onlyOwner {
        currentStep = _step;
        emit stepUpdated(currentStep);
    }

    // @dev see {IMarmottoshisIsERC1155-updateMarmott}
    function updateMarmott(address _marmott) external {
        require(msg.sender == marmott || msg.sender == owner(), "Only Marmott or owner can update Marmott");
        marmott = _marmott;
    }

    // @dev see {IMarmottoshisIsERC1155-lockMetadata}
    function lockMetadata() external onlyOwner {
        isMetadataLocked = true;
    }

    // @dev see {IMarmottoshisIsERC1155-reveal}
    function reveal() external onlyOwner {
        isRevealed = true;
    }

    // @dev see {IMarmottoshisIsERC1155-updateURI}
    function updateURI(string memory _newUri) external onlyOwner {
        require(!isMetadataLocked, "Metadata locked");
        _uri = _newUri;
    }

    // @dev see {IMarmottoshisIsERC1155-addSats}
    function addSats(uint satoshis) external {
        require(msg.sender == marmott, "Only Marmott can add BTC");
        balanceOfSatoshis = balanceOfSatoshis + satoshis;
        uint divedBy = getNumberOfIdLeft();
        require(divedBy > 0, "No NFT left");
        uint satoshisPerId = satoshis / divedBy;
        for (uint i = 1; i <= maxToken; i++) {
            if (supplyByID[i] > 0) {
                balanceOfSatoshiByID[i] = balanceOfSatoshiByID[i] + satoshisPerId;
            }
        }
    }

    // @dev see {IMarmottoshisIsERC1155-subSats}
    function subSats(uint satoshis) external {
        require(msg.sender == marmott, "Only Marmott can sub BTC");
        require(balanceOfSatoshis >= satoshis, "Not enough satoshis in balance to sub");
        balanceOfSatoshis = balanceOfSatoshis - satoshis;
        uint divedBy = getNumberOfIdLeft();
        require(divedBy > 0, "No NFT left");
        uint satoshisPerId = satoshis / divedBy;
        for (uint i = 1; i <= maxToken; i++) {
            if (supplyByID[i] > 0) {
                require(balanceOfSatoshiByID[i] >= satoshisPerId, "Not enough satoshis in balance to sub (by id)");
                balanceOfSatoshiByID[i] = balanceOfSatoshiByID[i] - satoshisPerId;
            }
        }
    }

    // @dev see {IMarmottoshisIsERC1155-burnAndRedeem}
    function burnAndRedeem(uint _idToRedeem, string memory _btcAddress) public nonReentrant {
        require(_idToRedeem >= 1, "Nonexistent id");
        require(_idToRedeem <= maxToken, "Nonexistent id");
        require(currentStep == Step.SoldOut, "You can't redeem satoshis yet");
        require(balanceOf(msg.sender, _idToRedeem) >= 1, "Not enough Marmottoshis to burn");
        _burn(msg.sender, _idToRedeem, 1);
        uint satoshisToRedeem = redeemableById(_idToRedeem);
        require(satoshisToRedeem > 0, "No satoshi to redeem");
        balanceOfSatoshis = balanceOfSatoshis - satoshisToRedeem;
        balanceOfSatoshiByID[_idToRedeem] = balanceOfSatoshiByID[_idToRedeem] - satoshisToRedeem;
        supplyByID[_idToRedeem] = supplyByID[_idToRedeem] - 1;
        emit newRedeemRequest(msg.sender, _idToRedeem, 1, _btcAddress, satoshisToRedeem);
    }

    // @dev see {IMarmottoshisIsERC1155-reservationForWhitelist}
    function reservationForWhitelist() external payable nonReentrant {
        require(currentStep == Step.WLReservation, "Reservation for whitelist is not open");
        require(msg.value >= reservationPrice, "Not enough ether");
        require(reservationList[msg.sender] == false, "You are already in the pre-whitelist");
        require(currentReservationNumber + 1 <= 400, "Max pre-whitelist reached");
        currentReservationNumber = currentReservationNumber + 1;
        reservationList[msg.sender] = true;
        emit newReservation(msg.sender);
    }

    // @dev see {IMarmottoshisIsERC1155-redeemableById}
    function redeemableById(uint _id) public view returns (uint) {
        if (supplyByID[_id] == 0) {
            return 0;
        } else {
            return balanceOfSatoshiByID[_id] / supplyByID[_id];
        }
    }

    // @dev see {IMarmottoshisIsERC1155-getNumberOfIdLeft}
    function getNumberOfIdLeft() public view returns (uint) {
        uint numberOfIdLeft = 0;
        for (uint i = 1; i <= maxToken; i++) {
            if (supplyByID[i] > 0) {
                numberOfIdLeft = numberOfIdLeft + 1;
            }
        }
        return numberOfIdLeft;
    }

    // @dev see {IMarmottoshisIsERC1155-addMetadata}
    function addMetadata(uint[] memory _id, string[] memory _artists_names, string[] memory _marmot_name, string[] memory _links, string[] memory _uri) external onlyOwner {
        require(!isMetadataLocked, "Metadata locked");
        for (uint i = 0; i < _id.length; i++) {
            metadataById[_id[i]] = Metadata({
                id: _id[i],
                artist_name: _artists_names[i],
                marmot_name: _marmot_name[i],
                link: _links[i],
                uri: _uri[i]
            });
        }
    }

    // @dev see {IMarmottoshisIsERC1155-updateFreeMintMerkleRoot}
    function updateFreeMintMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
        freeMintMerkleRoot = _merkleRoot;
    }

    // @dev see {IMarmottoshisIsERC1155-updateFirstWhitelistMerkleRoot}
    function updateFirstWhitelistMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
        firstMerkleRoot = _merkleRoot;
    }

    // @dev see {IMarmottoshisIsERC1155-updateSecondWhitelistMerkleRoot}
    function updateSecondWhitelistMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
        secondMerkleRoot = _merkleRoot;
    }

    // @dev see {IMarmottoshisIsERC1155-updateReservationPrice}
    function updateReservationPrice(uint _reservationPrice) external onlyOwner {
        reservationPrice = _reservationPrice;
    }

    // @dev see {IMarmottoshisIsERC1155-updateReservationNFTPrice}
    function updateReservationNFTPrice(uint _reservationNFTPrice) external onlyOwner {
        reservationNFTPrice = _reservationNFTPrice;
    }

    // @dev see {IMarmottoshisIsERC1155-updateWLPrice}
    function updateWLPrice(uint _whitelistPrice) external onlyOwner {
        whitelistPrice = _whitelistPrice;
    }

    // @dev see {IMarmottoshisIsERC1155-updatePublicPrice}
    function updatePublicPrice(uint _publicPrice) external onlyOwner {
        publicPrice = _publicPrice;
    }

    // @dev see {IERC1155MetadataURI-uri}
    function uri(uint256 _tokenId) override public view returns (string memory) {
        require(_tokenId >= 1, "Nonexistent id");
        require(_tokenId <= maxToken, "Nonexistent id");
        if (!isRevealed) {
            return _uri;
        }
        string memory image = metadataById[_tokenId].uri;
        string memory marmot_name = metadataById[_tokenId].marmot_name;
        string memory json = Base64.encode(
            bytes(
                string(
                    abi.encodePacked(
                        '{"name": "', marmot_name, '", "image": "', image, '", "description": "Realised by ', metadataById[_tokenId].artist_name, '. You can see more here : ', metadataById[_tokenId].link, ' .", "attributes": [{"trait_type": "Satoshis", "value": "', redeemableById(_tokenId).toString(), '"}, {"trait_type": "Remaining Copy", "value": "', supplyByID[_tokenId].toString(), '"}]}'
                    )
                )
            )
        );

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

    // @dev see {IMarmottoshisIsERC1155-totalSupply}
    function totalSupply() public view returns (uint) {
        uint supply = 0;
        for (uint i = 1; i <= maxToken; i++) {
            supply = supply + supplyByID[i];
        }
        return supply;
    }

    // @dev see {IMarmottoshisIsERC1155-withdraw}
    function withdraw() external onlyOwner {
        payable(msg.sender).transfer(address(this).balance);
    }

    // @dev see {IMarmottoshisIsERC1155-isOnList}
    function isOnList(address _account, bytes32[] calldata _proof, uint _step) public view returns (bool) {
        if (_step == 0) {
            return _verify(_leaf(_account), _proof, freeMintMerkleRoot);
        } else if (_step == 1) {
            return _verify(_leaf(_account), _proof, firstMerkleRoot);
        } else if (_step == 2) {
            return _verify(_leaf(_account), _proof, secondMerkleRoot);
        } else {
            return false;
        }
    }

    function _leaf(address _account) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(_account));
    }

    function _verify(bytes32 leaf, bytes32[] memory proof, bytes32 root) internal pure returns (bool) {
        return MerkleProof.verify(proof, root, leaf);
    }


    // @dev see {IERC165-supportsInterface}.
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, ERC2981) returns (bool) {
        return super.supportsInterface(interfaceId);
    }

    // @dev see {IMarmottoshisIsERC1155-setDefaultRoyalty}
    function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
        _setDefaultRoyalty(receiver, feeNumerator);
    }
}
MerkleProof.sol 65 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees 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 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++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = _efficientHash(computedHash, proofElement);
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = _efficientHash(proofElement, computedHash);
            }
        }
        return computedHash;
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

pragma solidity ^0.8.0;

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

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

Read Contract

balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
balanceOfSatoshiByID 0xae4c4fff → uint256
balanceOfSatoshis 0x8482add0 → uint256
currentReservationNumber 0x05e75513 → uint256
currentStep 0x5bc34f71 → uint8
firstMerkleRoot 0xb7a1aa9d → bytes32
firstWhitelistMintByWallet 0x531fd9a7 → uint256
freeMintByWallet 0x27accd5a → uint256
freeMintMerkleRoot 0x68963df0 → bytes32
getNumberOfIdLeft 0xebc0cb01 → uint256
isApprovedForAll 0xe985e9c5 → bool
isMetadataLocked 0xd7e45cd7 → bool
isOnList 0x84bbce3f → bool
isRevealed 0x54214f69 → bool
marmott 0xc0602152 → address
maxSupply 0xd5abeb01 → uint256
maxToken 0xca69e323 → uint256
metadataById 0xdaea4cb3 → uint256, string, string, string, string
name 0x06fdde03 → string
owner 0x8da5cb5b → address
publicPrice 0xa945bf80 → uint256
redeemableById 0x0cec1944 → uint256
reservationList 0x7d0c152e → bool
reservationMintByWallet 0x1d7e4708 → uint256
reservationNFTPrice 0x3b94fdb8 → uint256
reservationPrice 0xaf426f11 → uint256
royaltyInfo 0x2a55205a → address, uint256
secondMerkleRoot 0xc40bb60b → bytes32
secondWhitelistMintByWallet 0xe13a0399 → uint256
supplyByID 0x9a18b269 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uri 0x0e89341c → string
whitelistPrice 0xfc1a1c36 → uint256

Write Contract 25 functions

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

addMetadata 0x0fc562af
uint256[] _id
string[] _artists_names
string[] _marmot_name
string[] _links
string[] _uri
addSats 0x37dcd25e
uint256 satoshis
burnAndRedeem 0x327bbc47
uint256 _idToRedeem
string _btcAddress
lockMetadata 0x989bdbb6
No parameters
mint 0xba41b0c6
uint256 idToMint
bytes32[] _proof
renounceOwnership 0x715018a6
No parameters
reservationForWhitelist 0x696f2bd1
No parameters
reveal 0xa475b5dd
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setDefaultRoyalty 0x04634d8d
address receiver
uint96 feeNumerator
subSats 0x3c62b27e
uint256 satoshis
transferOwnership 0xf2fde38b
address newOwner
updateFirstWhitelistMerkleRoot 0x7a6e4457
bytes32 _merkleRoot
updateFreeMintMerkleRoot 0xe41fb1ce
bytes32 _merkleRoot
updateMarmott 0x41058361
address _marmott
updatePublicPrice 0x16e0a200
uint256 _publicPrice
updateReservationNFTPrice 0x4ecb1f29
uint256 _reservationNFTPrice
updateReservationPrice 0x79d35eea
uint256 _reservationPrice
updateSecondWhitelistMerkleRoot 0x03f7f9a4
bytes32 _merkleRoot
updateStep 0x7caa481b
uint8 _step
updateURI 0xc30f4a5a
string _newUri
updateWLPrice 0xe549fe77
uint256 _whitelistPrice
withdraw 0x3ccfd60b
No parameters

Recent Transactions

No transactions found for this address