Address Contract Verified
Address
0xD1606499804Ff42B04CE7d9143ADBE568bF50F1c
Balance
0 ETH
Nonce
1
Code Size
20335 bytes
Creator
0x271FC830...Dc8F at tx 0x4cb6fbe8...24d1a7
Indexed Transactions
0
Contract Bytecode
20335 bytes
0x608060405234801561001057600080fd5b50600436106101725760003560e01c8063715018a6116100de578063a22cb46511610097578063e985e9c511610071578063e985e9c514610443578063f242432a14610473578063f2fde38b1461048f578063f5298aca146104ab57610172565b8063a22cb465146103ef578063af430c291461040b578063d81d0a151461042757610172565b8063715018a61461034157806383177db31461034b5780638d53b2081461037b5780638da5cb5b1461039757806390709751146103b557806395d89b41146103d157610172565b80632a095742116101305780632a0957421461025d5780632eb2c2d61461028d57806340554c3a146102a95780634cf47f0a146102c55780634e1273f4146102f55780636b20c4541461032557610172565b8062fdd58e1461017757806301ffc9a7146101a757806302fe5305146101d757806306fdde03146101f35780630e89341c14610211578063156e29f614610241575b600080fd5b610191600480360381019061018c91906131e1565b6104c7565b60405161019e9190613230565b60405180910390f35b6101c160048036038101906101bc91906132a3565b610590565b6040516101ce91906132eb565b60405180910390f35b6101f160048036038101906101ec919061344c565b610672565b005b6101fb610708565b604051610208919061351d565b60405180910390f35b61022b6004803603810190610226919061353f565b610745565b604051610238919061351d565b60405180910390f35b61025b6004803603810190610256919061356c565b61077c565b005b61027760048036038101906102729190613687565b6107ed565b60405161028491906137a1565b60405180910390f35b6102a760048036038101906102a29190613864565b61095e565b005b6102c360048036038101906102be9190613969565b610a01565b005b6102df60048036038101906102da91906139a9565b610d7d565b6040516102ec9190613230565b60405180910390f35b61030f600480360381019061030a9190613a99565b610df9565b60405161031c91906137a1565b60405180910390f35b61033f600480360381019061033a9190613b11565b610f12565b005b610349610fb1565b005b61036560048036038101906103609190613969565b611039565b60405161037291906132eb565b60405180910390f35b61039560048036038101906103909190613969565b61109a565b005b61039f6112a0565b6040516103ac9190613bab565b60405180910390f35b6103cf60048036038101906103ca919061344c565b6112c9565b005b6103d961135f565b6040516103e6919061351d565b60405180910390f35b61040960048036038101906104049190613bf2565b61139c565b005b610425600480360381019061042091906139a9565b6113b2565b005b610441600480360381019061043c9190613b11565b61150c565b005b61045d60048036038101906104589190613c32565b61157d565b60405161046a91906132eb565b60405180910390f35b61048d60048036038101906104889190613c72565b611637565b005b6104a960048036038101906104a49190613d09565b6116da565b005b6104c560048036038101906104c0919061356c565b6117d1565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161052e90613da8565b60405180910390fd5b6002600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061065b57507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061066b575061066a82611870565b5b9050919050565b61067a6118da565b73ffffffffffffffffffffffffffffffffffffffff166106986112a0565b73ffffffffffffffffffffffffffffffffffffffff16146106ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e590613e14565b60405180910390fd5b8060049080519060200190610704929190613096565b5050565b60606040518060400160405280600a81526020017f5465737454726169747300000000000000000000000000000000000000000000815250905090565b60606004610752836118e2565b600560405160200161076693929190613f64565b6040516020818303038152906040529050919050565b61078e60006107896118da565b611a42565b6107cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c490613fe1565b60405180910390fd5b6107e883838360405180602001604052806000815250611aa7565b505050565b6060600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361085e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085590613da8565b60405180910390fd5b6000825167ffffffffffffffff81111561087b5761087a613321565b5b6040519080825280602002602001820160405280156108a95781602001602082028036833780820191505090505b50905060005b835181101561095357600260008583815181106108cf576108ce614001565b5b6020026020010151815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482828151811061093657610935614001565b5b6020026020010181815250508061094c9061405f565b90506108af565b508091505092915050565b6109666118da565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614806109ae57506109ad856109a66118da565b6002611c1e565b5b6109ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e490614119565b60405180910390fd5b6109fa8585858585611d2d565b5050505050565b610a096118da565b73ffffffffffffffffffffffffffffffffffffffff16610a276112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610a7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7490613e14565b60405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff163b11610ad7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ace906141ab565b60405180910390fd5b6000610ae283612035565b90506000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000826001901b82179050808203610b75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6c90614217565b60405180910390fd5b80600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600484901b9050600081600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16901c6bffffffffffffffffffffffff1690506000600160046001901b610c149190614237565b6001901b821614610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c51906142dd565b60405180910390fd5b60018060046001901b610c6d9190614237565b6001901b610c7b9190614237565b60018060046001901b610c8e9190614237565b6001901b610c9c9190614237565b821610610cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd590614349565b60405180910390fd5b816001901b600060148282829054906101000a90046bffffffffffffffffffffffff160192506101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508573ffffffffffffffffffffffffffffffffffffffff16877ff20afd7b032307b01752ee91e3f6a4b83a5b4ab631f9ab279322fd45634382c060405160405180910390a350505050505050565b600080610d8983612035565b90506000600482901b905060018060046001901b610da79190614237565b6001901b610db59190614237565b81600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16901c6bffffffffffffffffffffffff161692505050919050565b60608151835114610e3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e36906143db565b60405180910390fd5b6000835167ffffffffffffffff811115610e5c57610e5b613321565b5b604051908082528060200260200182016040528015610e8a5781602001602082028036833780820191505090505b50905060005b8451811015610f0757610ed7858281518110610eaf57610eae614001565b5b6020026020010151858381518110610eca57610ec9614001565b5b60200260200101516104c7565b828281518110610eea57610ee9614001565b5b60200260200101818152505080610f009061405f565b9050610e90565b508091505092915050565b610f1a6118da565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480610f625750610f6183610f5a6118da565b6001611c1e565b5b610fa1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f989061446d565b60405180910390fd5b610fac83838361217e565b505050565b610fb96118da565b73ffffffffffffffffffffffffffffffffffffffff16610fd76112a0565b73ffffffffffffffffffffffffffffffffffffffff161461102d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102490613e14565b60405180910390fd5b6110376000612412565b565b60008061104584612035565b6001901b9050600081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205416141591505092915050565b6110a26118da565b73ffffffffffffffffffffffffffffffffffffffff166110c06112a0565b73ffffffffffffffffffffffffffffffffffffffff1614611116576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110d90613e14565b60405180910390fd5b600061112183612035565b90506000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000826001901b19821690508082036111b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ac906144d9565b60405180910390fd5b80600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600484901b9050806001901b600060148282829054906101000a90046bffffffffffffffffffffffff160392506101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508473ffffffffffffffffffffffffffffffffffffffff16867fe7906b77ea165c70ad8268ce5b59b778a198edf9c1ae4118378eefdc76fce5f460405160405180910390a3505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6112d16118da565b73ffffffffffffffffffffffffffffffffffffffff166112ef6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614611345576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133c90613e14565b60405180910390fd5b806005908051906020019061135b929190613096565b5050565b60606040518060400160405280600581526020017f5452414954000000000000000000000000000000000000000000000000000000815250905090565b6113ae6113a76118da565b83836124d6565b5050565b6113ba6118da565b73ffffffffffffffffffffffffffffffffffffffff166113d86112a0565b73ffffffffffffffffffffffffffffffffffffffff161461142e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142590613e14565b60405180910390fd5b600061143982612035565b90506000600482901b9050600081600160046001901b6114599190614237565b6001901b901b905060008060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff1690506000828216146114d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c99061456b565b60405180910390fd5b818117600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055505050505050565b61151e60006115196118da565b611a42565b61155d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155490613fe1565b60405180910390fd5b61157883838360405180602001604052806000815250612660565b505050565b60006002808111156115925761159161458b565b5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600281111561162e5761162d61458b565b5b14905092915050565b61163f6118da565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061168757506116868561167f6118da565b6002611c1e565b5b6116c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116bd9061446d565b60405180910390fd5b6116d3858585858561286f565b5050505050565b6116e26118da565b73ffffffffffffffffffffffffffffffffffffffff166117006112a0565b73ffffffffffffffffffffffffffffffffffffffff1614611756576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174d90613e14565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036117c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117bc9061462c565b60405180910390fd5b6117ce81612412565b50565b6117d96118da565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806118215750611820836118196118da565b6001611c1e565b5b611860576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118579061446d565b60405180910390fd5b61186b838383612ad5565b505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b606060008203611929576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050611a3d565b600082905060005b6000821461195b5780806119449061405f565b915050600a82611954919061467b565b9150611931565b60008167ffffffffffffffff81111561197757611976613321565b5b6040519080825280601f01601f1916602001820160405280156119a95781602001600182028036833780820191505090505b5090505b60008514611a36576001826119c29190614237565b9150600a856119d191906146ac565b60306119dd91906146dd565b60f81b8183815181106119f3576119f2614001565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85611a2f919061467b565b94506119ad565b8093505050505b919050565b600080836003811115611a5857611a5761458b565b5b6001901b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054161415905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611b16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0d906147a5565b60405180910390fd5b6000611b206118da565b9050826002600086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611b8291906146dd565b925050819055508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051611c009291906147c5565b60405180910390a4611c1781600087878787612cc5565b5050505050565b600080600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050600280811115611cc057611cbf61458b565b5b816002811115611cd357611cd261458b565b5b03611ce2576001915050611d26565b60016002811115611cf657611cf561458b565b5b816002811115611d0957611d0861458b565b5b03611d18576000915050611d26565b611d228385611a42565b9150505b9392505050565b8151835114611d71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6890614860565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611de0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd7906148f2565b60405180910390fd5b6000611dea6118da565b905060005b8451811015611fa0576000858281518110611e0d57611e0c614001565b5b602002602001015190506000858381518110611e2c57611e2b614001565b5b6020026020010151905060006002600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611ece576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec590614984565b60405180910390fd5b8181036002600085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816002600085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611f8591906146dd565b9250508190555050505080611f999061405f565b9050611def565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516120179291906149a4565b60405180910390a461202d818787878787612e9c565b505050505050565b60007f4d494e5400000000000000000000000000000000000000000000000000000000820361207957600060038111156120725761207161458b565b5b9050612179565b7f4255524e0000000000000000000000000000000000000000000000000000000082036120bb57600160038111156120b4576120b361458b565b5b9050612179565b7f5452414e5346455200000000000000000000000000000000000000000000000082036120fd57600260038111156120f6576120f561458b565b5b9050612179565b7f434c41494d000000000000000000000000000000000000000000000000000000820361213e576003808111156121375761213661458b565b5b9050612179565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161217090614a27565b60405180910390fd5b919050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036121ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e490614ab9565b60405180910390fd5b8051825114612231576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222890614860565b60405180910390fd5b600061223b6118da565b905060005b835181101561238c57600084828151811061225e5761225d614001565b5b60200260200101519050600084838151811061227d5761227c614001565b5b6020026020010151905060006002600084815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561231f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231690614b4b565b60405180910390fd5b8181036002600085815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505080806123849061405f565b915050612240565b50600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516124049291906149a4565b60405180910390a450505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612544576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161253b90614bdd565b60405180910390fd5b80612550576001612553565b60025b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360028111156125f1576125f061458b565b5b02179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161265391906132eb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036126cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126c6906147a5565b60405180910390fd5b8151835114612713576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270a90614860565b60405180910390fd5b600061271d6118da565b905060005b84518110156127d95783818151811061273e5761273d614001565b5b60200260200101516002600087848151811061275d5761275c614001565b5b6020026020010151815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546127bf91906146dd565b9250508190555080806127d19061405f565b915050612722565b508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516128519291906149a4565b60405180910390a461286881600087878787612e9c565b5050505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036128de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128d5906148f2565b60405180910390fd5b60006128e86118da565b905060006002600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083811015612982576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161297990614984565b60405180910390fd5b8381036002600087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836002600087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612a3991906146dd565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628888604051612ab69291906147c5565b60405180910390a4612acc828888888888612cc5565b50505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612b44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b3b90614ab9565b60405180910390fd5b6000612b4e6118da565b905060006002600085815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015612be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bdf90614b4b565b60405180910390fd5b8281036002600086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051612cb69291906147c5565b60405180910390a45050505050565b612ce48473ffffffffffffffffffffffffffffffffffffffff16613073565b15612e94578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b8152600401612d2a959493929190614c52565b6020604051808303816000875af1925050508015612d6657506040513d601f19601f82011682018060405250810190612d639190614cc1565b60015b612e0b57612d72614cfb565b806308c379a003612dce5750612d86614d1d565b80612d915750612dd0565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dc5919061351d565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e0290614e1f565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612e92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8990614eb1565b60405180910390fd5b505b505050505050565b612ebb8473ffffffffffffffffffffffffffffffffffffffff16613073565b1561306b578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b8152600401612f01959493929190614ed1565b6020604051808303816000875af1925050508015612f3d57506040513d601f19601f82011682018060405250810190612f3a9190614cc1565b60015b612fe257612f49614cfb565b806308c379a003612fa55750612f5d614d1d565b80612f685750612fa7565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f9c919061351d565b60405180910390fd5b505b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fd990614e1f565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614613069576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161306090614eb1565b60405180910390fd5b505b505050505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b8280546130a290613e63565b90600052602060002090601f0160209004810192826130c4576000855561310b565b82601f106130dd57805160ff191683800117855561310b565b8280016001018555821561310b579182015b8281111561310a5782518255916020019190600101906130ef565b5b509050613118919061311c565b5090565b5b8082111561313557600081600090555060010161311d565b5090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006131788261314d565b9050919050565b6131888161316d565b811461319357600080fd5b50565b6000813590506131a58161317f565b92915050565b6000819050919050565b6131be816131ab565b81146131c957600080fd5b50565b6000813590506131db816131b5565b92915050565b600080604083850312156131f8576131f7613143565b5b600061320685828601613196565b9250506020613217858286016131cc565b9150509250929050565b61322a816131ab565b82525050565b60006020820190506132456000830184613221565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6132808161324b565b811461328b57600080fd5b50565b60008135905061329d81613277565b92915050565b6000602082840312156132b9576132b8613143565b5b60006132c78482850161328e565b91505092915050565b60008115159050919050565b6132e5816132d0565b82525050565b600060208201905061330060008301846132dc565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61335982613310565b810181811067ffffffffffffffff8211171561337857613377613321565b5b80604052505050565b600061338b613139565b90506133978282613350565b919050565b600067ffffffffffffffff8211156133b7576133b6613321565b5b6133c082613310565b9050602081019050919050565b82818337600083830152505050565b60006133ef6133ea8461339c565b613381565b90508281526020810184848401111561340b5761340a61330b565b5b6134168482856133cd565b509392505050565b600082601f83011261343357613432613306565b5b81356134438482602086016133dc565b91505092915050565b60006020828403121561346257613461613143565b5b600082013567ffffffffffffffff8111156134805761347f613148565b5b61348c8482850161341e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156134cf5780820151818401526020810190506134b4565b838111156134de576000848401525b50505050565b60006134ef82613495565b6134f981856134a0565b93506135098185602086016134b1565b61351281613310565b840191505092915050565b6000602082019050818103600083015261353781846134e4565b905092915050565b60006020828403121561355557613554613143565b5b6000613563848285016131cc565b91505092915050565b60008060006060848603121561358557613584613143565b5b600061359386828701613196565b93505060206135a4868287016131cc565b92505060406135b5868287016131cc565b9150509250925092565b600067ffffffffffffffff8211156135da576135d9613321565b5b602082029050602081019050919050565b600080fd5b60006136036135fe846135bf565b613381565b90508083825260208201905060208402830185811115613626576136256135eb565b5b835b8181101561364f578061363b88826131cc565b845260208401935050602081019050613628565b5050509392505050565b600082601f83011261366e5761366d613306565b5b813561367e8482602086016135f0565b91505092915050565b6000806040838503121561369e5761369d613143565b5b60006136ac85828601613196565b925050602083013567ffffffffffffffff8111156136cd576136cc613148565b5b6136d985828601613659565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613718816131ab565b82525050565b600061372a838361370f565b60208301905092915050565b6000602082019050919050565b600061374e826136e3565b61375881856136ee565b9350613763836136ff565b8060005b8381101561379457815161377b888261371e565b975061378683613736565b925050600181019050613767565b5085935050505092915050565b600060208201905081810360008301526137bb8184613743565b905092915050565b600067ffffffffffffffff8211156137de576137dd613321565b5b6137e782613310565b9050602081019050919050565b6000613807613802846137c3565b613381565b9050828152602081018484840111156138235761382261330b565b5b61382e8482856133cd565b509392505050565b600082601f83011261384b5761384a613306565b5b813561385b8482602086016137f4565b91505092915050565b600080600080600060a086880312156138805761387f613143565b5b600061388e88828901613196565b955050602061389f88828901613196565b945050604086013567ffffffffffffffff8111156138c0576138bf613148565b5b6138cc88828901613659565b935050606086013567ffffffffffffffff8111156138ed576138ec613148565b5b6138f988828901613659565b925050608086013567ffffffffffffffff81111561391a57613919613148565b5b61392688828901613836565b9150509295509295909350565b6000819050919050565b61394681613933565b811461395157600080fd5b50565b6000813590506139638161393d565b92915050565b600080604083850312156139805761397f613143565b5b600061398e85828601613954565b925050602061399f85828601613196565b9150509250929050565b6000602082840312156139bf576139be613143565b5b60006139cd84828501613954565b91505092915050565b600067ffffffffffffffff8211156139f1576139f0613321565b5b602082029050602081019050919050565b6000613a15613a10846139d6565b613381565b90508083825260208201905060208402830185811115613a3857613a376135eb565b5b835b81811015613a615780613a4d8882613196565b845260208401935050602081019050613a3a565b5050509392505050565b600082601f830112613a8057613a7f613306565b5b8135613a90848260208601613a02565b91505092915050565b60008060408385031215613ab057613aaf613143565b5b600083013567ffffffffffffffff811115613ace57613acd613148565b5b613ada85828601613a6b565b925050602083013567ffffffffffffffff811115613afb57613afa613148565b5b613b0785828601613659565b9150509250929050565b600080600060608486031215613b2a57613b29613143565b5b6000613b3886828701613196565b935050602084013567ffffffffffffffff811115613b5957613b58613148565b5b613b6586828701613659565b925050604084013567ffffffffffffffff811115613b8657613b85613148565b5b613b9286828701613659565b9150509250925092565b613ba58161316d565b82525050565b6000602082019050613bc06000830184613b9c565b92915050565b613bcf816132d0565b8114613bda57600080fd5b50565b600081359050613bec81613bc6565b92915050565b60008060408385031215613c0957613c08613143565b5b6000613c1785828601613196565b9250506020613c2885828601613bdd565b9150509250929050565b60008060408385031215613c4957613c48613143565b5b6000613c5785828601613196565b9250506020613c6885828601613196565b9150509250929050565b600080600080600060a08688031215613c8e57613c8d613143565b5b6000613c9c88828901613196565b9550506020613cad88828901613196565b9450506040613cbe888289016131cc565b9350506060613ccf888289016131cc565b925050608086013567ffffffffffffffff811115613cf057613cef613148565b5b613cfc88828901613836565b9150509295509295909350565b600060208284031215613d1f57613d1e613143565b5b6000613d2d84828501613196565b91505092915050565b7f455243313135353a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b6000613d92602b836134a0565b9150613d9d82613d36565b604082019050919050565b60006020820190508181036000830152613dc181613d85565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613dfe6020836134a0565b9150613e0982613dc8565b602082019050919050565b60006020820190508181036000830152613e2d81613df1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613e7b57607f821691505b602082108103613e8e57613e8d613e34565b5b50919050565b600081905092915050565b60008190508160005260206000209050919050565b60008154613ec181613e63565b613ecb8186613e94565b94506001821660008114613ee65760018114613ef757613f2a565b60ff19831686528186019350613f2a565b613f0085613e9f565b60005b83811015613f2257815481890152600182019150602081019050613f03565b838801955050505b50505092915050565b6000613f3e82613495565b613f488185613e94565b9350613f588185602086016134b1565b80840191505092915050565b6000613f708286613eb4565b9150613f7c8285613f33565b9150613f888284613eb4565b9150819050949350505050565b7f4e6f7420616c6c6f77656420746f206d696e7400000000000000000000000000600082015250565b6000613fcb6013836134a0565b9150613fd682613f95565b602082019050919050565b60006020820190508181036000830152613ffa81613fbe565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061406a826131ab565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361409c5761409b614030565b5b600182019050919050565b7f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b60006141036032836134a0565b915061410e826140a7565b604082019050919050565b60006020820190508181036000830152614132816140f6565b9050919050565b7f43616e206f6e6c79206772616e742061636365737320746f206120636f6e747260008201527f6163740000000000000000000000000000000000000000000000000000000000602082015250565b60006141956023836134a0565b91506141a082614139565b604082019050919050565b600060208201905081810360008301526141c481614188565b9050919050565b7f4163636f756e7420616c72656164792068617320616363657373000000000000600082015250565b6000614201601a836134a0565b915061420c826141cb565b602082019050919050565b60006020820190508181036000830152614230816141f4565b9050919050565b6000614242826131ab565b915061424d836131ab565b9250828210156142605761425f614030565b5b828203905092915050565b7f4772616e74696e67207468697320616363657373206973207065726d616e656e60008201527f746c792064697361626c65640000000000000000000000000000000000000000602082015250565b60006142c7602c836134a0565b91506142d28261426b565b604082019050919050565b600060208201905081810360008301526142f6816142ba565b9050919050565b7f416363657373206c696d69742072656163686564000000000000000000000000600082015250565b60006143336014836134a0565b915061433e826142fd565b602082019050919050565b6000602082019050818103600083015261436281614326565b9050919050565b7f455243313135353a206163636f756e747320616e6420696473206c656e67746860008201527f206d69736d617463680000000000000000000000000000000000000000000000602082015250565b60006143c56029836134a0565b91506143d082614369565b604082019050919050565b600060208201905081810360008301526143f4816143b8565b9050919050565b7f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008201527f20617070726f7665640000000000000000000000000000000000000000000000602082015250565b60006144576029836134a0565b9150614462826143fb565b604082019050919050565b600060208201905081810360008301526144868161444a565b9050919050565b7f4163636f756e7420646f6573206e6f7420686176652061636365737300000000600082015250565b60006144c3601c836134a0565b91506144ce8261448d565b602082019050919050565b600060208201905081810360008301526144f2816144b6565b9050919050565b7f4772616e74696e6720746869732061636365737320697320616c72656164792060008201527f64697361626c6564000000000000000000000000000000000000000000000000602082015250565b60006145556028836134a0565b9150614560826144f9565b604082019050919050565b6000602082019050818103600083015261458481614548565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006146166026836134a0565b9150614621826145ba565b604082019050919050565b6000602082019050818103600083015261464581614609565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614686826131ab565b9150614691836131ab565b9250826146a1576146a061464c565b5b828204905092915050565b60006146b7826131ab565b91506146c2836131ab565b9250826146d2576146d161464c565b5b828206905092915050565b60006146e8826131ab565b91506146f3836131ab565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561472857614727614030565b5b828201905092915050565b7f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600061478f6021836134a0565b915061479a82614733565b604082019050919050565b600060208201905081810360008301526147be81614782565b9050919050565b60006040820190506147da6000830185613221565b6147e76020830184613221565b9392505050565b7f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008201527f6d69736d61746368000000000000000000000000000000000000000000000000602082015250565b600061484a6028836134a0565b9150614855826147ee565b604082019050919050565b600060208201905081810360008301526148798161483d565b9050919050565b7f455243313135353a207472616e7366657220746f20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006148dc6025836134a0565b91506148e782614880565b604082019050919050565b6000602082019050818103600083015261490b816148cf565b9050919050565b7f455243313135353a20696e73756666696369656e742062616c616e636520666f60008201527f72207472616e7366657200000000000000000000000000000000000000000000602082015250565b600061496e602a836134a0565b915061497982614912565b604082019050919050565b6000602082019050818103600083015261499d81614961565b9050919050565b600060408201905081810360008301526149be8185613743565b905081810360208301526149d28184613743565b90509392505050565b7f416363657373207479706520646f6573206e6f74206578697374000000000000600082015250565b6000614a11601a836134a0565b9150614a1c826149db565b602082019050919050565b60006020820190508181036000830152614a4081614a04565b9050919050565b7f455243313135353a206275726e2066726f6d20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000614aa36023836134a0565b9150614aae82614a47565b604082019050919050565b60006020820190508181036000830152614ad281614a96565b9050919050565b7f455243313135353a206275726e20616d6f756e7420657863656564732062616c60008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b6000614b356024836134a0565b9150614b4082614ad9565b604082019050919050565b60006020820190508181036000830152614b6481614b28565b9050919050565b7f455243313135353a2073657474696e6720617070726f76616c2073746174757360008201527f20666f722073656c660000000000000000000000000000000000000000000000602082015250565b6000614bc76029836134a0565b9150614bd282614b6b565b604082019050919050565b60006020820190508181036000830152614bf681614bba565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000614c2482614bfd565b614c2e8185614c08565b9350614c3e8185602086016134b1565b614c4781613310565b840191505092915050565b600060a082019050614c676000830188613b9c565b614c746020830187613b9c565b614c816040830186613221565b614c8e6060830185613221565b8181036080830152614ca08184614c19565b90509695505050505050565b600081519050614cbb81613277565b92915050565b600060208284031215614cd757614cd6613143565b5b6000614ce584828501614cac565b91505092915050565b60008160e01c9050919050565b600060033d1115614d1a5760046000803e614d17600051614cee565b90505b90565b600060443d10614daa57614d2f613139565b60043d036004823e80513d602482011167ffffffffffffffff82111715614d57575050614daa565b808201805167ffffffffffffffff811115614d755750505050614daa565b80602083010160043d038501811115614d92575050505050614daa565b614da182602001850186613350565b82955050505050505b90565b7f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008201527f526563656976657220696d706c656d656e746572000000000000000000000000602082015250565b6000614e096034836134a0565b9150614e1482614dad565b604082019050919050565b60006020820190508181036000830152614e3881614dfc565b9050919050565b7f455243313135353a204552433131353552656365697665722072656a6563746560008201527f6420746f6b656e73000000000000000000000000000000000000000000000000602082015250565b6000614e9b6028836134a0565b9150614ea682614e3f565b604082019050919050565b60006020820190508181036000830152614eca81614e8e565b9050919050565b600060a082019050614ee66000830188613b9c565b614ef36020830187613b9c565b8181036040830152614f058186613743565b90508181036060830152614f198185613743565b90508181036080830152614f2d8184614c19565b9050969550505050505056fea2646970667358221220a146e7eb842181fb6c6a382695ed3c6fd592ae33eea87c1e470c44c2f85f7ca164736f6c634300080d0033
Verified Source Code Full Match
Compiler: v0.8.13+commit.abaa5c0e
EVM: london
Optimization: No
Traits.sol 42 lines
// SPDX-License-Identifier: MIT
pragma solidity =0.8.13;
import "@openzeppelin/contracts/utils/Strings.sol";
import "./ERC1155.sol";
contract Traits is ERC1155 {
constructor() ERC1155() {}
string private _uriBase;
string private _extension;
function name() public pure returns (string memory) {
return "TestTraits";
}
function symbol() public pure returns (string memory) {
return "TRAIT";
}
function setURI(string memory uriBase) public onlyOwner {
_uriBase = uriBase;
}
function setURIExtension(string memory extension) public onlyOwner {
_extension = extension;
}
function uri(uint256 tokenId) override public view returns (string memory) {
return string(abi.encodePacked(_uriBase, Strings.toString(tokenId), _extension));
}
function mint(address to, uint256 id, uint256 amount) external {
require(_hasAccess(Access.Mint, _msgSender()), "Not allowed to mint");
_safeMint(to, id, amount, "");
}
function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts) external {
require(_hasAccess(Access.Mint, _msgSender()), "Not allowed to mint");
_safeMintBatch(to, ids, amounts, "");
}
}
ERC1155.sol 470 lines
// SPDX-License-Identifier: MIT
// Adapted from OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "./OwnableTokenAccessControl.sol";
/**
* @dev Extended implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by OpenZeppelin: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol
* and Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, OwnableTokenAccessControl {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
enum Approval {
Unknown,
NotApproved,
Approved
}
// Mapping from account to operator approvals
mapping(address => mapping(address => Approval)) private _operatorApprovals;
constructor() {
}
/**
* @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 "";
}
/**
* @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;
}
/**
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOfBatchIds(address account, uint256[] memory ids)
public
view
virtual
returns (uint256[] memory)
{
require(account != address(0), "ERC1155: balance query for the zero address");
uint256[] memory batchBalances = new uint256[](ids.length);
for (uint256 i = 0; i < ids.length; ++i) {
batchBalances[i] = _balances[ids[i]][account];
}
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] == Approval.Approved;
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || _isApprovedForAllOrHasAccess(from, _msgSender(), Access.Transfer),
"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() || _isApprovedForAllOrHasAccess(from, _msgSender(), Access.Transfer),
"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 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();
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 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 _safeMint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_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 {_safeMint}.
*
* 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 _safeMintBatch(
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();
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);
}
function burn(
address account,
uint256 id,
uint256 amount
) external {
require(
account == _msgSender() || _isApprovedForAllOrHasAccess(account, _msgSender(), Access.Burn),
"ERC1155: caller is not owner nor approved"
);
_burn(account, id, amount);
}
function burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) external {
require(
account == _msgSender() || _isApprovedForAllOrHasAccess(account, _msgSender(), Access.Burn),
"ERC1155: caller is not owner nor approved"
);
_burnBatch(account, ids, amounts);
}
/**
* @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 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();
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);
}
function _isApprovedForAllOrHasAccess(
address account,
address operator,
Access access
) internal virtual returns (bool) {
Approval aproval = _operatorApprovals[account][operator];
if (aproval == Approval.Approved) {
return true;
}
if (aproval == Approval.NotApproved) {
return false;
}
return _hasAccess(access, operator);
}
/**
* @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 ? Approval.Approved : Approval.NotApproved;
emit ApprovalForAll(owner, operator, approved);
}
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");
}
}
}
}
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);
}
}
OwnableTokenAccessControl.sol 101 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title OwnableTokenAccessControl
/// @notice Basic access control for utility tokens
/// @author ponky
contract OwnableTokenAccessControl is Ownable {
/// @dev Keeps track of how many accounts have been granted each type of access
uint96 private _accessCounts;
mapping (address => uint256) private _accessFlags;
/// @dev Access types
enum Access { Mint, Burn, Transfer, Claim }
/// @dev Emitted when `account` is granted `access`.
event AccessGranted(bytes32 indexed access, address indexed account);
/// @dev Emitted when `account` is revoked `access`.
event AccessRevoked(bytes32 indexed access, address indexed account);
/// @dev Helper constants for fitting each access index into _accessCounts
uint constant private _AC_BASE = 4;
uint constant private _AC_MASK_BITSIZE = 1 << _AC_BASE;
uint constant private _AC_DISABLED = (1 << (_AC_MASK_BITSIZE - 1));
uint constant private _AC_MASK_COUNT = _AC_DISABLED - 1;
/// @dev Convert the string `access` to an uint
function _accessToIndex(bytes32 access) internal pure virtual returns (uint index) {
if (access == 'MINT') {return uint(Access.Mint);}
if (access == 'BURN') {return uint(Access.Burn);}
if (access == 'TRANSFER') {return uint(Access.Transfer);}
if (access == 'CLAIM') {return uint(Access.Claim);}
revert("Access type does not exist");
}
function _hasAccess(Access access, address account) internal view returns (bool) {
return (_accessFlags[account] & (1 << uint(access))) != 0;
}
function hasAccess(bytes32 access, address account) public view returns (bool) {
uint256 flag = 1 << _accessToIndex(access);
return (_accessFlags[account] & flag) != 0;
}
function grantAccess(bytes32 access, address account) external onlyOwner {
require(account.code.length > 0, "Can only grant access to a contract");
uint index = _accessToIndex(access);
uint256 flags = _accessFlags[account];
uint256 newFlags = flags | (1 << index);
require(flags != newFlags, "Account already has access");
_accessFlags[account] = newFlags;
uint shift = index << _AC_BASE;
uint256 accessCount = _accessCounts >> shift;
require((accessCount & _AC_DISABLED) == 0, "Granting this access is permanently disabled");
require((accessCount & _AC_MASK_COUNT) < _AC_MASK_COUNT, "Access limit reached");
unchecked {
_accessCounts += uint96(1 << shift);
}
emit AccessGranted(access, account);
}
function revokeAccess(bytes32 access, address account) external onlyOwner {
uint index = _accessToIndex(access);
uint256 flags = _accessFlags[account];
uint256 newFlags = flags & ~(1 << index);
require(flags != newFlags, "Account does not have access");
_accessFlags[account] = newFlags;
uint shift = index << _AC_BASE;
unchecked {
_accessCounts -= uint96(1 << shift);
}
emit AccessRevoked(access, account);
}
/// @dev Returns the number of contracts that have `access`.
function countOfAccess(bytes32 access) external view returns (uint256 accessCount) {
uint index = _accessToIndex(access);
uint shift = index << _AC_BASE;
accessCount = (_accessCounts >> shift) & _AC_MASK_COUNT;
}
/// @dev `access` can still be revoked but not granted
function permanentlyDisableGrantingAccess(bytes32 access) external onlyOwner {
uint index = _accessToIndex(access);
uint shift = index << _AC_BASE;
uint256 flag = _AC_DISABLED << shift;
uint256 accessCounts = _accessCounts;
require((accessCounts & flag) == 0, "Granting this access is already disabled");
_accessCounts = uint96(accessCounts | flag);
}
}
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;
}
}
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;
}
}
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);
}
}
}
}
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);
}
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);
}
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;
}
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);
}
}
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);
}
Read Contract
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
balanceOfBatchIds 0x2a095742 → uint256[]
countOfAccess 0x4cf47f0a → uint256
hasAccess 0x83177db3 → bool
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
uri 0x0e89341c → string
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
burn 0xf5298aca
address account
uint256 id
uint256 amount
burnBatch 0x6b20c454
address account
uint256[] ids
uint256[] amounts
grantAccess 0x40554c3a
bytes32 access
address account
mint 0x156e29f6
address to
uint256 id
uint256 amount
mintBatch 0xd81d0a15
address to
uint256[] ids
uint256[] amounts
permanentlyDisableGrantingAccess 0xaf430c29
bytes32 access
renounceOwnership 0x715018a6
No parameters
revokeAccess 0x8d53b208
bytes32 access
address account
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
setURI 0x02fe5305
string uriBase
setURIExtension 0x90709751
string extension
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address