Address Contract Partially Verified
Address
0x334AF25dBd2cd6b1bc99DDA88F77A46E6091e957
Balance
0 ETH
Nonce
1
Code Size
20471 bytes
Creator
0xB4A8955A...0d6c at tx 0xa415685f...89b8b1
Indexed Transactions
0 (1 on-chain, 0.9% indexed)
Contract Bytecode
20471 bytes
0x6080604052600436106102c55760003560e01c806382875f7911610179578063c01bd0e9116100d6578063dedf141e1161008a578063f242432a11610064578063f242432a14610885578063f2fde38b146108a5578063f5298aca146108c557600080fd5b8063dedf141e14610807578063e8a3d48514610827578063e985e9c51461083c57600080fd5b8063d6046836116100bb578063d604683614610746578063d6febde814610766578063da0321cd1461077957600080fd5b8063c01bd0e9146106f6578063c873d1aa1461073157600080fd5b8063a22cb4651161012d578063aeb2de3511610112578063aeb2de3514610698578063b375d492146106b8578063b39e12cf146106d857600080fd5b8063a22cb46514610658578063ae0aa35b1461067857600080fd5b8063927a97a11161015e578063927a97a1146105f7578063933a6f0d1461062357806395d89b411461064357600080fd5b806382875f79146105b05780638da5cb5b146105c557600080fd5b80632eb2c2d61161022757806358939061116101db57806366a4a49c116101c057806366a4a49c1461055b5780636b20c4541461057b578063715018a61461059b57600080fd5b8063589390611461051b5780635a4462151461053b57600080fd5b80634ed52c491161020c5780634ed52c491461049d57806354fd4d50146104b05780635547171d146104f957600080fd5b80632eb2c2d6146104505780634e1273f41461047057600080fd5b8063122ed6791161027e5780631f0f3547116102635780631f0f3547146103d157806326f1a1fd146103f15780632a55205a1461041157600080fd5b8063122ed67914610391578063166d44ea146103b157600080fd5b806306fdde03116102af57806306fdde031461032d5780630e89341c1461034f5780631218ee111461036f57600080fd5b8062fdd58e146102ca57806301ffc9a7146102fd575b600080fd5b3480156102d657600080fd5b506102ea6102e536600461415d565b6108e5565b6040519081526020015b60405180910390f35b34801561030957600080fd5b5061031d61031836600461419f565b61098e565b60405190151581526020016102f4565b34801561033957600080fd5b506103426109d2565b6040516102f49190614214565b34801561035b57600080fd5b5061034261036a366004614227565b610a67565b34801561037b57600080fd5b5061038f61038a366004614240565b610afb565b005b34801561039d57600080fd5b5061038f6103ac3660046142b7565b610c38565b3480156103bd57600080fd5b5061038f6103cc36600461435f565b610fcb565b3480156103dd57600080fd5b5061038f6103ec3660046143be565b61104a565b3480156103fd57600080fd5b506102ea61040c366004614227565b6111ed565b34801561041d57600080fd5b5061043161042c366004614444565b61120e565b604080516001600160a01b0390931683526020830191909152016102f4565b34801561045c57600080fd5b5061038f61046b3660046145b2565b611244565b34801561047c57600080fd5b5061049061048b366004614660565b6112e6565b6040516102f49190614768565b61038f6104ab36600461477b565b611424565b3480156104bc57600080fd5b506103426040518060400160405280600581526020017f322e322e3000000000000000000000000000000000000000000000000000000081525081565b34801561050557600080fd5b5061050e6115be565b6040516102f491906147d0565b34801561052757600080fd5b5061038f61053636600461435f565b61163b565b34801561054757600080fd5b5061038f610556366004614829565b6116bc565b34801561056757600080fd5b5061038f610576366004614895565b61173a565b34801561058757600080fd5b5061038f61059636600461490a565b611844565b3480156105a757600080fd5b5061038f6118c9565b3480156105bc57600080fd5b5061038f61192f565b3480156105d157600080fd5b506003546001600160a01b03165b6040516001600160a01b0390911681526020016102f4565b34801561060357600080fd5b5061060c61196f565b6040516102f49b9a99989796959493929190614980565b34801561062f57600080fd5b5061038f61063e366004614444565b611bdc565b34801561064f57600080fd5b50610342611c4c565b34801561066457600080fd5b5061038f610673366004614a0d565b611c5e565b34801561068457600080fd5b5061038f610693366004614a46565b611c6d565b3480156106a457600080fd5b5061038f6106b3366004614829565b611d5a565b3480156106c457600080fd5b5061038f6106d3366004614a63565b611e1e565b3480156106e457600080fd5b506004546001600160a01b03166105df565b34801561070257600080fd5b50610716610711366004614227565b611f26565b604080519384526020840192909252908201526060016102f4565b34801561073d57600080fd5b50610490611f59565b34801561075257600080fd5b5061038f61076136600461435f565b611fb0565b61038f610774366004614444565b612028565b34801561078557600080fd5b50600f546010546011546012546013546014546015546107be966001600160a01b03908116968116958116948116938116928116911687565b604080516001600160a01b039889168152968816602088015294871694860194909452918516606085015284166080840152831660a083015290911660c082015260e0016102f4565b34801561081357600080fd5b5061038f610822366004614444565b6120f1565b34801561083357600080fd5b50610342612161565b34801561084857600080fd5b5061031d610857366004614a7b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b34801561089157600080fd5b5061038f6108a0366004614aa9565b612173565b3480156108b157600080fd5b5061038f6108c0366004614a46565b6121fa565b3480156108d157600080fd5b5061038f6108e0366004614b12565b6122d9565b60006001600160a01b0383166109685760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b031982167f2a55205a0000000000000000000000000000000000000000000000000000000014806109cc57506109cc8261235e565b92915050565b6060600560000180546109e490614b47565b80601f0160208091040260200160405190810160405280929190818152602001828054610a1090614b47565b8015610a5d5780601f10610a3257610100808354040283529160200191610a5d565b820191906000526020600020905b815481529060010190602001808311610a4057829003601f168201915b5050505050905090565b606060028054610a7690614b47565b80601f0160208091040260200160405190810160405280929190818152602001828054610aa290614b47565b8015610aef5780601f10610ac457610100808354040283529160200191610aef565b820191906000526020600020905b815481529060010190602001808311610ad257829003601f168201915b50505050509050919050565b6004546001600160a01b0316336001600160a01b031614610b605760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b8160168581548110610b7457610b74614b7c565b90600052602060002001541115610bb7576040517f1d77a89900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82600e8581548110610bcb57610bcb614b7c565b90600052602060002090600302016000018190555081600e8581548110610bf457610bf4614b7c565b90600052602060002090600302016001018190555080600e8581548110610c1d57610c1d614b7c565b90600052602060002090600302016002018190555050505050565b6004546001600160a01b0316336001600160a01b031614610c9d5760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b323314610cbd57604051633ebb273b60e21b815260040160405180910390fd5b8460005b81811015610fc1576000868683818110610cdd57610cdd614b7c565b9050602002810190610cef9190614b92565b9050905060005b81811015610ec05760006016898986818110610d1457610d14614b7c565b9050602002810190610d269190614b92565b84818110610d3657610d36614b7c565b9050602002013581548110610d4d57610d4d614b7c565b90600052602060002001549050600e898986818110610d6e57610d6e614b7c565b9050602002810190610d809190614b92565b84818110610d9057610d90614b7c565b9050602002013581548110610da757610da7614b7c565b906000526020600020906003020160010154878786818110610dcb57610dcb614b7c565b9050602002810190610ddd9190614b92565b84818110610ded57610ded614b7c565b9050602002013582610dff9190614bf2565b1115610e1e57604051638a164f6360e01b815260040160405180910390fd5b868685818110610e3057610e30614b7c565b9050602002810190610e429190614b92565b83818110610e5257610e52614b7c565b90506020020135810190508060168a8a87818110610e7257610e72614b7c565b9050602002810190610e849190614b92565b85818110610e9457610e94614b7c565b9050602002013581548110610eab57610eab614b7c565b60009182526020909120015550600101610cf6565b50610fb8898984818110610ed657610ed6614b7c565b9050602002016020810190610eeb9190614a46565b888885818110610efd57610efd614b7c565b9050602002810190610f0f9190614b92565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508a9250899150879050818110610f5557610f55614b7c565b9050602002810190610f679190614b92565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080518082019091526002815261060f60f31b602082015291506123f99050565b50600101610cc1565b5050505050505050565b6004546001600160a01b0316336001600160a01b0316146110305760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b600980549115156101000261ff0019909216919091179055565b32331461106a57604051633ebb273b60e21b815260040160405180910390fd5b82421061108a57604051630819bdcd60e01b815260040160405180910390fd5b6040805130606090811b6bffffffffffffffffffffffff1990811660208085019190915233831b821660348501528b831b82166048850152918a901b16605c830152607082018890526090820187905260b08083018790528351808403909101815260d0830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060f084015261010c8084018290528451808503909101815261012c9093019093528151910120600090601154604080516020601f88018190048102820181019092528681529293506001600160a01b03909116916111949184919088908890819084018382808284376000920191909152506125ce92505050565b6001600160a01b0316146111bb57604051631648fd0160e01b815260040160405180910390fd5b6111e28989898960405180604001604052806002815260200161060f60f31b815250612173565b505050505050505050565b601681815481106111fd57600080fd5b600091825260209091200154905081565b601554600d546001600160a01b0390911690600090612710906112319085614c0a565b61123b9190614c29565b90509250929050565b6001600160a01b03851633148061126057506112608533610857565b6112d25760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606482015260840161095f565b6112df85858585856125ea565b5050505050565b6060815183511461135f5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161095f565b6000835167ffffffffffffffff81111561137b5761137b614466565b6040519080825280602002602001820160405280156113a4578160200160208202803683370190505b50905060005b845181101561141c576113ef8582815181106113c8576113c8614b7c565b60200260200101518583815181106113e2576113e2614b7c565b60200260200101516108e5565b82828151811061140157611401614b7c565b602090810291909101015261141581614c4b565b90506113aa565b509392505050565b60095460ff1661144757604051639d7da54560e01b815260040160405180910390fd5b32331461146757604051633ebb273b60e21b815260040160405180910390fd5b82421061148757604051630819bdcd60e01b815260040160405180910390fd5b6040805130606090811b6bffffffffffffffffffffffff199081166020808501919091523390921b16603483015260488201899052606882018890526088820187905260a8820186905260c88083018b90528351808403909101815260e8830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a333200000000610108840152610124808401829052845180850390910181526101449093019093528151910120600090601154604080516020601f88018190048102820181019092528681529293506001600160a01b039091169161158c9184919088908890819084018382808284376000920191909152506125ce92505050565b6001600160a01b0316146115b357604051631648fd0160e01b815260040160405180910390fd5b6111e2898989612856565b6060600e805480602002602001604051908101604052809291908181526020016000905b8282101561163257838290600052602060002090600302016040518060600160405290816000820154815260200160018201548152602001600282015481525050815260200190600101906115e2565b50505050905090565b6004546001600160a01b0316336001600160a01b0316146116a05760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b60098054911515620100000262ff000019909216919091179055565b6004546001600160a01b0316336001600160a01b0316146117215760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b61172d6005858561403b565b506112df6006838361403b565b6004546001600160a01b0316336001600160a01b03161461179f5760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b60005b8181101561183f576016805460018101825560009182527fd833147d7dc355ba459fc788f669e58cfaf9dc25ddcd0702e87d69c7b51242890155600e8383838181106117f0576117f0614b7c565b83546001810185556000948552602090942060609091029290920192600302909101905061183582828135815560208201356001820155604082013560028201555050565b50506001016117a2565b505050565b6001600160a01b03831633148061186057506118608333610857565b6118be5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201526808185c1c1c9bdd995960ba1b606482015260840161095f565b61183f838383612bcb565b6003546001600160a01b031633146119235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161095f565b61192d6000612e20565b565b600f546001600160a01b0316331461195a57604051631648fd0160e01b815260040160405180910390fd5b600f5461192d906001600160a01b0316612e72565b60058054819061197e90614b47565b80601f01602080910402602001604051908101604052809291908181526020018280546119aa90614b47565b80156119f75780601f106119cc576101008083540402835291602001916119f7565b820191906000526020600020905b8154815290600101906020018083116119da57829003601f168201915b505050505090806001018054611a0c90614b47565b80601f0160208091040260200160405190810160405280929190818152602001828054611a3890614b47565b8015611a855780601f10611a5a57610100808354040283529160200191611a85565b820191906000526020600020905b815481529060010190602001808311611a6857829003601f168201915b505050505090806002018054611a9a90614b47565b80601f0160208091040260200160405190810160405280929190818152602001828054611ac690614b47565b8015611b135780601f10611ae857610100808354040283529160200191611b13565b820191906000526020600020905b815481529060010190602001808311611af657829003601f168201915b505050505090806003018054611b2890614b47565b80601f0160208091040260200160405190810160405280929190818152602001828054611b5490614b47565b8015611ba15780601f10611b7657610100808354040283529160200191611ba1565b820191906000526020600020905b815481529060010190602001808311611b8457829003601f168201915b505050506004830154600584015460068501546007860154600890960154949560ff808516966101008604821696506201000090950416938b565b6004546001600160a01b0316336001600160a01b031614611c415760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b600c91909155600d55565b6060600560010180546109e490614b47565b611c69338383612ec4565b5050565b6004546001600160a01b0316336001600160a01b031614611cd25760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b6001600160a01b038116611d4e5760405162461bcd60e51b815260206004820152602f60248201527f4f776e61626c653a206e657720636f6e7472616374206f776e6572206973207460448201527f6865207a65726f20616464726573730000000000000000000000000000000000606482015260840161095f565b611d5781612e72565b50565b6004546001600160a01b0316336001600160a01b031614611dbf5760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b611dcb6007858561403b565b50611dd86008838361403b565b50611e1882828080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fb992505050565b50505050565b6004546001600160a01b0316336001600160a01b031614611e835760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b600f546001600160a01b0316611e9c6020830183614a46565b6001600160a01b031614611edc576040517f9598453c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611eec6040820160208301614a46565b6010546001600160a01b03908116911614611f1957611f19611f146040830160208401614a46565b612e20565b80600f61183f8282614c66565b600e8181548110611f3657600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b60606016805480602002602001604051908101604052809291908181526020018280548015610a5d57602002820191906000526020600020905b815481526020019060010190808311611f93575050505050905090565b6004546001600160a01b0316336001600160a01b0316146120155760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b6009805460ff1916911515919091179055565b60095460ff1661204b57604051639d7da54560e01b815260040160405180910390fd5b32331461206b57604051633ebb273b60e21b815260040160405180910390fd5b600a54158061207b5750600a5442105b156120b2576040517fdd4e010600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081600e84815481106120c8576120c8614b7c565b9060005260206000209060030201600001546120e49190614c0a565b905061183f838383612856565b6004546001600160a01b0316336001600160a01b0316146121565760405162461bcd60e51b815260206004820152602b6024820152600080516020614fa283398151915260448201526a30b1ba1036b0b730b3b2b960a91b606482015260840161095f565b600a91909155600b55565b6060600560020180546109e490614b47565b6001600160a01b03851633148061218f575061218f8533610857565b6121ed5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201526808185c1c1c9bdd995960ba1b606482015260840161095f565b6112df8585858585612fcc565b6003546001600160a01b031633146122545760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161095f565b6001600160a01b0381166122d05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161095f565b611d5781612e20565b6001600160a01b0383163314806122f557506122f58333610857565b6123535760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201526808185c1c1c9bdd995960ba1b606482015260840161095f565b61183f83838361317a565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806123c157506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b806109cc57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316146109cc565b6001600160a01b0384166124595760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840161095f565b81518351146124bb5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b606482015260840161095f565b336124cb8160008787878761330a565b60005b8451811015612566578381815181106124e9576124e9614b7c565b602002602001015160008087848151811061250657612506614b7c565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b03168152602001908152602001600020600082825461254e9190614bf2565b9091555081905061255e81614c4b565b9150506124ce565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516125b7929190614d97565b60405180910390a46112df816000878787876135c3565b60008060006125dd8585613769565b9150915061141c816137d9565b815183511461264c5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b606482015260840161095f565b6001600160a01b0384166126b05760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161095f565b336126bf81878787878761330a565b60005b84518110156127e85760008582815181106126df576126df614b7c565b6020026020010151905060008583815181106126fd576126fd614b7c565b602090810291909101810151600084815280835260408082206001600160a01b038e1683529093529190912054909150818110156127905760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161095f565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906127cd908490614bf2565b92505081905550505050806127e190614c4b565b90506126c2565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612838929190614d97565b60405180910390a461284e8187878787876135c3565b505050505050565b600b541561289957600b544210612899576040517f4c013bd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000601684815481106128ae576128ae614b7c565b906000526020600020015490506000600e85815481106128d0576128d0614b7c565b90600052602060002090600302016001015490508084836128f19190614bf2565b111561291057604051638a164f6360e01b815260040160405180910390fd5b6000600e868154811061292557612925614b7c565b90600052602060002090600302016002015490508060001461297b578085111561297b576040517fe9a8adbf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c546000906127109061298f9087614c0a565b6129999190614c29565b6012549091506001600160a01b031615612a0f576012546001600160a01b031681156129db576013546129db906001600160a01b038381169133911685613994565b601454612a099033906001600160a01b03166129f7858a614dc5565b6001600160a01b038516929190613994565b50612b75565b84341015612a49576040517f7e6fc84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8015612ade576013546040516000916001600160a01b03169083908381818185875af1925050503d8060008114612a9c576040519150601f19603f3d011682016040523d82523d6000602084013e612aa1565b606091505b5050905080612adc576040517ff1fc694900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6014546000906001600160a01b0316612af78388614dc5565b604051600081818185875af1925050503d8060008114612b33576040519150601f19603f3d011682016040523d82523d6000602084013e612b38565b606091505b5050905080612b73576040517f475c941300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b85840193508360168881548110612b8e57612b8e614b7c565b9060005260206000200181905550612bc233888860405180604001604052806002815260200161060f60f31b815250613a1c565b50505050505050565b6001600160a01b038316612c2d5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b606482015260840161095f565b8051825114612c8f5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b606482015260840161095f565b6000339050612cb28185600086866040518060200160405280600081525061330a565b60005b8351811015612db3576000848281518110612cd257612cd2614b7c565b602002602001015190506000848381518110612cf057612cf0614b7c565b602090810291909101810151600084815280835260408082206001600160a01b038c168352909352919091205490915081811015612d7c5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b606482015260840161095f565b6000928352602083815260408085206001600160a01b038b1686529091529092209103905580612dab81614c4b565b915050612cb5565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612e04929190614d97565b60405180910390a4604080516020810190915260009052611e18565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5fb4f5c581870540f90f9705018e944972197c5be2aa889f6bb847b6cd2236e190600090a35050565b816001600160a01b0316836001600160a01b03161415612f4c5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161095f565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b8051611c699060029060208401906140bf565b6001600160a01b0384166130305760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b606482015260840161095f565b33600061303c85613b36565b9050600061304985613b36565b905061305983898985858961330a565b6000868152602081815260408083206001600160a01b038c168452909152902054858110156130dd5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b606482015260840161095f565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a1682528120805488929061311a908490614bf2565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46111e2848a8a8a8a8a613b81565b6001600160a01b0383166131dc5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b606482015260840161095f565b3360006131e884613b36565b905060006131f584613b36565b90506132158387600085856040518060200160405280600081525061330a565b6000858152602081815260408083206001600160a01b038a168452909152902054848110156132925760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b606482015260840161095f565b6000868152602081815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4604080516020810190915260009052612bc2565b604080517fb39e12cf0000000000000000000000000000000000000000000000000000000081529051869186916001600160a01b0380851615929084161591600091309163b39e12cf916004808201926020929091908290030181865afa158015613379573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061339d9190614ddc565b6001600160a01b0386811691161490506000356001600160e01b0319167f1f0f35470000000000000000000000000000000000000000000000000000000014831580156133e8575081155b80156133f2575082155b80156133fc575080155b1561344257600954610100900460ff16613442576040517f8574adcf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6009548b9062010000900460ff168061345a576135b3565b6daaeb6d7670e522a718067333cd4e3b156135b3576001600160a01b038216331415613485576135b3565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156134d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f89190614df9565b801561357b5750604051633185c44d60e21b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015613557573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061357b9190614df9565b6135b3576040517fede71dcc00000000000000000000000000000000000000000000000000000000815233600482015260240161095f565b5050505050505050505050505050565b6001600160a01b0384163b1561284e5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906136079089908990889088908890600401614e16565b6020604051808303816000875af1925050508015613642575060408051601f3d908101601f1916820190925261363f91810190614e74565b60015b6136f85761364e614e91565b806308c379a014156136885750613663614ead565b8061366e575061368a565b8060405162461bcd60e51b815260040161095f9190614214565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161095f565b6001600160e01b0319811663bc197c8160e01b14612bc25760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161095f565b6000808251604114156137a05760208301516040840151606085015160001a61379487828585613c7d565b945094505050506137d2565b8251604014156137ca57602083015160408401516137bf868383613d6a565b9350935050506137d2565b506000905060025b9250929050565b60008160048111156137ed576137ed614f37565b14156137f65750565b600181600481111561380a5761380a614f37565b14156138585760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161095f565b600281600481111561386c5761386c614f37565b14156138ba5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161095f565b60038160048111156138ce576138ce614f37565b14156139275760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161095f565b600481600481111561393b5761393b614f37565b1415611d575760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161095f565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611e18908590613dbc565b6001600160a01b038416613a7c5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b606482015260840161095f565b336000613a8885613b36565b90506000613a9585613b36565b9050613aa68360008985858961330a565b6000868152602081815260408083206001600160a01b038b16845290915281208054879290613ad6908490614bf2565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612bc283600089898989613b81565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110613b7057613b70614b7c565b602090810291909101015292915050565b6001600160a01b0384163b1561284e5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190613bc59089908990889088908890600401614f4d565b6020604051808303816000875af1925050508015613c00575060408051601f3d908101601f19168201909252613bfd91810190614e74565b60015b613c0c5761364e614e91565b6001600160e01b0319811663f23a6e6160e01b14612bc25760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b606482015260840161095f565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613cb45750600090506003613d61565b8460ff16601b14158015613ccc57508460ff16601c14155b15613cdd5750600090506004613d61565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613d31573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613d5a57600060019250925050613d61565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681613da060ff86901c601b614bf2565b9050613dae87828885613c7d565b935093505050935093915050565b6000613e11826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613ea19092919063ffffffff16565b80519091501561183f5780806020019051810190613e2f9190614df9565b61183f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161095f565b6060613eb08484600085613eba565b90505b9392505050565b606082471015613f325760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161095f565b6001600160a01b0385163b613f895760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161095f565b600080866001600160a01b03168587604051613fa59190614f85565b60006040518083038185875af1925050503d8060008114613fe2576040519150601f19603f3d011682016040523d82523d6000602084013e613fe7565b606091505b5091509150613ff7828286614002565b979650505050505050565b60608315614011575081613eb3565b8251156140215782518084602001fd5b8160405162461bcd60e51b815260040161095f9190614214565b82805461404790614b47565b90600052602060002090601f01602090048101928261406957600085556140af565b82601f106140825782800160ff198235161785556140af565b828001600101855582156140af579182015b828111156140af578235825591602001919060010190614094565b506140bb929150614133565b5090565b8280546140cb90614b47565b90600052602060002090601f0160209004810192826140ed57600085556140af565b82601f1061410657805160ff19168380011785556140af565b828001600101855582156140af579182015b828111156140af578251825591602001919060010190614118565b5b808211156140bb5760008155600101614134565b6001600160a01b0381168114611d5757600080fd5b6000806040838503121561417057600080fd5b823561417b81614148565b946020939093013593505050565b6001600160e01b031981168114611d5757600080fd5b6000602082840312156141b157600080fd5b8135613eb381614189565b60005b838110156141d75781810151838201526020016141bf565b83811115611e185750506000910152565b600081518084526142008160208601602086016141bc565b601f01601f19169290920160200192915050565b602081526000613eb360208301846141e8565b60006020828403121561423957600080fd5b5035919050565b6000806000806080858703121561425657600080fd5b5050823594602084013594506040840135936060013592509050565b60008083601f84011261428457600080fd5b50813567ffffffffffffffff81111561429c57600080fd5b6020830191508360208260051b85010111156137d257600080fd5b600080600080600080606087890312156142d057600080fd5b863567ffffffffffffffff808211156142e857600080fd5b6142f48a838b01614272565b9098509650602089013591508082111561430d57600080fd5b6143198a838b01614272565b9096509450604089013591508082111561433257600080fd5b5061433f89828a01614272565b979a9699509497509295939492505050565b8015158114611d5757600080fd5b60006020828403121561437157600080fd5b8135613eb381614351565b60008083601f84011261438e57600080fd5b50813567ffffffffffffffff8111156143a657600080fd5b6020830191508360208285010111156137d257600080fd5b600080600080600080600060c0888a0312156143d957600080fd5b87356143e481614148565b965060208801356143f481614148565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff81111561442557600080fd5b6144318a828b0161437c565b989b979a50959850939692959293505050565b6000806040838503121561445757600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff811182821017156144a2576144a2614466565b6040525050565b600067ffffffffffffffff8211156144c3576144c3614466565b5060051b60200190565b600082601f8301126144de57600080fd5b813560206144eb826144a9565b6040516144f8828261447c565b83815260059390931b850182019282810191508684111561451857600080fd5b8286015b84811015614533578035835291830191830161451c565b509695505050505050565b600082601f83011261454f57600080fd5b813567ffffffffffffffff81111561456957614569614466565b604051614580601f8301601f19166020018261447c565b81815284602083860101111561459557600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156145ca57600080fd5b85356145d581614148565b945060208601356145e581614148565b9350604086013567ffffffffffffffff8082111561460257600080fd5b61460e89838a016144cd565b9450606088013591508082111561462457600080fd5b61463089838a016144cd565b9350608088013591508082111561464657600080fd5b506146538882890161453e565b9150509295509295909350565b6000806040838503121561467357600080fd5b823567ffffffffffffffff8082111561468b57600080fd5b818501915085601f83011261469f57600080fd5b813560206146ac826144a9565b6040516146b9828261447c565b83815260059390931b85018201928281019150898411156146d957600080fd5b948201945b838610156147005785356146f181614148565b825294820194908201906146de565b9650508601359250508082111561471657600080fd5b50614723858286016144cd565b9150509250929050565b600081518084526020808501945080840160005b8381101561475d57815187529582019590820190600101614741565b509495945050505050565b602081526000613eb3602083018461472d565b600080600080600080600060c0888a03121561479657600080fd5b873596506020880135955060408801359450606088013593506080880135925060a088013567ffffffffffffffff81111561442557600080fd5b602080825282518282018190526000919060409081850190868401855b8281101561481c57815180518552868101518786015285015185850152606090930192908501906001016147ed565b5091979650505050505050565b6000806000806040858703121561483f57600080fd5b843567ffffffffffffffff8082111561485757600080fd5b6148638883890161437c565b9096509450602087013591508082111561487c57600080fd5b506148898782880161437c565b95989497509550505050565b600080602083850312156148a857600080fd5b823567ffffffffffffffff808211156148c057600080fd5b818501915085601f8301126148d457600080fd5b8135818111156148e357600080fd5b8660206060830285010111156148f857600080fd5b60209290920196919550909350505050565b60008060006060848603121561491f57600080fd5b833561492a81614148565b9250602084013567ffffffffffffffff8082111561494757600080fd5b614953878388016144cd565b9350604086013591508082111561496957600080fd5b50614976868287016144cd565b9150509250925092565b60006101608083526149948184018f6141e8565b905082810360208401526149a8818e6141e8565b905082810360408401526149bc818d6141e8565b905082810360608401526149d0818c6141e8565b9915156080840152505095151560a087015293151560c086015260e085019290925261010084015261012083015261014090910152949350505050565b60008060408385031215614a2057600080fd5b8235614a2b81614148565b91506020830135614a3b81614351565b809150509250929050565b600060208284031215614a5857600080fd5b8135613eb381614148565b600060e08284031215614a7557600080fd5b50919050565b60008060408385031215614a8e57600080fd5b8235614a9981614148565b91506020830135614a3b81614148565b600080600080600060a08688031215614ac157600080fd5b8535614acc81614148565b94506020860135614adc81614148565b93506040860135925060608601359150608086013567ffffffffffffffff811115614b0657600080fd5b6146538882890161453e565b600080600060608486031215614b2757600080fd5b8335614b3281614148565b95602085013595506040909401359392505050565b600181811c90821680614b5b57607f821691505b60208210811415614a7557634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112614ba957600080fd5b83018035915067ffffffffffffffff821115614bc457600080fd5b6020019150600581901b36038213156137d257600080fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115614c0557614c05614bdc565b500190565b6000816000190483118215151615614c2457614c24614bdc565b500290565b600082614c4657634e487b7160e01b600052601260045260246000fd5b500490565b6000600019821415614c5f57614c5f614bdc565b5060010190565b8135614c7181614148565b81546001600160a01b0319166001600160a01b038216178255506020820135614c9981614148565b6001820180546001600160a01b0319166001600160a01b038316179055506040820135614cc581614148565b6002820180546001600160a01b0319166001600160a01b038316179055506060820135614cf181614148565b6003820180546001600160a01b0319166001600160a01b038316179055506080820135614d1d81614148565b6004820180546001600160a01b0319166001600160a01b0383161790555060a0820135614d4981614148565b6005820180546001600160a01b0319166001600160a01b0383161790555060c0820135614d7581614148565b6006820180546001600160a01b0319166001600160a01b038316179055505050565b604081526000614daa604083018561472d565b8281036020840152614dbc818561472d565b95945050505050565b600082821015614dd757614dd7614bdc565b500390565b600060208284031215614dee57600080fd5b8151613eb381614148565b600060208284031215614e0b57600080fd5b8151613eb381614351565b60006001600160a01b03808816835280871660208401525060a06040830152614e4260a083018661472d565b8281036060840152614e54818661472d565b90508281036080840152614e6881856141e8565b98975050505050505050565b600060208284031215614e8657600080fd5b8151613eb381614189565b600060033d1115614eaa5760046000803e5060005160e01c5b90565b600060443d1015614ebb5790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715614eeb57505050505090565b8285019150815181811115614f035750505050505090565b843d8701016020828501011115614f1d5750505050505090565b614f2c6020828601018761447c565b509095945050505050565b634e487b7160e01b600052602160045260246000fd5b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613ff760a08301846141e8565b60008251614f978184602087016141bc565b919091019291505056fe4f776e61626c653a2063616c6c6572206973206e6f742074686520636f6e7472a26469706673582212206cccee37e9baa679b76c1acf454cf8e377cbdd422176e2ed9627e866321a97bb64736f6c634300080a0033
Verified Source Code Partial Match
Compiler: v0.8.10+commit.fc410830
EVM: london
Optimization: Yes (1000 runs)
Ownable_1_0_0.sol 133 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/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;
address private _contractManager;
event ContractManagerTransferred(
address indexed previousContractManager,
address indexed newContractManager
);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferContractManager(msg.sender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
'Ownable: new owner is the zero address'
);
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev Returns the manager of the contract
*/
function contractManager() public view virtual returns (address) {
return _contractManager;
}
/**
* @dev Throws if called by any account other than the Contract Manager.
*/
modifier onlyContractManager() {
require(
_msgSender() == _contractManager,
'Ownable: caller is not the contract manager'
);
_;
}
/**
* @dev Transfers manager of the contract to a new account (`newContractManager`).
* Can only be called by the current _contractManager.
*/
function transferContractManager(
address newContractManager
) public virtual onlyContractManager {
require(
newContractManager != address(0),
'Ownable: new contract owner is the zero address'
);
_transferContractManager(newContractManager);
}
/**
* @dev Transfers management of the contract to a new account (`newContractManager`).
* Internal function without access restriction.
*/
function _transferContractManager(
address newContractManager
) internal virtual {
address oldContractManager = _contractManager;
_contractManager = newContractManager;
emit ContractManagerTransferred(oldContractManager, newContractManager);
}
}
HyperMintERC1155_2_2_0.sol 447 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import '@openzeppelin/contracts/interfaces/IERC2981.sol';
import '@openzeppelin/contracts/interfaces/IERC20.sol';
import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol';
import './opensea-operator-filter/OperatorFilterer.sol';
import './Ownable_1_0_0.sol';
import './Interfaces/IHyperMintERC1155_2_2_0.sol';
contract HyperMintERC1155_2_2_0 is
IHyperMintERC1155_2_2_0,
ERC1155Burnable,
Ownable,
OperatorFilterer
{
using SafeERC20 for IERC20;
/* ================= STATE VARIABLES ================= */
// ========= Immutable Storage =========
uint256 internal constant BASIS_POINTS = 10000;
// ========== Mutable Storage ==========
string public constant version = '2.2.0';
GeneralConfig public generalConfig;
TokenConfig[] public tokenConfigs;
Addresses public addresses;
uint256[] public supplies;
/* =================== CONSTRUCTOR =================== */
/// @param _generalConfig settings for the contract
/// @param _addresses a collection of addresses
constructor(
GeneralConfig memory _generalConfig,
Addresses memory _addresses
)
ERC1155('')
OperatorFilterer(
address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6), // default filter by OS
true // subscribe to the filter list
)
{
_transferOwnership(_addresses.collectionOwnerAddress);
generalConfig = _generalConfig;
addresses = _addresses;
_setURI(generalConfig.tokenMetadataUrl);
}
/* ====================== Views ====================== */
function getTokenConfigs()
external
view
returns (TokenConfig[] memory configs)
{
configs = tokenConfigs;
}
function getSupplies()
external
view
returns (uint256[] memory tokenSupplies)
{
tokenSupplies = supplies;
}
function name() public view returns (string memory collectionName) {
collectionName = generalConfig.name;
}
function symbol() public view returns (string memory collectionSymbol) {
collectionSymbol = generalConfig.symbol;
}
function contractURI() public view virtual returns (string memory uri) {
uri = generalConfig.contractMetadataUrl;
}
function royaltyInfo(
uint256 _tokenId,
uint256 _salePrice
) external view returns (address royaltyAddress, uint256 royaltyAmount) {
/// @dev secondary royalty to be paid out by the marketplace
/// to the splitter contract
royaltyAddress = addresses.secondaryRoyaltyAddress;
royaltyAmount =
(_salePrice * generalConfig.secondaryRoyaltyFee) /
BASIS_POINTS;
}
function supportsInterface(
bytes4 _interfaceId
)
public
view
virtual
override(ERC1155, IHyperMintERC1155_2_2_0)
returns (bool result)
{
result = (_interfaceId == type(IERC2981).interfaceId ||
super.supportsInterface(_interfaceId));
}
/* ================ MUTATIVE FUNCTIONS ================ */
// ============ Restricted =============
function setNameAndSymbol(
string calldata _newName,
string calldata _newSymbol
) external onlyContractManager {
generalConfig.name = _newName;
generalConfig.symbol = _newSymbol;
}
function setMetadataURIs(
string calldata _contractURI,
string calldata _tokenURI
) external onlyContractManager {
generalConfig.contractMetadataUrl = _contractURI;
generalConfig.tokenMetadataUrl = _tokenURI;
_setURI(_tokenURI);
}
function setDates(
uint256 _publicSale,
uint256 _saleClosed
) external onlyContractManager {
generalConfig.publicSaleDate = _publicSale;
generalConfig.saleCloseDate = _saleClosed;
}
function setTokenConfig(
uint256 _id,
uint256 _price,
uint256 _maxSupply,
uint256 _maxPerTransaction
) external onlyContractManager {
if (supplies[_id] > _maxSupply) revert NewSupplyTooLow();
tokenConfigs[_id].price = _price;
tokenConfigs[_id].maxSupply = _maxSupply;
tokenConfigs[_id].maxPerTransaction = _maxPerTransaction;
}
function setAddresses(
Addresses calldata _addresses
) external onlyContractManager {
if (_addresses.recoveryAddress != addresses.recoveryAddress)
revert ImmutableRecoveryAddress();
if (
addresses.collectionOwnerAddress !=
_addresses.collectionOwnerAddress
) {
_transferOwnership(_addresses.collectionOwnerAddress);
}
addresses = _addresses;
}
function setAllowBuy(bool _allowBuy) external onlyContractManager {
generalConfig.allowBuy = _allowBuy;
}
function setAllowPublicTransfer(
bool _allowPublicTransfer
) external onlyContractManager {
generalConfig.allowPublicTransfer = _allowPublicTransfer;
}
function setEnableOpenSeaOperatorFilterRegistry(
bool _enable
) external onlyContractManager {
generalConfig.enableOpenSeaOperatorFilterRegistry = _enable;
}
function setRoyalty(
uint256 _primaryFee,
uint256 _secondaryFee
) external onlyContractManager {
generalConfig.primaryRoyaltyFee = _primaryFee;
generalConfig.secondaryRoyaltyFee = _secondaryFee;
}
function addTokens(
TokenConfig[] calldata _tokens
) external onlyContractManager {
for (uint256 i = 0; i < _tokens.length; ) {
supplies.push(0);
tokenConfigs.push(_tokens[i]);
unchecked {
++i;
}
}
}
// ============== Minting ==============
function mintBatch(
address[] calldata _to,
uint256[][] calldata _ids,
uint256[][] calldata _amounts
) external onlyContractManager nonContract {
uint256 toLength = _to.length;
for (uint256 i = 0; i < toLength; ) {
uint256 idsLength = _ids[i].length;
for (uint256 j = 0; j < idsLength; ) {
uint256 _supply = supplies[_ids[i][j]];
if (
_supply + _amounts[i][j] >
tokenConfigs[_ids[i][j]].maxSupply
) revert MaxSupplyExceeded();
/// @dev remove overflow protection enabled by default
/// as supplies is already capped by totalSupplies
unchecked {
_supply += _amounts[i][j];
}
/// @dev write back to storage
supplies[_ids[i][j]] = _supply;
unchecked {
++j;
}
}
_mintBatch(_to[i], _ids[i], _amounts[i], '0x');
unchecked {
++i;
}
}
}
// ================ Buy ================
function buyAuthorised(
uint256 _id,
uint256 _amount,
uint256 _totalPrice,
uint256 _maxPerAddress,
uint256 _expires,
bytes calldata _signature
) external payable buyAllowed nonContract {
if (block.timestamp >= _expires) revert SignatureExpired();
bytes32 hash = keccak256(
abi.encodePacked(
address(this),
msg.sender,
_amount,
_totalPrice,
_maxPerAddress,
_expires,
_id
)
);
bytes32 message = ECDSA.toEthSignedMessageHash(hash);
if (
ECDSA.recover(message, _signature) != addresses.authorisationAddress
) revert NotAuthorised();
_buy(_id, _amount, _totalPrice);
}
function buy(
uint256 _id,
uint256 _amount
) external payable buyAllowed nonContract {
if (
generalConfig.publicSaleDate == 0 ||
block.timestamp < generalConfig.publicSaleDate
) revert PublicSaleClosed();
uint256 totalPrice = tokenConfigs[_id].price * _amount;
_buy(_id, _amount, totalPrice);
}
function _buy(uint256 _id, uint256 _amount, uint256 _totalPrice) internal {
if (generalConfig.saleCloseDate != 0) {
if (block.timestamp >= generalConfig.saleCloseDate)
revert SaleClosed();
}
uint256 _supply = supplies[_id];
uint256 _maxSupply = tokenConfigs[_id].maxSupply;
if (_supply + _amount > _maxSupply) revert MaxSupplyExceeded();
uint256 _maxPerTransaction = tokenConfigs[_id].maxPerTransaction;
if (_maxPerTransaction != 0) {
if (_amount > _maxPerTransaction)
revert MaxPerTransactionsExceeded();
}
uint256 royaltyAmount = (_totalPrice *
generalConfig.primaryRoyaltyFee) / BASIS_POINTS;
if (addresses.purchaseTokenAddress != address(0)) {
IERC20 token = IERC20(addresses.purchaseTokenAddress);
/// @dev primary royalty cut for HyperMint
if (royaltyAmount != 0) {
// only transfer if royaltyAmount is non-zero so we don't waste gas
token.safeTransferFrom(
msg.sender,
addresses.managerPrimaryRoyaltyAddress,
royaltyAmount
);
}
/// @dev primary sale (i.e. minting revenue) for customer (or its payees)
token.safeTransferFrom(
msg.sender,
addresses.customerPrimaryRoyaltyAddress,
_totalPrice - royaltyAmount
);
} else {
if (msg.value < _totalPrice) revert InsufficientPaymentValue();
/// @dev primary royalty cut for HyperMint
if (royaltyAmount != 0) {
// only transfer if royaltyAmount is non-zero so we don't waste gas
(bool successManager, ) = addresses
.managerPrimaryRoyaltyAddress
.call{value: royaltyAmount}('');
if (!successManager) revert PayoutToManagerFailed();
}
/// @dev primary sale (i.e. minting revenue) for customer (or its payees)
(bool successCustomer, ) = addresses
.customerPrimaryRoyaltyAddress
.call{value: _totalPrice - royaltyAmount}('');
if (!successCustomer) revert PayoutToCustomerFailed();
}
/// @dev remove overflow protection enabled by default
/// as supply is already capped by totalSupply
unchecked {
_supply += _amount;
}
/// @dev write back to storage
supplies[_id] = _supply;
_mint(msg.sender, _id, _amount, '0x');
}
// ================ Transfers ================
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
)
internal
override(ERC1155)
transferAllowed(from, to)
onlyAllowedOperator(
from,
generalConfig.enableOpenSeaOperatorFilterRegistry
)
{
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
}
function transferAuthorised(
address _from,
address _to,
uint256 _tokenId,
uint256 _amount,
uint256 _expires,
bytes calldata _signature
) external nonContract {
if (block.timestamp >= _expires) revert SignatureExpired();
bytes32 hash = keccak256(
abi.encodePacked(
address(this),
msg.sender,
_from,
_to,
_tokenId,
_amount,
_expires
)
);
bytes32 message = ECDSA.toEthSignedMessageHash(hash);
if (
ECDSA.recover(message, _signature) != addresses.authorisationAddress
) revert NotAuthorised();
super.safeTransferFrom(_from, _to, _tokenId, _amount, '0x');
}
// ============= Ownership=============
function recoverContract() external {
if (msg.sender != addresses.recoveryAddress) revert NotAuthorised();
_transferContractManager(addresses.recoveryAddress);
}
/* ==================== MODIFIERS ===================== */
modifier buyAllowed() {
if (!generalConfig.allowBuy) revert BuyDisabled();
_;
}
/// @dev this eliminates the possibility of being called
/// from a contract
modifier nonContract() {
if (tx.origin != msg.sender) revert ContractCallBlocked();
_;
}
modifier transferAllowed(address from, address to) {
bool isMinting = from == address(0);
bool isBurning = to == address(0);
bool isContractManager = from == this.contractManager();
bool isTransferAuthorised = msg.sig == this.transferAuthorised.selector;
if (
!isMinting &&
!isContractManager &&
!isBurning &&
!isTransferAuthorised
) {
if (!generalConfig.allowPublicTransfer) revert TransfersDisabled();
}
_;
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
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;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
IERC20.sol 6 lines
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
IERC2981.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
ERC1155.sol 511 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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: balance query for the zero address");
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 owner nor 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: transfer caller is not owner nor 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}.
*
* 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`
*
* 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}.
*
* 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 a {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 `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 _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 125 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 be 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;
}
ECDSA.sol 230 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
IHyperMintERC1155_2_2_0.sol 141 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
// ============== Structs ==============
struct GeneralConfig {
string name;
string symbol;
string contractMetadataUrl;
string tokenMetadataUrl;
bool allowBuy;
bool allowPublicTransfer;
bool enableOpenSeaOperatorFilterRegistry;
uint256 publicSaleDate;
uint256 saleCloseDate;
uint256 primaryRoyaltyFee;
uint256 secondaryRoyaltyFee;
}
struct TokenConfig {
uint256 price;
uint256 maxSupply;
uint256 maxPerTransaction;
}
struct Addresses {
address recoveryAddress;
address collectionOwnerAddress;
address authorisationAddress;
address purchaseTokenAddress;
address managerPrimaryRoyaltyAddress;
address customerPrimaryRoyaltyAddress;
address secondaryRoyaltyAddress;
}
interface IHyperMintERC1155_2_2_0 {
/* ================= CUSTOM ERRORS ================= */
error NewSupplyTooLow();
error ArrayLengthMismatch();
error MaxSupplyExceeded();
error SignatureExpired();
error NotAuthorised();
error BuyDisabled();
error InsufficientPaymentValue();
error PublicSaleClosed();
error SaleClosed();
error MaxPerTransactionsExceeded();
error ContractCallBlocked();
error ImmutableRecoveryAddress();
error TransfersDisabled();
error PayoutToManagerFailed();
error PayoutToCustomerFailed();
/* ====================== Views ====================== */
function name() external view returns (string memory collectionName);
function symbol() external view returns (string memory collectionSymbol);
function getTokenConfigs()
external
view
returns (TokenConfig[] memory configs);
function getSupplies()
external
view
returns (uint256[] memory tokenSupplies);
function contractURI() external view returns (string memory uri);
function royaltyInfo(
uint256 _tokenId,
uint256 _salePrice
) external view returns (address royaltyAddress, uint256 royaltyAmount);
function supportsInterface(
bytes4 _interfaceId
) external view returns (bool result);
/* ================ MUTATIVE FUNCTIONS ================ */
// ============ Restricted =============
function setNameAndSymbol(
string calldata _name,
string calldata _symbol
) external;
function setMetadataURIs(
string calldata _contractUri,
string calldata _tokenUri
) external;
function setDates(uint256 _publicSale, uint256 _saleClosed) external;
function setTokenConfig(
uint256 _id,
uint256 _price,
uint256 _maxSupply,
uint256 _maxPerTransaction
) external;
function setAddresses(Addresses calldata _addresses) external;
function setAllowBuy(bool allowBuy) external;
function setAllowPublicTransfer(bool _allowPublicTransfer) external;
function setEnableOpenSeaOperatorFilterRegistry(bool _enable) external;
function setRoyalty(uint256 primaryFee, uint256 secondaryFee) external;
function addTokens(TokenConfig[] calldata _tokens) external;
// ============== Minting ==============
function mintBatch(
address[] calldata _to,
uint256[][] calldata _ids,
uint256[][] calldata _amounts
) external;
// ================ Buy ================
function buyAuthorised(
uint256 _id,
uint256 _amount,
uint256 _totalPrice,
uint256 _maxPerAddress,
uint256 _expires,
bytes calldata _signature
) external payable;
function buy(uint256 _id, uint256 _amount) external payable;
// ================ Transfers ================
function transferAuthorised(
address _from,
address _to,
uint256 _tokenId,
uint256 _amount,
uint256 _expires,
bytes calldata _signature
) external;
}
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;
}
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
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);
}
OperatorFilterer.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import {IOperatorFilterRegistry} from './IOperatorFilterRegistry.sol';
abstract contract OperatorFilterer {
error OperatorNotAllowed(address operator);
IOperatorFilterRegistry constant operatorFilterRegistry =
IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for the modifier to filter addresses.
if (address(operatorFilterRegistry).code.length > 0) {
if (subscribe) {
operatorFilterRegistry.registerAndSubscribe(
address(this),
subscriptionOrRegistrantToCopy
);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
operatorFilterRegistry.registerAndCopyEntries(
address(this),
subscriptionOrRegistrantToCopy
);
} else {
operatorFilterRegistry.register(address(this));
}
}
}
}
modifier onlyAllowedOperator(address from, bool switchedOn) virtual {
// return back out if toggle is off
if (!switchedOn) {
_;
return;
}
// Check registry code length to facilitate testing in environments without a deployed registry.
if (address(operatorFilterRegistry).code.length > 0) {
// Allow spending tokens from addresses with balance
// Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
// from an EOA.
if (from == msg.sender) {
_;
return;
}
if (
!(operatorFilterRegistry.isOperatorAllowed(
address(this),
msg.sender
) &&
operatorFilterRegistry.isOperatorAllowed(
address(this),
from
))
) {
revert OperatorNotAllowed(msg.sender);
}
}
_;
}
}
IOperatorFilterRegistry.sol 93 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IOperatorFilterRegistry {
function isOperatorAllowed(address registrant, address operator)
external
view
returns (bool);
function register(address registrant) external;
function registerAndSubscribe(address registrant, address subscription)
external;
function registerAndCopyEntries(
address registrant,
address registrantToCopy
) external;
function updateOperator(
address registrant,
address operator,
bool filtered
) external;
function updateOperators(
address registrant,
address[] calldata operators,
bool filtered
) external;
function updateCodeHash(
address registrant,
bytes32 codehash,
bool filtered
) external;
function updateCodeHashes(
address registrant,
bytes32[] calldata codeHashes,
bool filtered
) external;
function subscribe(address registrant, address registrantToSubscribe)
external;
function unsubscribe(address registrant, bool copyExistingEntries) external;
function subscriptionOf(address addr) external returns (address registrant);
function subscribers(address registrant)
external
returns (address[] memory);
function subscriberAt(address registrant, uint256 index)
external
returns (address);
function copyEntriesOf(address registrant, address registrantToCopy)
external;
function isOperatorFiltered(address registrant, address operator)
external
returns (bool);
function isCodeHashOfFiltered(address registrant, address operatorWithCode)
external
returns (bool);
function isCodeHashFiltered(address registrant, bytes32 codeHash)
external
returns (bool);
function filteredOperators(address addr)
external
returns (address[] memory);
function filteredCodeHashes(address addr)
external
returns (bytes32[] memory);
function filteredOperatorAt(address registrant, uint256 index)
external
returns (address);
function filteredCodeHashAt(address registrant, uint256 index)
external
returns (bytes32);
function isRegistered(address addr) external returns (bool);
function codeHashOf(address addr) external returns (bytes32);
}
ERC1155Burnable.sol 40 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of {ERC1155} that allows token holders to destroy both their
* own tokens and those that they have been approved to use.
*
* _Available since v3.1._
*/
abstract contract ERC1155Burnable is ERC1155 {
function burn(
address account,
uint256 id,
uint256 value
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_burn(account, id, value);
}
function burnBatch(
address account,
uint256[] memory ids,
uint256[] memory values
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_burnBatch(account, ids, values);
}
}
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);
}
IERC165.sol 6 lines
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
Read Contract
addresses 0xda0321cd → address, address, address, address, address, address, address
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
contractManager 0xb39e12cf → address
contractURI 0xe8a3d485 → string
generalConfig 0x927a97a1 → string, string, string, string, bool, bool, bool, uint256, uint256, uint256, uint256
getSupplies 0xc873d1aa → uint256[]
getTokenConfigs 0x5547171d → tuple[]
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
royaltyInfo 0x2a55205a → address, uint256
supplies 0x26f1a1fd → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenConfigs 0xc01bd0e9 → uint256, uint256, uint256
uri 0x0e89341c → string
version 0x54fd4d50 → string
Write Contract 23 functions
These functions modify contract state and require a wallet transaction to execute.
addTokens 0x11bc63eb
tuple[] _tokens
burn 0xf5298aca
address account
uint256 id
uint256 value
burnBatch 0x6b20c454
address account
uint256[] ids
uint256[] values
buy 0xd6febde8
uint256 _id
uint256 _amount
buyAuthorised 0x4ed52c49
uint256 _id
uint256 _amount
uint256 _totalPrice
uint256 _maxPerAddress
uint256 _expires
bytes _signature
mintBatch 0x122ed679
address[] _to
uint256[][] _ids
uint256[][] _amounts
recoverContract 0x82875f79
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
setAddresses 0xd9ab4d9c
tuple _addresses
setAllowBuy 0xd6046836
bool _allowBuy
setAllowPublicTransfer 0x166d44ea
bool _allowPublicTransfer
setApprovalForAll 0xa22cb465
address operator
bool approved
setDates 0xdedf141e
uint256 _publicSale
uint256 _saleClosed
setEnableOpenSeaOperatorFilterRegistry 0x58939061
bool _enable
setMetadataURIs 0xaeb2de35
string _contractURI
string _tokenURI
setNameAndSymbol 0x5a446215
string _newName
string _newSymbol
setRoyalty 0x933a6f0d
uint256 _primaryFee
uint256 _secondaryFee
setTokenConfig 0x1218ee11
uint256 _id
uint256 _price
uint256 _maxSupply
uint256 _maxPerTransaction
transferAuthorised 0x1f0f3547
address _from
address _to
uint256 _tokenId
uint256 _amount
uint256 _expires
bytes _signature
transferContractManager 0xae0aa35b
address newContractManager
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
This address has 1 on-chain transactions, but only 0.9% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →