Address Contract Verified
Address
0x0a8D803E3e29f07BD58e3061D9AeE7B57813DF2c
Balance
0 ETH
Nonce
1
Code Size
18289 bytes
Creator
0xB76340b8...8533 at tx 0xe71e9a29...c60e8b
Indexed Transactions
0
Contract Bytecode
18289 bytes
0x6080604052600436106101655760003560e01c8063715018a6116100d1578063c040e6b81161008a578063e985e9c511610064578063e985e9c5146104d7578063f242432a14610514578063f2fde38b1461053d578063f4a0a5281461056657610165565b8063c040e6b814610458578063d1f1ef3414610483578063e5ec56a01461049a57610165565b8063715018a61461036e5780637cb64759146103855780638da5cb5b146103ae578063a22cb465146103d9578063a53dc05f14610402578063af640d0f1461042d57610165565b80633391e5f8116101235780633391e5f8146102a05780633ccfd60b146102bc5780634e1273f4146102d357806356f8f78c1461031057806367dce1ed146103275780636817c76c1461034357610165565b8062fdd58e1461016a57806301ffc9a7146101a757806306fdde03146101e45780630e89341c1461020f5780632eb2c2d61461024c5780632eb4a7ab14610275575b600080fd5b34801561017657600080fd5b50610191600480360381019061018c9190612e52565b61058f565b60405161019e9190613a54565b60405180910390f35b3480156101b357600080fd5b506101ce60048036038101906101c99190612ff7565b610658565b6040516101db9190613741565b60405180910390f35b3480156101f057600080fd5b506101f961073a565b6040516102069190613792565b60405180910390f35b34801561021b57600080fd5b5061023660048036038101906102319190613051565b6107c8565b6040516102439190613792565b60405180910390f35b34801561025857600080fd5b50610273600480360381019061026e9190612cac565b61084e565b005b34801561028157600080fd5b5061028a6108ef565b604051610297919061375c565b60405180910390f35b6102ba60048036038101906102b59190612f6a565b6108f5565b005b3480156102c857600080fd5b506102d1610bec565b005b3480156102df57600080fd5b506102fa60048036038101906102f59190612e92565b610d17565b60405161030791906136e8565b60405180910390f35b34801561031c57600080fd5b50610325610e30565b005b610341600480360381019061033c919061307e565b610f51565b005b34801561034f57600080fd5b506103586110e1565b6040516103659190613a54565b60405180910390f35b34801561037a57600080fd5b506103836110e7565b005b34801561039157600080fd5b506103ac60048036038101906103a79190612fca565b61116f565b005b3480156103ba57600080fd5b506103c36111f5565b6040516103d0919061360b565b60405180910390f35b3480156103e557600080fd5b5061040060048036038101906103fb9190612e12565b61121f565b005b34801561040e57600080fd5b50610417611235565b6040516104249190613a98565b60405180910390f35b34801561043957600080fd5b50610442611248565b60405161044f9190613a54565b60405180910390f35b34801561046457600080fd5b5061046d611254565b60405161047a9190613777565b60405180910390f35b34801561048f57600080fd5b50610498611267565b005b3480156104a657600080fd5b506104c160048036038101906104bc9190612f0a565b611388565b6040516104ce9190613741565b60405180910390f35b3480156104e357600080fd5b506104fe60048036038101906104f99190612c6c565b61139e565b60405161050b9190613741565b60405180910390f35b34801561052057600080fd5b5061053b60048036038101906105369190612d7b565b611432565b005b34801561054957600080fd5b50610564600480360381019061055f9190612c3f565b6114d3565b005b34801561057257600080fd5b5061058d60048036038101906105889190613051565b6115cb565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610600576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f790613814565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061072357507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610733575061073282611651565b5b9050919050565b6005805461074790613e26565b80601f016020809104026020016040519081016040528092919081815260200182805461077390613e26565b80156107c05780601f10610795576101008083540402835291602001916107c0565b820191906000526020600020905b8154815290600101906020018083116107a357829003601f168201915b505050505081565b60606107d460046116bb565b8210610815576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080c906138d4565b60405180910390fd5b61081e826116c9565b6108278361175d565b6040516020016108389291906135c7565b6040516020818303038152906040529050919050565b6108566118be565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061089c575061089b856108966118be565b61139e565b5b6108db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d290613934565b60405180910390fd5b6108e885858585856118c6565b5050505050565b60095481565b600180600281111561090a57610909613f8f565b5b600b60009054906101000a900460ff16600281111561092c5761092b613f8f565b5b1461096c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610963906138f4565b60405180910390fd5b8383610979828233611bda565b6109b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109af906137f4565b60405180910390fd5b8360ff16806007546109ca9190613ca6565b341015610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390613854565b60405180910390fd5b8460ff16600860009054906101000a900460ff1660ff16811115610a65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5c906138b4565b60405180910390fd5b8560ff1680600654610a779190613d00565b610a8160046116bb565b10610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab890613954565b60405180910390fd5b600860009054906101000a900460ff1660ff16600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1610610b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5b90613994565b60405180910390fd5b6001600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282829054906101000a900460ff16610bc09190613c3e565b92506101000a81548160ff021916908360ff160217905550610be187611c5e565b505050505050505050565b610bf46118be565b73ffffffffffffffffffffffffffffffffffffffff16610c126111f5565b73ffffffffffffffffffffffffffffffffffffffff1614610c68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5f906139b4565b60405180910390fd5b60003373ffffffffffffffffffffffffffffffffffffffff1647604051610c8e906135f6565b60006040518083038185875af1925050503d8060008114610ccb576040519150601f19603f3d011682016040523d82523d6000602084013e610cd0565b606091505b5050905080610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b90613894565b60405180910390fd5b50565b60608151835114610d5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d54906139f4565b60405180910390fd5b6000835167ffffffffffffffff811115610d7a57610d7961401c565b5b604051908082528060200260200182016040528015610da85781602001602082028036833780820191505090505b50905060005b8451811015610e2557610df5858281518110610dcd57610dcc613fed565b5b6020026020010151858381518110610de857610de7613fed565b5b602002602001015161058f565b828281518110610e0857610e07613fed565b5b60200260200101818152505080610e1e90613e89565b9050610dae565b508091505092915050565b6001806002811115610e4557610e44613f8f565b5b600b60009054906101000a900460ff166002811115610e6757610e66613f8f565b5b14610ea7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9e906138f4565b60405180910390fd5b610eaf6118be565b73ffffffffffffffffffffffffffffffffffffffff16610ecd6111f5565b73ffffffffffffffffffffffffffffffffffffffff1614610f23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1a906139b4565b60405180910390fd5b6002600b60006101000a81548160ff02191690836002811115610f4957610f48613f8f565b5b021790555050565b6002806002811115610f6657610f65613f8f565b5b600b60009054906101000a900460ff166002811115610f8857610f87613f8f565b5b14610fc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbf906138f4565b60405180910390fd5b8160ff1680600754610fda9190613ca6565b34101561101c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101390613854565b60405180910390fd5b8260ff16600860009054906101000a900460ff1660ff16811115611075576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106c906138b4565b60405180910390fd5b8360ff16806006546110879190613d00565b61109160046116bb565b106110d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c890613954565b60405180910390fd5b6110da85611c5e565b5050505050565b60075481565b6110ef6118be565b73ffffffffffffffffffffffffffffffffffffffff1661110d6111f5565b73ffffffffffffffffffffffffffffffffffffffff1614611163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115a906139b4565b60405180910390fd5b61116d6000611d94565b565b6111776118be565b73ffffffffffffffffffffffffffffffffffffffff166111956111f5565b73ffffffffffffffffffffffffffffffffffffffff16146111eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e2906139b4565b60405180910390fd5b8060098190555050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61123161122a6118be565b8383611e5a565b5050565b600860009054906101000a900460ff1681565b60048060000154905081565b600b60009054906101000a900460ff1681565b600080600281111561127c5761127b613f8f565b5b600b60009054906101000a900460ff16600281111561129e5761129d613f8f565b5b146112de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d5906138f4565b60405180910390fd5b6112e66118be565b73ffffffffffffffffffffffffffffffffffffffff166113046111f5565b73ffffffffffffffffffffffffffffffffffffffff161461135a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611351906139b4565b60405180910390fd5b6001600b60006101000a81548160ff021916908360028111156113805761137f613f8f565b5b021790555050565b6000611395848484611bda565b90509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61143a6118be565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480611480575061147f8561147a6118be565b61139e565b5b6114bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b690613874565b60405180910390fd5b6114cc8585858585611fc7565b5050505050565b6114db6118be565b73ffffffffffffffffffffffffffffffffffffffff166114f96111f5565b73ffffffffffffffffffffffffffffffffffffffff161461154f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611546906139b4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115b690613834565b60405180910390fd5b6115c881611d94565b50565b6115d36118be565b73ffffffffffffffffffffffffffffffffffffffff166115f16111f5565b73ffffffffffffffffffffffffffffffffffffffff1614611647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163e906139b4565b60405180910390fd5b8060078190555050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600081600001549050919050565b6060600280546116d890613e26565b80601f016020809104026020016040519081016040528092919081815260200182805461170490613e26565b80156117515780601f1061172657610100808354040283529160200191611751565b820191906000526020600020905b81548152906001019060200180831161173457829003601f168201915b50505050509050919050565b606060008214156117a5576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506118b9565b600082905060005b600082146117d75780806117c090613e89565b915050600a826117d09190613c75565b91506117ad565b60008167ffffffffffffffff8111156117f3576117f261401c565b5b6040519080825280601f01601f1916602001820160405280156118255781602001600182028036833780820191505090505b5090505b600085146118b25760018261183e9190613d00565b9150600a8561184d9190613f00565b60306118599190613be8565b60f81b81838151811061186f5761186e613fed565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856118ab9190613c75565b9450611829565b8093505050505b919050565b600033905090565b815183511461190a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190190613a14565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561197a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197190613914565b60405180910390fd5b60006119846118be565b9050611994818787878787612249565b60005b8451811015611b455760008582815181106119b5576119b4613fed565b5b6020026020010151905060008583815181106119d4576119d3613fed565b5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611a75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6c90613974565b60405180910390fd5b81810360008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611b2a9190613be8565b9250508190555050505080611b3e90613e89565b9050611997565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611bbc92919061370a565b60405180910390a4611bd2818787878787612251565b505050505050565b60008082604051602001611bee9190613580565b604051602081830303815290604052805190602001209050611c54858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505060095483612438565b9150509392505050565b60008160ff1667ffffffffffffffff811115611c7d57611c7c61401c565b5b604051908082528060200260200182016040528015611cab5781602001602082028036833780820191505090505b50905060008260ff1667ffffffffffffffff811115611ccd57611ccc61401c565b5b604051908082528060200260200182016040528015611cfb5781602001602082028036833780820191505090505b50905060005b8360ff16811015611d7357611d1660046116bb565b838281518110611d2957611d28613fed565b5b6020026020010181815250506001828281518110611d4a57611d49613fed565b5b602002602001018181525050611d60600461244f565b8080611d6b90613e89565b915050611d01565b50611d8f33838360405180602001604052806000815250612465565b505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ec9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec0906139d4565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611fba9190613741565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612037576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202e90613914565b60405180910390fd5b60006120416118be565b905061206181878761205288612683565b61205b88612683565b87612249565b600080600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156120f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ef90613974565b60405180910390fd5b83810360008087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546121ad9190613be8565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62888860405161222a929190613a6f565b60405180910390a46122408288888888886126fd565b50505050505050565b505050505050565b6122708473ffffffffffffffffffffffffffffffffffffffff166128e4565b15612430578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b81526004016122b6959493929190613626565b602060405180830381600087803b1580156122d057600080fd5b505af192505050801561230157506040513d601f19601f820116820180604052508101906122fe9190613024565b60015b6123a75761230d61404b565b806308c379a0141561236a5750612322614607565b8061232d575061236c565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123619190613792565b60405180910390fd5b505b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239e906137b4565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461242e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612425906137d4565b60405180910390fd5b505b505050505050565b60008261244585846128f7565b1490509392505050565b6001816000016000828254019250508190555050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156124d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124cc90613a34565b60405180910390fd5b8151835114612519576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251090613a14565b60405180910390fd5b60006125236118be565b905061253481600087878787612249565b60005b84518110156125ed5783818151811061255357612552613fed565b5b602002602001015160008087848151811061257157612570613fed565b5b6020026020010151815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546125d39190613be8565b9250508190555080806125e590613e89565b915050612537565b508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161266592919061370a565b60405180910390a461267c81600087878787612251565b5050505050565b60606000600167ffffffffffffffff8111156126a2576126a161401c565b5b6040519080825280602002602001820160405280156126d05781602001602082028036833780820191505090505b50905082816000815181106126e8576126e7613fed565b5b60200260200101818152505080915050919050565b61271c8473ffffffffffffffffffffffffffffffffffffffff166128e4565b156128dc578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b815260040161276295949392919061368e565b602060405180830381600087803b15801561277c57600080fd5b505af19250505080156127ad57506040513d601f19601f820116820180604052508101906127aa9190613024565b60015b612853576127b961404b565b806308c379a0141561281657506127ce614607565b806127d95750612818565b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280d9190613792565b60405180910390fd5b505b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a906137b4565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146128da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128d1906137d4565b60405180910390fd5b505b505050505050565b600080823b905060008111915050919050565b60008082905060005b845181101561299f57600085828151811061291e5761291d613fed565b5b6020026020010151905080831161295f57828160405160200161294292919061359b565b60405160208183030381529060405280519060200120925061298b565b808360405160200161297292919061359b565b6040516020818303038152906040528051906020012092505b50808061299790613e89565b915050612900565b508091505092915050565b60006129bd6129b884613ad8565b613ab3565b905080838252602082019050828560208602820111156129e0576129df614077565b5b60005b85811015612a1057816129f68882612acc565b8452602084019350602083019250506001810190506129e3565b5050509392505050565b6000612a2d612a2884613b04565b613ab3565b90508083825260208201905082856020860282011115612a5057612a4f614077565b5b60005b85811015612a805781612a668882612c15565b845260208401935060208301925050600181019050612a53565b5050509392505050565b6000612a9d612a9884613b30565b613ab3565b905082815260208101848484011115612ab957612ab861407c565b5b612ac4848285613de4565b509392505050565b600081359050612adb816146b1565b92915050565b600082601f830112612af657612af5614072565b5b8135612b068482602086016129aa565b91505092915050565b60008083601f840112612b2557612b24614072565b5b8235905067ffffffffffffffff811115612b4257612b4161406d565b5b602083019150836020820283011115612b5e57612b5d614077565b5b9250929050565b600082601f830112612b7a57612b79614072565b5b8135612b8a848260208601612a1a565b91505092915050565b600081359050612ba2816146c8565b92915050565b600081359050612bb7816146df565b92915050565b600081359050612bcc816146f6565b92915050565b600081519050612be1816146f6565b92915050565b600082601f830112612bfc57612bfb614072565b5b8135612c0c848260208601612a8a565b91505092915050565b600081359050612c248161470d565b92915050565b600081359050612c3981614724565b92915050565b600060208284031215612c5557612c54614086565b5b6000612c6384828501612acc565b91505092915050565b60008060408385031215612c8357612c82614086565b5b6000612c9185828601612acc565b9250506020612ca285828601612acc565b9150509250929050565b600080600080600060a08688031215612cc857612cc7614086565b5b6000612cd688828901612acc565b9550506020612ce788828901612acc565b945050604086013567ffffffffffffffff811115612d0857612d07614081565b5b612d1488828901612b65565b935050606086013567ffffffffffffffff811115612d3557612d34614081565b5b612d4188828901612b65565b925050608086013567ffffffffffffffff811115612d6257612d61614081565b5b612d6e88828901612be7565b9150509295509295909350565b600080600080600060a08688031215612d9757612d96614086565b5b6000612da588828901612acc565b9550506020612db688828901612acc565b9450506040612dc788828901612c15565b9350506060612dd888828901612c15565b925050608086013567ffffffffffffffff811115612df957612df8614081565b5b612e0588828901612be7565b9150509295509295909350565b60008060408385031215612e2957612e28614086565b5b6000612e3785828601612acc565b9250506020612e4885828601612b93565b9150509250929050565b60008060408385031215612e6957612e68614086565b5b6000612e7785828601612acc565b9250506020612e8885828601612c15565b9150509250929050565b60008060408385031215612ea957612ea8614086565b5b600083013567ffffffffffffffff811115612ec757612ec6614081565b5b612ed385828601612ae1565b925050602083013567ffffffffffffffff811115612ef457612ef3614081565b5b612f0085828601612b65565b9150509250929050565b600080600060408486031215612f2357612f22614086565b5b600084013567ffffffffffffffff811115612f4157612f40614081565b5b612f4d86828701612b0f565b93509350506020612f6086828701612acc565b9150509250925092565b600080600060408486031215612f8357612f82614086565b5b600084013567ffffffffffffffff811115612fa157612fa0614081565b5b612fad86828701612b0f565b93509350506020612fc086828701612c2a565b9150509250925092565b600060208284031215612fe057612fdf614086565b5b6000612fee84828501612ba8565b91505092915050565b60006020828403121561300d5761300c614086565b5b600061301b84828501612bbd565b91505092915050565b60006020828403121561303a57613039614086565b5b600061304884828501612bd2565b91505092915050565b60006020828403121561306757613066614086565b5b600061307584828501612c15565b91505092915050565b60006020828403121561309457613093614086565b5b60006130a284828501612c2a565b91505092915050565b60006130b78383613553565b60208301905092915050565b6130cc81613d34565b82525050565b6130e36130de82613d34565b613ed2565b82525050565b60006130f482613b71565b6130fe8185613b9f565b935061310983613b61565b8060005b8381101561313a57815161312188826130ab565b975061312c83613b92565b92505060018101905061310d565b5085935050505092915050565b61315081613d46565b82525050565b61315f81613d52565b82525050565b61317661317182613d52565b613ee4565b82525050565b600061318782613b7c565b6131918185613bb0565b93506131a1818560208601613df3565b6131aa8161408b565b840191505092915050565b6131be81613dd2565b82525050565b60006131cf82613b87565b6131d98185613bcc565b93506131e9818560208601613df3565b6131f28161408b565b840191505092915050565b600061320882613b87565b6132128185613bdd565b9350613222818560208601613df3565b80840191505092915050565b600061323b603483613bcc565b9150613246826140b6565b604082019050919050565b600061325e602883613bcc565b915061326982614105565b604082019050919050565b6000613281601083613bcc565b915061328c82614154565b602082019050919050565b60006132a4602b83613bcc565b91506132af8261417d565b604082019050919050565b60006132c7602683613bcc565b91506132d2826141cc565b604082019050919050565b60006132ea601083613bcc565b91506132f58261421b565b602082019050919050565b600061330d602983613bcc565b915061331882614244565b604082019050919050565b6000613330601483613bcc565b915061333b82614293565b602082019050919050565b6000613353601083613bcc565b915061335e826142bc565b602082019050919050565b6000613376600a83613bcc565b9150613381826142e5565b602082019050919050565b6000613399600f83613bcc565b91506133a48261430e565b602082019050919050565b60006133bc602583613bcc565b91506133c782614337565b604082019050919050565b60006133df603283613bcc565b91506133ea82614386565b604082019050919050565b6000613402601683613bcc565b915061340d826143d5565b602082019050919050565b6000613425602a83613bcc565b9150613430826143fe565b604082019050919050565b6000613448600583613bdd565b91506134538261444d565b600582019050919050565b600061346b601983613bcc565b915061347682614476565b602082019050919050565b600061348e602083613bcc565b91506134998261449f565b602082019050919050565b60006134b1600083613bc1565b91506134bc826144c8565b600082019050919050565b60006134d4602983613bcc565b91506134df826144cb565b604082019050919050565b60006134f7602983613bcc565b91506135028261451a565b604082019050919050565b600061351a602883613bcc565b915061352582614569565b604082019050919050565b600061353d602183613bcc565b9150613548826145b8565b604082019050919050565b61355c81613dbb565b82525050565b61356b81613dbb565b82525050565b61357a81613dc5565b82525050565b600061358c82846130d2565b60148201915081905092915050565b60006135a78285613165565b6020820191506135b78284613165565b6020820191508190509392505050565b60006135d382856131fd565b91506135df82846131fd565b91506135ea8261343b565b91508190509392505050565b6000613601826134a4565b9150819050919050565b600060208201905061362060008301846130c3565b92915050565b600060a08201905061363b60008301886130c3565b61364860208301876130c3565b818103604083015261365a81866130e9565b9050818103606083015261366e81856130e9565b90508181036080830152613682818461317c565b90509695505050505050565b600060a0820190506136a360008301886130c3565b6136b060208301876130c3565b6136bd6040830186613562565b6136ca6060830185613562565b81810360808301526136dc818461317c565b90509695505050505050565b6000602082019050818103600083015261370281846130e9565b905092915050565b6000604082019050818103600083015261372481856130e9565b9050818103602083015261373881846130e9565b90509392505050565b60006020820190506137566000830184613147565b92915050565b60006020820190506137716000830184613156565b92915050565b600060208201905061378c60008301846131b5565b92915050565b600060208201905081810360008301526137ac81846131c4565b905092915050565b600060208201905081810360008301526137cd8161322e565b9050919050565b600060208201905081810360008301526137ed81613251565b9050919050565b6000602082019050818103600083015261380d81613274565b9050919050565b6000602082019050818103600083015261382d81613297565b9050919050565b6000602082019050818103600083015261384d816132ba565b9050919050565b6000602082019050818103600083015261386d816132dd565b9050919050565b6000602082019050818103600083015261388d81613300565b9050919050565b600060208201905081810360008301526138ad81613323565b9050919050565b600060208201905081810360008301526138cd81613346565b9050919050565b600060208201905081810360008301526138ed81613369565b9050919050565b6000602082019050818103600083015261390d8161338c565b9050919050565b6000602082019050818103600083015261392d816133af565b9050919050565b6000602082019050818103600083015261394d816133d2565b9050919050565b6000602082019050818103600083015261396d816133f5565b9050919050565b6000602082019050818103600083015261398d81613418565b9050919050565b600060208201905081810360008301526139ad8161345e565b9050919050565b600060208201905081810360008301526139cd81613481565b9050919050565b600060208201905081810360008301526139ed816134c7565b9050919050565b60006020820190508181036000830152613a0d816134ea565b9050919050565b60006020820190508181036000830152613a2d8161350d565b9050919050565b60006020820190508181036000830152613a4d81613530565b9050919050565b6000602082019050613a696000830184613562565b92915050565b6000604082019050613a846000830185613562565b613a916020830184613562565b9392505050565b6000602082019050613aad6000830184613571565b92915050565b6000613abd613ace565b9050613ac98282613e58565b919050565b6000604051905090565b600067ffffffffffffffff821115613af357613af261401c565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613b1f57613b1e61401c565b5b602082029050602081019050919050565b600067ffffffffffffffff821115613b4b57613b4a61401c565b5b613b548261408b565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000613bf382613dbb565b9150613bfe83613dbb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c3357613c32613f31565b5b828201905092915050565b6000613c4982613dc5565b9150613c5483613dc5565b92508260ff03821115613c6a57613c69613f31565b5b828201905092915050565b6000613c8082613dbb565b9150613c8b83613dbb565b925082613c9b57613c9a613f60565b5b828204905092915050565b6000613cb182613dbb565b9150613cbc83613dbb565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613cf557613cf4613f31565b5b828202905092915050565b6000613d0b82613dbb565b9150613d1683613dbb565b925082821015613d2957613d28613f31565b5b828203905092915050565b6000613d3f82613d9b565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6000819050613d968261469d565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613ddd82613d88565b9050919050565b82818337600083830152505050565b60005b83811015613e11578082015181840152602081019050613df6565b83811115613e20576000848401525b50505050565b60006002820490506001821680613e3e57607f821691505b60208210811415613e5257613e51613fbe565b5b50919050565b613e618261408b565b810181811067ffffffffffffffff82111715613e8057613e7f61401c565b5b80604052505050565b6000613e9482613dbb565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613ec757613ec6613f31565b5b600182019050919050565b6000613edd82613eee565b9050919050565b6000819050919050565b6000613ef98261409c565b9050919050565b6000613f0b82613dbb565b9150613f1683613dbb565b925082613f2657613f25613f60565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060033d111561406a5760046000803e6140676000516140a9565b90505b90565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b60008160e01c9050919050565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b7f4e6f74206f6e2077686974656c69737400000000000000000000000000000000600082015250565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4e6f7420656e6f7567682066756e647300000000000000000000000000000000600082015250565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b7f4661696c656420746f2073656e64204574686572000000000000000000000000600082015250565b7f416d6f756e7420746f6f206c6172676500000000000000000000000000000000600082015250565b7f496e76616c696420696400000000000000000000000000000000000000000000600082015250565b7f496e636f72726563742073746167650000000000000000000000000000000000600082015250565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b7f4e6f7420656e6f75676820746f6b656e73206c65667400000000000000000000600082015250565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b7f2e6a736f6e000000000000000000000000000000000000000000000000000000600082015250565b7f4d6178206d696e74656420616d6f756e74207265616368656400000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b50565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600060443d10156146175761469a565b61461f613ace565b60043d036004823e80513d602482011167ffffffffffffffff8211171561464757505061469a565b808201805167ffffffffffffffff811115614665575050505061469a565b80602083010160043d03850181111561468257505050505061469a565b61469182602001850186613e58565b82955050505050505b90565b600381106146ae576146ad613f8f565b5b50565b6146ba81613d34565b81146146c557600080fd5b50565b6146d181613d46565b81146146dc57600080fd5b50565b6146e881613d52565b81146146f357600080fd5b50565b6146ff81613d5c565b811461470a57600080fd5b50565b61471681613dbb565b811461472157600080fd5b50565b61472d81613dc5565b811461473857600080fd5b5056fea26469706673582212207655e2732affb6f885df2fc8cffbb9ddc49424d936bae227cdd8fda436700b3d64736f6c63430008060033
Verified Source Code Full Match
Compiler: v0.8.6+commit.11564f7e
EVM: berlin
Optimization: No
SyndicateMember.sol 153 lines
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
enum Stages {
WHITELIST,
PRIVATE_SALE,
PUBLIC_SALE
}
contract SyndicateMember is ERC1155, Ownable {
using Strings for uint256;
using Counters for Counters.Counter;
using EnumerableSet for EnumerableSet.AddressSet;
Counters.Counter public id;
string public name = "Syndicate 893";
uint256 private totalSupply = 893;
uint256 public mintPrice = 0.15 ether;
uint8 public maxMintAmt = 2;
bytes32 public merkleRoot;
mapping(address => uint8) private mintedCount;
Stages public stage = Stages.WHITELIST;
constructor(string memory _uri) ERC1155(_uri) {}
modifier atStage(Stages _stage) {
require(stage == _stage, "Incorrect stage");
_;
}
modifier onlyWhitelist(bytes32[] calldata _merkleProof) {
require(_inWhitelist(_merkleProof, msg.sender), "Not on whitelist");
_;
}
modifier ensureEnoughFunds(uint256 _amount) {
require(msg.value >= mintPrice * _amount, "Not enough funds");
_;
}
modifier lessThanMaxAmount(uint256 _amount) {
require(_amount <= maxMintAmt, "Amount too large");
_;
}
modifier ensureEnoughTokensAvailable(uint256 _amount) {
require(id.current() < totalSupply - _amount, "Not enough tokens left");
_;
}
function _inWhitelist(bytes32[] calldata _merkleProof, address _sender)
internal
view
returns (bool)
{
bytes32 _leaf = keccak256(abi.encodePacked(_sender));
return MerkleProof.verify(_merkleProof, merkleRoot, _leaf);
}
function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
merkleRoot = _merkleRoot;
}
function inWhitelist(bytes32[] calldata _merkleProof, address _user)
external
view
returns (bool)
{
return _inWhitelist(_merkleProof, _user);
}
function setPrivateSale() external atStage(Stages.WHITELIST) onlyOwner {
stage = Stages.PRIVATE_SALE;
}
function setPublicSale() external atStage(Stages.PRIVATE_SALE) onlyOwner {
stage = Stages.PUBLIC_SALE;
}
function setMintPrice(uint256 _mintPrice) external onlyOwner {
mintPrice = _mintPrice;
}
function _doSubscriptionMint(uint8 _amount) internal {
uint256[] memory _ids = new uint256[](_amount);
uint256[] memory _amounts = new uint256[](_amount);
for (uint256 _i = 0; _i < _amount; _i++) {
_ids[_i] = id.current();
_amounts[_i] = 1;
id.increment();
}
_mintBatch(msg.sender, _ids, _amounts, "");
}
function withdraw() external onlyOwner {
(bool sent, ) = payable(msg.sender).call{value: address(this).balance}(
""
);
require(sent, "Failed to send Ether");
}
function mintPrivate(bytes32[] calldata _merkleProof, uint8 _amount)
external
payable
atStage(Stages.PRIVATE_SALE)
onlyWhitelist(_merkleProof)
ensureEnoughFunds(_amount)
lessThanMaxAmount(_amount)
ensureEnoughTokensAvailable(_amount)
{
require(
mintedCount[msg.sender] < maxMintAmt,
"Max minted amount reached"
);
mintedCount[msg.sender] += 1;
_doSubscriptionMint(_amount);
}
function mintPublic(uint8 _amount)
external
payable
atStage(Stages.PUBLIC_SALE)
ensureEnoughFunds(_amount)
lessThanMaxAmount(_amount)
ensureEnoughTokensAvailable(_amount)
{
_doSubscriptionMint(_amount);
}
// Metadata is always the same regardless of id
function uri(uint256 _id) public view override returns (string memory) {
require(_id < id.current(), "Invalid id");
return
string(
abi.encodePacked(super.uri(_id), Strings.toString(_id), ".json")
);
}
}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
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 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);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Counters.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
ERC1155.sol 464 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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();
_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 `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();
_beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_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);
_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();
_beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
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);
}
/**
* @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);
}
/**
* @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 {}
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;
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
EnumerableSet.sol 357 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
return _values(set._inner);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly {
result := store
}
return result;
}
}
IERC1155Receiver.sol 53 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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.
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);
}
MerkleProof.sol 52 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
return computedHash;
}
}
ERC1155Receiver.sol 19 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";
/**
* @dev _Available since v3.1._
*/
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
}
IERC1155MetadataURI.sol 22 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Read Contract
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
id 0xaf640d0f → uint256
inWhitelist 0xe5ec56a0 → bool
isApprovedForAll 0xe985e9c5 → bool
maxMintAmt 0xa53dc05f → uint8
merkleRoot 0x2eb4a7ab → bytes32
mintPrice 0x6817c76c → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
stage 0xc040e6b8 → uint8
supportsInterface 0x01ffc9a7 → bool
uri 0x0e89341c → string
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
mintPrivate 0x3391e5f8
bytes32[] _merkleProof
uint8 _amount
mintPublic 0x67dce1ed
uint8 _amount
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
setMerkleRoot 0x7cb64759
bytes32 _merkleRoot
setMintPrice 0xf4a0a528
uint256 _mintPrice
setPrivateSale 0xd1f1ef34
No parameters
setPublicSale 0x56f8f78c
No parameters
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Token Balances (1)
View Transfers →Recent Transactions
No transactions found for this address