Address Contract Verified
Address
0x7760EdB2FE1824Ee6E2Ca065e9f4bdEa9ff23695
Balance
0 ETH
Nonce
1
Code Size
12443 bytes
Creator
0xA36C193a...FAd8 at tx 0x66c66001...bc800b
Indexed Transactions
0
Contract Bytecode
12443 bytes
0x608060405234801561000f575f80fd5b50600436106101fc575f3560e01c80634f64b2be11610114578063bd85b039116100a9578063e71f0bc011610079578063e71f0bc0146104de578063e985e9c5146104f1578063f101e4811461052c578063f242432a14610535578063f2fde38b14610548575f80fd5b8063bd85b03914610486578063cc307530146104a5578063d606fd58146104b8578063e417bc2a146104cb575f80fd5b80638456cb59116100e45780638456cb591461043a5780638da5cb5b1461044257806395d89b411461046b578063a22cb46514610473575f80fd5b80634f64b2be146103e45780635c975abb1461040757806370345c6314610412578063715018a614610432575f80fd5b8063162094c4116101955780633ccfd60b116101655780633ccfd60b146103805780633f4ba83a1461038857806345c0c502146103905780634e1273f4146103a35780634f558e79146103c3575f80fd5b8063162094c4146103155780631f7fdffa146103285780632a55205a1461033b5780632eb2c2d61461036d575f80fd5b8063074eb53f116101d0578063074eb53f1461027357806308dc9f42146102b65780630e89341c146102c957806315fbcaad146102dc575f80fd5b8062fdd58e1461020057806301ffc9a71461022657806304634d8d1461024957806306fdde031461025e575b5f80fd5b61021361020e366004612272565b61055b565b6040519081526020015b60405180910390f35b6102396102343660046122b1565b6105f2565b604051901515815260200161021d565b61025c6102573660046122cc565b6105fc565b005b610266610612565b60405161021d9190612351565b610239610281366004612363565b5f928352600a602090815260408085206001600160a01b03949094168552600590930181528284209184525290205460ff1690565b61025c6102c4366004612447565b61069e565b6102666102d7366004612492565b610948565b6102136102ea3660046124a9565b5f828152600a602090815260408083206001600160a01b038516845260060190915290205492915050565b61025c6103233660046124cc565b610a30565b61025c61033636600461259f565b610add565b61034e610349366004612633565b610af7565b604080516001600160a01b03909316835260208301919091520161021d565b61025c61037b366004612653565b610ba1565b61025c610bed565b61025c610c21565b61025c61039e366004612492565b610c33565b6103b66103b1366004612765565b610cde565b60405161021d91906127f3565b6102396103d1366004612492565b5f90815260076020526040902054151590565b6103f76103f2366004612492565b610e05565b60405161021d9493929190612805565b60055460ff16610239565b610425610420366004612492565b610eb6565b60405161021d9190612836565b61025c610f22565b61025c610f33565b60055461010090046001600160a01b03166040516001600160a01b03909116815260200161021d565b610266610f43565b61025c610481366004612882565b610f50565b610213610494366004612492565b5f9081526007602052604090205490565b61025c6104b33660046128b2565b610f5b565b61025c6104c636600461290a565b611015565b61025c6104d936600461295d565b6110e6565b61025c6104ec3660046129ba565b611131565b6102396104ff366004612a66565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205460ff1690565b610213600b5481565b61025c610543366004612a92565b61131c565b61025c610556366004612af5565b611361565b5f6001600160a01b0383166105ca5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b60648201526084015b60405180910390fd5b505f818152602081815260408083206001600160a01b03861684529091529020545b92915050565b5f6105ec826113d7565b6106046113fb565b61060e828261145b565b5050565b6008805461061f90612b10565b80601f016020809104026020016040519081016040528092919081815260200182805461064b90612b10565b80156106965780601f1061066d57610100808354040283529160200191610696565b820191905f5260205f20905b81548152906001019060200180831161067957829003601f168201915b505050505081565b6106a6611558565b5f838152600a60209081526040808320805460079093529220546106cb906001612b5c565b11156107145760405162461bcd60e51b81526020600482015260186024820152774f68206e6f2c20737570706c79206f76657272756e203a2f60401b60448201526064016105c1565b5f8080805b600185015481101561086357846005015f86600101838154811061073f5761073f612b6f565b5f9182526020808320909101546001600160a01b0316835282810193909352604091820181208a825290925290205460ff161561077f5760019250610851565b84600101818154811061079457610794612b6f565b5f918252602090912001546040516331a9108f60e11b8152600481018990526001600160a01b0390911690636352211e90602401602060405180830381865afa925050508015610801575060408051601f3d908101601f191682019092526107fe91810190612b83565b60015b1561085157336001600160a01b0382160361084f57600194505f935085600101828154811061083257610832612b6f565b5f918252602090912001546001600160a01b031692506108639050565b505b8061085b81612b9e565b915050610719565b5081156108b25760405162461bcd60e51b815260206004820152601c60248201527f4f68206e6f2c20746f6b656e20616c72656164792075736564203a2f0000000060448201526064016105c1565b826108ff5760405162461bcd60e51b815260206004820152601960248201527f4865792c20796f75206172656e277420686f6c646572203a2f0000000000000060448201526064016105c1565b6001600160a01b0381165f90815260058501602090815260408083208984529091529020805460ff1916600190811790915561093f90339089908861159e565b50505050505050565b60606001821015801561095c5750600b5482105b6109785760405162461bcd60e51b81526004016105c190612bb6565b5f828152600a60205260408120600301805461099390612b10565b80601f01602080910402602001604051908101604052809291908181526020018280546109bf90612b10565b8015610a0a5780601f106109e157610100808354040283529160200191610a0a565b820191905f5260205f20905b8154815290600101906020018083116109ed57829003601f168201915b505050505090505f815111610a2757610a2283611678565b610a29565b805b9392505050565b610a386113fb565b60018210158015610a4a5750600b5482105b610a665760405162461bcd60e51b81526004016105c190612bb6565b5f828152600a602052604090206004015460ff1615610abe5760405162461bcd60e51b81526020600482015260146024820152734865792c20555249206973206c6f636b6564202160601b60448201526064016105c1565b5f828152600a60205260409020600301610ad88282612c32565b505050565b610ae56113fb565b610af184848484611700565b50505050565b5f8281526004602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610b6b5750604080518082019091526003546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f9061271090610b89906001600160601b031687612ced565b610b939190612d04565b915196919550909350505050565b6001600160a01b038516331480610bbd5750610bbd85336104ff565b610bd95760405162461bcd60e51b81526004016105c190612d23565b610be68585858585611851565b5050505050565b610bf56113fb565b60405133904780156108fc02915f818181858888f19350505050158015610c1e573d5f803e3d5ffd5b50565b610c296113fb565b610c316119ee565b565b610c3b6113fb565b60018110158015610c4d5750600b5481105b610c695760405162461bcd60e51b81526004016105c190612bb6565b5f818152600a602052604090206004015460ff1615610cc15760405162461bcd60e51b81526020600482015260146024820152734865792c20555249206973206c6f636b6564202160601b60448201526064016105c1565b5f908152600a60205260409020600401805460ff19166001179055565b60608151835114610d435760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b60648201526084016105c1565b5f83516001600160401b03811115610d5d57610d5d612398565b604051908082528060200260200182016040528015610d86578160200160208202803683370190505b5090505f5b8451811015610dfd57610dd0858281518110610da957610da9612b6f565b6020026020010151858381518110610dc357610dc3612b6f565b602002602001015161055b565b828281518110610de257610de2612b6f565b6020908102919091010152610df681612b9e565b9050610d8b565b509392505050565b600a6020525f908152604090208054600282015460038301805492939192610e2c90612b10565b80601f0160208091040260200160405190810160405280929190818152602001828054610e5890612b10565b8015610ea35780601f10610e7a57610100808354040283529160200191610ea3565b820191905f5260205f20905b815481529060010190602001808311610e8657829003601f168201915b5050506004909301549192505060ff1684565b5f818152600a6020908152604091829020600101805483518184028101840190945280845260609392830182828015610f1657602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610ef8575b50505050509050919050565b610f2a6113fb565b610c315f611a40565b610f3b6113fb565b610c31611a99565b6009805461061f90612b10565b61060e338383611ad6565b610f636113fb565b600b545f908152600a6020526040902084815560038101610f848382612c32565b50600281018390555f5b8451811015610ff95781600101858281518110610fad57610fad612b6f565b60209081029190910181015182546001810184555f938452919092200180546001600160a01b0319166001600160a01b0390921691909117905580610ff181612b9e565b915050610f8e565b50600b8054905f61100983612b9e565b91905055505050505050565b61101d6113fb565b6001841015801561102f5750600b5484105b61104b5760405162461bcd60e51b81526004016105c190612bb6565b5f848152600a602052604081208481556002810183905590611071906001830190612230565b5f5b83518110156110de578160010184828151811061109257611092612b6f565b60209081029190910181015182546001810184555f938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806110d681612b9e565b915050611073565b505050505050565b6110ee6113fb565b5f5b8351811015610af15761111f84828151811061110e5761110e612b6f565b60200260200101518460018561159e565b8061112981612b9e565b9150506110f0565b611139611558565b5f868152600a6020526040902060018610156111825760405162461bcd60e51b81526020600482015260086024820152675265616c6c79203f60c01b60448201526064016105c1565b80545f8881526007602052604090205461119d908890612b5c565b11156111e65760405162461bcd60e51b81526020600482015260186024820152774f68206e6f2c20737570706c79206f76657272756e203a2f60401b60448201526064016105c1565b61122733868686808060200260200160405190810160405280939291908181526020018383602002808284375f920191909152505050506002850154611bb5565b61127f5760405162461bcd60e51b815260206004820152602360248201527f4865792c20796f75206172656e2774206f6e2074686520616c6c6f776c697374604482015262203a2f60e81b60648201526084016105c1565b335f908152600682016020526040902054869061129c9087612d71565b10156112ea5760405162461bcd60e51b815260206004820152601c60248201527f4865792c206974277320746f6f206d75636820666f7220796f7520210000000060448201526064016105c1565b335f9081526006820160205260408120805488929061130a908490612b5c565b9091555061093f90503388888561159e565b6001600160a01b038516331480611338575061133885336104ff565b6113545760405162461bcd60e51b81526004016105c190612d23565b610be68585858585611c09565b6113696113fb565b6001600160a01b0381166113ce5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105c1565b610c1e81611a40565b5f6001600160e01b0319821663152a902d60e11b14806105ec57506105ec82611d3d565b6005546001600160a01b03610100909104163314610c315760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105c1565b6127106001600160601b03821611156114c95760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084016105c1565b6001600160a01b03821661151f5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016105c1565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600355565b60055460ff1615610c315760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105c1565b6001600160a01b0384166115c45760405162461bcd60e51b81526004016105c190612d84565b335f6115cf85611d8c565b90505f6115db85611d8c565b90506115eb835f89858589611dd5565b5f868152602081815260408083206001600160a01b038b1684529091528120805487929061161a908490612b5c565b909155505060408051878152602081018790526001600160a01b03808a16925f92918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461093f835f89898989611de3565b60606002805461168790612b10565b80601f01602080910402602001604051908101604052809291908181526020018280546116b390612b10565b8015610f165780601f106116d557610100808354040283529160200191610f16565b820191905f5260205f20905b8154815290600101906020018083116116e15750939695505050505050565b6001600160a01b0384166117265760405162461bcd60e51b81526004016105c190612d84565b81518351146117475760405162461bcd60e51b81526004016105c190612dc5565b33611756815f87878787611dd5565b5f5b84518110156117eb5783818151811061177357611773612b6f565b60200260200101515f8087848151811061178f5761178f612b6f565b602002602001015181526020019081526020015f205f886001600160a01b03166001600160a01b031681526020019081526020015f205f8282546117d39190612b5c565b909155508190506117e381612b9e565b915050611758565b50846001600160a01b03165f6001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161183b929190612e0d565b60405180910390a4610be6815f87878787611f3d565b81518351146118725760405162461bcd60e51b81526004016105c190612dc5565b6001600160a01b0384166118985760405162461bcd60e51b81526004016105c190612e31565b336118a7818787878787611dd5565b5f5b8451811015611988575f8582815181106118c5576118c5612b6f565b602002602001015190505f8583815181106118e2576118e2612b6f565b6020908102919091018101515f84815280835260408082206001600160a01b038e1683529093529190912054909150818110156119315760405162461bcd60e51b81526004016105c190612e76565b5f838152602081815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929061196d908490612b5c565b925050819055505050508061198190612b9e565b90506118a9565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516119d8929190612e0d565b60405180910390a46110de818787878787611f3d565b6119f6611ff7565b6005805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600580546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b611aa1611558565b6005805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611a233390565b816001600160a01b0316836001600160a01b031603611b495760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b60648201526084016105c1565b6001600160a01b038381165f81815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6040516bffffffffffffffffffffffff19606086901b166020820152603481018490525f90611c00908490849060540160405160208183030381529060405280519060200120612040565b95945050505050565b6001600160a01b038416611c2f5760405162461bcd60e51b81526004016105c190612e31565b335f611c3a85611d8c565b90505f611c4685611d8c565b9050611c56838989858589611dd5565b5f868152602081815260408083206001600160a01b038c16845290915290205485811015611c965760405162461bcd60e51b81526004016105c190612e76565b5f878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290611cd2908490612b5c565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611d32848a8a8a8a8a611de3565b505050505050505050565b5f6001600160e01b03198216636cdb3d1360e11b1480611d6d57506001600160e01b031982166303a24d0760e21b145b806105ec57506301ffc9a760e01b6001600160e01b03198316146105ec565b6040805160018082528183019092526060915f91906020808301908036833701905050905082815f81518110611dc457611dc4612b6f565b602090810291909101015292915050565b6110de868686868686612055565b6001600160a01b0384163b156110de5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190611e279089908990889088908890600401612ec0565b6020604051808303815f875af1925050508015611e61575060408051601f3d908101601f19168201909252611e5e91810190612f04565b60015b611f0d57611e6d612f1f565b806308c379a003611ea65750611e81612f38565b80611e8c5750611ea8565b8060405162461bcd60e51b81526004016105c19190612351565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60648201526084016105c1565b6001600160e01b0319811663f23a6e6160e01b1461093f5760405162461bcd60e51b81526004016105c190612fc0565b6001600160a01b0384163b156110de5760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190611f819089908990889088908890600401613008565b6020604051808303815f875af1925050508015611fbb575060408051601f3d908101601f19168201909252611fb891810190612f04565b60015b611fc757611e6d612f1f565b6001600160e01b0319811663bc197c8160e01b1461093f5760405162461bcd60e51b81526004016105c190612fc0565b60055460ff16610c315760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105c1565b5f8261204c85846121c3565b14949350505050565b6001600160a01b0385166120d8575f5b83518110156120d65782818151811061208057612080612b6f565b602002602001015160075f86848151811061209d5761209d612b6f565b602002602001015181526020019081526020015f205f8282546120c09190612b5c565b909155506120cf905081612b9e565b9050612065565b505b6001600160a01b0384166110de575f5b835181101561093f575f84828151811061210457612104612b6f565b602002602001015190505f84838151811061212157612121612b6f565b602002602001015190505f60075f8481526020019081526020015f20549050818110156121a15760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b60648201526084016105c1565b5f92835260076020526040909220910390556121bc81612b9e565b90506120e8565b5f81815b8451811015610dfd576121f3828683815181106121e6576121e6612b6f565b6020026020010151612207565b9150806121ff81612b9e565b9150506121c7565b5f818310612221575f828152602084905260409020610a29565b505f9182526020526040902090565b5080545f8255905f5260205f2090810190610c1e91905b8082111561225a575f8155600101612247565b5090565b6001600160a01b0381168114610c1e575f80fd5b5f8060408385031215612283575f80fd5b823561228e8161225e565b946020939093013593505050565b6001600160e01b031981168114610c1e575f80fd5b5f602082840312156122c1575f80fd5b8135610a298161229c565b5f80604083850312156122dd575f80fd5b82356122e88161225e565b915060208301356001600160601b0381168114612303575f80fd5b809150509250929050565b5f81518084525f5b8181101561233257602081850181015186830182015201612316565b505f602082860101526020601f19601f83011685010191505092915050565b602081525f610a29602083018461230e565b5f805f60608486031215612375575f80fd5b8335925060208401356123878161225e565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b601f8201601f191681016001600160401b03811182821017156123d1576123d1612398565b6040525050565b5f82601f8301126123e7575f80fd5b81356001600160401b0381111561240057612400612398565b604051612417601f8301601f1916602001826123ac565b81815284602083860101111561242b575f80fd5b816020850160208301375f918101602001919091529392505050565b5f805f60608486031215612459575f80fd5b833592506020840135915060408401356001600160401b0381111561247c575f80fd5b612488868287016123d8565b9150509250925092565b5f602082840312156124a2575f80fd5b5035919050565b5f80604083850312156124ba575f80fd5b8235915060208301356123038161225e565b5f80604083850312156124dd575f80fd5b8235915060208301356001600160401b038111156124f9575f80fd5b612505858286016123d8565b9150509250929050565b5f6001600160401b0382111561252757612527612398565b5060051b60200190565b5f82601f830112612540575f80fd5b8135602061254d8261250f565b60405161255a82826123ac565b83815260059390931b8501820192828101915086841115612579575f80fd5b8286015b84811015612594578035835291830191830161257d565b509695505050505050565b5f805f80608085870312156125b2575f80fd5b84356125bd8161225e565b935060208501356001600160401b03808211156125d8575f80fd5b6125e488838901612531565b945060408701359150808211156125f9575f80fd5b61260588838901612531565b9350606087013591508082111561261a575f80fd5b50612627878288016123d8565b91505092959194509250565b5f8060408385031215612644575f80fd5b50508035926020909101359150565b5f805f805f60a08688031215612667575f80fd5b85356126728161225e565b945060208601356126828161225e565b935060408601356001600160401b038082111561269d575f80fd5b6126a989838a01612531565b945060608801359150808211156126be575f80fd5b6126ca89838a01612531565b935060808801359150808211156126df575f80fd5b506126ec888289016123d8565b9150509295509295909350565b5f82601f830112612708575f80fd5b813560206127158261250f565b60405161272282826123ac565b83815260059390931b8501820192828101915086841115612741575f80fd5b8286015b848110156125945780356127588161225e565b8352918301918301612745565b5f8060408385031215612776575f80fd5b82356001600160401b038082111561278c575f80fd5b612798868387016126f9565b935060208501359150808211156127ad575f80fd5b5061250585828601612531565b5f8151808452602080850194508084015f5b838110156127e8578151875295820195908201906001016127cc565b509495945050505050565b602081525f610a2960208301846127ba565b848152836020820152608060408201525f612823608083018561230e565b9050821515606083015295945050505050565b602080825282518282018190525f9190848201906040850190845b818110156128765783516001600160a01b031683529284019291840191600101612851565b50909695505050505050565b5f8060408385031215612893575f80fd5b823561289e8161225e565b915060208301358015158114612303575f80fd5b5f805f80608085870312156128c5575f80fd5b8435935060208501356001600160401b03808211156128e2575f80fd5b6128ee888389016126f9565b945060408701359350606087013591508082111561261a575f80fd5b5f805f806080858703121561291d575f80fd5b843593506020850135925060408501356001600160401b03811115612940575f80fd5b61294c878288016126f9565b949793965093946060013593505050565b5f805f6060848603121561296f575f80fd5b83356001600160401b0380821115612985575f80fd5b612991878388016126f9565b94506020860135935060408601359150808211156129ad575f80fd5b50612488868287016123d8565b5f805f805f8060a087890312156129cf575f80fd5b86359550602087013594506040870135935060608701356001600160401b03808211156129fa575f80fd5b818901915089601f830112612a0d575f80fd5b813581811115612a1b575f80fd5b8a60208260051b8501011115612a2f575f80fd5b602083019550809450506080890135915080821115612a4c575f80fd5b50612a5989828a016123d8565b9150509295509295509295565b5f8060408385031215612a77575f80fd5b8235612a828161225e565b915060208301356123038161225e565b5f805f805f60a08688031215612aa6575f80fd5b8535612ab18161225e565b94506020860135612ac18161225e565b9350604086013592506060860135915060808601356001600160401b03811115612ae9575f80fd5b6126ec888289016123d8565b5f60208284031215612b05575f80fd5b8135610a298161225e565b600181811c90821680612b2457607f821691505b602082108103612b4257634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b808201808211156105ec576105ec612b48565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215612b93575f80fd5b8151610a298161225e565b5f60018201612baf57612baf612b48565b5060010190565b6020808252601c908201527f4f68206e6f2c20696e636f727265637420746f6b656e204944203a2f00000000604082015260600190565b601f821115610ad8575f81815260208120601f850160051c81016020861015612c135750805b601f850160051c820191505b818110156110de57828155600101612c1f565b81516001600160401b03811115612c4b57612c4b612398565b612c5f81612c598454612b10565b84612bed565b602080601f831160018114612c92575f8415612c7b5750858301515b5f19600386901b1c1916600185901b1785556110de565b5f85815260208120601f198616915b82811015612cc057888601518255948401946001909101908401612ca1565b5085821015612cdd57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b80820281158282048414176105ec576105ec612b48565b5f82612d1e57634e487b7160e01b5f52601260045260245ffd5b500490565b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b818103818111156105ec576105ec612b48565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b604081525f612e1f60408301856127ba565b8281036020840152611c0081856127ba565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190525f90612ef99083018461230e565b979650505050505050565b5f60208284031215612f14575f80fd5b8151610a298161229c565b5f60033d1115612f355760045f803e505f5160e01c5b90565b5f60443d1015612f455790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715612f7457505050505090565b8285019150815181811115612f8c5750505050505090565b843d8701016020828501011115612fa65750505050505090565b612fb5602082860101876123ac565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b0386811682528516602082015260a0604082018190525f90613033908301866127ba565b828103606084015261304581866127ba565b90508281036080840152613059818561230e565b9897505050505050505056fea264697066735822122080328be3358d43dd67e13bccc8e120f082b892ccd9fad18f77964a336a72ae0864736f6c63430008150033
Verified Source Code Full Match
Compiler: v0.8.21+commit.d9974bed
EVM: shanghai
Optimization: Yes (200 runs)
AristoSpecialEdition.sol 180 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
// █▀ █▀▀ █▄▄ █▄█ █▀█ █▀█ █▀▀ █▀▄▀█ ▄▀█ ▀▄▀
// ▄█ █▄▄ █▄█ ░█░ █▀▄ █▀▀ █▄█ █░▀░█ █▀█ █░█
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
contract AristoSpecialEdition is ERC1155, ERC2981, Pausable, Ownable, ReentrancyGuard, ERC1155Supply {
string public name = "Aristo Special Edition";
string public symbol = "ARISTOSPECIAL";
struct Token {
uint256 maxSupply;
address[] ISC;
bytes32 merkleTreeRoot;
string URI;
bool isURILocked;
mapping (address => mapping (uint256 => bool)) usedISCTokens;
mapping(address => uint256) mintedByAddress;
}
mapping(uint256 => Token) public tokens;
uint256 public nextTokenID = 1;
constructor() ERC1155("") {
_setDefaultRoyalty(0x220639868D2947E8e336A109b7531ed87662b276, 1000); // Royalties par défaut fixées à 10%
}
// [O] Permet de switch la mise en pause du SC
function pause() public onlyOwner { _pause(); }
function unpause() public onlyOwner { _unpause(); }
// [O] Permet de définir l'URI d'un token donné (pour ajout ultérieur)
function setTokenURI(uint256 _tokenID, string memory _newuri) public onlyOwner {
require(_tokenID >= 1 && _tokenID < nextTokenID, "Oh no, incorrect token ID :/");
require(!tokens[_tokenID].isURILocked, "Hey, URI is locked !");
tokens[_tokenID].URI = _newuri;
}
// [O] Permet de verrouiller l'URI d'un token donné
function lockTokenURI(uint256 _tokenID) public onlyOwner {
require(_tokenID >= 1 && _tokenID < nextTokenID, "Oh no, incorrect token ID :/");
require(!tokens[_tokenID].isURILocked, "Hey, URI is locked !");
tokens[_tokenID].isURILocked = true;
}
// [O] Ajoute un nouveau token mintable
function addToken(uint256 _maxSupply, address[] memory _ISC, bytes32 _merkleTreeRoot, string memory _URI) public onlyOwner {
Token storage newToken = tokens[nextTokenID];
newToken.maxSupply = _maxSupply;
newToken.URI = _URI;
newToken.merkleTreeRoot = _merkleTreeRoot;
for(uint sc = 0; sc < _ISC.length; sc++) {
newToken.ISC.push(_ISC[sc]);
}
nextTokenID++;
}
// [O] Met à jour un token mintable
function updateToken(uint256 _tokenID, uint256 _maxSupply, address[] memory _ISC, bytes32 _merkleTreeRoot) public onlyOwner {
require(_tokenID >= 1 && _tokenID < nextTokenID, "Oh no, incorrect token ID :/");
Token storage tokenToUpdate = tokens[_tokenID];
tokenToUpdate.maxSupply = _maxSupply;
tokenToUpdate.merkleTreeRoot = _merkleTreeRoot;
delete tokenToUpdate.ISC;
for(uint sc = 0; sc < _ISC.length; sc++) {
tokenToUpdate.ISC.push(_ISC[sc]);
}
}
// [P] Permet de mint avec prérequis de token "Genesis" et en quantité fixée (1)
function mint(uint256 _tokenID, uint256 _genesisTokenID, bytes memory _data) public whenNotPaused {
Token storage currentToken = tokens[_tokenID]; // Bascule en storage pour optimisation
require(totalSupply(_tokenID) + 1 <= currentToken.maxSupply, "Oh no, supply overrun :/");
bool isOwnerOfISC = false;
bool isGenesisTokenIDUsed = false;
address userISC;
for(uint sc = 0; sc < currentToken.ISC.length; sc++) { // On boucle sur les différentes SC interfacés
if (currentToken.usedISCTokens[currentToken.ISC[sc]][_genesisTokenID]) {
isGenesisTokenIDUsed = true;
continue; // Si l'utilisateur a déjà mint pour le SC en cours, on passe au SC suivant
}
try IERC721(currentToken.ISC[sc]).ownerOf(_genesisTokenID) returns (address tokenOwner) {
if (tokenOwner == msg.sender) { // L'utilisateur est bien owner du SC en cours
isOwnerOfISC = true;
isGenesisTokenIDUsed = false;
userISC = currentToken.ISC[sc]; // Récupération de l'adresse du SC
break; // On sort de la boucle
}
} catch { }
}
// Sinon on s'assure qu'il est bien holder + que le NFT concerné n'a jamais été utilisé auparavant
require(!isGenesisTokenIDUsed, "Oh no, token already used :/");
require(isOwnerOfISC, "Hey, you aren't holder :/");
currentToken.usedISCTokens[userISC][_genesisTokenID] = true; // Tracking token utilisé, rattaché à l'adresse du SC concerné
_mint(msg.sender, _tokenID, 1, _data); // Mint time !
}
// [P] Permet de mint avec prérequis de WL, en quantité définie en amont (snapshot)
function mintExt(uint256 _tokenID, uint256 _amount, uint256 _maxMints, bytes32[] calldata _proof, bytes memory _data) public whenNotPaused {
Token storage currentToken = tokens[_tokenID]; // Bascule en storage pour optimisation
require(_amount >= 1, "Really ?");
require(totalSupply(_tokenID) + _amount <= currentToken.maxSupply, "Oh no, supply overrun :/");
require(_verify(msg.sender, _maxMints, _proof, currentToken.merkleTreeRoot), "Hey, you aren't on the allowlist :/");
require((_maxMints - currentToken.mintedByAddress[msg.sender]) >= _amount, "Hey, it's too much for you !");
currentToken.mintedByAddress[msg.sender] += _amount; // Tracking mints effectués par adresse
_mint(msg.sender, _tokenID, _amount, _data); // Mint time !
}
// [I] Permet de vérifier qu'une adresse est WL
function _verify(address _userAddress, uint256 _mints, bytes32[] memory _proof, bytes32 _root) internal pure returns (bool) {
return MerkleProof.verify(_proof, _root, keccak256(abi.encodePacked(_userAddress, _mints)));
}
// [O] Permet de mint une quantité souhaitée pour chaque token, sans prérequis, uniquement par l'owner du SC
function mintBatch(address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data) public onlyOwner {
_mintBatch(_to, _ids, _amounts, _data);
}
// [O] Permet d'airdrop un token vers de multiples adresses, sans prérequis, uniquement par l'owner du SC
function airdrop(address[] memory _recipients, uint256 _tokenId, bytes memory _data) public onlyOwner {
for (uint to = 0; to < _recipients.length; to++) { _mint(_recipients[to], _tokenId, 1, _data); }
}
// [P] Retourne les différents SC interfacés pour un token donné
function getISCAddresses(uint256 _tokenID) public view returns (address[] memory) {
return tokens[_tokenID].ISC;
}
// [P] Retourne le nombre de tokens mintés par une adresse pour un token donné
function getMintedTokensByAddress(uint256 _tokenID, address _userAddress) public view returns (uint256) {
return tokens[_tokenID].mintedByAddress[_userAddress];
}
// [P] Retourne le statut d'utilisation d'un token pour un SC d'un token donné
function isUsedISCTokens(uint256 _tokenID, address _iscAddress, uint256 _iscTokenId) public view returns (bool) {
return tokens[_tokenID].usedISCTokens[_iscAddress][_iscTokenId];
}
// [P] Retourne l'URI d'un token, générale ou spécifique si existante
function uri(uint256 _tokenID) public view override returns (string memory) {
require(_tokenID >= 1 && _tokenID < nextTokenID, "Oh no, incorrect token ID :/");
string memory _tokenURI = tokens[_tokenID].URI;
return bytes(_tokenURI).length > 0 ? _tokenURI : super.uri(_tokenID);
}
// [O] Permet de récupérer d'éventuels ETH envoyés par erreur sur le SC
function withdraw() external onlyOwner { payable(msg.sender).transfer(address(this).balance); }
// Overrides nécessaires
function _beforeTokenTransfer(address _operator, address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data) internal override(ERC1155, ERC1155Supply) {
super._beforeTokenTransfer(_operator, _from, _to, _ids, _amounts, _data);
}
function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC1155, ERC2981) returns (bool) {
return super.supportsInterface(_interfaceId);
}
// ROYALTIES via ERC-2981
function setDefaultRoyalty(address _receiver, uint96 _feeNumerator) external onlyOwner {
_setDefaultRoyalty(_receiver, _feeNumerator);
}
}
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
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;
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
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);
}
}
Pausable.sol 105 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
IERC2981.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}
IERC721.sol 132 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
ERC2981.sol 107 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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:
*
* - `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];
}
}
ERC1155.sol 497 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../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 private _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");
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");
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;
}
}
IERC1155.sol 119 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../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;
}
ReentrancyGuard.sol 77 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
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;
}
}
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);
}
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);
}
MerkleProof.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* 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.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
ERC1155Supply.sol 64 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of ERC1155 that adds tracking of total supply per id.
*
* Useful for scenarios where Fungible and Non-fungible tokens have to be
* clearly identified. Note: While a totalSupply of 1 might mean the
* corresponding is an NFT, there is no guarantees that no other token with the
* same id are not going to be minted.
*/
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 => uint256) private _totalSupply;
/**
* @dev Total amount of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Indicates whether any token exist with a given id, or not.
*/
function exists(uint256 id) public view virtual returns (bool) {
return ERC1155Supply.totalSupply(id) > 0;
}
/**
* @dev See {ERC1155-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (from == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] += amounts[i];
}
}
if (to == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 supply = _totalSupply[id];
require(supply >= amount, "ERC1155: burn amount exceeds totalSupply");
unchecked {
_totalSupply[id] = supply - amount;
}
}
}
}
}
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);
}
Read Contract
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
exists 0x4f558e79 → bool
getISCAddresses 0x70345c63 → address[]
getMintedTokensByAddress 0x15fbcaad → uint256
isApprovedForAll 0xe985e9c5 → bool
isUsedISCTokens 0x074eb53f → bool
name 0x06fdde03 → string
nextTokenID 0xf101e481 → uint256
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokens 0x4f64b2be → uint256, bytes32, string, bool
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
addToken 0xcc307530
uint256 _maxSupply
address[] _ISC
bytes32 _merkleTreeRoot
string _URI
airdrop 0xe417bc2a
address[] _recipients
uint256 _tokenId
bytes _data
lockTokenURI 0x45c0c502
uint256 _tokenID
mint 0x08dc9f42
uint256 _tokenID
uint256 _genesisTokenID
bytes _data
mintBatch 0x1f7fdffa
address _to
uint256[] _ids
uint256[] _amounts
bytes _data
mintExt 0xe71f0bc0
uint256 _tokenID
uint256 _amount
uint256 _maxMints
bytes32[] _proof
bytes _data
pause 0x8456cb59
No parameters
renounceOwnership 0x715018a6
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
setTokenURI 0x162094c4
uint256 _tokenID
string _newuri
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updateToken 0xd606fd58
uint256 _tokenID
uint256 _maxSupply
address[] _ISC
bytes32 _merkleTreeRoot
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address