Address Contract Verified
Address
0x01A75Fb1A4b1A8f699fd00ad051f9100EbEcec42
Balance
0 ETH
Nonce
1
Code Size
19206 bytes
Creator
0x10dCA407...E8d6 at tx 0x6a6378bd...e3351b
Indexed Transactions
0
Contract Bytecode
19206 bytes
0x6080604052600436106102675760003560e01c806370a0823111610144578063a5962524116100b6578063d4c720d31161007a578063d4c720d31461090b578063d5abeb0114610934578063d684534e1461095f578063e01d55c51461098a578063e985e9c5146109b3578063f2fde38b146109f057610267565b8063a596252414610800578063b74003d41461082b578063b88d4fde14610868578063c87b56dd14610891578063c8838b14146108ce57610267565b806391f3649c1161010857806391f3649c14610711578063931688cb1461073c57806395d89b4114610765578063996517cf14610790578063a0712d68146107bb578063a22cb465146107d757610267565b806370a082311461062a578063715018a6146106675780637e4831d31461067e5780638b88a687146106a95780638da5cb5b146106e657610267565b80633b37d1d6116101dd5780635371212a116101a15780635371212a1461051c5780635683ffd6146105455780636352211e1461058257806367243482146105bf5780636aea3854146105e85780636c0360eb146105ff57610267565b80633b37d1d6146104855780633ccfd60b1461049c57806342842e0e146104b35780634c890060146104dc5780634f0e3d1d146104f357610267565b806313faede61161022f57806313faede61461036357806318160ddd1461038e57806322d34454146103b957806323b872dd146103f657806323c5a0881461041f57806332531c3c1461044857610267565b806301ffc9a71461026c57806306fdde03146102a9578063081812fc146102d4578063095ea7b31461031157806311fa9ac01461033a575b600080fd5b34801561027857600080fd5b50610293600480360381019061028e9190613336565b610a19565b6040516102a0919061337e565b60405180910390f35b3480156102b557600080fd5b506102be610aab565b6040516102cb9190613432565b60405180910390f35b3480156102e057600080fd5b506102fb60048036038101906102f6919061348a565b610b3d565b60405161030891906134f8565b60405180910390f35b34801561031d57600080fd5b506103386004803603810190610333919061353f565b610bb9565b005b34801561034657600080fd5b50610361600480360381019061035c91906136c7565b610cfa565b005b34801561036f57600080fd5b50610378610e9e565b604051610385919061374e565b60405180910390f35b34801561039a57600080fd5b506103a3610ea4565b6040516103b0919061374e565b60405180910390f35b3480156103c557600080fd5b506103e060048036038101906103db919061353f565b610ebb565b6040516103ed919061374e565b60405180910390f35b34801561040257600080fd5b5061041d60048036038101906104189190613769565b610ed9565b005b34801561042b57600080fd5b506104466004803603810190610441919061348a565b6111fb565b005b34801561045457600080fd5b5061046f600480360381019061046a91906137bc565b611281565b60405161047c919061337e565b60405180910390f35b34801561049157600080fd5b5061049a6112a1565b005b3480156104a857600080fd5b506104b1611357565b005b3480156104bf57600080fd5b506104da60048036038101906104d59190613769565b6114a8565b005b3480156104e857600080fd5b506104f16114c8565b005b3480156104ff57600080fd5b5061051a600480360381019061051591906138ac565b61151f565b005b34801561052857600080fd5b50610543600480360381019061053e919061392e565b61172f565b005b34801561055157600080fd5b5061056c6004803603810190610567919061353f565b6117e5565b604051610579919061374e565b60405180910390f35b34801561058e57600080fd5b506105a960048036038101906105a4919061348a565b611816565b6040516105b691906134f8565b60405180910390f35b3480156105cb57600080fd5b506105e660048036038101906105e1919061396e565b611828565b005b3480156105f457600080fd5b506105fd611906565b005b34801561060b57600080fd5b50610614611ade565b6040516106219190613432565b60405180910390f35b34801561063657600080fd5b50610651600480360381019061064c91906137bc565b611b6c565b60405161065e919061374e565b60405180910390f35b34801561067357600080fd5b5061067c611c24565b005b34801561068a57600080fd5b50610693611cac565b6040516106a091906139f5565b60405180910390f35b3480156106b557600080fd5b506106d060048036038101906106cb91906137bc565b611cbf565b6040516106dd919061374e565b60405180910390f35b3480156106f257600080fd5b506106fb611d27565b60405161070891906134f8565b60405180910390f35b34801561071d57600080fd5b50610726611d51565b6040516107339190613a6f565b60405180910390f35b34801561074857600080fd5b50610763600480360381019061075e9190613b3f565b611d75565b005b34801561077157600080fd5b5061077a611e04565b6040516107879190613432565b60405180910390f35b34801561079c57600080fd5b506107a5611e96565b6040516107b2919061374e565b60405180910390f35b6107d560048036038101906107d0919061348a565b611e9c565b005b3480156107e357600080fd5b506107fe60048036038101906107f99190613bb4565b6120f5565b005b34801561080c57600080fd5b5061081561226c565b60405161082291906134f8565b60405180910390f35b34801561083757600080fd5b50610852600480360381019061084d91906137bc565b612290565b60405161085f9190613cb2565b60405180910390f35b34801561087457600080fd5b5061088f600480360381019061088a9190613d75565b612327565b005b34801561089d57600080fd5b506108b860048036038101906108b3919061348a565b61239a565b6040516108c59190613432565b60405180910390f35b3480156108da57600080fd5b506108f560048036038101906108f091906137bc565b612438565b6040516109029190613cb2565b60405180910390f35b34801561091757600080fd5b50610932600480360381019061092d919061348a565b6126cc565b005b34801561094057600080fd5b5061094961278a565b604051610956919061374e565b60405180910390f35b34801561096b57600080fd5b506109746127ae565b60405161098191906139f5565b60405180910390f35b34801561099657600080fd5b506109b160048036038101906109ac919061348a565b6127c1565b005b3480156109bf57600080fd5b506109da60048036038101906109d59190613df8565b612847565b6040516109e7919061337e565b60405180910390f35b3480156109fc57600080fd5b50610a176004803603810190610a1291906137bc565b6128db565b005b60006301ffc9a760e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610a7457506380ac58cd60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610aa45750635b5e139f60e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b9050919050565b606060028054610aba90613e67565b80601f0160208091040260200160405190810160405280929190818152602001828054610ae690613e67565b8015610b335780601f10610b0857610100808354040283529160200191610b33565b820191906000526020600020905b815481529060010190602001808311610b1657829003601f168201915b5050505050905090565b6000610b48826129d2565b610b7e576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610bc482611816565b90508073ffffffffffffffffffffffffffffffffffffffff16610be5612a31565b73ffffffffffffffffffffffffffffffffffffffff1614610c4857610c1181610c0c612a31565b612847565b610c47576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b826006600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b610d02612a39565b73ffffffffffffffffffffffffffffffffffffffff16610d20611d27565b73ffffffffffffffffffffffffffffffffffffffff1614610d76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6d90613ee4565b60405180910390fd5b60005b8251811015610e07576001600e6000858481518110610d9b57610d9a613f04565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610dff90613f62565b915050610d79565b5060005b8151811015610e99576000600e6000848481518110610e2d57610e2c613f04565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610e9190613f62565b915050610e0b565b505050565b600d5481565b6000610eae612a41565b6001546000540303905090565b6000610ec683611cbf565b82610ed19190613faa565b905092915050565b6000610ee482612a46565b90508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610f4b576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080610f5784612b12565b91509150610f6d8187610f68612a31565b612b34565b610fb957610f8286610f7d612a31565b612847565b610fb8576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff160361101f576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61102c8686866001612b78565b801561103757600082555b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081546001900391905081905550600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815460010191905081905550611105856110e1888887612b7e565b7c020000000000000000000000000000000000000000000000000000000017612ba6565b600460008681526020019081526020016000208190555060007c020000000000000000000000000000000000000000000000000000000084160361118b5760006001850190506000600460008381526020019081526020016000205403611189576000548114611188578360046000838152602001908152602001600020819055505b5b505b838573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46111f38686866001612bd1565b505050505050565b611203612a39565b73ffffffffffffffffffffffffffffffffffffffff16611221611d27565b73ffffffffffffffffffffffffffffffffffffffff1614611277576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126e90613ee4565b60405180910390fd5b80600d8190555050565b600e6020528060005260406000206000915054906101000a900460ff1681565b6112a9612a39565b73ffffffffffffffffffffffffffffffffffffffff166112c7611d27565b73ffffffffffffffffffffffffffffffffffffffff161461131d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131490613ee4565b60405180910390fd5b6001600a60006101000a81548160ff021916908360ff1602179055506000600a60016101000a81548160ff021916908360ff160217905550565b61135f612a39565b73ffffffffffffffffffffffffffffffffffffffff1661137d611d27565b73ffffffffffffffffffffffffffffffffffffffff16146113d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ca90613ee4565b60405180910390fd5b600260095403611418576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140f90614050565b60405180910390fd5b6002600981905550600061142a611d27565b73ffffffffffffffffffffffffffffffffffffffff164760405161144d906140a1565b60006040518083038185875af1925050503d806000811461148a576040519150601f19603f3d011682016040523d82523d6000602084013e61148f565b606091505b505090508061149d57600080fd5b506001600981905550565b6114c383838360405180602001604052806000815250612327565b505050565b6001600a60009054906101000a900460ff1660ff160361151d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151490614102565b60405180910390fd5b565b6000611529612a39565b90506001600a60019054906101000a900460ff1660ff1603611580576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157790614102565b60405180910390fd5b60008251118015611592575060058251105b6115d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c89061416e565b60405180910390fd5b60005b82518110156116b3577f0000000000000000000000009984bd85adfef02cea2c28819af81a6d17a3cb9673ffffffffffffffffffffffffffffffffffffffff166323b872dd837f000000000000000000000000000000000000000000000000000000000000dead86858151811061164e5761164d613f04565b5b60200260200101516040518463ffffffff1660e01b81526004016116749392919061418e565b600060405180830381600087803b15801561168e57600080fd5b505af11580156116a2573d6000803e3d6000fd5b5050505080806001019150506115d4565b50600060644244846040516020016116cd9392919061422e565b6040516020818303038152906040528051906020012060001c6116f0919061429a565b905060006004845114611712576019845161170b9190613faa565b8210611715565b60015b9050801561172957611728836001612bd7565b5b50505050565b611737612a39565b73ffffffffffffffffffffffffffffffffffffffff16611755611d27565b73ffffffffffffffffffffffffffffffffffffffff16146117ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117a290613ee4565b60405180910390fd5b81600a60006101000a81548160ff021916908360ff16021790555080600a60016101000a81548160ff021916908360ff1602179055505050565b600f602052816000526040600020818154811061180157600080fd5b90600052602060002001600091509150505481565b600061182182612a46565b9050919050565b611830612a39565b73ffffffffffffffffffffffffffffffffffffffff1661184e611d27565b73ffffffffffffffffffffffffffffffffffffffff16146118a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189b90613ee4565b60405180910390fd5b60005b8251811015611901576118ee8382815181106118c6576118c5613f04565b5b60200260200101518383815181106118e1576118e0613f04565b5b6020026020010151612bd7565b80806118f990613f62565b9150506118a7565b505050565b61190e612a39565b73ffffffffffffffffffffffffffffffffffffffff1661192c611d27565b73ffffffffffffffffffffffffffffffffffffffff1614611982576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197990613ee4565b60405180910390fd5b60005b610181811015611adb5760007f0000000000000000000000009984bd85adfef02cea2c28819af81a6d17a3cb9673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004016119ea919061374e565b602060405180830381865afa158015611a07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a2b91906142e0565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015611ab657507f000000000000000000000000000000000000000000000000000000000000dead73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b15611ac757611ac6816001612bd7565b5b508080611ad390613f62565b915050611985565b50565b600b8054611aeb90613e67565b80601f0160208091040260200160405190810160405280929190818152602001828054611b1790613e67565b8015611b645780601f10611b3957610100808354040283529160200191611b64565b820191906000526020600020905b815481529060010190602001808311611b4757829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611bd3576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054169050919050565b611c2c612a39565b73ffffffffffffffffffffffffffffffffffffffff16611c4a611d27565b73ffffffffffffffffffffffffffffffffffffffff1614611ca0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9790613ee4565b60405180910390fd5b611caa6000612d22565b565b600a60009054906101000a900460ff1681565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611d1c5760009050611d22565b600d5490505b919050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f0000000000000000000000009984bd85adfef02cea2c28819af81a6d17a3cb9681565b611d7d612a39565b73ffffffffffffffffffffffffffffffffffffffff16611d9b611d27565b73ffffffffffffffffffffffffffffffffffffffff1614611df1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de890613ee4565b60405180910390fd5b80600b9081611e0091906144af565b5050565b606060038054611e1390613e67565b80601f0160208091040260200160405190810160405280929190818152602001828054611e3f90613e67565b8015611e8c5780601f10611e6157610100808354040283529160200191611e8c565b820191906000526020600020905b815481529060010190602001808311611e6f57829003601f168201915b5050505050905090565b600c5481565b6000611ea6612a39565b90506000611eb48284610ebb565b9050611ebe6114c8565b60008311611f01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef8906145cd565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614611f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6690614639565b60405180910390fd5b80341015611fb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fa9906146a5565b60405180910390fd5b600c5483600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905061200391906146c5565b1115612044576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203b90614767565b60405180910390fd5b61204e8284612bd7565b60005b838110156120ef57600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081856120a2610ea4565b6120ac9190614787565b6120b691906146c5565b908060018154018082558091505060019003906000526020600020016000909190919091505580806120e790613f62565b915050612051565b50505050565b6120fd612a31565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612161576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806007600061216e612a31565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff1661221b612a31565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612260919061337e565b60405180910390a35050565b7f000000000000000000000000000000000000000000000000000000000000dead81565b6060600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561231b57602002820191906000526020600020905b815481526020019060010190808311612307575b50505050509050919050565b612332848484610ed9565b60008373ffffffffffffffffffffffffffffffffffffffff163b146123945761235d84848484612de8565b612393576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b50505050565b60606123a5826129d2565b6123db576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006123e5612f38565b905060008151036124055760405180602001604052806000815250612430565b8061240f84612fca565b6040516020016124209291906147f7565b6040516020818303038152906040525b915050919050565b606060007f0000000000000000000000009984bd85adfef02cea2c28819af81a6d17a3cb9673ffffffffffffffffffffffffffffffffffffffff166370a08231846040518263ffffffff1660e01b815260040161249591906134f8565b602060405180830381865afa1580156124b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d69190614830565b67ffffffffffffffff8111156124ef576124ee613584565b5b60405190808252806020026020018201604052801561251d5781602001602082028036833780820191505090505b50915060005b7f0000000000000000000000009984bd85adfef02cea2c28819af81a6d17a3cb9673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561258e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b29190614830565b8110156126c5578373ffffffffffffffffffffffffffffffffffffffff167f0000000000000000000000009984bd85adfef02cea2c28819af81a6d17a3cb9673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b8152600401612629919061374e565b602060405180830381865afa158015612646573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061266a91906142e0565b73ffffffffffffffffffffffffffffffffffffffff16036126b2578083838061269290613f62565b9450815181106126a5576126a4613f04565b5b6020026020010181815250505b80806126bd90613f62565b915050612523565b5050919050565b6126d4612a39565b73ffffffffffffffffffffffffffffffffffffffff166126f2611d27565b73ffffffffffffffffffffffffffffffffffffffff1614612748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273f90613ee4565b60405180910390fd5b6000600a60006101000a81548160ff021916908360ff1602179055506001600a60016101000a81548160ff021916908360ff16021790555080600d8190555050565b7f000000000000000000000000000000000000000000000000000000000000115c81565b600a60019054906101000a900460ff1681565b6127c9612a39565b73ffffffffffffffffffffffffffffffffffffffff166127e7611d27565b73ffffffffffffffffffffffffffffffffffffffff161461283d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283490613ee4565b60405180910390fd5b80600c8190555050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6128e3612a39565b73ffffffffffffffffffffffffffffffffffffffff16612901611d27565b73ffffffffffffffffffffffffffffffffffffffff1614612957576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294e90613ee4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036129c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129bd906148cf565b60405180910390fd5b6129cf81612d22565b50565b6000816129dd612a41565b111580156129ec575060005482105b8015612a2a575060007c0100000000000000000000000000000000000000000000000000000000600460008581526020019081526020016000205416145b9050919050565b600033905090565b600033905090565b600090565b60008082905080612a55612a41565b11612adb57600054811015612ada5760006004600083815260200190815260200160002054905060007c0100000000000000000000000000000000000000000000000000000000821603612ad8575b60008103612ace576004600083600190039350838152602001908152602001600020549050612aa4565b8092505050612b0d565b505b5b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b6000806000600690508360005280602052604060002092508254915050915091565b600073ffffffffffffffffffffffffffffffffffffffff8316925073ffffffffffffffffffffffffffffffffffffffff821691508382148383141790509392505050565b50505050565b60008060e883901c905060e8612b95868684613024565b62ffffff16901b9150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff83169250814260a01b178317905092915050565b50505050565b7f000000000000000000000000000000000000000000000000000000000000115c81612c01610ea4565b612c0b91906146c5565b1115612c4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c439061493b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015612cd557507f000000000000000000000000000000000000000000000000000000000000dead73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b612d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d0b906149cd565b60405180910390fd5b612d1e828261302d565b5050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612e0e612a31565b8786866040518563ffffffff1660e01b8152600401612e309493929190614a42565b6020604051808303816000875af1925050508015612e6c57506040513d601f19601f82011682018060405250810190612e699190614aa3565b60015b612ee5573d8060008114612e9c576040519150601f19603f3d011682016040523d82523d6000602084013e612ea1565b606091505b506000815103612edd576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b6060600b8054612f4790613e67565b80601f0160208091040260200160405190810160405280929190818152602001828054612f7390613e67565b8015612fc05780601f10612f9557610100808354040283529160200191612fc0565b820191906000526020600020905b815481529060010190602001808311612fa357829003601f168201915b5050505050905090565b60606080604051019050806040528082600183039250600a81066030018353600a810490505b801561301057600183039250600a81066030018353600a81049050612ff0565b508181036020830392508083525050919050565b60009392505050565b61304782826040518060200160405280600081525061304b565b5050565b61305583836130e8565b60008373ffffffffffffffffffffffffffffffffffffffff163b146130e357600080549050600083820390505b6130956000868380600101945086612de8565b6130cb576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8181106130825781600054146130e057600080fd5b50505b505050565b600080549050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603613154576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000820361318e576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61319b6000848385612b78565b600160406001901b178202600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550613212836132036000866000612b7e565b61320c856132ba565b17612ba6565b60046000838152602001908152602001600020819055506000819050600083830190505b818060010192508573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4808210613236578060008190555050506132b56000848385612bd1565b505050565b60006001821460e11b9050919050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613313816132de565b811461331e57600080fd5b50565b6000813590506133308161330a565b92915050565b60006020828403121561334c5761334b6132d4565b5b600061335a84828501613321565b91505092915050565b60008115159050919050565b61337881613363565b82525050565b6000602082019050613393600083018461336f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156133d35780820151818401526020810190506133b8565b838111156133e2576000848401525b50505050565b6000601f19601f8301169050919050565b600061340482613399565b61340e81856133a4565b935061341e8185602086016133b5565b613427816133e8565b840191505092915050565b6000602082019050818103600083015261344c81846133f9565b905092915050565b6000819050919050565b61346781613454565b811461347257600080fd5b50565b6000813590506134848161345e565b92915050565b6000602082840312156134a05761349f6132d4565b5b60006134ae84828501613475565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006134e2826134b7565b9050919050565b6134f2816134d7565b82525050565b600060208201905061350d60008301846134e9565b92915050565b61351c816134d7565b811461352757600080fd5b50565b60008135905061353981613513565b92915050565b60008060408385031215613556576135556132d4565b5b60006135648582860161352a565b925050602061357585828601613475565b9150509250929050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6135bc826133e8565b810181811067ffffffffffffffff821117156135db576135da613584565b5b80604052505050565b60006135ee6132ca565b90506135fa82826135b3565b919050565b600067ffffffffffffffff82111561361a57613619613584565b5b602082029050602081019050919050565b600080fd5b600061364361363e846135ff565b6135e4565b905080838252602082019050602084028301858111156136665761366561362b565b5b835b8181101561368f578061367b888261352a565b845260208401935050602081019050613668565b5050509392505050565b600082601f8301126136ae576136ad61357f565b5b81356136be848260208601613630565b91505092915050565b600080604083850312156136de576136dd6132d4565b5b600083013567ffffffffffffffff8111156136fc576136fb6132d9565b5b61370885828601613699565b925050602083013567ffffffffffffffff811115613729576137286132d9565b5b61373585828601613699565b9150509250929050565b61374881613454565b82525050565b6000602082019050613763600083018461373f565b92915050565b600080600060608486031215613782576137816132d4565b5b60006137908682870161352a565b93505060206137a18682870161352a565b92505060406137b286828701613475565b9150509250925092565b6000602082840312156137d2576137d16132d4565b5b60006137e08482850161352a565b91505092915050565b600067ffffffffffffffff82111561380457613803613584565b5b602082029050602081019050919050565b6000613828613823846137e9565b6135e4565b9050808382526020820190506020840283018581111561384b5761384a61362b565b5b835b8181101561387457806138608882613475565b84526020840193505060208101905061384d565b5050509392505050565b600082601f8301126138935761389261357f565b5b81356138a3848260208601613815565b91505092915050565b6000602082840312156138c2576138c16132d4565b5b600082013567ffffffffffffffff8111156138e0576138df6132d9565b5b6138ec8482850161387e565b91505092915050565b600060ff82169050919050565b61390b816138f5565b811461391657600080fd5b50565b60008135905061392881613902565b92915050565b60008060408385031215613945576139446132d4565b5b600061395385828601613919565b925050602061396485828601613919565b9150509250929050565b60008060408385031215613985576139846132d4565b5b600083013567ffffffffffffffff8111156139a3576139a26132d9565b5b6139af85828601613699565b925050602083013567ffffffffffffffff8111156139d0576139cf6132d9565b5b6139dc8582860161387e565b9150509250929050565b6139ef816138f5565b82525050565b6000602082019050613a0a60008301846139e6565b92915050565b6000819050919050565b6000613a35613a30613a2b846134b7565b613a10565b6134b7565b9050919050565b6000613a4782613a1a565b9050919050565b6000613a5982613a3c565b9050919050565b613a6981613a4e565b82525050565b6000602082019050613a846000830184613a60565b92915050565b600080fd5b600067ffffffffffffffff821115613aaa57613aa9613584565b5b613ab3826133e8565b9050602081019050919050565b82818337600083830152505050565b6000613ae2613add84613a8f565b6135e4565b905082815260208101848484011115613afe57613afd613a8a565b5b613b09848285613ac0565b509392505050565b600082601f830112613b2657613b2561357f565b5b8135613b36848260208601613acf565b91505092915050565b600060208284031215613b5557613b546132d4565b5b600082013567ffffffffffffffff811115613b7357613b726132d9565b5b613b7f84828501613b11565b91505092915050565b613b9181613363565b8114613b9c57600080fd5b50565b600081359050613bae81613b88565b92915050565b60008060408385031215613bcb57613bca6132d4565b5b6000613bd98582860161352a565b9250506020613bea85828601613b9f565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c2981613454565b82525050565b6000613c3b8383613c20565b60208301905092915050565b6000602082019050919050565b6000613c5f82613bf4565b613c698185613bff565b9350613c7483613c10565b8060005b83811015613ca5578151613c8c8882613c2f565b9750613c9783613c47565b925050600181019050613c78565b5085935050505092915050565b60006020820190508181036000830152613ccc8184613c54565b905092915050565b600067ffffffffffffffff821115613cef57613cee613584565b5b613cf8826133e8565b9050602081019050919050565b6000613d18613d1384613cd4565b6135e4565b905082815260208101848484011115613d3457613d33613a8a565b5b613d3f848285613ac0565b509392505050565b600082601f830112613d5c57613d5b61357f565b5b8135613d6c848260208601613d05565b91505092915050565b60008060008060808587031215613d8f57613d8e6132d4565b5b6000613d9d8782880161352a565b9450506020613dae8782880161352a565b9350506040613dbf87828801613475565b925050606085013567ffffffffffffffff811115613de057613ddf6132d9565b5b613dec87828801613d47565b91505092959194509250565b60008060408385031215613e0f57613e0e6132d4565b5b6000613e1d8582860161352a565b9250506020613e2e8582860161352a565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613e7f57607f821691505b602082108103613e9257613e91613e38565b5b50919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613ece6020836133a4565b9150613ed982613e98565b602082019050919050565b60006020820190508181036000830152613efd81613ec1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613f6d82613454565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613f9f57613f9e613f33565b5b600182019050919050565b6000613fb582613454565b9150613fc083613454565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ff957613ff8613f33565b5b828202905092915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b600061403a601f836133a4565b915061404582614004565b602082019050919050565b600060208201905081810360008301526140698161402d565b9050919050565b600081905092915050565b50565b600061408b600083614070565b91506140968261407b565b600082019050919050565b60006140ac8261407e565b9150819050919050565b7f43757272656e7420616374696f6e206973207061757365640000000000000000600082015250565b60006140ec6018836133a4565b91506140f7826140b6565b602082019050919050565b6000602082019050818103600083015261411b816140df565b9050919050565b7f496e76616c696420746f6b656e49647300000000000000000000000000000000600082015250565b60006141586010836133a4565b915061416382614122565b602082019050919050565b600060208201905081810360008301526141878161414b565b9050919050565b60006060820190506141a360008301866134e9565b6141b060208301856134e9565b6141bd604083018461373f565b949350505050565b6000819050919050565b6141e06141db82613454565b6141c5565b82525050565b60008160601b9050919050565b60006141fe826141e6565b9050919050565b6000614210826141f3565b9050919050565b614228614223826134d7565b614205565b82525050565b600061423a82866141cf565b60208201915061424a82856141cf565b60208201915061425a8284614217565b601482019150819050949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006142a582613454565b91506142b083613454565b9250826142c0576142bf61426b565b5b828206905092915050565b6000815190506142da81613513565b92915050565b6000602082840312156142f6576142f56132d4565b5b6000614304848285016142cb565b91505092915050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261436f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614332565b6143798683614332565b95508019841693508086168417925050509392505050565b60006143ac6143a76143a284613454565b613a10565b613454565b9050919050565b6000819050919050565b6143c683614391565b6143da6143d2826143b3565b84845461433f565b825550505050565b600090565b6143ef6143e2565b6143fa8184846143bd565b505050565b5b8181101561441e576144136000826143e7565b600181019050614400565b5050565b601f821115614463576144348161430d565b61443d84614322565b8101602085101561444c578190505b61446061445885614322565b8301826143ff565b50505b505050565b600082821c905092915050565b600061448660001984600802614468565b1980831691505092915050565b600061449f8383614475565b9150826002028217905092915050565b6144b882613399565b67ffffffffffffffff8111156144d1576144d0613584565b5b6144db8254613e67565b6144e6828285614422565b600060209050601f8311600181146145195760008415614507578287015190505b6145118582614493565b865550614579565b601f1984166145278661430d565b60005b8281101561454f5784890151825560018201915060208501945060208101905061452a565b8683101561456c5784890151614568601f891682614475565b8355505b6001600288020188555050505b505050505050565b7f496e76616c6964207175616e7469747900000000000000000000000000000000600082015250565b60006145b76010836133a4565b91506145c282614581565b602082019050919050565b600060208201905081810360008301526145e6816145aa565b9050919050565b7f4f6e6c7920454f41000000000000000000000000000000000000000000000000600082015250565b60006146236008836133a4565b915061462e826145ed565b602082019050919050565b6000602082019050818103600083015261465281614616565b9050919050565b7f496e73756666696369656e742066756e64730000000000000000000000000000600082015250565b600061468f6012836133a4565b915061469a82614659565b602082019050919050565b600060208201905081810360008301526146be81614682565b9050919050565b60006146d082613454565b91506146db83613454565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156147105761470f613f33565b5b828201905092915050565b7f4d6178206d696e7473207065722077616c6c6574206d65740000000000000000600082015250565b60006147516018836133a4565b915061475c8261471b565b602082019050919050565b6000602082019050818103600083015261478081614744565b9050919050565b600061479282613454565b915061479d83613454565b9250828210156147b0576147af613f33565b5b828203905092915050565b600081905092915050565b60006147d182613399565b6147db81856147bb565b93506147eb8185602086016133b5565b80840191505092915050565b600061480382856147c6565b915061480f82846147c6565b91508190509392505050565b60008151905061482a8161345e565b92915050565b600060208284031215614846576148456132d4565b5b60006148548482850161481b565b91505092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006148b96026836133a4565b91506148c48261485d565b604082019050919050565b600060208201905081810360008301526148e8816148ac565b9050919050565b7f4d617820737570706c7920657863656564656400000000000000000000000000600082015250565b60006149256013836133a4565b9150614930826148ef565b602082019050919050565b6000602082019050818103600083015261495481614918565b9050919050565b7f43616e6e6f7420686176652061206e6f6e2d616464726573732061732072657360008201527f657276652e000000000000000000000000000000000000000000000000000000602082015250565b60006149b76025836133a4565b91506149c28261495b565b604082019050919050565b600060208201905081810360008301526149e6816149aa565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000614a14826149ed565b614a1e81856149f8565b9350614a2e8185602086016133b5565b614a37816133e8565b840191505092915050565b6000608082019050614a5760008301876134e9565b614a6460208301866134e9565b614a71604083018561373f565b8181036060830152614a838184614a09565b905095945050505050565b600081519050614a9d8161330a565b92915050565b600060208284031215614ab957614ab86132d4565b5b6000614ac784828501614a8e565b9150509291505056fea2646970667358221220093043a51e4ab11d28dc7a9375890f75864d94222ae6ddfd4cef647d3ef277f364736f6c634300080f0033
Verified Source Code Full Match
Compiler: v0.8.15+commit.e14f2714
EVM: london
Optimization: No
mint.sol 160 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;
import 'erc721a/contracts/ERC721A.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
contract HumanFly is ERC721A, Ownable, ReentrancyGuard {
uint public immutable maxSupply = 4444;
IERC721A public immutable dirtyFlies;
address public immutable deadAddr = 0x000000000000000000000000000000000000dEaD;
uint8 public mintPaused = 1;
uint8 public burnPaused = 1;
string public baseURI = 'https://static-resource.dirtyflies.xyz/human_fly/metadata/';
uint public mintLimit = 2;
uint public cost = 0;
mapping(address => bool) public whitelistMap;
mapping(address => uint[]) public mintTokenIdsMap;
constructor() ERC721A('Human Fly', 'HM') {
dirtyFlies = IERC721A(0x9984bD85adFEF02Cea2C28819aF81A6D17a3Cb96);
}
function enableMint(uint cost_) public onlyOwner {
mintPaused = 0;
burnPaused = 1;
cost = cost_;
}
function enableBurn() public onlyOwner {
mintPaused = 1;
burnPaused = 0;
}
function updatePaused(uint8 mintPaused_, uint8 burnPaused_) public onlyOwner {
mintPaused = mintPaused_;
burnPaused = burnPaused_;
}
function updateBaseURI(string memory baseURI_) public onlyOwner {
baseURI = baseURI_;
}
function updateMintLimit(uint mintLimit_) public onlyOwner {
mintLimit = mintLimit_;
}
function updateCost(uint cost_) public onlyOwner {
cost = cost_;
}
function updateWhitelistMap(address[] memory addAddrs, address[] memory delAddrs) public onlyOwner {
for (uint i = 0; i < addAddrs.length; i++) {
whitelistMap[addAddrs[i]] = true;
}
for (uint i = 0; i < delAddrs.length; i++) {
whitelistMap[delAddrs[i]] = false;
}
}
function getCost(address msgSender) public view returns (uint) {
if (whitelistMap[msgSender]) {
return 0;
}
return cost;
}
function calculateCost(address msgSender, uint quantity) public view returns (uint) {
return quantity * getCost(msgSender);
}
function checkPaused() public view {
require(mintPaused != 1, 'Current action is paused');
}
function getMintTokenIds(address msgSender) public view returns (uint[] memory _tokenIds) {
_tokenIds = mintTokenIdsMap[msgSender];
}
function getHoldingTokenIds(address msgSender) public view returns (uint[] memory _tokenIds) {
uint j = 0;
_tokenIds = new uint[](dirtyFlies.balanceOf(msgSender));
for (uint i = 0; i < dirtyFlies.totalSupply(); i++) {
if (dirtyFlies.ownerOf(i) == msgSender) {
_tokenIds[j++] = i;
}
}
}
function burnDirtyFlies(uint[] memory tokenIds) external {
address msgSender = _msgSender();
require(burnPaused != 1, 'Current action is paused');
require(tokenIds.length > 0 && tokenIds.length < 5, 'Invalid tokenIds');
for (uint i = 0; i < tokenIds.length;) {
dirtyFlies.transferFrom(msgSender, deadAddr, tokenIds[i]);
unchecked {
i++;
}
}
uint random = uint(keccak256(abi.encodePacked(block.timestamp, block.difficulty, msgSender))) % 100;
bool success = tokenIds.length == 4 ? true : random < (tokenIds.length * 25);
if (success) {
_doMint(msgSender, 1);
}
}
function mint(uint quantity) external payable {
address msgSender = _msgSender();
uint expectedCost = calculateCost(msgSender, quantity);
checkPaused();
require(quantity > 0, 'Invalid quantity');
require(tx.origin == msgSender, 'Only EOA');
require(msg.value >= expectedCost, 'Insufficient funds');
require(mintTokenIdsMap[msgSender].length + quantity <= mintLimit, 'Max mints per wallet met');
_doMint(msgSender, quantity);
for (uint i = 0; i < quantity; i++) {
mintTokenIdsMap[msgSender].push(totalSupply() - quantity + i);
}
}
function airdrop(address[] memory mintAddresses, uint[] memory mintCounts) public onlyOwner {
for (uint i = 0; i < mintAddresses.length; i++) {
_doMint(mintAddresses[i], mintCounts[i]);
}
}
function airdropForDirtyFliesSpecialHolders() public onlyOwner {
for (uint i = 0; i < 385; i++) {
address owner = dirtyFlies.ownerOf(i);
if (owner != address(0) && owner != deadAddr) {
_doMint(owner, 1);
}
}
}
function _doMint(address to, uint quantity) private {
require(totalSupply() + quantity <= maxSupply, 'Max supply exceeded');
require(to != address(0) && to != deadAddr, 'Cannot have a non-address as reserve.');
_safeMint(to, quantity);
}
function withdraw() public onlyOwner nonReentrant {
(bool os,) = payable(owner()).call{value : address(this).balance}('');
require(os);
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
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 making 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;
}
}
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);
}
}
ERC721A.sol 950 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.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 bit position of `extraData` in packed ownership.
uint256 private constant BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with `_mintERC2309`.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to `_mintERC2309`
// is required to cause an overflow, which is unrealistic.
uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// 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`
// - [232..255] `extraData`
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 auxiliary 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 auxiliary 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;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
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;
ownership.extraData = uint24(packed >> BITPOS_EXTRA_DATA);
}
/**
* 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 Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, BITMASK_ADDRESS)
// `owner | (block.timestamp << BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @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, it can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << BITPOS_NEXT_INITIALIZED`.
result := shl(BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ownerOf(tokenId);
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-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 {
transferFrom(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.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = _currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) revert();
}
}
}
/**
* @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 for each mint.
*/
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` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_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] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
uint256 tokenId = startTokenId;
uint256 end = startTokenId + quantity;
do {
emit Transfer(address(0), to, tokenId++);
} while (tokenId < end);
_currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_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] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
_currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
mapping(uint256 => address) storage tokenApprovalsPtr = _tokenApprovals;
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`.
assembly {
// Compute the slot.
mstore(0x00, tokenId)
mstore(0x20, tokenApprovalsPtr.slot)
approvedAddressSlot := keccak256(0x00, 0x40)
// Load the slot's value from storage.
approvedAddress := sload(approvedAddressSlot)
}
}
/**
* @dev Returns whether the `approvedAddress` is equals to `from` or `msgSender`.
*/
function _isOwnerOrApproved(
address approvedAddress,
address from,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
from := and(from, BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, BITMASK_ADDRESS)
// `msgSender == from || msgSender == approvedAddress`.
result := or(eq(msgSender, from), eq(msgSender, approvedAddress))
}
}
/**
* @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 transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// 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] = _packOwnershipData(
to,
BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
);
// 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));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// 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] = _packOwnershipData(
from,
(BITMASK_BURNED | BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// 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 Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal {
uint256 packed = _packedOwnerships[index];
if (packed == 0) revert OwnershipNotInitializedForExtraData();
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << BITPOS_EXTRA_DATA);
_packedOwnerships[index] = packed;
}
/**
* @dev Returns the next extra data for the packed ownership data.
* The returned result is shifted into position.
*/
function _nextExtraData(
address from,
address to,
uint256 prevOwnershipPacked
) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << BITPOS_EXTRA_DATA;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* 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 _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual returns (uint24) {}
/**
* @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 277 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.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();
/**
* 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();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
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;
// Arbitrary data similar to `startTimestamp` that can be set through `_extraData`.
uint24 extraData;
}
/**
* @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);
// ==============================
// IERC2309
// ==============================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId` (inclusive) is transferred from `from` to `to`,
* as defined in the ERC2309 standard. See `_mintERC2309` for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}
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;
}
}
Read Contract
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
burnPaused 0xd684534e → uint8
calculateCost 0x22d34454 → uint256
checkPaused 0x4c890060
cost 0x13faede6 → uint256
deadAddr 0xa5962524 → address
dirtyFlies 0x91f3649c → address
getApproved 0x081812fc → address
getCost 0x8b88a687 → uint256
getHoldingTokenIds 0xc8838b14 → uint256[]
getMintTokenIds 0xb74003d4 → uint256[]
isApprovedForAll 0xe985e9c5 → bool
maxSupply 0xd5abeb01 → uint256
mintLimit 0x996517cf → uint256
mintPaused 0x7e4831d3 → uint8
mintTokenIdsMap 0x5683ffd6 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
whitelistMap 0x32531c3c → bool
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
airdrop 0x67243482
address[] mintAddresses
uint256[] mintCounts
airdropForDirtyFliesSpecialHolders 0x6aea3854
No parameters
approve 0x095ea7b3
address to
uint256 tokenId
burnDirtyFlies 0x4f0e3d1d
uint256[] tokenIds
enableBurn 0x3b37d1d6
No parameters
enableMint 0xd4c720d3
uint256 cost_
mint 0xa0712d68
uint256 quantity
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
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateBaseURI 0x931688cb
string baseURI_
updateCost 0x23c5a088
uint256 cost_
updateMintLimit 0xe01d55c5
uint256 mintLimit_
updatePaused 0x5371212a
uint8 mintPaused_
uint8 burnPaused_
updateWhitelistMap 0x11fa9ac0
address[] addAddrs
address[] delAddrs
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address