Address Contract Verified
Address
0x6eCe2E550D7848c40C26A0E704b7a19D1f8dbcF0
Balance
0 ETH
Nonce
1
Code Size
19832 bytes
Creator
0x188f630E...2fc0 at tx 0x9d28516b...ecd1b4
Indexed Transactions
0
Contract Bytecode
19832 bytes
0x608060405234801561001057600080fd5b50600436106101c35760003560e01c80636ba4c138116100f9578063bed2417b11610097578063ea5a78b111610071578063ea5a78b1146104c8578063f242432a146104e4578063f2fde38b14610500578063f5298aca1461051c576101c3565b8063bed2417b1461045e578063e777df201461047a578063e985e9c514610498576101c3565b80638da5cb5b116100d35780638da5cb5b146103d85780639667f708146103f65780639c4ed0cf14610426578063a22cb46514610442576101c3565b80636ba4c13814610394578063715018a6146103c45780638010fc45146103ce576101c3565b806324600fc3116101665780632eb2c2d6116101405780632eb2c2d614610310578063465554651461032c5780634e1273f4146103485780636b20c45414610378576101c3565b806324600fc3146102ba57806327089c8c146102c45780632a6e81ac146102e0576101c3565b80630e89341c116101a25780630e89341c14610246578063202fcbbd1461027657806321f31e461461029257806321fec36c146102b0576101c3565b8062fdd58e146101c857806301ffc9a7146101f857806306fdde0314610228575b600080fd5b6101e260048036038101906101dd919061305b565b610538565b6040516101ef91906130aa565b60405180910390f35b610212600480360381019061020d919061311d565b610600565b60405161021f9190613165565b60405180910390f35b6102306106e2565b60405161023d9190613219565b60405180910390f35b610260600480360381019061025b919061323b565b610770565b60405161026d9190613219565b60405180910390f35b610290600480360381019061028b919061323b565b610804565b005b61029a61088a565b6040516102a79190613165565b60405180910390f35b6102b86108a1565b005b6102c2610949565b005b6102de60048036038101906102d9919061323b565b610a0e565b005b6102fa60048036038101906102f5919061323b565b610b7b565b6040516103079190613165565b60405180910390f35b61032a60048036038101906103259190613465565b610ba5565b005b610346600480360381019061034191906135e5565b610c46565b005b610362600480360381019061035d9190613729565b610d8c565b60405161036f919061385f565b60405180910390f35b610392600480360381019061038d9190613881565b610ea5565b005b6103ae60048036038101906103a9919061390c565b610f42565b6040516103bb91906130aa565b60405180910390f35b6103cc6112a0565b005b6103d6611328565b005b6103e06113d0565b6040516103ed9190613968565b60405180910390f35b610410600480360381019061040b919061390c565b6113fa565b60405161041d9190613a41565b60405180910390f35b610440600480360381019061043b9190613a63565b6114d7565b005b61045c60048036038101906104579190613abc565b611597565b005b61047860048036038101906104739190613a63565b6115ad565b005b61048261166d565b60405161048f91906130aa565b60405180910390f35b6104b260048036038101906104ad9190613afc565b611677565b6040516104bf9190613165565b60405180910390f35b6104e260048036038101906104dd9190613b3c565b61170b565b005b6104fe60048036038101906104f99190613bbd565b6119ff565b005b61051a60048036038101906105159190613a63565b611aa0565b005b61053660048036038101906105319190613c54565b611b97565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036105a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059f90613d19565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806106cb57507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806106db57506106da82611c34565b5b9050919050565b600b80546106ef90613d68565b80601f016020809104026020016040519081016040528092919081815260200182805461071b90613d68565b80156107685780601f1061073d57610100808354040283529160200191610768565b820191906000526020600020905b81548152906001019060200180831161074b57829003601f168201915b505050505081565b60606002805461077f90613d68565b80601f01602080910402602001604051908101604052809291908181526020018280546107ab90613d68565b80156107f85780601f106107cd576101008083540402835291602001916107f8565b820191906000526020600020905b8154815290600101906020018083116107db57829003601f168201915b50505050509050919050565b61080c611c9e565b73ffffffffffffffffffffffffffffffffffffffff1661082a6113d0565b73ffffffffffffffffffffffffffffffffffffffff1614610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087790613de5565b60405180910390fd5b8060068190555050565b6000600a60009054906101000a900460ff16905090565b6108a9611c9e565b73ffffffffffffffffffffffffffffffffffffffff166108c76113d0565b73ffffffffffffffffffffffffffffffffffffffff161461091d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091490613de5565b60405180910390fd5b600a60019054906101000a900460ff1615600a60016101000a81548160ff021916908315150217905550565b610951611c9e565b73ffffffffffffffffffffffffffffffffffffffff1661096f6113d0565b73ffffffffffffffffffffffffffffffffffffffff16146109c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109bc90613de5565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610a0b573d6000803e3d6000fd5b50565b610a16611c9e565b73ffffffffffffffffffffffffffffffffffffffff16610a346113d0565b73ffffffffffffffffffffffffffffffffffffffff1614610a8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8190613de5565b60405180910390fd5b6000610a963383610538565b11610ad6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610acd90613e51565b60405180910390fd5b610ae233826001611b97565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663c349c93e3360016040518363ffffffff1660e01b8152600401610b45929190613eb6565b600060405180830381600087803b158015610b5f57600080fd5b505af1158015610b73573d6000803e3d6000fd5b505050505050565b60006009600083815260200190815260200160002060009054906101000a900460ff169050919050565b610bad611c9e565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610bf35750610bf285610bed611c9e565b611677565b5b610c32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2990613f51565b60405180910390fd5b610c3f8585858585611ca6565b5050505050565b610c4e611c9e565b73ffffffffffffffffffffffffffffffffffffffff16610c6c6113d0565b73ffffffffffffffffffffffffffffffffffffffff1614610cc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb990613de5565b60405180910390fd5b60005b84849050811015610d855760046000815480929190610ce390613fa0565b9190505550828282818110610cfb57610cfa613fe8565b5b90506020020135600554610d0f9190614017565b600581905550610d72858583818110610d2b57610d2a613fe8565b5b9050602002016020810190610d409190613a63565b600454858585818110610d5657610d55613fe8565b5b9050602002013560405180602001604052806000815250611fc7565b8080610d7d90613fa0565b915050610cc5565b5050505050565b60608151835114610dd2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc9906140df565b60405180910390fd5b6000835167ffffffffffffffff811115610def57610dee61326d565b5b604051908082528060200260200182016040528015610e1d5781602001602082028036833780820191505090505b50905060005b8451811015610e9a57610e6a858281518110610e4257610e41613fe8565b5b6020026020010151858381518110610e5d57610e5c613fe8565b5b6020026020010151610538565b828281518110610e7d57610e7c613fe8565b5b60200260200101818152505080610e9390613fa0565b9050610e23565b508091505092915050565b610ead611c9e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480610ef35750610ef283610eed611c9e565b611677565b5b610f32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2990614171565b60405180910390fd5b610f3d838383612177565b505050565b600060011515600a60009054906101000a900460ff16151514610f9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f91906141dd565b60405180910390fd5b60008383905011610fe0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd790614249565b60405180910390fd5b600080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060005b85859050811015611243573373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16636352211e88888581811061105c5761105b613fe8565b5b905060200201356040518263ffffffff1660e01b815260040161107f91906130aa565b602060405180830381865afa15801561109c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c0919061427e565b73ffffffffffffffffffffffffffffffffffffffff1614611116576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110d90613e51565b60405180910390fd5b6000151561113c8787848181106111305761112f613fe8565b5b90506020020135610b7b565b15151461117e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611175906142f7565b60405180910390fd5b60065486868381811061119457611193613fe8565b5b9050602002013511156111dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d390614363565b60405180910390fd5b6001600960008888858181106111f5576111f4613fe8565b5b90506020020135815260200190815260200160002060006101000a81548160ff02191690831515021790555060018361122e9190614017565b9250808061123b90613fa0565b91505061100b565b50600060045490506004600081548092919061125e90613fa0565b9190505550826005546112719190614017565b600581905550611294336004548560405180602001604052806000815250611fc7565b80935050505092915050565b6112a8611c9e565b73ffffffffffffffffffffffffffffffffffffffff166112c66113d0565b73ffffffffffffffffffffffffffffffffffffffff161461131c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131390613de5565b60405180910390fd5b6113266000612445565b565b611330611c9e565b73ffffffffffffffffffffffffffffffffffffffff1661134e6113d0565b73ffffffffffffffffffffffffffffffffffffffff16146113a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139b90613de5565b60405180910390fd5b600a60009054906101000a900460ff1615600a60006101000a81548160ff021916908315150217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060008383905067ffffffffffffffff81111561141b5761141a61326d565b5b6040519080825280602002602001820160405280156114495781602001602082028036833780820191505090505b50905060005b848490508110156114cc576009600086868481811061147157611470613fe8565b5b90506020020135815260200190815260200160002060009054906101000a900460ff168282815181106114a7576114a6613fe8565b5b60200260200101901515908115158152505080806114c490613fa0565b91505061144f565b508091505092915050565b6114df611c9e565b73ffffffffffffffffffffffffffffffffffffffff166114fd6113d0565b73ffffffffffffffffffffffffffffffffffffffff1614611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90613de5565b60405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6115a96115a2611c9e565b838361250b565b5050565b6115b5611c9e565b73ffffffffffffffffffffffffffffffffffffffff166115d36113d0565b73ffffffffffffffffffffffffffffffffffffffff1614611629576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162090613de5565b60405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600554905090565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60011515600a60019054906101000a900460ff16151514611761576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611758906143cf565b60405180910390fd5b8181905084849050146117a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117a090614461565b60405180910390fd5b6000805b858590508110156118d55760006117dd338888858181106117d1576117d0613fe8565b5b90506020020135610538565b1161181d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181490613e51565b60405180910390fd5b8383828181106118305761182f613fe8565b5b9050602002013561185a3388888581811061184e5761184d613fe8565b5b90506020020135610538565b101561189b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611892906144cd565b60405180910390fd5b8383828181106118ae576118ad613fe8565b5b90506020020135826118c09190614017565b915080806118cd90613fa0565b9150506117ad565b5061196333868680806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050610ea5565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663c349c93e33846040518363ffffffff1660e01b81526004016119c59291906144ed565b600060405180830381600087803b1580156119df57600080fd5b505af11580156119f3573d6000803e3d6000fd5b50505050505050505050565b611a07611c9e565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480611a4d5750611a4c85611a47611c9e565b611677565b5b611a8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8390614171565b60405180910390fd5b611a998585858585612677565b5050505050565b611aa8611c9e565b73ffffffffffffffffffffffffffffffffffffffff16611ac66113d0565b73ffffffffffffffffffffffffffffffffffffffff1614611b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1390613de5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611b8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8290614588565b60405180910390fd5b611b9481612445565b50565b611b9f611c9e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611be55750611be483611bdf611c9e565b611677565b5b611c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1b90614171565b60405180910390fd5b611c2f838383612912565b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b8151835114611cea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce19061461a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611d59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d50906146ac565b60405180910390fd5b6000611d63611c9e565b9050611d73818787878787612b58565b60005b8451811015611f24576000858281518110611d9457611d93613fe8565b5b602002602001015190506000858381518110611db357611db2613fe8565b5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611e54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4b9061473e565b60405180910390fd5b81810360008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611f099190614017565b9250508190555050505080611f1d90613fa0565b9050611d76565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611f9b92919061475e565b60405180910390a4611fb1818787878787612b60565b611fbf818787878787612b68565b505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202d90614807565b60405180910390fd5b6000612040611c9e565b9050600061204d85612d3f565b9050600061205a85612d3f565b905061206b83600089858589612b58565b8460008088815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546120ca9190614017565b925050819055508673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628989604051612148929190614827565b60405180910390a461215f83600089858589612b60565b61216e83600089898989612db9565b50505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036121e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121dd906148c2565b60405180910390fd5b805182511461222a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122219061461a565b60405180910390fd5b6000612234611c9e565b905061225481856000868660405180602001604052806000815250612b58565b60005b83518110156123a157600084828151811061227557612274613fe8565b5b60200260200101519050600084838151811061229457612293613fe8565b5b60200260200101519050600080600084815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612335576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161232c90614954565b60405180910390fd5b81810360008085815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050808061239990613fa0565b915050612257565b50600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb868660405161241992919061475e565b60405180910390a461243f81856000868660405180602001604052806000815250612b60565b50505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612579576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612570906149e6565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161266a9190613165565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036126e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126dd906146ac565b60405180910390fd5b60006126f0611c9e565b905060006126fd85612d3f565b9050600061270a85612d3f565b905061271a838989858589612b58565b600080600088815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050858110156127b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127a89061473e565b60405180910390fd5b85810360008089815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560008089815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546128669190614017565b925050819055508773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628a8a6040516128e3929190614827565b60405180910390a46128f9848a8a86868a612b60565b612907848a8a8a8a8a612db9565b505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612981576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612978906148c2565b60405180910390fd5b600061298b611c9e565b9050600061299884612d3f565b905060006129a584612d3f565b90506129c583876000858560405180602001604052806000815250612b58565b600080600087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905084811015612a5c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a5390614954565b60405180910390fd5b84810360008088815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628989604051612b29929190614827565b60405180910390a4612b4f84886000868660405180602001604052806000815250612b60565b50505050505050565b505050505050565b505050505050565b612b878473ffffffffffffffffffffffffffffffffffffffff16612f90565b15612d37578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b8152600401612bcd959493929190614a5b565b6020604051808303816000875af1925050508015612c0957506040513d601f19601f82011682018060405250810190612c069190614ad8565b60015b612cae57612c15614b12565b806308c379a003612c715750612c29614b34565b80612c345750612c73565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c689190613219565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ca590614c36565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612d35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d2c90614cc8565b60405180910390fd5b505b505050505050565b60606000600167ffffffffffffffff811115612d5e57612d5d61326d565b5b604051908082528060200260200182016040528015612d8c5781602001602082028036833780820191505090505b5090508281600081518110612da457612da3613fe8565b5b60200260200101818152505080915050919050565b612dd88473ffffffffffffffffffffffffffffffffffffffff16612f90565b15612f88578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b8152600401612e1e959493929190614ce8565b6020604051808303816000875af1925050508015612e5a57506040513d601f19601f82011682018060405250810190612e579190614ad8565b60015b612eff57612e66614b12565b806308c379a003612ec25750612e7a614b34565b80612e855750612ec4565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612eb99190613219565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ef690614c36565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612f86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f7d90614cc8565b60405180910390fd5b505b505050505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ff282612fc7565b9050919050565b61300281612fe7565b811461300d57600080fd5b50565b60008135905061301f81612ff9565b92915050565b6000819050919050565b61303881613025565b811461304357600080fd5b50565b6000813590506130558161302f565b92915050565b6000806040838503121561307257613071612fbd565b5b600061308085828601613010565b925050602061309185828601613046565b9150509250929050565b6130a481613025565b82525050565b60006020820190506130bf600083018461309b565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6130fa816130c5565b811461310557600080fd5b50565b600081359050613117816130f1565b92915050565b60006020828403121561313357613132612fbd565b5b600061314184828501613108565b91505092915050565b60008115159050919050565b61315f8161314a565b82525050565b600060208201905061317a6000830184613156565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156131ba57808201518184015260208101905061319f565b838111156131c9576000848401525b50505050565b6000601f19601f8301169050919050565b60006131eb82613180565b6131f5818561318b565b935061320581856020860161319c565b61320e816131cf565b840191505092915050565b6000602082019050818103600083015261323381846131e0565b905092915050565b60006020828403121561325157613250612fbd565b5b600061325f84828501613046565b91505092915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6132a5826131cf565b810181811067ffffffffffffffff821117156132c4576132c361326d565b5b80604052505050565b60006132d7612fb3565b90506132e3828261329c565b919050565b600067ffffffffffffffff8211156133035761330261326d565b5b602082029050602081019050919050565b600080fd5b600061332c613327846132e8565b6132cd565b9050808382526020820190506020840283018581111561334f5761334e613314565b5b835b8181101561337857806133648882613046565b845260208401935050602081019050613351565b5050509392505050565b600082601f83011261339757613396613268565b5b81356133a7848260208601613319565b91505092915050565b600080fd5b600067ffffffffffffffff8211156133d0576133cf61326d565b5b6133d9826131cf565b9050602081019050919050565b82818337600083830152505050565b6000613408613403846133b5565b6132cd565b905082815260208101848484011115613424576134236133b0565b5b61342f8482856133e6565b509392505050565b600082601f83011261344c5761344b613268565b5b813561345c8482602086016133f5565b91505092915050565b600080600080600060a0868803121561348157613480612fbd565b5b600061348f88828901613010565b95505060206134a088828901613010565b945050604086013567ffffffffffffffff8111156134c1576134c0612fc2565b5b6134cd88828901613382565b935050606086013567ffffffffffffffff8111156134ee576134ed612fc2565b5b6134fa88828901613382565b925050608086013567ffffffffffffffff81111561351b5761351a612fc2565b5b61352788828901613437565b9150509295509295909350565b600080fd5b60008083601f84011261354f5761354e613268565b5b8235905067ffffffffffffffff81111561356c5761356b613534565b5b60208301915083602082028301111561358857613587613314565b5b9250929050565b60008083601f8401126135a5576135a4613268565b5b8235905067ffffffffffffffff8111156135c2576135c1613534565b5b6020830191508360208202830111156135de576135dd613314565b5b9250929050565b600080600080604085870312156135ff576135fe612fbd565b5b600085013567ffffffffffffffff81111561361d5761361c612fc2565b5b61362987828801613539565b9450945050602085013567ffffffffffffffff81111561364c5761364b612fc2565b5b6136588782880161358f565b925092505092959194509250565b600067ffffffffffffffff8211156136815761368061326d565b5b602082029050602081019050919050565b60006136a56136a084613666565b6132cd565b905080838252602082019050602084028301858111156136c8576136c7613314565b5b835b818110156136f157806136dd8882613010565b8452602084019350506020810190506136ca565b5050509392505050565b600082601f8301126137105761370f613268565b5b8135613720848260208601613692565b91505092915050565b600080604083850312156137405761373f612fbd565b5b600083013567ffffffffffffffff81111561375e5761375d612fc2565b5b61376a858286016136fb565b925050602083013567ffffffffffffffff81111561378b5761378a612fc2565b5b61379785828601613382565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6137d681613025565b82525050565b60006137e883836137cd565b60208301905092915050565b6000602082019050919050565b600061380c826137a1565b61381681856137ac565b9350613821836137bd565b8060005b8381101561385257815161383988826137dc565b9750613844836137f4565b925050600181019050613825565b5085935050505092915050565b600060208201905081810360008301526138798184613801565b905092915050565b60008060006060848603121561389a57613899612fbd565b5b60006138a886828701613010565b935050602084013567ffffffffffffffff8111156138c9576138c8612fc2565b5b6138d586828701613382565b925050604084013567ffffffffffffffff8111156138f6576138f5612fc2565b5b61390286828701613382565b9150509250925092565b6000806020838503121561392357613922612fbd565b5b600083013567ffffffffffffffff81111561394157613940612fc2565b5b61394d8582860161358f565b92509250509250929050565b61396281612fe7565b82525050565b600060208201905061397d6000830184613959565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6139b88161314a565b82525050565b60006139ca83836139af565b60208301905092915050565b6000602082019050919050565b60006139ee82613983565b6139f8818561398e565b9350613a038361399f565b8060005b83811015613a34578151613a1b88826139be565b9750613a26836139d6565b925050600181019050613a07565b5085935050505092915050565b60006020820190508181036000830152613a5b81846139e3565b905092915050565b600060208284031215613a7957613a78612fbd565b5b6000613a8784828501613010565b91505092915050565b613a998161314a565b8114613aa457600080fd5b50565b600081359050613ab681613a90565b92915050565b60008060408385031215613ad357613ad2612fbd565b5b6000613ae185828601613010565b9250506020613af285828601613aa7565b9150509250929050565b60008060408385031215613b1357613b12612fbd565b5b6000613b2185828601613010565b9250506020613b3285828601613010565b9150509250929050565b60008060008060408587031215613b5657613b55612fbd565b5b600085013567ffffffffffffffff811115613b7457613b73612fc2565b5b613b808782880161358f565b9450945050602085013567ffffffffffffffff811115613ba357613ba2612fc2565b5b613baf8782880161358f565b925092505092959194509250565b600080600080600060a08688031215613bd957613bd8612fbd565b5b6000613be788828901613010565b9550506020613bf888828901613010565b9450506040613c0988828901613046565b9350506060613c1a88828901613046565b925050608086013567ffffffffffffffff811115613c3b57613c3a612fc2565b5b613c4788828901613437565b9150509295509295909350565b600080600060608486031215613c6d57613c6c612fbd565b5b6000613c7b86828701613010565b9350506020613c8c86828701613046565b9250506040613c9d86828701613046565b9150509250925092565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b6000613d03602b8361318b565b9150613d0e82613ca7565b604082019050919050565b60006020820190508181036000830152613d3281613cf6565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613d8057607f821691505b602082108103613d9357613d92613d39565b5b50919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613dcf60208361318b565b9150613dda82613d99565b602082019050919050565b60006020820190508181036000830152613dfe81613dc2565b9050919050565b7f446f65736e2774206f776e2074686520746f6b656e0000000000000000000000600082015250565b6000613e3b60158361318b565b9150613e4682613e05565b602082019050919050565b60006020820190508181036000830152613e6a81613e2e565b9050919050565b6000819050919050565b6000819050919050565b6000613ea0613e9b613e9684613e71565b613e7b565b613025565b9050919050565b613eb081613e85565b82525050565b6000604082019050613ecb6000830185613959565b613ed86020830184613ea7565b9392505050565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b6000613f3b60328361318b565b9150613f4682613edf565b604082019050919050565b60006020820190508181036000830152613f6a81613f2e565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613fab82613025565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613fdd57613fdc613f71565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061402282613025565b915061402d83613025565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561406257614061613f71565b5b828201905092915050565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b60006140c960298361318b565b91506140d48261406d565b604082019050919050565b600060208201905081810360008301526140f8816140bc565b9050919050565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b600061415b60298361318b565b9150614166826140ff565b604082019050919050565b6000602082019050818103600083015261418a8161414e565b9050919050565b7f436c61696d696e6720686173206e6f7420737461727465640000000000000000600082015250565b60006141c760188361318b565b91506141d282614191565b602082019050919050565b600060208201905081810360008301526141f6816141ba565b9050919050565b7f4e6f20746f6b656e732064657465637465640000000000000000000000000000600082015250565b600061423360128361318b565b915061423e826141fd565b602082019050919050565b6000602082019050818103600083015261426281614226565b9050919050565b60008151905061427881612ff9565b92915050565b60006020828403121561429457614293612fbd565b5b60006142a284828501614269565b91505092915050565b7f546f6b656e20616c72656164792072656465656d656400000000000000000000600082015250565b60006142e160168361318b565b91506142ec826142ab565b602082019050919050565b60006020820190508181036000830152614310816142d4565b9050919050565b7f546f6b656e206e6f742076616c69640000000000000000000000000000000000600082015250565b600061434d600f8361318b565b915061435882614317565b602082019050919050565b6000602082019050818103600083015261437c81614340565b9050919050565b7f4d6967726174696f6e20686173206e6f74207374617274656400000000000000600082015250565b60006143b960198361318b565b91506143c482614383565b602082019050919050565b600060208201905081810360008301526143e8816143ac565b9050919050565b7f4d69736d61746368206265747765656e2069647320616e6420616d6f756e747360008201527f206c656e67746873000000000000000000000000000000000000000000000000602082015250565b600061444b60288361318b565b9150614456826143ef565b604082019050919050565b6000602082019050818103600083015261447a8161443e565b9050919050565b7f416d6f756e7420657863656564732062616c616e636500000000000000000000600082015250565b60006144b760168361318b565b91506144c282614481565b602082019050919050565b600060208201905081810360008301526144e6816144aa565b9050919050565b60006040820190506145026000830185613959565b61450f602083018461309b565b9392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061457260268361318b565b915061457d82614516565b604082019050919050565b600060208201905081810360008301526145a181614565565b9050919050565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b600061460460288361318b565b915061460f826145a8565b604082019050919050565b60006020820190508181036000830152614633816145f7565b9050919050565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061469660258361318b565b91506146a18261463a565b604082019050919050565b600060208201905081810360008301526146c581614689565b9050919050565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b6000614728602a8361318b565b9150614733826146cc565b604082019050919050565b600060208201905081810360008301526147578161471b565b9050919050565b600060408201905081810360008301526147788185613801565b9050818103602083015261478c8184613801565b90509392505050565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b60006147f160218361318b565b91506147fc82614795565b604082019050919050565b60006020820190508181036000830152614820816147e4565b9050919050565b600060408201905061483c600083018561309b565b614849602083018461309b565b9392505050565b7f455243313135353a206275726e2066726f6d20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006148ac60238361318b565b91506148b782614850565b604082019050919050565b600060208201905081810360008301526148db8161489f565b9050919050565b7f455243313135353a206275726e20616d6f756e7420657863656564732062616c60008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b600061493e60248361318b565b9150614949826148e2565b604082019050919050565b6000602082019050818103600083015261496d81614931565b9050919050565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b60006149d060298361318b565b91506149db82614974565b604082019050919050565b600060208201905081810360008301526149ff816149c3565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000614a2d82614a06565b614a378185614a11565b9350614a4781856020860161319c565b614a50816131cf565b840191505092915050565b600060a082019050614a706000830188613959565b614a7d6020830187613959565b8181036040830152614a8f8186613801565b90508181036060830152614aa38185613801565b90508181036080830152614ab78184614a22565b90509695505050505050565b600081519050614ad2816130f1565b92915050565b600060208284031215614aee57614aed612fbd565b5b6000614afc84828501614ac3565b91505092915050565b60008160e01c9050919050565b600060033d1115614b315760046000803e614b2e600051614b05565b90505b90565b600060443d10614bc157614b46612fb3565b60043d036004823e80513d602482011167ffffffffffffffff82111715614b6e575050614bc1565b808201805167ffffffffffffffff811115614b8c5750505050614bc1565b80602083010160043d038501811115614ba9575050505050614bc1565b614bb88260200185018661329c565b82955050505050505b90565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b6000614c2060348361318b565b9150614c2b82614bc4565b604082019050919050565b60006020820190508181036000830152614c4f81614c13565b9050919050565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b6000614cb260288361318b565b9150614cbd82614c56565b604082019050919050565b60006020820190508181036000830152614ce181614ca5565b9050919050565b600060a082019050614cfd6000830188613959565b614d0a6020830187613959565b614d17604083018661309b565b614d24606083018561309b565b8181036080830152614d368184614a22565b9050969550505050505056fea264697066735822122050ba139b2ebfbc3c26c92b0cfd7c8f7fd524d4a2407c3fba7a250b456ea54afa64736f6c634300080e0033
Verified Source Code Full Match
Compiler: v0.8.14+commit.80d49f37
EVM: london
Optimization: No
SkyFalls.sol 152 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
abstract contract SilksMigrateToInterface {
function mintTransfer(address to, uint256 amount) public virtual;
}
abstract contract ERC721 {
function ownerOf(uint256 tokenId) public view virtual returns (address);
}
contract SkyFalls is ERC1155, Ownable, ERC1155Burnable {
using SafeMath for uint256;
uint256 skyFallsTokenId = 0;
uint256 amountMinted = 0;
// Note: In the claim function the maximum number of tokens will be based on whether not the avatar id being used
// is equal to or below this value. Transferring SkyFall tokens to an address without using a avatar can be done
// by the contract owner using the airdropGiveaway function. There is not limit on how many can be given away there.
uint256 maxTokenId = 5000;
address silksMigrateToContractAddress;
address silksAvatarContractAddress;
mapping (uint256 => bool) usedToken;
bool claimStarted = false;
bool migrationStarted = false;
string public name = "Silks - Sky Falls";
constructor() ERC1155("https://claim.silks.io/api/metadata") {
silksAvatarContractAddress = 0xA03e357A09E761E8d486A1419c74bf42e8D1B064;
}
function setSilksAvatarContractAddress(address contractAddress) public onlyOwner {
silksAvatarContractAddress = contractAddress;
}
// Set authorized contract address for minting the ERC-721 token
function setSilksMigrateToContract(address contractAddress) public onlyOwner {
silksMigrateToContractAddress = contractAddress;
}
function setMaxTokenId(uint256 _maxTokenId) public onlyOwner {
maxTokenId = _maxTokenId;
}
// Toggle whether contract claiming is allowed
function toggleClaiming() public onlyOwner {
claimStarted = !claimStarted;
}
function isClaimingStarted() public view virtual returns (bool) {
return claimStarted;
}
// Authorize specific smart contract to be used for minting an ERC-1155 token
function toggleMigration() public onlyOwner {
migrationStarted = !migrationStarted;
}
// Claim Batch function
function claim(uint256[] calldata tokenIds) public returns(uint256) {
require(claimStarted == true, "Claiming has not started");
require(tokenIds.length > 0, "No tokens detected");
uint256 amount = 0;
ERC721 silksGenesisAvatarContract = ERC721(silksAvatarContractAddress);
// Verify token ownership and if already redeemed
for(uint256 i = 0; i < tokenIds.length; i++) {
require(silksGenesisAvatarContract.ownerOf(tokenIds[i]) == msg.sender, "Doesn't own the token");
require(checkIfRedeemed(tokenIds[i]) == false, "Token already redeemed");
require(tokenIds[i] <= maxTokenId, "Token not valid");
usedToken[tokenIds[i]] = true;
amount += 1;
}
uint256 prevSkyFallTokenId = skyFallsTokenId;
skyFallsTokenId++;
amountMinted = amountMinted + amount;
_mint(msg.sender, skyFallsTokenId, amount, "");
return prevSkyFallTokenId;
}
// Allowing direct drop for gievaway
function airdropGiveaway(address[] calldata to, uint256[] calldata amountToMint) public onlyOwner {
for(uint256 i = 0; i < to.length; i++) {
skyFallsTokenId++;
amountMinted = amountMinted + amountToMint[i];
_mint(to[i], skyFallsTokenId, amountToMint[i], "");
}
}
// Allow to use the ERC-1155 to get the SilksLand ERC-721 final token
function migrateTokens(uint256[] calldata ids, uint256[] calldata amounts) public {
require(migrationStarted == true, "Migration has not started");
require(ids.length == amounts.length, "Mismatch between ids and amounts lengths");
uint256 mintAmount = 0;
for (uint256 i = 0; i < ids.length; i++){
require(balanceOf(msg.sender, ids[i]) > 0, "Doesn't own the token"); // Check if the user own one of the ERC-1155
require(balanceOf(msg.sender, ids[i]) >= amounts[i], "Amount exceeds balance");
mintAmount += amounts[i];
}
burnBatch(msg.sender, ids, amounts); // Burn N number of ERC-1155 token
SilksMigrateToInterface silksLandContract = SilksMigrateToInterface(silksMigrateToContractAddress);
silksLandContract.mintTransfer(msg.sender, mintAmount); // Return the minted IDs
}
// Allow to use the ERC-1155 to get the SilksLand ERC-721 final token (Forced)
function forceMigrateToken(uint256 id) public onlyOwner {
require(balanceOf(msg.sender, id) > 0, "Doesn't own the token"); // Kept so no one can't force someone else to open a SilksLand
burn(msg.sender, id, 1); // Burn one the ERC-1155 token
SilksMigrateToInterface silksLandContract = SilksMigrateToInterface(silksMigrateToContractAddress);
silksLandContract.mintTransfer(msg.sender, 1); // Mint the ERC-721 token
}
// Check if the Silk Avatar has been used to mint an ERC-1155
function checkIfRedeemed(uint256 _tokenId) view public returns(bool) {
return usedToken[_tokenId];
}
function checkIfRedeemedBatch(uint256[] calldata _tokenIds) view public returns(bool[] memory) {
bool[] memory checks = new bool[](_tokenIds.length);
for (uint256 i = 0; i < _tokenIds.length; i++){
checks[i] = usedToken[_tokenIds[i]];
}
return checks;
}
// Get amount of 1155 minted
function getAmountMinted() view public returns(uint256) {
return amountMinted;
}
// Basic withdrawal of funds function in order to transfer ETH out of the smart contract
function withdrawFunds() public onlyOwner {
payable(msg.sender).transfer(address(this).balance);
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
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);
}
}
SafeMath.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
ERC1155.sol 511 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: transfer caller is not owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
IERC1155.sol 125 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
ERC1155Burnable.sol 40 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of {ERC1155} that allows token holders to destroy both their
* own tokens and those that they have been approved to use.
*
* _Available since v3.1._
*/
abstract contract ERC1155Burnable is ERC1155 {
function burn(
address account,
uint256 id,
uint256 value
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_burn(account, id, value);
}
function burnBatch(
address account,
uint256[] memory ids,
uint256[] memory values
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_burnBatch(account, ids, values);
}
}
IERC1155MetadataURI.sol 22 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Read Contract
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
checkIfRedeemed 0x2a6e81ac → bool
checkIfRedeemedBatch 0x9667f708 → bool[]
getAmountMinted 0xe777df20 → uint256
isApprovedForAll 0xe985e9c5 → bool
isClaimingStarted 0x21f31e46 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
supportsInterface 0x01ffc9a7 → bool
uri 0x0e89341c → string
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
airdropGiveaway 0x46555465
address[] to
uint256[] amountToMint
burn 0xf5298aca
address account
uint256 id
uint256 value
burnBatch 0x6b20c454
address account
uint256[] ids
uint256[] values
claim 0x6ba4c138
uint256[] tokenIds
returns: uint256
forceMigrateToken 0x27089c8c
uint256 id
migrateTokens 0xea5a78b1
uint256[] ids
uint256[] amounts
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
setMaxTokenId 0x202fcbbd
uint256 _maxTokenId
setSilksAvatarContractAddress 0xbed2417b
address contractAddress
setSilksMigrateToContract 0x9c4ed0cf
address contractAddress
toggleClaiming 0x8010fc45
No parameters
toggleMigration 0x21fec36c
No parameters
transferOwnership 0xf2fde38b
address newOwner
withdrawFunds 0x24600fc3
No parameters
Recent Transactions
No transactions found for this address