Address Contract Partially Verified
Address
0x36036ee347c6308b905fBe2206f68dCb98D92d55
Balance
0.045000 ETH
Nonce
1
Code Size
13521 bytes
Creator
0xAdB61C69...0F95 at tx 0x94a45f7e...8fe96f
Indexed Transactions
0
Contract Bytecode
13521 bytes
0x6080604052600436106101c25760003560e01c8063715018a6116100f7578063b80f55c911610095578063c87b56dd11610064578063c87b56dd1461061d578063d5abeb011461065a578063e985e9c514610685578063f2fde38b146106c2576101c2565b8063b80f55c914610577578063b88d4fde146105a0578063c204642c146105c9578063c7abf7e0146105f2576101c2565b8063a035b1fe116100d1578063a035b1fe146104dc578063a0712d6814610507578063a22cb46514610523578063b3ee8ba51461054c576101c2565b8063715018a61461046f5780638da5cb5b1461048657806395d89b41146104b1576101c2565b80632e1a7d4d116101645780635c975abb1161013e5780635c975abb1461038d5780636352211e146103b85780636bb7676e146103f557806370a0823114610432576101c2565b80632e1a7d4d1461031257806342842e0e1461033b57806355f804b314610364576101c2565b8063095ea7b3116101a0578063095ea7b31461026c57806316c38b3c1461029557806318160ddd146102be57806323b872dd146102e9576101c2565b806301ffc9a7146101c757806306fdde0314610204578063081812fc1461022f575b600080fd5b3480156101d357600080fd5b506101ee60048036038101906101e991906125c2565b6106eb565b6040516101fb919061260a565b60405180910390f35b34801561021057600080fd5b5061021961077d565b60405161022691906126be565b60405180910390f35b34801561023b57600080fd5b5061025660048036038101906102519190612716565b61080f565b6040516102639190612784565b60405180910390f35b34801561027857600080fd5b50610293600480360381019061028e91906127cb565b61088b565b005b3480156102a157600080fd5b506102bc60048036038101906102b79190612837565b610a32565b005b3480156102ca57600080fd5b506102d3610acc565b6040516102e09190612873565b60405180910390f35b3480156102f557600080fd5b50610310600480360381019061030b919061288e565b610ae3565b005b34801561031e57600080fd5b5061033960048036038101906103349190612716565b610af3565b005b34801561034757600080fd5b50610362600480360381019061035d919061288e565b610bb9565b005b34801561037057600080fd5b5061038b60048036038101906103869190612a16565b610bd9565b005b34801561039957600080fd5b506103a2610c6f565b6040516103af919061260a565b60405180910390f35b3480156103c457600080fd5b506103df60048036038101906103da9190612716565b610c86565b6040516103ec9190612784565b60405180910390f35b34801561040157600080fd5b5061041c60048036038101906104179190612a5f565b610c98565b6040516104299190612873565b60405180910390f35b34801561043e57600080fd5b5061045960048036038101906104549190612a5f565b610cb0565b6040516104669190612873565b60405180910390f35b34801561047b57600080fd5b50610484610d69565b005b34801561049257600080fd5b5061049b610df1565b6040516104a89190612784565b60405180910390f35b3480156104bd57600080fd5b506104c6610e1a565b6040516104d391906126be565b60405180910390f35b3480156104e857600080fd5b506104f1610eac565b6040516104fe9190612873565b60405180910390f35b610521600480360381019061051c9190612716565b610eb2565b005b34801561052f57600080fd5b5061054a60048036038101906105459190612a8c565b6110f8565b005b34801561055857600080fd5b50610561611270565b60405161056e9190612873565b60405180910390f35b34801561058357600080fd5b5061059e60048036038101906105999190612b94565b611276565b005b3480156105ac57600080fd5b506105c760048036038101906105c29190612c7e565b611338565b005b3480156105d557600080fd5b506105f060048036038101906105eb9190612dc4565b6113ab565b005b3480156105fe57600080fd5b5061060761146f565b6040516106149190612873565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190612716565b611475565b60405161065191906126be565b60405180910390f35b34801561066657600080fd5b5061066f611514565b60405161067c9190612873565b60405180910390f35b34801561069157600080fd5b506106ac60048036038101906106a79190612e20565b61151a565b6040516106b9919061260a565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e49190612a5f565b6115ae565b005b60006301ffc9a760e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061074657506380ac58cd60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806107765750635b5e139f60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b60606003805461078c90612e8f565b80601f01602080910402602001604051908101604052809291908181526020018280546107b890612e8f565b80156108055780601f106107da57610100808354040283529160200191610805565b820191906000526020600020905b8154815290600101906020018083116107e857829003601f168201915b5050505050905090565b600061081a826116a6565b610850576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061089682611705565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108fe576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1661091d6117d3565b73ffffffffffffffffffffffffffffffffffffffff161461098057610949816109446117d3565b61151a565b61097f576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b826007600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b610a3a6117db565b73ffffffffffffffffffffffffffffffffffffffff16610a58610df1565b73ffffffffffffffffffffffffffffffffffffffff1614610aae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa590612f0d565b60405180910390fd5b80610ac057610abb6117e3565b610ac9565b610ac8611885565b5b50565b6000610ad6611928565b6002546001540303905090565b610aee83838361192d565b505050565b610afb6117db565b73ffffffffffffffffffffffffffffffffffffffff16610b19610df1565b73ffffffffffffffffffffffffffffffffffffffff1614610b6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6690612f0d565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610bb5573d6000803e3d6000fd5b5050565b610bd483838360405180602001604052806000815250611338565b505050565b610be16117db565b73ffffffffffffffffffffffffffffffffffffffff16610bff610df1565b73ffffffffffffffffffffffffffffffffffffffff1614610c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4c90612f0d565b60405180910390fd5b80600f9080519060200190610c6b9291906124b3565b5050565b6000600960009054906101000a900460ff16905090565b6000610c9182611705565b9050919050565b600e6020528060005260406000206000915090505481565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d18576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054169050919050565b610d716117db565b73ffffffffffffffffffffffffffffffffffffffff16610d8f610df1565b73ffffffffffffffffffffffffffffffffffffffff1614610de5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ddc90612f0d565b60405180910390fd5b610def6000611cd7565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054610e2990612e8f565b80601f0160208091040260200160405190810160405280929190818152602001828054610e5590612e8f565b8015610ea25780601f10610e7757610100808354040283529160200191610ea2565b820191906000526020600020905b815481529060010190602001808311610e8557829003601f168201915b5050505050905090565b600b5481565b610eba610c6f565b15610efa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef190612f79565b60405180910390fd5b600a5481610f06610acc565b610f109190612fc8565b1115610f51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4890613090565b60405180910390fd5b600d5481600e6000610f616117db565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fa69190612fc8565b1115610fe7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fde906130fc565b60405180910390fd5b600c54610ff2610acc565b106110485780600b54611005919061311c565b341015611047576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103e906131c2565b60405180910390fd5b5b6110596110536117db565b82611d9b565b80600e60006110666117db565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110ab9190612fc8565b600e60006110b76117db565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6111006117d3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611165576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600860006111726117d3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661121f6117d3565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611264919061260a565b60405180910390a35050565b600d5481565b61127e6117db565b73ffffffffffffffffffffffffffffffffffffffff1661129c610df1565b73ffffffffffffffffffffffffffffffffffffffff16146112f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e990612f0d565b60405180910390fd5b60005b815181101561133457611321828281518110611314576113136131e2565b5b6020026020010151611f70565b808061132c90613211565b9150506112f5565b5050565b61134384848461192d565b60008373ffffffffffffffffffffffffffffffffffffffff163b146113a55761136e84848484611f7e565b6113a4576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b50505050565b6113b36117db565b73ffffffffffffffffffffffffffffffffffffffff166113d1610df1565b73ffffffffffffffffffffffffffffffffffffffff1614611427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141e90612f0d565b60405180910390fd5b60005b825181101561146a57611457838281518110611449576114486131e2565b5b602002602001015183611d9b565b808061146290613211565b91505061142a565b505050565b600c5481565b6060611480826116a6565b6114b6576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006114c06120cf565b90506000815114156114e1576040518060200160405280600081525061150c565b806114eb84612161565b6040516020016114fc929190613296565b6040516020818303038152906040525b915050919050565b600a5481565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6115b66117db565b73ffffffffffffffffffffffffffffffffffffffff166115d4610df1565b73ffffffffffffffffffffffffffffffffffffffff161461162a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162190612f0d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561169a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116919061332c565b60405180910390fd5b6116a381611cd7565b50565b6000816116b1611928565b111580156116c0575060015482105b80156116fe575060007c0100000000000000000000000000000000000000000000000000000000600560008581526020019081526020016000205416145b9050919050565b60008082905080611714611928565b1161179c5760015481101561179b5760006005600083815260200190815260200160002054905060007c010000000000000000000000000000000000000000000000000000000082161415611799575b600081141561178f576005600083600190039350838152602001908152602001600020549050611764565b80925050506117ce565b505b5b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600033905090565b600033905090565b6117eb610c6f565b61182a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182190613398565b60405180910390fd5b6000600960006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61186e6117db565b60405161187b9190612784565b60405180910390a1565b61188d610c6f565b156118cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c490612f79565b60405180910390fd5b6001600960006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119116117db565b60405161191e9190612784565b60405180910390a1565b600090565b600061193882611705565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461199f576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008473ffffffffffffffffffffffffffffffffffffffff166119c06117d3565b73ffffffffffffffffffffffffffffffffffffffff1614806119ef57506119ee856119e96117d3565b61151a565b5b80611a3457506119fd6117d3565b73ffffffffffffffffffffffffffffffffffffffff16611a1c8461080f565b73ffffffffffffffffffffffffffffffffffffffff16145b905080611a6d576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415611ad4576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611ae185858560016121bb565b6007600084815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081546001900391905081905550600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154600101919050819055507c020000000000000000000000000000000000000000000000000000000060a042901b611bde866121c1565b1717600560008581526020019081526020016000208190555060007c020000000000000000000000000000000000000000000000000000000083161415611c68576000600184019050600060056000838152602001908152602001600020541415611c66576001548114611c65578260056000838152602001908152602001600020819055505b5b505b828473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611cd085858560016121cb565b5050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006001549050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e09576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000821415611e44576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611e5160008483856121bb565b600160406001901b178202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060e1611eb6600184146121d1565b901b60a042901b611ec6856121c1565b171760056000838152602001908152602001600020819055506000819050600083820190505b818060010192508573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4808210611eec57816001819055505050611f6b60008483856121cb565b505050565b611f7b8160006121db565b50565b60008373ffffffffffffffffffffffffffffffffffffffff1663150b7a02611fa46117d3565b8786866040518563ffffffff1660e01b8152600401611fc6949392919061340d565b6020604051808303816000875af192505050801561200257506040513d601f19601f82011682018060405250810190611fff919061346e565b60015b61207c573d8060008114612032576040519150601f19603f3d011682016040523d82523d6000602084013e612037565b606091505b50600081511415612074576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b6060600f80546120de90612e8f565b80601f016020809104026020016040519081016040528092919081815260200182805461210a90612e8f565b80156121575780601f1061212c57610100808354040283529160200191612157565b820191906000526020600020905b81548152906001019060200180831161213a57829003601f168201915b5050505050905090565b60606080604051019050806040528082600183039250600a81066030018353600a810490505b80156121a757600183039250600a81066030018353600a81049050612187565b508181036020830392508083525050919050565b50505050565b6000819050919050565b50505050565b6000819050919050565b60006121e683611705565b9050600081905082156122c35760008173ffffffffffffffffffffffffffffffffffffffff166122146117d3565b73ffffffffffffffffffffffffffffffffffffffff16148061224357506122428261223d6117d3565b61151a565b5b8061228857506122516117d3565b73ffffffffffffffffffffffffffffffffffffffff166122708661080f565b73ffffffffffffffffffffffffffffffffffffffff16145b9050806122c1576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6122d18160008660016121bb565b6007600085815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600160806001901b03600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055507c02000000000000000000000000000000000000000000000000000000007c010000000000000000000000000000000000000000000000000000000060a042901b6123a6846121c1565b171717600560008681526020019081526020016000208190555060007c02000000000000000000000000000000000000000000000000000000008316141561243157600060018501905060006005600083815260200190815260200160002054141561242f57600154811461242e578260056000838152602001908152602001600020819055505b5b505b83600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461249b8160008660016121cb565b60026000815480929190600101919050555050505050565b8280546124bf90612e8f565b90600052602060002090601f0160209004810192826124e15760008555612528565b82601f106124fa57805160ff1916838001178555612528565b82800160010185558215612528579182015b8281111561252757825182559160200191906001019061250c565b5b5090506125359190612539565b5090565b5b8082111561255257600081600090555060010161253a565b5090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61259f8161256a565b81146125aa57600080fd5b50565b6000813590506125bc81612596565b92915050565b6000602082840312156125d8576125d7612560565b5b60006125e6848285016125ad565b91505092915050565b60008115159050919050565b612604816125ef565b82525050565b600060208201905061261f60008301846125fb565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561265f578082015181840152602081019050612644565b8381111561266e576000848401525b50505050565b6000601f19601f8301169050919050565b600061269082612625565b61269a8185612630565b93506126aa818560208601612641565b6126b381612674565b840191505092915050565b600060208201905081810360008301526126d88184612685565b905092915050565b6000819050919050565b6126f3816126e0565b81146126fe57600080fd5b50565b600081359050612710816126ea565b92915050565b60006020828403121561272c5761272b612560565b5b600061273a84828501612701565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061276e82612743565b9050919050565b61277e81612763565b82525050565b60006020820190506127996000830184612775565b92915050565b6127a881612763565b81146127b357600080fd5b50565b6000813590506127c58161279f565b92915050565b600080604083850312156127e2576127e1612560565b5b60006127f0858286016127b6565b925050602061280185828601612701565b9150509250929050565b612814816125ef565b811461281f57600080fd5b50565b6000813590506128318161280b565b92915050565b60006020828403121561284d5761284c612560565b5b600061285b84828501612822565b91505092915050565b61286d816126e0565b82525050565b60006020820190506128886000830184612864565b92915050565b6000806000606084860312156128a7576128a6612560565b5b60006128b5868287016127b6565b93505060206128c6868287016127b6565b92505060406128d786828701612701565b9150509250925092565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61292382612674565b810181811067ffffffffffffffff82111715612942576129416128eb565b5b80604052505050565b6000612955612556565b9050612961828261291a565b919050565b600067ffffffffffffffff821115612981576129806128eb565b5b61298a82612674565b9050602081019050919050565b82818337600083830152505050565b60006129b96129b484612966565b61294b565b9050828152602081018484840111156129d5576129d46128e6565b5b6129e0848285612997565b509392505050565b600082601f8301126129fd576129fc6128e1565b5b8135612a0d8482602086016129a6565b91505092915050565b600060208284031215612a2c57612a2b612560565b5b600082013567ffffffffffffffff811115612a4a57612a49612565565b5b612a56848285016129e8565b91505092915050565b600060208284031215612a7557612a74612560565b5b6000612a83848285016127b6565b91505092915050565b60008060408385031215612aa357612aa2612560565b5b6000612ab1858286016127b6565b9250506020612ac285828601612822565b9150509250929050565b600067ffffffffffffffff821115612ae757612ae66128eb565b5b602082029050602081019050919050565b600080fd5b6000612b10612b0b84612acc565b61294b565b90508083825260208201905060208402830185811115612b3357612b32612af8565b5b835b81811015612b5c5780612b488882612701565b845260208401935050602081019050612b35565b5050509392505050565b600082601f830112612b7b57612b7a6128e1565b5b8135612b8b848260208601612afd565b91505092915050565b600060208284031215612baa57612ba9612560565b5b600082013567ffffffffffffffff811115612bc857612bc7612565565b5b612bd484828501612b66565b91505092915050565b600067ffffffffffffffff821115612bf857612bf76128eb565b5b612c0182612674565b9050602081019050919050565b6000612c21612c1c84612bdd565b61294b565b905082815260208101848484011115612c3d57612c3c6128e6565b5b612c48848285612997565b509392505050565b600082601f830112612c6557612c646128e1565b5b8135612c75848260208601612c0e565b91505092915050565b60008060008060808587031215612c9857612c97612560565b5b6000612ca6878288016127b6565b9450506020612cb7878288016127b6565b9350506040612cc887828801612701565b925050606085013567ffffffffffffffff811115612ce957612ce8612565565b5b612cf587828801612c50565b91505092959194509250565b600067ffffffffffffffff821115612d1c57612d1b6128eb565b5b602082029050602081019050919050565b6000612d40612d3b84612d01565b61294b565b90508083825260208201905060208402830185811115612d6357612d62612af8565b5b835b81811015612d8c5780612d7888826127b6565b845260208401935050602081019050612d65565b5050509392505050565b600082601f830112612dab57612daa6128e1565b5b8135612dbb848260208601612d2d565b91505092915050565b60008060408385031215612ddb57612dda612560565b5b600083013567ffffffffffffffff811115612df957612df8612565565b5b612e0585828601612d96565b9250506020612e1685828601612701565b9150509250929050565b60008060408385031215612e3757612e36612560565b5b6000612e45858286016127b6565b9250506020612e56858286016127b6565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680612ea757607f821691505b60208210811415612ebb57612eba612e60565b5b50919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612ef7602083612630565b9150612f0282612ec1565b602082019050919050565b60006020820190508181036000830152612f2681612eea565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000612f63601083612630565b9150612f6e82612f2d565b602082019050919050565b60006020820190508181036000830152612f9281612f56565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612fd3826126e0565b9150612fde836126e0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561301357613012612f99565b5b828201905092915050565b7f4d617820616d6f756e74206f66206b65797320686173206265656e207265616360008201527f6865640000000000000000000000000000000000000000000000000000000000602082015250565b600061307a602383612630565b91506130858261301e565b604082019050919050565b600060208201905081810360008301526130a98161306d565b9050919050565b7f596f752063616e2774206d696e74206d6f7265206b6579730000000000000000600082015250565b60006130e6601883612630565b91506130f1826130b0565b602082019050919050565b60006020820190508181036000830152613115816130d9565b9050919050565b6000613127826126e0565b9150613132836126e0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a612f99565b5b828202905092915050565b7f4e6f7420656e6f75676820455448000000000000000000000000000000000000600082015250565b60006131ac600e83612630565b91506131b782613176565b602082019050919050565b600060208201905081810360008301526131db8161319f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061321c826126e0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561324f5761324e612f99565b5b600182019050919050565b600081905092915050565b600061327082612625565b61327a818561325a565b935061328a818560208601612641565b80840191505092915050565b60006132a28285613265565b91506132ae8284613265565b91508190509392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613316602683612630565b9150613321826132ba565b604082019050919050565b6000602082019050818103600083015261334581613309565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b6000613382601483612630565b915061338d8261334c565b602082019050919050565b600060208201905081810360008301526133b181613375565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006133df826133b8565b6133e981856133c3565b93506133f9818560208601612641565b61340281612674565b840191505092915050565b60006080820190506134226000830187612775565b61342f6020830186612775565b61343c6040830185612864565b818103606083015261344e81846133d4565b905095945050505050565b60008151905061346881612596565b92915050565b60006020828403121561348457613483612560565b5b600061349284828501613459565b9150509291505056fea264697066735822122029ee01d1141d4cf7f6197fe1f4586f72feb1a30f5ebb559b4a91393786a4e24e64736f6c634300080a0033
Verified Source Code Partial Match
Compiler: v0.8.10+commit.fc410830
EVM: london
Optimization: No
ERC721A.sol 816 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.0.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721A.sol';
/**
* @dev ERC721 token receiver interface.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is IERC721A {
// Mask of an entry in packed address data.
uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225;
// The tokenId of the next token to be minted.
uint256 private _currentIndex;
// The number of tokens burned.
uint256 private _burnCounter;
// 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 `_packedOwnershipOf` implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// 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;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see `_totalMinted`.
*/
function totalSupply() public view override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than `_currentIndex - _startTokenId()` times.
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view returns (uint256) {
// Counter underflow is impossible as _currentIndex does not decrement,
// and it is initialized to `_startTokenId()`
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view returns (uint256) {
return _burnCounter;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes of the XOR of
// all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165
// e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`
return
interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) & BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(_packedAddressData[owner] >> BITPOS_AUX);
}
/**
* Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
assembly { // Cast aux without masking.
auxCasted := aux
}
packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);
_packedAddressData[owner] = packed;
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
// If not burned.
if (packed & BITMASK_BURNED == 0) {
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed is zero.
while (packed == 0) {
packed = _packedOwnerships[--curr];
}
return packed;
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP);
ownership.burned = packed & BITMASK_BURNED != 0;
}
/**
* Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around in the collection over time.
*/
function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @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) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
}
/**
* @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.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
/**
* @dev Casts the address to uint256 without masking.
*/
function _addressToUint256(address value) private pure returns (uint256 result) {
assembly {
result := value
}
}
/**
* @dev Casts the boolean to uint256 without branching.
*/
function _boolToUint256(bool value) private pure returns (uint256 result) {
assembly {
result := value
}
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = address(uint160(_packedOwnershipOf(tokenId)));
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
if (operator == _msgSenderERC721A()) revert ApproveToCaller();
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), 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 virtual override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
_transfer(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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
_startTokenId() <= tokenId &&
tokenId < _currentIndex && // If within bounds,
_packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned.
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, '');
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the balance and number minted.
_packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] =
_addressToUint256(to) |
(block.timestamp << BITPOS_START_TIMESTAMP) |
(_boolToUint256(quantity == 1) << BITPOS_NEXT_INITIALIZED);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (to.code.length != 0) {
do {
emit Transfer(address(0), to, updatedIndex);
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex < end);
// Reentrancy protection
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex < end);
}
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 quantity) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the balance and number minted.
_packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] =
_addressToUint256(to) |
(block.timestamp << BITPOS_START_TIMESTAMP) |
(_boolToUint256(quantity == 1) << BITPOS_NEXT_INITIALIZED);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex < end);
_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 {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
bool isApprovedOrOwner = (_msgSenderERC721A() == from ||
isApprovedForAll(from, _msgSenderERC721A()) ||
getApproved(tokenId) == _msgSenderERC721A());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
delete _tokenApprovals[tokenId];
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] =
_addressToUint256(to) |
(block.timestamp << BITPOS_START_TIMESTAMP) |
BITMASK_NEXT_INITIALIZED;
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `_burn(tokenId, false)`.
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
if (approvalCheck) {
bool isApprovedOrOwner = (_msgSenderERC721A() == from ||
isApprovedForAll(from, _msgSenderERC721A()) ||
getApproved(tokenId) == _msgSenderERC721A());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
delete _tokenApprovals[tokenId];
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] =
_addressToUint256(from) |
(block.timestamp << BITPOS_START_TIMESTAMP) |
BITMASK_BURNED |
BITMASK_NEXT_INITIALIZED;
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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 _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
* And also called before burning one token.
*
* 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`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
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.
* And also called after one token has been burned.
*
* 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` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Returns the message sender (defaults to `msg.sender`).
*
* If you are writing GSN compatible contracts, you need to override this function.
*/
function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function _toString(uint256 value) internal pure returns (string memory ptr) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit),
// but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged.
// We will need 1 32-byte word to store the length,
// and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128.
ptr := add(mload(0x40), 128)
// Update the free memory pointer to allocate.
mstore(0x40, ptr)
// Cache the end of the memory to calculate the length later.
let end := ptr
// We write the string from the rightmost digit to the leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// Costs a bit more than early returning for the zero case,
// but cheaper in terms of deployment and overall runtime costs.
for {
// Initialize and perform the first pass without check.
let temp := value
// Move the pointer 1 byte leftwards to point to an empty character slot.
ptr := sub(ptr, 1)
// Write the character to the pointer. 48 is the ASCII index of '0'.
mstore8(ptr, add(48, mod(temp, 10)))
temp := div(temp, 10)
} temp {
// Keep dividing `temp` until zero.
temp := div(temp, 10)
} { // Body of the for loop.
ptr := sub(ptr, 1)
mstore8(ptr, add(48, mod(temp, 10)))
}
let length := sub(end, ptr)
// Move the pointer 32 bytes leftwards to make room for the length.
ptr := sub(ptr, 32)
// Store the length.
mstore(ptr, length)
}
}
}
IERC721A.sol 260 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.0.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of an ERC721A compliant contract.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* The caller cannot approve to their own address.
*/
error ApproveToCaller();
/**
* The caller cannot approve to the current owner.
*/
error ApprovalToCurrentOwner();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
/**
* @dev Returns the total amount of tokens stored by the contract.
*
* Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
*/
function totalSupply() external view returns (uint256);
// ==============================
// 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
// ==============================
/**
* @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`.
*
* 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;
/**
* @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 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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
// ==============================
// IERC721Metadata
// ==============================
/**
* @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);
}
HedgeHeroesFireKey.sol 75 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
contract HedgeHeroesFireKey is Ownable, ERC721A, Pausable {
uint256 public maxSupply = 10000;
uint256 public price = 0.005 ether;
uint256 public freeUntilSupply = 8000;
uint256 public maxMintablePerWallet = 3;
mapping(address => uint256) public totalMintedPerWallet;
string private baseURI;
constructor() ERC721A("Fire Keys by Hedge Heroes", "FKHH") {
_mint(_msgSender(), 200);
_pause();
}
function mint(uint256 _amount) external payable whenNotPaused {
require(
totalSupply() + _amount <= maxSupply,
"Max amount of keys has been reached"
);
require(
totalMintedPerWallet[_msgSender()] + _amount <=
maxMintablePerWallet,
"You can't mint more keys"
);
if (totalSupply() >= freeUntilSupply)
require(msg.value >= price * _amount, "Not enough ETH");
_mint(_msgSender(), _amount);
totalMintedPerWallet[_msgSender()] =
totalMintedPerWallet[_msgSender()] +
_amount;
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function setBaseURI(string memory _uri) external onlyOwner {
baseURI = _uri;
}
function airdrop(address[] memory _addresses, uint256 _amount)
external
onlyOwner
{
for (uint256 i = 0; i < _addresses.length; i++) {
_mint(_addresses[i], _amount);
}
}
function burn(uint256[] memory _ids) external onlyOwner {
for (uint256 i = 0; i < _ids.length; i++) {
_burn(_ids[i]);
}
}
function setPaused(bool _paused) external onlyOwner {
_paused ? _pause() : _unpause();
}
function withdraw(uint256 amount) external onlyOwner {
payable(msg.sender).transfer(amount);
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Counters.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
Pausable.sol 91 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
Read Contract
balanceOf 0x70a08231 → uint256
freeUntilSupply 0xc7abf7e0 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxMintablePerWallet 0xb3ee8ba5 → uint256
maxSupply 0xd5abeb01 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
price 0xa035b1fe → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalMintedPerWallet 0x6bb7676e → uint256
totalSupply 0x18160ddd → uint256
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
airdrop 0xc204642c
address[] _addresses
uint256 _amount
approve 0x095ea7b3
address to
uint256 tokenId
burn 0xb80f55c9
uint256[] _ids
mint 0xa0712d68
uint256 _amount
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _uri
setPaused 0x16c38b3c
bool _paused
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x2e1a7d4d
uint256 amount
Token Balances (1)
View Transfers →Recent Transactions
No transactions found for this address