Address Contract Partially Verified
Address
0x2A459947f0ac25eC28C197f09C2d88058a83f3Bb
Balance
0 ETH
Nonce
1
Code Size
20825 bytes
Creator
0x697F4bAd...7DA9 at tx 0xc4cb3519...361959
Indexed Transactions
0
Contract Bytecode
20825 bytes
0x608060405234801561001057600080fd5b50600436106102485760003560e01c8063715018a61161013b578063c87b56dd116100b8578063e268e4d31161007c578063e268e4d3146106c7578063e58306f9146106e3578063e5a4756c146106ff578063e985e9c51461071b578063f2fde38b1461074b57610248565b8063c87b56dd14610621578063cc1afc5414610651578063d5abeb011461066f578063d7224ba01461068d578063dab5f340146106ab57610248565b8063a9e966b7116100ff578063a9e966b71461057f578063b4cc927d1461059b578063b88d4fde146105cb578063ba41b0c6146105e7578063c19d93fb1461060357610248565b8063715018a6146104ff5780638da5cb5b1461050957806395d89b4114610527578063a22cb46514610545578063a40d36cd1461056157610248565b80633ccfd60b116101c95780634f6ccce71161018d5780634f6ccce7146104235780636352211e14610453578063677621691461048357806370480275146104b357806370a08231146104cf57610248565b80633ccfd60b146103a757806342842e0e146103b157806342966c68146103cd578063453c2310146103e9578063484b973c1461040757610248565b806318160ddd1161021057806318160ddd1461030357806323b872dd146103215780632d3456701461033d5780632eb4a7ab146103595780632f745c591461037757610248565b806301ffc9a71461024d57806302fe53051461027d57806306fdde0314610299578063081812fc146102b7578063095ea7b3146102e7575b600080fd5b610267600480360381019061026291906133ed565b610767565b6040516102749190613435565b60405180910390f35b61029760048036038101906102929190613596565b6108b1565b005b6102a161095e565b6040516102ae9190613667565b60405180910390f35b6102d160048036038101906102cc91906136bf565b6109f0565b6040516102de919061372d565b60405180910390f35b61030160048036038101906102fc9190613774565b610a75565b005b61030b610b8d565b60405161031891906137c3565b60405180910390f35b61033b600480360381019061033691906137de565b610b96565b005b61035760048036038101906103529190613831565b610ba6565b005b610361610c7d565b60405161036e9190613877565b60405180910390f35b610391600480360381019061038c9190613774565b610c83565b60405161039e91906137c3565b60405180910390f35b6103af610e7f565b005b6103cb60048036038101906103c691906137de565b610fb1565b005b6103e760048036038101906103e291906136bf565b610fd1565b005b6103f161102a565b6040516103fe91906137c3565b60405180910390f35b610421600480360381019061041c9190613774565b611030565b005b61043d600480360381019061043891906136bf565b61114a565b60405161044a91906137c3565b60405180910390f35b61046d600480360381019061046891906136bf565b61119d565b60405161047a919061372d565b60405180910390f35b61049d600480360381019061049891906138f2565b6111b3565b6040516104aa9190613435565b60405180910390f35b6104cd60048036038101906104c89190613831565b61123d565b005b6104e960048036038101906104e49190613831565b611314565b6040516104f691906137c3565b60405180910390f35b6105076113fc565b005b610511611484565b60405161051e919061372d565b60405180910390f35b61052f6114ae565b60405161053c9190613667565b60405180910390f35b61055f600480360381019061055a919061397e565b611540565b005b6105696116c0565b60405161057691906137c3565b60405180910390f35b610599600480360381019061059491906136bf565b6116c6565b005b6105b560048036038101906105b09190613831565b6117a3565b6040516105c291906137c3565b60405180910390f35b6105e560048036038101906105e09190613a5f565b6117bb565b005b61060160048036038101906105fc9190613ae2565b611817565b005b61060b611af2565b60405161061891906137c3565b60405180910390f35b61063b600480360381019061063691906136bf565b611af8565b6040516106489190613667565b60405180910390f35b610659611b9f565b60405161066691906137c3565b60405180910390f35b610677611ba5565b60405161068491906137c3565b60405180910390f35b610695611bab565b6040516106a291906137c3565b60405180910390f35b6106c560048036038101906106c09190613b6e565b611bb1565b005b6106e160048036038101906106dc91906136bf565b611c55565b005b6106fd60048036038101906106f89190613774565b611d32565b005b610719600480360381019061071491906136bf565b611ed5565b005b61073560048036038101906107309190613b9b565b611fb2565b6040516107429190613435565b60405180910390f35b61076560048036038101906107609190613831565b612046565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061083257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061089a57507f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806108aa57506108a98261213d565b5b9050919050565b60011515601260006108c16121a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461094b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094290613c27565b60405180910390fd5b806007908161095a9190613e53565b5050565b60606001805461096d90613c76565b80601f016020809104026020016040519081016040528092919081815260200182805461099990613c76565b80156109e65780601f106109bb576101008083540402835291602001916109e6565b820191906000526020600020905b8154815290600101906020018083116109c957829003601f168201915b5050505050905090565b60006109fb826121af565b610a3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3190613f97565b60405180910390fd5b6005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610a808261119d565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610af0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae790614029565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b0f6121a7565b73ffffffffffffffffffffffffffffffffffffffff161480610b3e5750610b3d81610b386121a7565b611fb2565b5b610b7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b74906140bb565b60405180910390fd5b610b888383836121bc565b505050565b60008054905090565b610ba183838361226e565b505050565b610bae6121a7565b73ffffffffffffffffffffffffffffffffffffffff16610bcc611484565b73ffffffffffffffffffffffffffffffffffffffff1614610c22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1990614127565b60405180910390fd5b6000601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c5481565b6000610c8e83611314565b8210610ccf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc6906141b9565b60405180910390fd5b6000610cd9610b8d565b905060008060005b83811015610e3d576000600360008381526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614610dd357806000015192505b8773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610e2957868403610e1a578195505050505050610e79565b8380610e2590614208565b9450505b508080610e3590614208565b915050610ce1565b506040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e70906142c2565b60405180910390fd5b92915050565b610e876121a7565b73ffffffffffffffffffffffffffffffffffffffff16610ea5611484565b73ffffffffffffffffffffffffffffffffffffffff1614610efb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef290614127565b60405180910390fd5b6000610f05611484565b73ffffffffffffffffffffffffffffffffffffffff1647604051610f2890614313565b60006040518083038185875af1925050503d8060008114610f65576040519150601f19603f3d011682016040523d82523d6000602084013e610f6a565b606091505b5050905080610fae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa590614374565b60405180910390fd5b50565b610fcc838383604051806020016040528060008152506117bb565b505050565b610fe4610fdc6121a7565b600083610b96565b7f4911fc0126af9455d0aa4a23d3cf11a705afa45b85f7721bf29a93ccbbf76a8761100d6121a7565b60008360405161101f93929190614394565b60405180910390a150565b600e5481565b6110386121a7565b73ffffffffffffffffffffffffffffffffffffffff16611056611484565b73ffffffffffffffffffffffffffffffffffffffff16146110ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a390614127565b60405180910390fd5b600b54816110b8610b8d565b6110c291906143cb565b1115611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa9061446d565b60405180910390fd5b61110d82826127b6565b7fb7656808f0e04b4af7a20f7ef1caa7669f0d781f1ca4cba31a3ba467880766c9828260405161113e92919061448d565b60405180910390a15050565b6000611154610b8d565b8210611195576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118c90614528565b60405180910390fd5b819050919050565b60006111a8826127d4565b600001519050919050565b600080846040516020016111c79190614590565b604051602081830303815290604052805190602001209050600061122f858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050600c54846129d7565b905080925050509392505050565b6112456121a7565b73ffffffffffffffffffffffffffffffffffffffff16611263611484565b73ffffffffffffffffffffffffffffffffffffffff16146112b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b090614127565b60405180910390fd5b6001601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611384576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137b9061461d565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169050919050565b6114046121a7565b73ffffffffffffffffffffffffffffffffffffffff16611422611484565b73ffffffffffffffffffffffffffffffffffffffff1614611478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146f90614127565b60405180910390fd5b61148260006129ee565b565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600280546114bd90613c76565b80601f01602080910402602001604051908101604052809291908181526020018280546114e990613c76565b80156115365780601f1061150b57610100808354040283529160200191611536565b820191906000526020600020905b81548152906001019060200180831161151957829003601f168201915b5050505050905090565b6115486121a7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036115b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ac90614689565b60405180910390fd5b80600660006115c26121a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661166f6121a7565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516116b49190613435565b60405180910390a35050565b600f5481565b60011515601260006116d66121a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611760576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175790613c27565b60405180910390fd5b80600d819055507f4f15260776495295a5ccc6ff5d8e4e9f14bb64e4e91865ce6204674948a21c85600d5460405161179891906137c3565b60405180910390a150565b60116020528060005260406000206000915090505481565b6117c684848461226e565b6117d284848484612ab4565b611811576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118089061471b565b60405180910390fd5b50505050565b6002600a540361185c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161185390614787565b60405180910390fd5b6002600a81905550600b5483611870610b8d565b61187a91906143cb565b11156118bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118b29061446d565b60405180910390fd5b600f54831115611900576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f7906147f3565b60405180910390fd5b600e546011600061190f6121a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461195591906143cb565b1115611996576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198d9061485f565b60405180910390fd5b6000600d54036119db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d2906148cb565b60405180910390fd5b82601160006119e86121a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611a3191906143cb565b925050819055506001600d5403611a9457611a54611a4d6121a7565b83836111b3565b611a93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8a90614937565b60405180910390fd5b5b611aa5611a9f6121a7565b846127b6565b7fb7656808f0e04b4af7a20f7ef1caa7669f0d781f1ca4cba31a3ba467880766c9611ace6121a7565b84604051611add92919061448d565b60405180910390a16001600a81905550505050565b600d5481565b6060611b03826121af565b611b42576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b39906149c9565b60405180910390fd5b6000611b4c612c3b565b90506000815111611b6c5760405180602001604052806000815250611b97565b80611b7684612ccd565b604051602001611b87929190614a25565b6040516020818303038152906040525b915050919050565b60105481565b600b5481565b60085481565b6001151560126000611bc16121a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611c4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4290613c27565b60405180910390fd5b80600c8190555050565b6001151560126000611c656121a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611cef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce690613c27565b60405180910390fd5b80600e819055507f17de41cf336455d084990095a5265d08647473fb62f43672612509e09a826d8d600e54604051611d2791906137c3565b60405180910390a150565b6001151560126000611d426121a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611dcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc390613c27565b60405180910390fd5b600b5481611dd8610b8d565b611de291906143cb565b1115611e23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1a9061446d565b60405180910390fd5b6101f481601054611e3491906143cb565b1115611e75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6c90614a95565b60405180910390fd5b8060106000828254611e8791906143cb565b92505081905550611e9882826127b6565b7fb7656808f0e04b4af7a20f7ef1caa7669f0d781f1ca4cba31a3ba467880766c98282604051611ec992919061448d565b60405180910390a15050565b6001151560126000611ee56121a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6690613c27565b60405180910390fd5b80600f819055507fd021a3c67e7464d25ec1aa20e406a4dd7a4685ff885800928ac1dd0cf7e7dc6d600f54604051611fa791906137c3565b60405180910390a150565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61204e6121a7565b73ffffffffffffffffffffffffffffffffffffffff1661206c611484565b73ffffffffffffffffffffffffffffffffffffffff16146120c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b990614127565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212890614b27565b60405180910390fd5b61213a816129ee565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b6000805482109050919050565b826005600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000612279826127d4565b90506000816000015173ffffffffffffffffffffffffffffffffffffffff166122a06121a7565b73ffffffffffffffffffffffffffffffffffffffff1614806122fc57506122c56121a7565b73ffffffffffffffffffffffffffffffffffffffff166122e4846109f0565b73ffffffffffffffffffffffffffffffffffffffff16145b80612318575061231782600001516123126121a7565b611fb2565b5b90508061235a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161235190614bb9565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff16146123cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123c390614c4b565b60405180910390fd5b6123d98585856001612e2d565b6123e960008484600001516121bc565b6001600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a90046fffffffffffffffffffffffffffffffff166124579190614c87565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506001600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a90046fffffffffffffffffffffffffffffffff166124fb9190614cbb565b92506101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060405180604001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff168152506003600085815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550905050600060018461260191906143cb565b9050600073ffffffffffffffffffffffffffffffffffffffff166003600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361274657612676816121af565b15612745576040518060400160405280846000015173ffffffffffffffffffffffffffffffffffffffff168152602001846020015167ffffffffffffffff168152506003600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055509050505b5b838573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46127ae8686866001612e33565b505050505050565b6127d0828260405180602001604052806000815250612e39565b5050565b6127dc613347565b6127e5826121af565b612824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161281b90614d73565b60405180910390fd5b60007f000000000000000000000000000000000000000000000000000000000000006483106128885760017f00000000000000000000000000000000000000000000000000000000000000648461287b9190614d93565b61288591906143cb565b90505b60008390505b818110612996576000600360008381526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614612982578093505050506129d2565b50808061298e90614dc7565b91505061288e565b506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129c990614e62565b60405180910390fd5b919050565b6000826129e485846132a8565b1490509392505050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000612ad58473ffffffffffffffffffffffffffffffffffffffff1661331d565b15612c2e578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612afe6121a7565b8786866040518563ffffffff1660e01b8152600401612b209493929190614ed7565b6020604051808303816000875af1925050508015612b5c57506040513d601f19601f82011682018060405250810190612b599190614f38565b60015b612bde573d8060008114612b8c576040519150601f19603f3d011682016040523d82523d6000602084013e612b91565b606091505b506000815103612bd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bcd9061471b565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612c33565b600190505b949350505050565b606060078054612c4a90613c76565b80601f0160208091040260200160405190810160405280929190818152602001828054612c7690613c76565b8015612cc35780601f10612c9857610100808354040283529160200191612cc3565b820191906000526020600020905b815481529060010190602001808311612ca657829003601f168201915b5050505050905090565b606060008203612d14576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612e28565b600082905060005b60008214612d46578080612d2f90614208565b915050600a82612d3f9190614f94565b9150612d1c565b60008167ffffffffffffffff811115612d6257612d6161346b565b5b6040519080825280601f01601f191660200182016040528015612d945781602001600182028036833780820191505090505b5090505b60008514612e2157600182612dad9190614d93565b9150600a85612dbc9190614fc5565b6030612dc891906143cb565b60f81b818381518110612dde57612ddd614ff6565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612e1a9190614f94565b9450612d98565b8093505050505b919050565b50505050565b50505050565b600080549050612e48816121af565b15612e88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e7f90615071565b60405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000064831115612eeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ee290615103565b60405180910390fd5b612ef86000858386612e2d565b6000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020016000820160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152505090506040518060400160405280858360000151612ff59190614cbb565b6fffffffffffffffffffffffffffffffff16815260200185836020015161301c9190614cbb565b6fffffffffffffffffffffffffffffffff16815250600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555090505060405180604001604052808673ffffffffffffffffffffffffffffffffffffffff1681526020014267ffffffffffffffff168152506003600084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550905050600082905060005b8581101561328b57818773ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461322b6000888488612ab4565b61326a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132619061471b565b60405180910390fd5b818061327590614208565b925050808061328390614208565b9150506131ba565b50806000819055506132a06000878588612e33565b505050505050565b60008082905060005b84518110156133125760008582815181106132cf576132ce614ff6565b5b602002602001015190508083116132f1576132ea8382613330565b92506132fe565b6132fb8184613330565b92505b50808061330a90614208565b9150506132b1565b508091505092915050565b600080823b905060008111915050919050565b600082600052816020526040600020905092915050565b6040518060400160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff1681525090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6133ca81613395565b81146133d557600080fd5b50565b6000813590506133e7816133c1565b92915050565b6000602082840312156134035761340261338b565b5b6000613411848285016133d8565b91505092915050565b60008115159050919050565b61342f8161341a565b82525050565b600060208201905061344a6000830184613426565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6134a38261345a565b810181811067ffffffffffffffff821117156134c2576134c161346b565b5b80604052505050565b60006134d5613381565b90506134e1828261349a565b919050565b600067ffffffffffffffff8211156135015761350061346b565b5b61350a8261345a565b9050602081019050919050565b82818337600083830152505050565b6000613539613534846134e6565b6134cb565b90508281526020810184848401111561355557613554613455565b5b613560848285613517565b509392505050565b600082601f83011261357d5761357c613450565b5b813561358d848260208601613526565b91505092915050565b6000602082840312156135ac576135ab61338b565b5b600082013567ffffffffffffffff8111156135ca576135c9613390565b5b6135d684828501613568565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156136195780820151818401526020810190506135fe565b83811115613628576000848401525b50505050565b6000613639826135df565b61364381856135ea565b93506136538185602086016135fb565b61365c8161345a565b840191505092915050565b60006020820190508181036000830152613681818461362e565b905092915050565b6000819050919050565b61369c81613689565b81146136a757600080fd5b50565b6000813590506136b981613693565b92915050565b6000602082840312156136d5576136d461338b565b5b60006136e3848285016136aa565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613717826136ec565b9050919050565b6137278161370c565b82525050565b6000602082019050613742600083018461371e565b92915050565b6137518161370c565b811461375c57600080fd5b50565b60008135905061376e81613748565b92915050565b6000806040838503121561378b5761378a61338b565b5b60006137998582860161375f565b92505060206137aa858286016136aa565b9150509250929050565b6137bd81613689565b82525050565b60006020820190506137d860008301846137b4565b92915050565b6000806000606084860312156137f7576137f661338b565b5b60006138058682870161375f565b93505060206138168682870161375f565b9250506040613827868287016136aa565b9150509250925092565b6000602082840312156138475761384661338b565b5b60006138558482850161375f565b91505092915050565b6000819050919050565b6138718161385e565b82525050565b600060208201905061388c6000830184613868565b92915050565b600080fd5b600080fd5b60008083601f8401126138b2576138b1613450565b5b8235905067ffffffffffffffff8111156138cf576138ce613892565b5b6020830191508360208202830111156138eb576138ea613897565b5b9250929050565b60008060006040848603121561390b5761390a61338b565b5b60006139198682870161375f565b935050602084013567ffffffffffffffff81111561393a57613939613390565b5b6139468682870161389c565b92509250509250925092565b61395b8161341a565b811461396657600080fd5b50565b60008135905061397881613952565b92915050565b600080604083850312156139955761399461338b565b5b60006139a38582860161375f565b92505060206139b485828601613969565b9150509250929050565b600067ffffffffffffffff8211156139d9576139d861346b565b5b6139e28261345a565b9050602081019050919050565b6000613a026139fd846139be565b6134cb565b905082815260208101848484011115613a1e57613a1d613455565b5b613a29848285613517565b509392505050565b600082601f830112613a4657613a45613450565b5b8135613a568482602086016139ef565b91505092915050565b60008060008060808587031215613a7957613a7861338b565b5b6000613a878782880161375f565b9450506020613a988782880161375f565b9350506040613aa9878288016136aa565b925050606085013567ffffffffffffffff811115613aca57613ac9613390565b5b613ad687828801613a31565b91505092959194509250565b600080600060408486031215613afb57613afa61338b565b5b6000613b09868287016136aa565b935050602084013567ffffffffffffffff811115613b2a57613b29613390565b5b613b368682870161389c565b92509250509250925092565b613b4b8161385e565b8114613b5657600080fd5b50565b600081359050613b6881613b42565b92915050565b600060208284031215613b8457613b8361338b565b5b6000613b9284828501613b59565b91505092915050565b60008060408385031215613bb257613bb161338b565b5b6000613bc08582860161375f565b9250506020613bd18582860161375f565b9150509250929050565b7f6f6e6c7941646d696e3a2053656e646572206d7573742062652061646d696e00600082015250565b6000613c11601f836135ea565b9150613c1c82613bdb565b602082019050919050565b60006020820190508181036000830152613c4081613c04565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613c8e57607f821691505b602082108103613ca157613ca0613c47565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302613d097fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613ccc565b613d138683613ccc565b95508019841693508086168417925050509392505050565b6000819050919050565b6000613d50613d4b613d4684613689565b613d2b565b613689565b9050919050565b6000819050919050565b613d6a83613d35565b613d7e613d7682613d57565b848454613cd9565b825550505050565b600090565b613d93613d86565b613d9e818484613d61565b505050565b5b81811015613dc257613db7600082613d8b565b600181019050613da4565b5050565b601f821115613e0757613dd881613ca7565b613de184613cbc565b81016020851015613df0578190505b613e04613dfc85613cbc565b830182613da3565b50505b505050565b600082821c905092915050565b6000613e2a60001984600802613e0c565b1980831691505092915050565b6000613e438383613e19565b9150826002028217905092915050565b613e5c826135df565b67ffffffffffffffff811115613e7557613e7461346b565b5b613e7f8254613c76565b613e8a828285613dc6565b600060209050601f831160018114613ebd5760008415613eab578287015190505b613eb58582613e37565b865550613f1d565b601f198416613ecb86613ca7565b60005b82811015613ef357848901518255600182019150602085019450602081019050613ece565b86831015613f105784890151613f0c601f891682613e19565b8355505b6001600288020188555050505b505050505050565b7f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560008201527f78697374656e7420746f6b656e00000000000000000000000000000000000000602082015250565b6000613f81602d836135ea565b9150613f8c82613f25565b604082019050919050565b60006020820190508181036000830152613fb081613f74565b9050919050565b7f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b60006140136022836135ea565b915061401e82613fb7565b604082019050919050565b6000602082019050818103600083015261404281614006565b9050919050565b7f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f76656420666f7220616c6c00000000000000602082015250565b60006140a56039836135ea565b91506140b082614049565b604082019050919050565b600060208201905081810360008301526140d481614098565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006141116020836135ea565b915061411c826140db565b602082019050919050565b6000602082019050818103600083015261414081614104565b9050919050565b7f455243373231413a206f776e657220696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b60006141a36022836135ea565b91506141ae82614147565b604082019050919050565b600060208201905081810360008301526141d281614196565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061421382613689565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614245576142446141d9565b5b600182019050919050565b7f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060008201527f6f776e657220627920696e646578000000000000000000000000000000000000602082015250565b60006142ac602e836135ea565b91506142b782614250565b604082019050919050565b600060208201905081810360008301526142db8161429f565b9050919050565b600081905092915050565b50565b60006142fd6000836142e2565b9150614308826142ed565b600082019050919050565b600061431e826142f0565b9150819050919050565b7f5472616e73666572206661696c00000000000000000000000000000000000000600082015250565b600061435e600d836135ea565b915061436982614328565b602082019050919050565b6000602082019050818103600083015261438d81614351565b9050919050565b60006060820190506143a9600083018661371e565b6143b6602083018561371e565b6143c360408301846137b4565b949350505050565b60006143d682613689565b91506143e183613689565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614416576144156141d9565b5b828201905092915050565b7f45786365656473206d617820737570706c790000000000000000000000000000600082015250565b60006144576012836135ea565b915061446282614421565b602082019050919050565b600060208201905081810360008301526144868161444a565b9050919050565b60006040820190506144a2600083018561371e565b6144af60208301846137b4565b9392505050565b7f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f7560008201527f6e64730000000000000000000000000000000000000000000000000000000000602082015250565b60006145126023836135ea565b915061451d826144b6565b604082019050919050565b6000602082019050818103600083015261454181614505565b9050919050565b60008160601b9050919050565b600061456082614548565b9050919050565b600061457282614555565b9050919050565b61458a6145858261370c565b614567565b82525050565b600061459c8284614579565b60148201915081905092915050565b7f455243373231413a2062616c616e636520717565727920666f7220746865207a60008201527f65726f2061646472657373000000000000000000000000000000000000000000602082015250565b6000614607602b836135ea565b9150614612826145ab565b604082019050919050565b60006020820190508181036000830152614636816145fa565b9050919050565b7f455243373231413a20617070726f766520746f2063616c6c6572000000000000600082015250565b6000614673601a836135ea565b915061467e8261463d565b602082019050919050565b600060208201905081810360008301526146a281614666565b9050919050565b7f455243373231413a207472616e7366657220746f206e6f6e204552433732315260008201527f6563656976657220696d706c656d656e74657200000000000000000000000000602082015250565b60006147056033836135ea565b9150614710826146a9565b604082019050919050565b60006020820190508181036000830152614734816146f8565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000614771601f836135ea565b915061477c8261473b565b602082019050919050565b600060208201905081810360008301526147a081614764565b9050919050565b7f45786365656473206d6178207065722074780000000000000000000000000000600082015250565b60006147dd6012836135ea565b91506147e8826147a7565b602082019050919050565b6000602082019050818103600083015261480c816147d0565b9050919050565b7f45786365656473206d6178207065722077616c6c657400000000000000000000600082015250565b60006148496016836135ea565b915061485482614813565b602082019050919050565b600060208201905081810360008301526148788161483c565b9050919050565b7f4d696e74696e6720697320636c6f736564000000000000000000000000000000600082015250565b60006148b56011836135ea565b91506148c08261487f565b602082019050919050565b600060208201905081810360008301526148e4816148a8565b9050919050565b7f616c6c6f77206c697374206f6e6c790000000000000000000000000000000000600082015250565b6000614921600f836135ea565b915061492c826148eb565b602082019050919050565b6000602082019050818103600083015261495081614914565b9050919050565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b60006149b3602f836135ea565b91506149be82614957565b604082019050919050565b600060208201905081810360008301526149e2816149a6565b9050919050565b600081905092915050565b60006149ff826135df565b614a0981856149e9565b9350614a198185602086016135fb565b80840191505092915050565b6000614a3182856149f4565b9150614a3d82846149f4565b91508190509392505050565b7f45786365656473206d61782061646d696e206d696e7400000000000000000000600082015250565b6000614a7f6016836135ea565b9150614a8a82614a49565b602082019050919050565b60006020820190508181036000830152614aae81614a72565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614b116026836135ea565b9150614b1c82614ab5565b604082019050919050565b60006020820190508181036000830152614b4081614b04565b9050919050565b7f455243373231413a207472616e736665722063616c6c6572206973206e6f742060008201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000602082015250565b6000614ba36032836135ea565b9150614bae82614b47565b604082019050919050565b60006020820190508181036000830152614bd281614b96565b9050919050565b7f455243373231413a207472616e736665722066726f6d20696e636f727265637460008201527f206f776e65720000000000000000000000000000000000000000000000000000602082015250565b6000614c356026836135ea565b9150614c4082614bd9565b604082019050919050565b60006020820190508181036000830152614c6481614c28565b9050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b6000614c9282614c6b565b9150614c9d83614c6b565b925082821015614cb057614caf6141d9565b5b828203905092915050565b6000614cc682614c6b565b9150614cd183614c6b565b9250826fffffffffffffffffffffffffffffffff03821115614cf657614cf56141d9565b5b828201905092915050565b7f455243373231413a206f776e657220717565727920666f72206e6f6e6578697360008201527f74656e7420746f6b656e00000000000000000000000000000000000000000000602082015250565b6000614d5d602a836135ea565b9150614d6882614d01565b604082019050919050565b60006020820190508181036000830152614d8c81614d50565b9050919050565b6000614d9e82613689565b9150614da983613689565b925082821015614dbc57614dbb6141d9565b5b828203905092915050565b6000614dd282613689565b915060008203614de557614de46141d9565b5b600182039050919050565b7f455243373231413a20756e61626c6520746f2064657465726d696e652074686560008201527f206f776e6572206f6620746f6b656e0000000000000000000000000000000000602082015250565b6000614e4c602f836135ea565b9150614e5782614df0565b604082019050919050565b60006020820190508181036000830152614e7b81614e3f565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000614ea982614e82565b614eb38185614e8d565b9350614ec38185602086016135fb565b614ecc8161345a565b840191505092915050565b6000608082019050614eec600083018761371e565b614ef9602083018661371e565b614f0660408301856137b4565b8181036060830152614f188184614e9e565b905095945050505050565b600081519050614f32816133c1565b92915050565b600060208284031215614f4e57614f4d61338b565b5b6000614f5c84828501614f23565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614f9f82613689565b9150614faa83613689565b925082614fba57614fb9614f65565b5b828204905092915050565b6000614fd082613689565b9150614fdb83613689565b925082614feb57614fea614f65565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f455243373231413a20746f6b656e20616c7265616479206d696e746564000000600082015250565b600061505b601d836135ea565b915061506682615025565b602082019050919050565b6000602082019050818103600083015261508a8161504e565b9050919050565b7f455243373231413a207175616e7469747920746f206d696e7420746f6f20686960008201527f6768000000000000000000000000000000000000000000000000000000000000602082015250565b60006150ed6022836135ea565b91506150f882615091565b604082019050919050565b6000602082019050818103600083015261511c816150e0565b905091905056fea2646970667358221220937d7b990074b2fb385b4d27e6d942481e25d6a7299c12d93add0f0db372e53e64736f6c634300080f0033
Verified Source Code Partial Match
Compiler: v0.8.15+commit.e14f2714
EVM: london
Optimization: No
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
Address.sol 189 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 25 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
ERC721A.sol 559 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./IERC721Metadata.sol";
import "./IERC721Enumerable.sol";
import "./Address.sol";
//import "@openzeppelin/contracts/utils/Context.sol";
import "./Strings.sol";
import "./ERC165.sol";
import "./Ownable.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
*
* Assumes the number of issuable tokens (collection size) is capped and fits in a uint128.
*
* Does not support burning tokens to address(0).
*/
contract ERC721A is
Context,
ERC165,
IERC721,
IERC721Metadata,
IERC721Enumerable
{
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
}
struct AddressData {
uint128 balance;
uint128 numberMinted;
}
uint256 private currentIndex = 0;
uint256 internal immutable collectionSize;
uint256 internal immutable maxBatchSize;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) private _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev
* `maxBatchSize` refers to how much a minter can mint at a time.
* `collectionSize_` refers to how many tokens are in the collection.
*/
constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_,
uint256 collectionSize_
) {
require(
collectionSize_ > 0,
"ERC721A: collection must have a nonzero supply"
);
require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero");
_name = name_;
_symbol = symbol_;
maxBatchSize = maxBatchSize_;
collectionSize = collectionSize_;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return currentIndex;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view override returns (uint256) {
require(index < totalSupply(), "ERC721A: global index out of bounds");
return index;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
* This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first.
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr = address(0);
for (uint256 i = 0; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
revert("ERC721A: unable to get token of owner by index");
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
require(owner != address(0), "ERC721A: balance query for the zero address");
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
require(
owner != address(0),
"ERC721A: number minted query for the zero address"
);
return uint256(_addressData[owner].numberMinted);
}
function ownershipOf(uint256 tokenId)
internal
view
returns (TokenOwnership memory)
{
require(_exists(tokenId), "ERC721A: owner query for nonexistent token");
uint256 lowestTokenToCheck;
if (tokenId >= maxBatchSize) {
lowestTokenToCheck = tokenId - maxBatchSize + 1;
}
for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
TokenOwnership memory ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
revert("ERC721A: unable to determine the owner of token");
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
string URI;
function _baseURI() internal view virtual returns (string memory) {
return URI;
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
require(to != owner, "ERC721A: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721A: approve caller is not owner nor approved for all"
);
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
require(_exists(tokenId), "ERC721A: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public override {
require(operator != _msgSender(), "ERC721A: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < currentIndex;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, "");
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - there must be `quantity` tokens remaining unminted in the total collection.
* - `to` cannot be the zero address.
* - `quantity` cannot be larger than the max batch size.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
//require(to != address(0), "ERC721A: mint to the zero address");
// We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
addressData.balance + uint128(quantity),
addressData.numberMinted + uint128(quantity)
);
_ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));
uint256 updatedIndex = startTokenId;
for (uint256 i = 0; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
require(
_checkOnERC721Received(address(0), to, updatedIndex, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
updatedIndex++;
}
currentIndex = updatedIndex;
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
getApproved(tokenId) == _msgSender() ||
isApprovedForAll(prevOwnership.addr, _msgSender()));
require(
isApprovedOrOwner,
"ERC721A: transfer caller is not owner nor approved"
);
require(
prevOwnership.addr == from,
"ERC721A: transfer from incorrect owner"
);
//require(to != address(0), "ERC721A: transfer to the zero address");
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (_exists(nextTokenId)) {
_ownerships[nextTokenId] = TokenOwnership(
prevOwnership.addr,
prevOwnership.startTimestamp
);
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
uint256 public nextOwnerToExplicitlySet = 0;
/**
* @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
*/
function _setOwnersExplicit(uint256 quantity) internal {
uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
require(quantity > 0, "quantity must be nonzero");
uint256 endIndex = oldNextOwnerToSet + quantity - 1;
if (endIndex > collectionSize - 1) {
endIndex = collectionSize - 1;
}
// We know if the last one in the group exists, all in the group exist, due to serial ordering.
require(_exists(endIndex), "not enough minted yet for this cleanup");
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0)) {
TokenOwnership memory ownership = ownershipOf(i);
_ownerships[i] = TokenOwnership(
ownership.addr,
ownership.startTimestamp
);
}
}
nextOwnerToExplicitlySet = endIndex + 1;
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721A: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
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 "./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);
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
MerkleProof.sol 65 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
StickmenToys.sol 123 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "./ERC721A.sol";
import "./Ownable.sol";
import "./ReentrancyGuard.sol";
import "./MerkleProof.sol";
contract StickmenToys is ERC721A, Ownable, ReentrancyGuard {
uint256 public maxSupply;
bytes32 public merkleRoot = 0x00314e565e0574cb412563df634608d76f5c59d9f817e85966100ec1d48005c0;
uint256 public state;
uint256 public maxPerWallet = 1;
uint256 public maxPerTX = 1;
uint256 public adminMints;
mapping(address => uint256) public numOfMints;
mapping(address => bool) private isAdmin;
event minted(address minter, uint256 amount);
event burned(address from, address to, uint256 id);
event saleStateChanged(uint256 state);
event maxPerTXChanged(uint256 max);
event maxPerWalletChanged(uint256 max);
modifier onlyAdmin {
require(isAdmin[_msgSender()] == true, "onlyAdmin: Sender must be admin");
_;
}
constructor()
ERC721A(
"Stickmen Toys",
"STICK",
100,
5000
) {
isAdmin[_msgSender()] = true;
isAdmin[0x6CD2C480E85222770de8675b5dF043BDbeBc9E39] = true;
maxSupply = 5000;
state = 0;
URI = "";
}
function mint(uint256 _amount, bytes32[] calldata _merkleProof) external nonReentrant {
require(totalSupply() + _amount <= maxSupply, "Exceeds max supply");
require(_amount <= maxPerTX, "Exceeds max per tx");
require(_amount + numOfMints[_msgSender()] <= maxPerWallet, "Exceeds max per wallet");
require(state != 0, "Minting is closed");
numOfMints[_msgSender()] += _amount;
if(state == 1) {
require(isAllowListed(_msgSender(), _merkleProof), "allow list only");
}
_safeMint(_msgSender(), _amount);
emit minted(_msgSender(), _amount);
}
function ownerMint(address _recipient, uint256 _amount) external onlyOwner {
require(totalSupply() + _amount <= maxSupply, "Exceeds max supply");
_safeMint(_recipient, _amount);
emit minted(_recipient, _amount);
}
function adminMint(address _recipient, uint256 _amount) external onlyAdmin {
require(totalSupply() + _amount <= maxSupply, "Exceeds max supply");
require(adminMints + _amount <= 500, "Exceeds max admin mint");
adminMints += _amount;
_safeMint(_recipient, _amount);
emit minted(_recipient, _amount);
}
function isAllowListed(address _recipient, bytes32[] calldata _merkleProof) public view returns(bool) {
bytes32 leaf = keccak256(abi.encodePacked(_recipient));
bool isal = MerkleProof.verify(_merkleProof, merkleRoot, leaf);
return isal;
}
function setRoot(bytes32 root) external onlyAdmin {
merkleRoot = root;
}
function burn(uint256 tokenId) external {
transferFrom(_msgSender(), address(0), tokenId);
emit burned(_msgSender(), address(0), tokenId);
}
function setURI(string memory _URI) external onlyAdmin {
URI = _URI;
}
function setState(uint256 _state) external onlyAdmin{
state = _state;
emit saleStateChanged(state);
}
function setMaxPerTX(uint256 _maxPerTX) external onlyAdmin {
maxPerTX = _maxPerTX;
emit maxPerTXChanged(maxPerTX);
}
function setMaxPerWallet(uint256 _maxPerWallet) external onlyAdmin {
maxPerWallet = _maxPerWallet;
emit maxPerWalletChanged(maxPerWallet);
}
function withdraw() public onlyOwner {
(bool success,) = owner().call{value: address(this).balance}("");
require(success, "Transfer fail");
}
function addAdmin(address _adm) external onlyOwner {
isAdmin[_adm] = true;
}
function revokeAdmin(address _adm) external onlyOwner {
isAdmin[_adm] = false;
}
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
ReentrancyGuard.sol 62 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
adminMints 0xcc1afc54 → uint256
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
isAllowListed 0x67762169 → bool
isApprovedForAll 0xe985e9c5 → bool
maxPerTX 0xa40d36cd → uint256
maxPerWallet 0x453c2310 → uint256
maxSupply 0xd5abeb01 → uint256
merkleRoot 0x2eb4a7ab → bytes32
name 0x06fdde03 → string
nextOwnerToExplicitlySet 0xd7224ba0 → uint256
numOfMints 0xb4cc927d → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
state 0xc19d93fb → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
addAdmin 0x70480275
address _adm
adminMint 0xe58306f9
address _recipient
uint256 _amount
approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 tokenId
mint 0xba41b0c6
uint256 _amount
bytes32[] _merkleProof
ownerMint 0x484b973c
address _recipient
uint256 _amount
renounceOwnership 0x715018a6
No parameters
revokeAdmin 0x2d345670
address _adm
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setMaxPerTX 0xe5a4756c
uint256 _maxPerTX
setMaxPerWallet 0xe268e4d3
uint256 _maxPerWallet
setRoot 0xdab5f340
bytes32 root
setState 0xa9e966b7
uint256 _state
setURI 0x02fe5305
string _URI
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address