Address Contract Partially Verified
Address
0xd6a152c351588EeC72556BC9769d9b22f37bFBf1
Balance
0 ETH
Nonce
1
Code Size
13912 bytes
Creator
0x721d0941...Ddb2 at tx 0xdd296e73...82706e
Indexed Transactions
0
Contract Bytecode
13912 bytes
0x608060405234801561001057600080fd5b506004361061023c5760003560e01c8063801b4c0a1161013b578063d18c0269116100b8578063e9e211a11161007c578063e9e211a1146105e2578063ec8154f014610605578063f242432a1461060d578063f2fde38b14610620578063f5298aca1461063357600080fd5b8063d18c026914610531578063d25b536f14610544578063d7cd4ee514610580578063e139278f14610593578063e985e9c5146105a657600080fd5b8063bacf9946116100ff578063bacf994614610471578063bd85b03914610484578063c1e03728146104a4578063c8f7dec81461050b578063c90c934a1461051e57600080fd5b8063801b4c0a1461041f57806387198cf2146104325780638da5cb5b1461044557806395d89b4114610456578063a22cb4651461045e57600080fd5b80633a8ed608116101c9578063587431711161018d57806358743171146103be5780636a8d0c28146103d157806370aa62f1146103e457806370ae92d2146103f7578063715018a61461041757600080fd5b80633a8ed6081461032b5780633f0bb0e2146103565780634e1273f4146103695780634f558e7914610389578063542cecdb146103ab57600080fd5b80631c31f710116102105780631c31f710146102b25780632d5aecda146102c75780632eb2c2d6146102f257806338af3eed1461030557806339e899ee1461031857600080fd5b8062fdd58e1461024157806301ffc9a71461026757806306fdde031461028a5780630e89341c1461029f575b600080fd5b61025461024f3660046128e3565b610646565b6040519081526020015b60405180910390f35b61027a610275366004612923565b6106dd565b604051901515815260200161025e565b61029261072f565b60405161025e919061299c565b6102926102ad3660046129af565b6107bd565b6102c56102c03660046129c8565b6107f9565b005b6008546102da906001600160a01b031681565b6040516001600160a01b03909116815260200161025e565b6102c5610300366004612b2c565b61088c565b6009546102da906001600160a01b031681565b6102c56103263660046129c8565b610923565b6102546103393660046128e3565b600c60209081526000928352604080842090915290825290205481565b6102c5610364366004612bd5565b61096f565b61037c610377366004612c08565b6109ff565b60405161025e9190612d0d565b61027a6103973660046129af565b600090815260036020526040902054151590565b6102546103b9366004612d20565b610b28565b6102c56103cc366004612d5f565b610b76565b6102546103df366004612db5565b610d0f565b600a546102da906001600160a01b031681565b6102546104053660046129c8565b600d6020526000908152604090205481565b6102c5610d28565b6102c561042d366004612bd5565b610d5e565b6102c5610440366004612e27565b610f2e565b6004546001600160a01b03166102da565b610292610f6d565b6102c561046c366004612e57565b610f7a565b6102c561047f366004612e57565b611051565b6102546104923660046129af565b60009081526003602052604090205490565b6104f06104b23660046129af565b6040805180820190915260008082526020820152506000908152600b6020908152604091829020825180840190935280548352600101549082015290565b6040805182518152602092830151928101929092520161025e565b6102c5610519366004612e8e565b6110a6565b6102c561052c366004612e27565b611111565b6102c561053f366004612ed0565b61114d565b61056b6105523660046129af565b600b602052600090815260409020805460019091015482565b6040805192835260208301919091520161025e565b6102c561058e366004612efc565b61118f565b6102c56105a1366004612fac565b611338565b61027a6105b436600461302d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b61027a6105f03660046129c8565b600e6020526000908152604090205460ff1681565b610292611559565b6102c561061b366004613060565b611566565b6102c561062e3660046129c8565b6115ab565b6102c5610641366004612bd5565b611646565b60006001600160a01b0383166106b75760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216636cdb3d1360e11b148061070e57506001600160e01b031982166303a24d0760e21b145b8061072957506301ffc9a760e01b6001600160e01b03198316145b92915050565b6005805461073c906130b8565b80601f0160208091040260200160405190810160405280929190818152602001828054610768906130b8565b80156107b55780601f1061078a576101008083540402835291602001916107b5565b820191906000526020600020905b81548152906001019060200180831161079857829003601f168201915b505050505081565b60606107c960006116e5565b6107d283611779565b6040516020016107e39291906130f3565b6040516020818303038152906040529050919050565b6004546001600160a01b031633146108235760405162461bcd60e51b81526004016106ae90613122565b6001600160a01b03811661086a5760405162461bcd60e51b815260206004820152600e60248201526d4e6f207a65726f2061646465737360901b60448201526064016106ae565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0385163314806108a857506108a885336105b4565b61090f5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b60648201526084016106ae565b61091c8585858585611876565b5050505050565b6004546001600160a01b0316331461094d5760405162461bcd60e51b81526004016106ae90613122565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b031633146109995760405162461bcd60e51b81526004016106ae90613122565b6001600160a01b0383166109d95760405162461bcd60e51b81526020600482015260076024820152664e6f207a65726f60c81b60448201526064016106ae565b6001600160a01b039092166000908152600c602090815260408083209383529290522055565b60608151835114610a645760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b60648201526084016106ae565b600083516001600160401b03811115610a7f57610a7f6129e3565b604051908082528060200260200182016040528015610aa8578160200160208202803683370190505b50905060005b8451811015610b2057610af3858281518110610acc57610acc613157565b6020026020010151858381518110610ae657610ae6613157565b6020026020010151610646565b828281518110610b0557610b05613157565b6020908102919091010152610b1981613183565b9050610aae565b509392505050565b6040805160208101869052908101849052606081018390526001600160a01b038216608082015260009060a0015b604051602081830303815290604052805190602001209050949350505050565b600085815260036020526040902054610b9090859061319e565b6000868152600b60205260409020541015610bbd5760405162461bcd60e51b81526004016106ae906131b6565b336000908152600d60205260409020548314610c095760405162461bcd60e51b815260206004820152600b60248201526a3737b731b29032b93937b960a91b60448201526064016106ae565b6000610c158383611a18565b6001600160a01b0381166000908152600e602052604090205490915060ff16610c795760405162461bcd60e51b81526020600482015260166024820152751cda59db985d1d5c994818da1958dac819985a5b195960521b60448201526064016106ae565b6000610c8787878733610b28565b905083610c9382611a34565b14610cd95760405162461bcd60e51b81526020600482015260166024820152751a5b9d1959dc995d1e4818da1958dac819985a5b195960521b60448201526064016106ae565b336000908152600d60205260408120805491610cf483613183565b9190505550610d063387896000611a87565b50505050505050565b600084848484604051602001610b5694939291906131e1565b6004546001600160a01b03163314610d525760405162461bcd60e51b81526004016106ae90613122565b610d5c6000611b61565b565b60008281526003602052604081205411610dac5760405162461bcd60e51b815260206004820152600f60248201526e13db9b1e481b5a5b9d195908139195608a1b60448201526064016106ae565b6001600160a01b0383166000908152600c60209081526040808320858452909152902054610e1c5760405162461bcd60e51b815260206004820152601760248201527f4e6f206d696e742077697468207468697320746f6b656e00000000000000000060448201526064016106ae565b600082815260036020526040902054610e3690829061319e565b6000838152600b60205260409020541015610e635760405162461bcd60e51b81526004016106ae906131b6565b6009546001600160a01b038085166000818152600c6020908152604080832088845290915290205490926323b872dd923392911690610ea3908690613228565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015610ef7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1b9190613247565b50610f293382846004611a87565b505050565b6004546001600160a01b03163314610f585760405162461bcd60e51b81526004016106ae90613122565b6000918252600b602052604090912060010155565b6006805461073c906130b8565b336001600160a01b0383161415610fe55760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b60648201526084016106ae565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6004546001600160a01b0316331461107b5760405162461bcd60e51b81526004016106ae90613122565b6001600160a01b03919091166000908152600e60205260409020805460ff1916911515919091179055565b6004546001600160a01b031633146110d05760405162461bcd60e51b81526004016106ae90613122565b6110f5858585604051806040016040528060018152602001600360fc1b815250611bb3565b6000848152600b6020526040902082815560010181905561091c565b6004546001600160a01b0316331461113b5760405162461bcd60e51b81526004016106ae90613122565b6000918252600b602052604090912055565b6004546001600160a01b031633146111775760405162461bcd60e51b81526004016106ae90613122565b6000928352600b602052604090922090815560010155565b6004546001600160a01b031633146111b95760405162461bcd60e51b81526004016106ae90613122565b815184511461121e5760405162461bcd60e51b815260206004820152602b60248201527f73746f704d696e74416674657220706172616d73206d7573742068617665206560448201526a0e2eac2d840d8cadccee8d60ab1b60648201526084016106ae565b80518451146112845760405162461bcd60e51b815260206004820152602c60248201527f6d6178546f74616c537570706c7920706172616d73206d75737420686176652060448201526b0cae2eac2d840d8cadccee8d60a31b60648201526084016106ae565b6112a9858585604051806040016040528060018152602001600360fc1b815250611c89565b60005b84518110156113305761131e8582815181106112ca576112ca613157565b60200260200101518483815181106112e4576112e4613157565b60200260200101518484815181106112fe576112fe613157565b60200260200101516000928352600b602052604090922090815560010155565b8061132881613183565b9150506112ac565b505050505050565b60005b85518110156113f75784818151811061135657611356613157565b602002602001015161138d87838151811061137357611373613157565b602002602001015160009081526003602052604090205490565b611397919061319e565b600b60008884815181106113ad576113ad613157565b602002602001015181526020019081526020016000206000015410156113e55760405162461bcd60e51b81526004016106ae906131b6565b806113ef81613183565b91505061133b565b50336000908152600d602052604090205483146114445760405162461bcd60e51b815260206004820152600b60248201526a3737b731b29032b93937b960a91b60448201526064016106ae565b60006114508383611a18565b6001600160a01b0381166000908152600e602052604090205490915060ff166114b45760405162461bcd60e51b81526020600482015260166024820152751cda59db985d1d5c994818da1958dac819985a5b195960521b60448201526064016106ae565b60006114c287878733610d0f565b9050836114ce82611a34565b146115145760405162461bcd60e51b81526020600482015260166024820152751a5b9d1959dc995d1e4818da1958dac819985a5b195960521b60448201526064016106ae565b336000908152600d6020526040812080549161152f83613183565b9190505550610d06338888604051806040016040528060018152602001600360fc1b815250611c89565b6007805461073c906130b8565b6001600160a01b038516331480611582575061158285336105b4565b61159e5760405162461bcd60e51b81526004016106ae90613264565b61091c8585858585611de3565b6004546001600160a01b031633146115d55760405162461bcd60e51b81526004016106ae90613122565b6001600160a01b03811661163a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ae565b61164381611b61565b50565b6001600160a01b038316331480611662575061166283336105b4565b61167e5760405162461bcd60e51b81526004016106ae90613264565b610f29838383611ef7565b6060816116b05750506040805180820190915260048152630307830360e41b602082015290565b8160005b81156116d357806116c481613183565b915050600882901c91506116b4565b6116dd8482612070565b949350505050565b6060600280546116f4906130b8565b80601f0160208091040260200160405190810160405280929190818152602001828054611720906130b8565b801561176d5780601f106117425761010080835404028352916020019161176d565b820191906000526020600020905b81548152906001019060200180831161175057829003601f168201915b50505050509050919050565b60608161179d5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156117c757806117b181613183565b91506117c09050600a836132c3565b91506117a1565b6000816001600160401b038111156117e1576117e16129e3565b6040519080825280601f01601f19166020018201604052801561180b576020820181803683370190505b5090505b84156116dd576118206001836132d7565b915061182d600a866132ee565b61183890603061319e565b60f81b81838151811061184d5761184d613157565b60200101906001600160f81b031916908160001a90535061186f600a866132c3565b945061180f565b81518351146118975760405162461bcd60e51b81526004016106ae90613302565b6001600160a01b0384166118bd5760405162461bcd60e51b81526004016106ae9061334a565b336118cc818787878787612212565b60005b84518110156119b25760008582815181106118ec576118ec613157565b60200260200101519050600085838151811061190a5761190a613157565b602090810291909101810151600084815280835260408082206001600160a01b038e16835290935291909120549091508181101561195a5760405162461bcd60e51b81526004016106ae9061338f565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929061199790849061319e565b92505081905550505050806119ab90613183565b90506118cf565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611a029291906133d9565b60405180910390a461133081878787878761231e565b6000806000611a27858561247a565b91509150610b20816124ea565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000828152600b6020908152604080832060010154600390925290912054611ab090859061319e565b1115611af45760405162461bcd60e51b81526020600482015260136024820152724e6f206d6f7265207468697320746f6b656e7360681b60448201526064016106ae565b611b19848385604051806040016040528060018152602001600360fc1b815250611bb3565b604080518381526020810185905260ff83168183015290517f7b881d936ff51ac84a956af91b7db25c1b7d9bd61372534c809254750233592d9181900360600190a150505050565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038416611bd95760405162461bcd60e51b81526004016106ae90613407565b33611bf981600087611bea886126a5565b611bf3886126a5565b87612212565b6000848152602081815260408083206001600160a01b038916845290915281208054859290611c2990849061319e565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461091c816000878787876126f0565b6001600160a01b038416611caf5760405162461bcd60e51b81526004016106ae90613407565b8151835114611cd05760405162461bcd60e51b81526004016106ae90613302565b33611ce081600087878787612212565b60005b8451811015611d7b57838181518110611cfe57611cfe613157565b6020026020010151600080878481518110611d1b57611d1b613157565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254611d63919061319e565b90915550819050611d7381613183565b915050611ce3565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611dcc9291906133d9565b60405180910390a461091c8160008787878761231e565b6001600160a01b038416611e095760405162461bcd60e51b81526004016106ae9061334a565b33611e19818787611bea886126a5565b6000848152602081815260408083206001600160a01b038a16845290915290205483811015611e5a5760405162461bcd60e51b81526004016106ae9061338f565b6000858152602081815260408083206001600160a01b038b8116855292528083208785039055908816825281208054869290611e9790849061319e565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610d068288888888886126f0565b6001600160a01b038316611f595760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b60648201526084016106ae565b33611f8881856000611f6a876126a5565b611f73876126a5565b60405180602001604052806000815250612212565b6000838152602081815260408083206001600160a01b0388168452909152902054828110156120055760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b60648201526084016106ae565b6000848152602081815260408083206001600160a01b03898116808652918452828520888703905582518981529384018890529092908616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45050505050565b6060600061207f836002613228565b61208a90600261319e565b6001600160401b038111156120a1576120a16129e3565b6040519080825280601f01601f1916602001820160405280156120cb576020820181803683370190505b509050600360fc1b816000815181106120e6576120e6613157565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061211557612115613157565b60200101906001600160f81b031916908160001a9053506000612139846002613228565b61214490600161319e565b90505b60018111156121bc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061217857612178613157565b1a60f81b82828151811061218e5761218e613157565b60200101906001600160f81b031916908160001a90535060049490941c936121b581613448565b9050612147565b50831561220b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106ae565b9392505050565b6001600160a01b0385166122995760005b83518110156122975782818151811061223e5761223e613157565b60200260200101516003600086848151811061225c5761225c613157565b602002602001015181526020019081526020016000206000828254612281919061319e565b90915550612290905081613183565b9050612223565b505b6001600160a01b0384166113305760005b8351811015610d06578281815181106122c5576122c5613157565b6020026020010151600360008684815181106122e3576122e3613157565b60200260200101518152602001908152602001600020600082825461230891906132d7565b90915550612317905081613183565b90506122aa565b6001600160a01b0384163b156113305760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190612362908990899088908890889060040161345f565b6020604051808303816000875af192505050801561239d575060408051601f3d908101601f1916820190925261239a918101906134bd565b60015b61244a576123a96134da565b806308c379a014156123e357506123be6134f6565b806123c957506123e5565b8060405162461bcd60e51b81526004016106ae919061299c565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60648201526084016106ae565b6001600160e01b0319811663bc197c8160e01b14610d065760405162461bcd60e51b81526004016106ae9061357f565b6000808251604114156124b15760208301516040840151606085015160001a6124a5878285856127ab565b945094505050506124e3565b8251604014156124db57602083015160408401516124d0868383612898565b9350935050506124e3565b506000905060025b9250929050565b60008160048111156124fe576124fe6135c7565b14156125075750565b600181600481111561251b5761251b6135c7565b14156125695760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016106ae565b600281600481111561257d5761257d6135c7565b14156125cb5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016106ae565b60038160048111156125df576125df6135c7565b14156126385760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016106ae565b600481600481111561264c5761264c6135c7565b14156116435760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016106ae565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106126df576126df613157565b602090810291909101015292915050565b6001600160a01b0384163b156113305760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619061273490899089908890889088906004016135dd565b6020604051808303816000875af192505050801561276f575060408051601f3d908101601f1916820190925261276c918101906134bd565b60015b61277b576123a96134da565b6001600160e01b0319811663f23a6e6160e01b14610d065760405162461bcd60e51b81526004016106ae9061357f565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156127e2575060009050600361288f565b8460ff16601b141580156127fa57508460ff16601c14155b1561280b575060009050600461288f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561285f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166128885760006001925092505061288f565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b016128b9878288856127ab565b935093505050935093915050565b80356001600160a01b03811681146128de57600080fd5b919050565b600080604083850312156128f657600080fd5b6128ff836128c7565b946020939093013593505050565b6001600160e01b03198116811461164357600080fd5b60006020828403121561293557600080fd5b813561220b8161290d565b60005b8381101561295b578181015183820152602001612943565b8381111561296a576000848401525b50505050565b60008151808452612988816020860160208601612940565b601f01601f19169290920160200192915050565b60208152600061220b6020830184612970565b6000602082840312156129c157600080fd5b5035919050565b6000602082840312156129da57600080fd5b61220b826128c7565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715612a1e57612a1e6129e3565b6040525050565b60006001600160401b03821115612a3e57612a3e6129e3565b5060051b60200190565b600082601f830112612a5957600080fd5b81356020612a6682612a25565b604051612a7382826129f9565b83815260059390931b8501820192828101915086841115612a9357600080fd5b8286015b84811015612aae5780358352918301918301612a97565b509695505050505050565b600082601f830112612aca57600080fd5b81356001600160401b03811115612ae357612ae36129e3565b604051612afa601f8301601f1916602001826129f9565b818152846020838601011115612b0f57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215612b4457600080fd5b612b4d866128c7565b9450612b5b602087016128c7565b935060408601356001600160401b0380821115612b7757600080fd5b612b8389838a01612a48565b94506060880135915080821115612b9957600080fd5b612ba589838a01612a48565b93506080880135915080821115612bbb57600080fd5b50612bc888828901612ab9565b9150509295509295909350565b600080600060608486031215612bea57600080fd5b612bf3846128c7565b95602085013595506040909401359392505050565b60008060408385031215612c1b57600080fd5b82356001600160401b0380821115612c3257600080fd5b818501915085601f830112612c4657600080fd5b81356020612c5382612a25565b604051612c6082826129f9565b83815260059390931b8501820192828101915089841115612c8057600080fd5b948201945b83861015612ca557612c96866128c7565b82529482019490820190612c85565b96505086013592505080821115612cbb57600080fd5b50612cc885828601612a48565b9150509250929050565b600081518084526020808501945080840160005b83811015612d0257815187529582019590820190600101612ce6565b509495945050505050565b60208152600061220b6020830184612cd2565b60008060008060808587031215612d3657600080fd5b843593506020850135925060408501359150612d54606086016128c7565b905092959194509250565b600080600080600060a08688031215612d7757600080fd5b8535945060208601359350604086013592506060860135915060808601356001600160401b03811115612da957600080fd5b612bc888828901612ab9565b60008060008060808587031215612dcb57600080fd5b84356001600160401b0380821115612de257600080fd5b612dee88838901612a48565b95506020870135915080821115612e0457600080fd5b50612e1187828801612a48565b93505060408501359150612d54606086016128c7565b60008060408385031215612e3a57600080fd5b50508035926020909101359150565b801515811461164357600080fd5b60008060408385031215612e6a57600080fd5b612e73836128c7565b91506020830135612e8381612e49565b809150509250929050565b600080600080600060a08688031215612ea657600080fd5b612eaf866128c7565b97602087013597506040870135966060810135965060800135945092505050565b600080600060608486031215612ee557600080fd5b505081359360208301359350604090920135919050565b600080600080600060a08688031215612f1457600080fd5b612f1d866128c7565b945060208601356001600160401b0380821115612f3957600080fd5b612f4589838a01612a48565b95506040880135915080821115612f5b57600080fd5b612f6789838a01612a48565b94506060880135915080821115612f7d57600080fd5b612f8989838a01612a48565b93506080880135915080821115612f9f57600080fd5b50612bc888828901612a48565b600080600080600060a08688031215612fc457600080fd5b85356001600160401b0380821115612fdb57600080fd5b612fe789838a01612a48565b96506020880135915080821115612ffd57600080fd5b61300989838a01612a48565b955060408801359450606088013593506080880135915080821115612bbb57600080fd5b6000806040838503121561304057600080fd5b613049836128c7565b9150613057602084016128c7565b90509250929050565b600080600080600060a0868803121561307857600080fd5b613081866128c7565b945061308f602087016128c7565b9350604086013592506060860135915060808601356001600160401b03811115612da957600080fd5b600181811c908216806130cc57607f821691505b602082108114156130ed57634e487b7160e01b600052602260045260246000fd5b50919050565b60008351613105818460208801612940565b835190830190613119818360208801612940565b01949350505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156131975761319761316d565b5060010190565b600082198211156131b1576131b161316d565b500190565b602080825260119082015270135a5b9d1a5b99c81a5cc81c185d5cd959607a1b604082015260600190565b6080815260006131f46080830187612cd2565b82810360208401526132068187612cd2565b604084019590955250506001600160a01b039190911660609091015292915050565b60008160001904831182151516156132425761324261316d565b500290565b60006020828403121561325957600080fd5b815161220b81612e49565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201526808185c1c1c9bdd995960ba1b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826132d2576132d26132ad565b500490565b6000828210156132e9576132e961316d565b500390565b6000826132fd576132fd6132ad565b500690565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6040815260006133ec6040830185612cd2565b82810360208401526133fe8185612cd2565b95945050505050565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b6000816134575761345761316d565b506000190190565b6001600160a01b0386811682528516602082015260a06040820181905260009061348b90830186612cd2565b828103606084015261349d8186612cd2565b905082810360808401526134b18185612970565b98975050505050505050565b6000602082840312156134cf57600080fd5b815161220b8161290d565b600060033d11156134f35760046000803e5060005160e01c5b90565b600060443d10156135045790565b6040516003193d81016004833e81513d6001600160401b03816024840111818411171561353357505050505090565b828501915081518181111561354b5750505050505090565b843d87010160208285010111156135655750505050505090565b613574602082860101876129f9565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061361790830184612970565b97965050505050505056fea264697066735822122096e143ad7dfd18b2627b2b2f553c04b727760bc8ab19563a303e3aa38d37454f64736f6c634300080b0033
Verified Source Code Partial Match
Compiler: v0.8.11+commit.d7f03943
EVM: istanbul
Optimization: Yes (200 runs)
ECDSA.sol 219 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @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;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 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 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));
}
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
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;
}
}
IERC20.sol 81 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}
Address.sol 216 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @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
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 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 23 lines
// SPDX-License-Identifier: MIT
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;
}
}
ERC1155.sol 451 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "IERC1155.sol";
import "IERC1155Receiver.sol";
import "IERC1155MetadataURI.sol";
import "Address.sol";
import "Context.sol";
import "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 {
require(_msgSender() != operator, "ERC1155: setting approval status for self");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_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();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), 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);
_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);
_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 `account`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][account] += amount;
emit TransferSingle(operator, address(0), account, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), account, 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);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `account`
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
uint256 accountBalance = _balances[id][account];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account] = accountBalance - amount;
}
emit TransferSingle(operator, account, address(0), id, amount);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 accountBalance = _balances[id][account];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account] = accountBalance - amount;
}
}
emit TransferBatch(operator, account, address(0), ids, amounts);
}
/**
* @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 {}
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;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
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);
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(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");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
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);
}
}
IERC1155.sol 124 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "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;
}
SidusItems.sol 235 lines
// SPDX-License-Identifier: MIT
// Sidus Cards
pragma solidity 0.8.11;
import "ERC1155Supply.sol";
import "IERC20.sol";
import "Ownable.sol";
import "Strings.sol";
import "ECDSA.sol";
contract SidusItems is ERC1155Supply, Ownable {
using Strings for uint256;
using Strings for uint160;
using ECDSA for bytes32;
struct TokenReq {
uint256 stopMintAfter; // for mint with erc20
uint256 maxTotalSupply;
}
string public name;
string public symbol;
string public baseurl;
address public externalWhiteList;
address public beneficiary;
address public externalShadow;
mapping(uint256 => TokenReq) public tokenReq;
mapping(address => mapping(uint256 => uint256)) public tokensForMint;
mapping(address => uint) public nonce;
mapping(address => bool) public trustedSigner;
//Event for track mint channel:
// 0 - With Shadow
// 2 - With Ethere
// 3 - External White List
// 4 - With ERC20
event MintSource(uint256 tokenId, uint256 amount, uint8 channel);
constructor(
string memory name_,
string memory symbol_,
string memory _baseurl
)
ERC1155(_baseurl)
{
baseurl = string(
abi.encodePacked(
_baseurl,
"/",
uint160(address(this)).toHexString(),
"/"
)
);
_setURI(baseurl);
name = name_;
symbol = symbol_;
}
function mintFromShadowBatch(uint256[] memory _tokenID, uint256[] memory _nftAmountForMint, uint _nonce, bytes32 _msgForSign, bytes memory _signature) public {
for(uint i=0;i<_tokenID.length;i++) {
require(tokenReq[_tokenID[i]].stopMintAfter >= totalSupply(_tokenID[i]) + _nftAmountForMint[i], "Minting is paused");
}
require(nonce[msg.sender] == _nonce, "nonce error");
//1. Lets check signer
address signedBy = _msgForSign.recover(_signature);
require(trustedSigner[signedBy], "signature check failed");
bytes32 actualMsg = getMsgForSignBatch(
_tokenID,
_nftAmountForMint,
_nonce,
msg.sender
);
require(actualMsg.toEthSignedMessageHash() == _msgForSign,"integrety check failed");
nonce[msg.sender]++;
_mintBatch(msg.sender, _tokenID, _nftAmountForMint, bytes('0'));
}
function mintFromShadow(uint256 _tokenID, uint256 _nftAmountForMint, uint _nonce, bytes32 _msgForSign, bytes memory _signature) external {
require(tokenReq[_tokenID].stopMintAfter >= totalSupply(_tokenID) + _nftAmountForMint, "Minting is paused");
//Double spend check
require(nonce[msg.sender] == _nonce, "nonce error");
address signedBy = _msgForSign.recover(_signature);
require(trustedSigner[signedBy], "signature check failed");
bytes32 actualMsg = getMsgForSign(
_tokenID,
_nftAmountForMint,
_nonce,
msg.sender
);
require(actualMsg.toEthSignedMessageHash() == _msgForSign,"integrety check failed");
nonce[msg.sender]++;
_multiMint(msg.sender, _nftAmountForMint, _tokenID, 0);
}
function mintWithERC20(address _withToken, uint256 _tokenID, uint256 _nftAmountForMint) external {
require(totalSupply(_tokenID) > 0, "Only minted NFT") ;
require(tokensForMint[_withToken][_tokenID]> 0, "No mint with this token");
require(tokenReq[_tokenID].stopMintAfter >= totalSupply(_tokenID) + _nftAmountForMint, "Minting is paused");
IERC20(_withToken).transferFrom(
msg.sender,
beneficiary,
tokensForMint[_withToken][_tokenID] * _nftAmountForMint
);
_multiMint(msg.sender, _nftAmountForMint, _tokenID, 4);
}
function burn(address account, uint256 _tokenID, uint256 amount) external {
require(account == msg.sender || isApprovedForAll(account, msg.sender),
"ERC1155: caller is not owner nor approved");
_burn(account, _tokenID, amount);
}
function getTokenDetails(uint256 _id) external view returns (TokenReq memory) {
return tokenReq[_id];
}
///////////////////////////////////////////////////////////////////
///// Owners Functions ///////////////////////////////////////////
///////////////////////////////////////////////////////////////////
function setTrustedSigner(address _signer, bool _isValid) external onlyOwner {
trustedSigner[_signer] = _isValid;
}
function setWhiteList(address _wl) external onlyOwner {
externalWhiteList = _wl;
}
function setMaxTotalSupply(uint256 id, uint256 _maxSupply) external onlyOwner {
tokenReq[id].maxTotalSupply = _maxSupply;
}
function setStopMinterAfter(uint256 id, uint256 _stopMinter) external onlyOwner {
tokenReq[id].stopMintAfter = _stopMinter;
}
function setPriceInToken(address _token, uint256 _tokenId, uint256 _pricePerMint) external onlyOwner {
require(_token != address(0), "No zero");
tokensForMint[_token][_tokenId] = _pricePerMint;
}
function createNew(
address account,
uint256 id,
uint256 amount,
uint256 _stopMintAfter,
uint256 _maxTotalSupply) external onlyOwner {
_mint(account, id, amount, bytes('0'));
_editTokenReq(id, _stopMintAfter, _maxTotalSupply);
}
function createNewBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts,
uint256[] memory _stopMintAfter,
uint256[] memory _maxTotalSupply) external onlyOwner {
require(ids.length == _stopMintAfter.length, "stopMintAfter params must have equal length");
require(ids.length == _maxTotalSupply.length, "maxTotalSupply params must have equal length");
_mintBatch(account, ids, amounts, bytes('0'));
for(uint256 i=0; i<ids.length; i++) {
_editTokenReq(ids[i], _stopMintAfter[i], _maxTotalSupply[i]);
}
}
function editTokenReq(
uint256 id,
uint256 _stopMintAfter,
uint256 _maxTotalSupply
) external onlyOwner {
_editTokenReq(id, _stopMintAfter, _maxTotalSupply);
}
function setBeneficiary(address _beneficiary) external onlyOwner {
require(_beneficiary != address(0), "No zero addess");
beneficiary = _beneficiary;
}
///////////////////////////////////////////////////////////////////
///// INTERNALS /////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
function _editTokenReq(
uint256 _id,
uint256 _stopMintAfter,
uint256 _maxTotalSupply
) internal {
tokenReq[_id].stopMintAfter = _stopMintAfter;
tokenReq[_id].maxTotalSupply = _maxTotalSupply;
}
function _multiMint(address to, uint256 amount, uint256 tokenID, uint8 channel) internal {
require(
totalSupply(tokenID) + amount
<= tokenReq[tokenID].maxTotalSupply,
"No more this tokens"
);
_mint(to, tokenID, amount, bytes('0'));
emit MintSource(tokenID, amount, channel);
}
function uri(uint256 _tokenID) public view override
returns (string memory _uri)
{
_uri = string(abi.encodePacked(ERC1155.uri(0), _tokenID.toString()));
}
function getMsgForSign(uint _tokenId, uint _amount, uint _nonce, address _sender) public pure returns(bytes32)
{
return keccak256(abi.encode(_tokenId, _amount, _nonce, _sender));
}
function getMsgForSignBatch(uint[] memory _tokenId, uint[] memory _amount, uint _nonce, address _sender) public pure returns(bytes32) {
return keccak256(abi.encode(_tokenId, _amount, _nonce, _sender));
}
}
ERC1155Supply.sol 57 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "ERC1155.sol";
/**
* @dev Extension of ERC1155 that adds tracking of total supply per id.
*
* Useful for scenarios where Fungible and Non-fungible tokens have to be
* clearly identified. Note: While a totalSupply of 1 might mean the
* corresponding is an NFT, there is no guarantees that no other token with the
* same id are not going to be minted.
*/
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 => uint256) private _totalSupply;
/**
* @dev Total amount of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Indicates weither any token exist with a given id, or not.
*/
function exists(uint256 id) public view virtual returns (bool) {
return ERC1155Supply.totalSupply(id) > 0;
}
/**
* @dev See {ERC1155-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (from == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] += amounts[i];
}
}
if (to == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] -= amounts[i];
}
}
}
}
IERC1155Receiver.sol 52 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "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.
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. 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);
}
IERC1155MetadataURI.sol 21 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Read Contract
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
baseurl 0xec8154f0 → string
beneficiary 0x38af3eed → address
exists 0x4f558e79 → bool
externalShadow 0x70aa62f1 → address
externalWhiteList 0x2d5aecda → address
getMsgForSign 0x542cecdb → bytes32
getMsgForSignBatch 0x6a8d0c28 → bytes32
getTokenDetails 0xc1e03728 → tuple
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
nonce 0x70ae92d2 → uint256
owner 0x8da5cb5b → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenReq 0xd25b536f → uint256, uint256
tokensForMint 0x3a8ed608 → uint256
totalSupply 0xbd85b039 → uint256
trustedSigner 0xe9e211a1 → bool
uri 0x0e89341c → string
Write Contract 18 functions
These functions modify contract state and require a wallet transaction to execute.
burn 0xf5298aca
address account
uint256 _tokenID
uint256 amount
createNew 0xc8f7dec8
address account
uint256 id
uint256 amount
uint256 _stopMintAfter
uint256 _maxTotalSupply
createNewBatch 0xd7cd4ee5
address account
uint256[] ids
uint256[] amounts
uint256[] _stopMintAfter
uint256[] _maxTotalSupply
editTokenReq 0xd18c0269
uint256 id
uint256 _stopMintAfter
uint256 _maxTotalSupply
mintFromShadow 0x58743171
uint256 _tokenID
uint256 _nftAmountForMint
uint256 _nonce
bytes32 _msgForSign
bytes _signature
mintFromShadowBatch 0xe139278f
uint256[] _tokenID
uint256[] _nftAmountForMint
uint256 _nonce
bytes32 _msgForSign
bytes _signature
mintWithERC20 0x801b4c0a
address _withToken
uint256 _tokenID
uint256 _nftAmountForMint
renounceOwnership 0x715018a6
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBeneficiary 0x1c31f710
address _beneficiary
setMaxTotalSupply 0x87198cf2
uint256 id
uint256 _maxSupply
setPriceInToken 0x3f0bb0e2
address _token
uint256 _tokenId
uint256 _pricePerMint
setStopMinterAfter 0xc90c934a
uint256 id
uint256 _stopMinter
setTrustedSigner 0xbacf9946
address _signer
bool _isValid
setWhiteList 0x39e899ee
address _wl
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address