Address Contract Verified
Address
0x007029dfb0Bc69dF0303E48D3e458eFa3Db6d98f
Balance
0 ETH
Nonce
1
Code Size
18307 bytes
Creator
0x0D26aD1B...fbb2 at tx 0x61289551...b983a5
Last Active
Indexed Transactions
1 (24,317,367 → 24,317,367)
Gas Used (indexed)
24,792
Contract Bytecode
18307 bytes
0x6080604052600436106102935760003560e01c8063715018a61161015a578063b2a098d9116100c1578063d685b6451161007a578063d685b645146109fd578063e985e9c514610a28578063ef72bae714610a65578063f23a6e6114610a81578063f2e73a0d14610abe578063f2fde38b14610ad557610293565b8063b2a098d9146108db578063b6f3ce0014610918578063b88d4fde14610941578063c49430fd1461096a578063c87b56dd14610995578063cfc86f7b146109d257610293565b806391b7f5ed1161011357806391b7f5ed146107df57806393c72ff21461080857806395d89b4114610831578063a035b1fe1461085c578063a22cb46514610887578063a29fb55e146108b057610293565b8063715018a6146106f75780637cb647591461070e578063897fa65f146107375780638da5cb5b146107625780638f1a01cf1461078d57806391306d3e146107b657610293565b80632eb4a7ab116101fe57806355f804b3116101b757806355f804b3146105d95780635e13c7e9146106025780636352211e1461062b5780636eba87841461066857806370a082311461069157806370b2e6a4146106ce57610293565b80632eb4a7ab146104f15780633089f68f1461051c5780633ccfd60b146105475780634090c4691461055e57806342842e0e1461058757806347645216146105b057610293565b8063150b7a0211610250578063150b7a02146103cc57806318160ddd146104095780631e7b8c4b1461043457806323b872dd1461045f5780632a31a830146104885780632a55205a146104b357610293565b806301ffc9a71461029857806306fdde03146102d5578063081812fc14610300578063081a8c9d1461033d578063095ea7b3146103665780630d007f941461038f575b600080fd5b3480156102a457600080fd5b506102bf60048036038101906102ba91906135d9565b610afe565b6040516102cc9190613621565b60405180910390f35b3480156102e157600080fd5b506102ea610b10565b6040516102f791906136d5565b60405180910390f35b34801561030c57600080fd5b506103276004803603810190610322919061372d565b610ba2565b604051610334919061379b565b60405180910390f35b34801561034957600080fd5b50610364600480360381019061035f9190613871565b610c1e565b005b34801561037257600080fd5b5061038d6004803603810190610388919061391e565b610d23565b005b34801561039b57600080fd5b506103b660048036038101906103b1919061395e565b610e27565b6040516103c3919061399a565b60405180910390f35b3480156103d857600080fd5b506103f360048036038101906103ee9190613ae5565b610e3f565b6040516104009190613b77565b60405180910390f35b34801561041557600080fd5b5061041e610eee565b60405161042b919061399a565b60405180910390f35b34801561044057600080fd5b50610449610f05565b6040516104569190613621565b60405180910390f35b34801561046b57600080fd5b5061048660048036038101906104819190613b92565b610f18565b005b34801561049457600080fd5b5061049d610f28565b6040516104aa9190613621565b60405180910390f35b3480156104bf57600080fd5b506104da60048036038101906104d59190613be5565b610f3b565b6040516104e8929190613c25565b60405180910390f35b3480156104fd57600080fd5b50610506611125565b6040516105139190613c67565b60405180910390f35b34801561052857600080fd5b5061053161112b565b60405161053e919061379b565b60405180910390f35b34801561055357600080fd5b5061055c611151565b005b34801561056a57600080fd5b506105856004803603810190610580919061391e565b61122a565b005b34801561059357600080fd5b506105ae60048036038101906105a99190613b92565b61128e565b005b3480156105bc57600080fd5b506105d760048036038101906105d2919061395e565b6112ae565b005b3480156105e557600080fd5b5061060060048036038101906105fb9190613cd8565b6112fa565b005b34801561060e57600080fd5b5061062960048036038101906106249190613d51565b611318565b005b34801561063757600080fd5b50610652600480360381019061064d919061372d565b61133d565b60405161065f919061379b565b60405180910390f35b34801561067457600080fd5b5061068f600480360381019061068a919061395e565b611353565b005b34801561069d57600080fd5b506106b860048036038101906106b3919061395e565b61139f565b6040516106c5919061399a565b60405180910390f35b3480156106da57600080fd5b506106f560048036038101906106f09190613dd4565b61146e565b005b34801561070357600080fd5b5061070c61179c565b005b34801561071a57600080fd5b5061073560048036038101906107309190613e4d565b6117b0565b005b34801561074357600080fd5b5061074c6117c2565b6040516107599190613621565b60405180910390f35b34801561076e57600080fd5b506107776117d5565b604051610784919061379b565b60405180910390f35b34801561079957600080fd5b506107b460048036038101906107af9190613d51565b6117ff565b005b3480156107c257600080fd5b506107dd60048036038101906107d89190613d51565b611824565b005b3480156107eb57600080fd5b506108066004803603810190610801919061372d565b611849565b005b34801561081457600080fd5b5061082f600480360381019061082a9190613d51565b61185b565b005b34801561083d57600080fd5b50610846611880565b60405161085391906136d5565b60405180910390f35b34801561086857600080fd5b50610871611912565b60405161087e919061399a565b60405180910390f35b34801561089357600080fd5b506108ae60048036038101906108a99190613e7a565b611918565b005b3480156108bc57600080fd5b506108c5611a8f565b6040516108d29190613621565b60405180910390f35b3480156108e757600080fd5b5061090260048036038101906108fd919061395e565b611aa2565b60405161090f9190613621565b60405180910390f35b34801561092457600080fd5b5061093f600480360381019061093a919061372d565b611ac2565b005b34801561094d57600080fd5b5061096860048036038101906109639190613ae5565b611ad4565b005b34801561097657600080fd5b5061097f611b4c565b60405161098c9190613621565b60405180910390f35b3480156109a157600080fd5b506109bc60048036038101906109b7919061372d565b611b5f565b6040516109c991906136d5565b60405180910390f35b3480156109de57600080fd5b506109e7611bfd565b6040516109f491906136d5565b60405180910390f35b348015610a0957600080fd5b50610a12611c8b565b604051610a1f919061399a565b60405180910390f35b348015610a3457600080fd5b50610a4f6004803603810190610a4a9190613eba565b611c91565b604051610a5c9190613621565b60405180910390f35b610a7f6004803603810190610a7a919061372d565b611d25565b005b348015610a8d57600080fd5b50610aa86004803603810190610aa39190613f50565b611fd1565b604051610ab59190613b77565b60405180910390f35b348015610aca57600080fd5b50610ad3612111565b005b348015610ae157600080fd5b50610afc6004803603810190610af7919061395e565b6121aa565b005b6000610b098261222d565b9050919050565b606060028054610b1f90614019565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4b90614019565b8015610b985780601f10610b6d57610100808354040283529160200191610b98565b820191906000526020600020905b815481529060010190602001808311610b7b57829003601f168201915b5050505050905090565b6000610bad826122a7565b610be3576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b610c266122f5565b818190508484905014610c6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6590614096565b60405180910390fd5b60005b84849050811015610d1c57828282818110610c8f57610c8e6140b6565b5b9050602002016020810190610ca4919061411e565b60ff1660106000878785818110610cbe57610cbd6140b6565b5b9050602002016020810190610cd3919061395e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806001019050610c71565b5050505050565b6000610d2e8261133d565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610d95576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610db4612373565b73ffffffffffffffffffffffffffffffffffffffff1614610e1757610de081610ddb612373565b611c91565b610e16576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b610e2283838361237b565b505050565b60106020528060005260406000206000915090505481565b6000801515600e60179054906101000a900460ff16151503610e8d576040517f7be21a5700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e9830858561128e565b828473ffffffffffffffffffffffffffffffffffffffff167f85d4b0c5388fffce9928fc2b961adf8e3a9f94bd908633d7eaa8214b0b3f280960405160405180910390a363150b7a0260e01b9050949350505050565b6000610ef861242d565b6001546000540303905090565b600e60179054906101000a900460ff1681565b610f23838383612432565b505050565b600e60159054906101000a900460ff1681565b6000806000600960008681526020019081526020016000206040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff16815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16036110d05760086040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff168152505090505b60006110da6128e6565b6bffffffffffffffffffffffff1682602001516bffffffffffffffffffffffff1686611106919061417a565b6111109190614203565b90508160000151819350935050509250929050565b60125481565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6111596122f5565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16476040516111a190614265565b60006040518083038185875af1925050503d80600081146111de576040519150601f19603f3d011682016040523d82523d6000602084013e6111e3565b606091505b5050905080611227576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121e906142c6565b60405180910390fd5b50565b6112326122f5565b611e148161123e610eee565b61124891906142e6565b1115611280576040517fe9d82b1100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61128a82826128f0565b5050565b6112a983838360405180602001604052806000815250611ad4565b505050565b6112b66122f5565b80600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6113026122f5565b818160119190611313929190613487565b505050565b6113206122f5565b80600e60146101000a81548160ff02191690831515021790555050565b600061134882612bca565b600001519050919050565b61135b6122f5565b80600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611406576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900467ffffffffffffffff1667ffffffffffffffff169050919050565b60001515600e60149054906101000a900460ff161515036114bb576040517f55c1036b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561153f576040517f1fe10b1900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115a4576040517f875fdad700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000151561161c838380806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050601254336040516020016116019190614384565b60405160208183030381529060405280519060200120612e55565b151503611655576040517f4380216d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054116116a45760016116e5565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020545b9050611388816116f3610eee565b6116fd91906142e6565b1115611735576040517f33d7536c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061179733826128f0565b505050565b6117a46122f5565b6117ae6000612e6c565b565b6117b86122f5565b8060128190555050565b600e60169054906101000a900460ff1681565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6118076122f5565b80600e60176101000a81548160ff02191690831515021790555050565b61182c6122f5565b80600e60166101000a81548160ff02191690831515021790555050565b6118516122f5565b80600b8190555050565b6118636122f5565b80600e60156101000a81548160ff02191690831515021790555050565b60606003805461188f90614019565b80601f01602080910402602001604051908101604052809291908181526020018280546118bb90614019565b80156119085780601f106118dd57610100808354040283529160200191611908565b820191906000526020600020905b8154815290600101906020018083116118eb57829003601f168201915b5050505050905090565b600b5481565b611920612373565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611984576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060076000611991612373565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611a3e612373565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611a839190613621565b60405180910390a35050565b600e60189054906101000a900460ff1681565b600f6020528060005260406000206000915054906101000a900460ff1681565b611aca6122f5565b80600c8190555050565b611adf848484612432565b611afe8373ffffffffffffffffffffffffffffffffffffffff16612f32565b15611b4657611b0f84848484612f55565b611b45576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5b50505050565b600e60149054906101000a900460ff1681565b6060611b6a826122a7565b611ba0576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611baa6130a5565b90506000815103611bca5760405180602001604052806000815250611bf5565b80611bd484613137565b604051602001611be59291906143db565b6040516020818303038152906040525b915050919050565b60118054611c0a90614019565b80601f0160208091040260200160405190810160405280929190818152602001828054611c3690614019565b8015611c835780601f10611c5857610100808354040283529160200191611c83565b820191906000526020600020905b815481529060010190602001808311611c6657829003601f168201915b505050505081565b600c5481565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600073ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611dad576040517f124550f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60001515600e60169054906101000a900460ff16151503611dfa576040517f52d1a29900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e5f576040517f875fdad700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c54811115611e9b576040517f49986e7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611e1481611ea7610eee565b611eb191906142e6565b1115611ee9576040517fe9d82b1100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600b54611ef7919061417a565b3414611f2f576040517ff7760f2500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611f3933826128f0565b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166323965a5133846040518363ffffffff1660e01b8152600401611f9b929190613c25565b600060405180830381600087803b158015611fb557600080fd5b505af1158015611fc9573d6000803e3d6000fd5b505050505050565b6000801515600e60159054906101000a900460ff1615150361201f576040517fbe3a330c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f242432a30898960016040518563ffffffff1660e01b81526004016120869493929190614478565b600060405180830381600087803b1580156120a057600080fd5b505af11580156120b4573d6000803e3d6000fd5b50505050858773ffffffffffffffffffffffffffffffffffffffff167ff38ec2e11c03a9b2affc961815953937bd7b017037e51a0015e21862a1f11e7f60405160405180910390a363f23a6e6160e01b9150509695505050505050565b6121196122f5565b600e60189054906101000a900460ff1615612160576040517f973732a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61218d600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660c86128f0565b6001600e60186101000a81548160ff021916908315150217905550565b6121b26122f5565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161221890614542565b60405180910390fd5b61222a81612e6c565b50565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806122a0575061229f82613297565b5b9050919050565b6000816122b261242d565b111580156122c1575060005482105b80156122ee575060046000838152602001908152602001600020600001601c9054906101000a900460ff16155b9050919050565b6122fd612373565b73ffffffffffffffffffffffffffffffffffffffff1661231b6117d5565b73ffffffffffffffffffffffffffffffffffffffff1614612371576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612368906145ae565b60405180910390fd5b565b600033905090565b826006600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b600090565b600061243d82612bca565b90508373ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16146124a8576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008473ffffffffffffffffffffffffffffffffffffffff166124c9612373565b73ffffffffffffffffffffffffffffffffffffffff1614806124f857506124f7856124f2612373565b611c91565b5b8061253d5750612506612373565b73ffffffffffffffffffffffffffffffffffffffff1661252584610ba2565b73ffffffffffffffffffffffffffffffffffffffff16145b905080612576576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036125dc576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6125e98585856001613379565b6125f56000848761237b565b6001600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160392506101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506001600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506000600460008581526020019081526020016000209050848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550428160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060006001850190506000600460008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361287457600054821461287357878160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084602001518160000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505b5b505050828473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46128df858585600161337f565b5050505050565b6000612710905090565b600080549050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361295c576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008203612996576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6129a36000848385613379565b81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160088282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550826004600083815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550426004600083815260200190815260200160002060000160146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506000819050600083820190505b818060010192508573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4808210612b4657816000819055505050612bc5600084838561337f565b505050565b612bd261350d565b600082905080612be061242d565b11612e1e57600054811015612e1d576000600460008381526020019081526020016000206040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601c9054906101000a900460ff16151515158152505090508060400151612e1b57600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614612cff578092505050612e50565b5b600115612e1a57818060019003925050600460008381526020019081526020016000206040518060600160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601c9054906101000a900460ff1615151515815250509050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614612e15578092505050612e50565b612d00565b5b505b5b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600082612e628584613385565b1490509392505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60008373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612f7b612373565b8786866040518563ffffffff1660e01b8152600401612f9d9493929190614612565b6020604051808303816000875af1925050508015612fd957506040513d601f19601f82011682018060405250810190612fd69190614673565b60015b613052573d8060008114613009576040519150601f19603f3d011682016040523d82523d6000602084013e61300e565b606091505b50600081510361304a576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050949350505050565b6060601180546130b490614019565b80601f01602080910402602001604051908101604052809291908181526020018280546130e090614019565b801561312d5780601f106131025761010080835404028352916020019161312d565b820191906000526020600020905b81548152906001019060200180831161311057829003601f168201915b5050505050905090565b60606000820361317e576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613292565b600082905060005b600082146131b0578080613199906146a0565b915050600a826131a99190614203565b9150613186565b60008167ffffffffffffffff8111156131cc576131cb6139ba565b5b6040519080825280601f01601f1916602001820160405280156131fe5781602001600182028036833780820191505090505b5090505b6000851461328b5760018261321791906146e8565b9150600a85613226919061471c565b603061323291906142e6565b60f81b818381518110613248576132476140b6565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856132849190614203565b9450613202565b8093505050505b919050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061336257507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806133725750613371826133db565b5b9050919050565b50505050565b50505050565b60008082905060005b84518110156133d0576133bb828683815181106133ae576133ad6140b6565b5b6020026020010151613445565b915080806133c8906146a0565b91505061338e565b508091505092915050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600081831061345d576134588284613470565b613468565b6134678383613470565b5b905092915050565b600082600052816020526040600020905092915050565b82805461349390614019565b90600052602060002090601f0160209004810192826134b557600085556134fc565b82601f106134ce57803560ff19168380011785556134fc565b828001600101855582156134fc579182015b828111156134fb5782358255916020019190600101906134e0565b5b5090506135099190613550565b5090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff1681526020016000151581525090565b5b80821115613569576000816000905550600101613551565b5090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6135b681613581565b81146135c157600080fd5b50565b6000813590506135d3816135ad565b92915050565b6000602082840312156135ef576135ee613577565b5b60006135fd848285016135c4565b91505092915050565b60008115159050919050565b61361b81613606565b82525050565b60006020820190506136366000830184613612565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561367657808201518184015260208101905061365b565b83811115613685576000848401525b50505050565b6000601f19601f8301169050919050565b60006136a78261363c565b6136b18185613647565b93506136c1818560208601613658565b6136ca8161368b565b840191505092915050565b600060208201905081810360008301526136ef818461369c565b905092915050565b6000819050919050565b61370a816136f7565b811461371557600080fd5b50565b60008135905061372781613701565b92915050565b60006020828403121561374357613742613577565b5b600061375184828501613718565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006137858261375a565b9050919050565b6137958161377a565b82525050565b60006020820190506137b0600083018461378c565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126137db576137da6137b6565b5b8235905067ffffffffffffffff8111156137f8576137f76137bb565b5b602083019150836020820283011115613814576138136137c0565b5b9250929050565b60008083601f840112613831576138306137b6565b5b8235905067ffffffffffffffff81111561384e5761384d6137bb565b5b60208301915083602082028301111561386a576138696137c0565b5b9250929050565b6000806000806040858703121561388b5761388a613577565b5b600085013567ffffffffffffffff8111156138a9576138a861357c565b5b6138b5878288016137c5565b9450945050602085013567ffffffffffffffff8111156138d8576138d761357c565b5b6138e48782880161381b565b925092505092959194509250565b6138fb8161377a565b811461390657600080fd5b50565b600081359050613918816138f2565b92915050565b6000806040838503121561393557613934613577565b5b600061394385828601613909565b925050602061395485828601613718565b9150509250929050565b60006020828403121561397457613973613577565b5b600061398284828501613909565b91505092915050565b613994816136f7565b82525050565b60006020820190506139af600083018461398b565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6139f28261368b565b810181811067ffffffffffffffff82111715613a1157613a106139ba565b5b80604052505050565b6000613a2461356d565b9050613a3082826139e9565b919050565b600067ffffffffffffffff821115613a5057613a4f6139ba565b5b613a598261368b565b9050602081019050919050565b82818337600083830152505050565b6000613a88613a8384613a35565b613a1a565b905082815260208101848484011115613aa457613aa36139b5565b5b613aaf848285613a66565b509392505050565b600082601f830112613acc57613acb6137b6565b5b8135613adc848260208601613a75565b91505092915050565b60008060008060808587031215613aff57613afe613577565b5b6000613b0d87828801613909565b9450506020613b1e87828801613909565b9350506040613b2f87828801613718565b925050606085013567ffffffffffffffff811115613b5057613b4f61357c565b5b613b5c87828801613ab7565b91505092959194509250565b613b7181613581565b82525050565b6000602082019050613b8c6000830184613b68565b92915050565b600080600060608486031215613bab57613baa613577565b5b6000613bb986828701613909565b9350506020613bca86828701613909565b9250506040613bdb86828701613718565b9150509250925092565b60008060408385031215613bfc57613bfb613577565b5b6000613c0a85828601613718565b9250506020613c1b85828601613718565b9150509250929050565b6000604082019050613c3a600083018561378c565b613c47602083018461398b565b9392505050565b6000819050919050565b613c6181613c4e565b82525050565b6000602082019050613c7c6000830184613c58565b92915050565b60008083601f840112613c9857613c976137b6565b5b8235905067ffffffffffffffff811115613cb557613cb46137bb565b5b602083019150836001820283011115613cd157613cd06137c0565b5b9250929050565b60008060208385031215613cef57613cee613577565b5b600083013567ffffffffffffffff811115613d0d57613d0c61357c565b5b613d1985828601613c82565b92509250509250929050565b613d2e81613606565b8114613d3957600080fd5b50565b600081359050613d4b81613d25565b92915050565b600060208284031215613d6757613d66613577565b5b6000613d7584828501613d3c565b91505092915050565b60008083601f840112613d9457613d936137b6565b5b8235905067ffffffffffffffff811115613db157613db06137bb565b5b602083019150836020820283011115613dcd57613dcc6137c0565b5b9250929050565b60008060208385031215613deb57613dea613577565b5b600083013567ffffffffffffffff811115613e0957613e0861357c565b5b613e1585828601613d7e565b92509250509250929050565b613e2a81613c4e565b8114613e3557600080fd5b50565b600081359050613e4781613e21565b92915050565b600060208284031215613e6357613e62613577565b5b6000613e7184828501613e38565b91505092915050565b60008060408385031215613e9157613e90613577565b5b6000613e9f85828601613909565b9250506020613eb085828601613d3c565b9150509250929050565b60008060408385031215613ed157613ed0613577565b5b6000613edf85828601613909565b9250506020613ef085828601613909565b9150509250929050565b60008083601f840112613f1057613f0f6137b6565b5b8235905067ffffffffffffffff811115613f2d57613f2c6137bb565b5b602083019150836001820283011115613f4957613f486137c0565b5b9250929050565b60008060008060008060a08789031215613f6d57613f6c613577565b5b6000613f7b89828a01613909565b9650506020613f8c89828a01613909565b9550506040613f9d89828a01613718565b9450506060613fae89828a01613718565b935050608087013567ffffffffffffffff811115613fcf57613fce61357c565b5b613fdb89828a01613efa565b92509250509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061403157607f821691505b60208210810361404457614043613fea565b5b50919050565b7f4c656e677468206d69736d617463680000000000000000000000000000000000600082015250565b6000614080600f83613647565b915061408b8261404a565b602082019050919050565b600060208201905081810360008301526140af81614073565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060ff82169050919050565b6140fb816140e5565b811461410657600080fd5b50565b600081359050614118816140f2565b92915050565b60006020828403121561413457614133613577565b5b600061414284828501614109565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614185826136f7565b9150614190836136f7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156141c9576141c861414b565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061420e826136f7565b9150614219836136f7565b925082614229576142286141d4565b5b828204905092915050565b600081905092915050565b50565b600061424f600083614234565b915061425a8261423f565b600082019050919050565b600061427082614242565b9150819050919050565b7f5769746864726177206661696c65640000000000000000000000000000000000600082015250565b60006142b0600f83613647565b91506142bb8261427a565b602082019050919050565b600060208201905081810360008301526142df816142a3565b9050919050565b60006142f1826136f7565b91506142fc836136f7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156143315761433061414b565b5b828201905092915050565b60008160601b9050919050565b60006143548261433c565b9050919050565b600061436682614349565b9050919050565b61437e6143798261377a565b61435b565b82525050565b6000614390828461436d565b60148201915081905092915050565b600081905092915050565b60006143b58261363c565b6143bf818561439f565b93506143cf818560208601613658565b80840191505092915050565b60006143e782856143aa565b91506143f382846143aa565b91508190509392505050565b6000819050919050565b6000819050919050565b600061442e614429614424846143ff565b614409565b6136f7565b9050919050565b61443e81614413565b82525050565b600082825260208201905092915050565b6000614462600083614444565b915061446d8261423f565b600082019050919050565b600060a08201905061448d600083018761378c565b61449a602083018661378c565b6144a7604083018561398b565b6144b46060830184614435565b81810360808301526144c581614455565b905095945050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061452c602683613647565b9150614537826144d0565b604082019050919050565b6000602082019050818103600083015261455b8161451f565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000614598602083613647565b91506145a382614562565b602082019050919050565b600060208201905081810360008301526145c78161458b565b9050919050565b600081519050919050565b60006145e4826145ce565b6145ee8185614444565b93506145fe818560208601613658565b6146078161368b565b840191505092915050565b6000608082019050614627600083018761378c565b614634602083018661378c565b614641604083018561398b565b818103606083015261465381846145d9565b905095945050505050565b60008151905061466d816135ad565b92915050565b60006020828403121561468957614688613577565b5b60006146978482850161465e565b91505092915050565b60006146ab826136f7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036146dd576146dc61414b565b5b600182019050919050565b60006146f3826136f7565b91506146fe836136f7565b9250828210156147115761471061414b565b5b828203905092915050565b6000614727826136f7565b9150614732836136f7565b925082614742576147416141d4565b5b82820690509291505056fea264697066735822122018c656c4f2e88346b4affa69370a7c9799842e568b320a59ee8b6c03a332a28c64736f6c634300080e0033
Verified Source Code Full Match
Compiler: v0.8.14+commit.80d49f37
EVM: london
Optimization: No
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721A.sol 612 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v3.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721A.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
/**
* @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 Context, ERC165, IERC721A {
using Address for address;
using Strings for uint256;
// The tokenId of the next token to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 internal _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 _ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) internal _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
/**
* To change the starting tokenId, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
*/
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();
}
}
/**
* 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 See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberMinted);
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberBurned);
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return _addressData[owner].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 {
_addressData[owner].aux = aux;
}
/**
* 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) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr) if (curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// 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.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return _ownershipOf(tokenId).addr;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner) if(!isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @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 == _msgSender()) revert ApproveToCaller();
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public 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.isContract()) 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 && !_ownerships[tokenId].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 {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (to.isContract()) {
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 {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
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 {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// 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 {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = to;
currSlot.startTimestamp = uint64(block.timestamp);
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
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 {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
address from = prevOwnership.addr;
if (approvalCheck) {
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// 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 {
AddressData storage addressData = _addressData[from];
addressData.balance -= 1;
addressData.numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = from;
currSlot.startTimestamp = uint64(block.timestamp);
currSlot.burned = true;
// If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
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 Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert 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 {}
}
IERC2981.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
IERC721A.sol 109 lines
// SPDX-License-Identifier: MIT
// ERC721A Contracts v3.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
/**
* @dev Interface of an ERC721A compliant contract.
*/
interface IERC721A is IERC721, IERC721Metadata {
/**
* 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();
// Compiler will pack this into a single 256bit word.
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;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
// For miscellaneous variable(s) pertaining to the address
// (e.g. number of whitelist mint slots used).
// If there are multiple variables, please pack them into a uint64.
uint64 aux;
}
/**
* @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);
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* 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 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);
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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 Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
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);
}
}
MerkleProof.sol 212 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,
* consuming from one or the other at each step according to the instructions given by
* `proofFlags`.
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
ERC2981.sol 111 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}
Strings.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
SSAInternational.sol 324 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;
// Prior art.
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import { ERC2981 } from "@openzeppelin/contracts/token/common/ERC2981.sol";
import { ERC721A } from "erc721a/contracts/ERC721A.sol";
import { IERC721Receiver } from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import { IERC1155Receiver } from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
// Contract art.
/*
.. ' .
.l-?}cQd*#MB*r.
...,,i><]u0b%%B@@$@$$$@@@8p/`
-U . .'i<)0do%8%@@$@$$@@@$$@@@@@@@@&ji.
;ob^ 'Il_-/YW8@B@@@B@B@@$$$$$$$$$$$$$$$$$@B%bf,
'UBX .. . .'I_xYOhM&8B$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$B%t
i#MI ..'"l_/rjzOM8&@@@@@@B@@@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@*"
I&@M_rwOpa*&%B@@@$$@@@@@B@BBowak@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@M~
!hBB@@@@@@BB%#oahmCz/1-. . f@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@8)
'?xCObB@@Bd'' . . `0$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@%j
.c@@M" .'Y$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@81
.rB@@_ `0$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@8[
?8@$z 'L$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@&]
'b@@%|. t%@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@#;
. (B@@Z` ~*@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@X.
^Q@@B/ "m@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$B|
<*@@@? . ;M@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@@@U
lo@BM} J@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@@ai
io@@8_ 'v%@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@@J'
(%@@@J`. `0@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@8)
.f8$@@k> ^mB$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$8!
,LBBB8X^. .'j8B@$$$$$$$$$$$$$$$$$$$$$$$$$$@@a<.
.]%@BBBO` ..-#@@@$$$$$$$$$$$$$$$$$$$$$$@@@o!
"uB@@@8v` .,Y%@@$$$$$$$$$$$$$$$$$$$$@@@Q`
."Y&B@@Bd1^ . .YWB@@$$$$$$$$$$$$$$@@@BW).
'-k@@@@BMJ[: ."UqB$$$$$$$$$$$$$$@B&t'
.[L#BB@@@BMn+>^. ^juJ*&B$$$$$@@BW/.
.!vWB@B@@@@@WWdCxf)/zJ0woM8@@@@$@%f:
. .."Yw*WB@@$$@@@@B@@B@@$$@8hqxI
,<{/0qmW%%B#aQv(-;'
.
*/
// Silhouettes.
interface IInventory {
function supplyPaidAgents(address _to, uint _amount) external;
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
}
interface SevenTwentyOne {
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
interface ElevenFiftyFive {
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
}
// Whoops.
error AlreadyRecruited();
error AlreadyMintedEarly();
error EarlyRecruitmentClosed();
error EarlyRecruitsTaken();
error ItemsContractAddressNotSet();
error ItemsNotUpgradeable();
error NotRecruitingSeason();
error NoContracts();
error NotOnTheList();
error MissionsNotYetBegun();
error RecruitingFull();
error WrongAmount();
error WrongPrice();
// An agreement. A contract, if you will.
contract SSAInternational is ERC721A, ERC2981, Ownable {
uint constant EARLY_SUPPLY = 5_000;
uint constant MAX_SUPPLY = 7_700;
uint constant TEAM_MINT_SUPPLY = 200;
uint public price = 0.07 ether;
uint public max_per_txn = 7;
address theAgency = 0x4D5949BE178270B031c18FE86663d8bA5Ea97204;
address public itemContractAddress;
bool public earlyRecruitmentIsOpen;
bool public itemsAreUpgradeable;
bool public itsRecruitingSeason;
bool public missionsAreGo;
bool public teamHasBeenRecruited;
mapping(address => bool) public addressHasMinted;
mapping(address => uint) public theSpecialists;
string public _baseTokenURI;
bytes32 public merkleRoot;
// Happenings.
event AgentShouldReceiveUpdate(address indexed _fromAndTo, uint256 indexed _tokenId);
event ItemShouldReceiveUpdate(address indexed _fromAndTo, uint256 indexed _tokenId);
// Have a seat. Let's begin.
constructor() ERC721A("SSA INTERNATIONAL", "SSA") {
// Hello, Agent 0
_mint(theAgency, 1);
}
// You're Early.
function earlyRecruit(bytes32[] calldata _proof)
external
{
if (earlyRecruitmentIsOpen == false) revert EarlyRecruitmentClosed();
if (addressHasMinted[msg.sender]) revert AlreadyMintedEarly();
if (msg.sender != tx.origin) revert NoContracts();
if (MerkleProof.verify(_proof, merkleRoot, keccak256(abi.encodePacked(msg.sender))) == false) revert NotOnTheList();
uint count = theSpecialists[msg.sender] > 0 ? theSpecialists[msg.sender] : 1;
if (totalSupply() + count > EARLY_SUPPLY) revert EarlyRecruitsTaken();
addressHasMinted[msg.sender] = true;
_mint(msg.sender, count);
}
// Welcome, Recruits.
function recruitYourAgent(uint _count)
external
payable
{
if (itemContractAddress == address(0)) revert ItemsContractAddressNotSet();
if (itsRecruitingSeason == false) revert NotRecruitingSeason();
if (msg.sender != tx.origin) revert NoContracts();
if (_count > max_per_txn) revert WrongAmount();
if (totalSupply() + _count > MAX_SUPPLY) revert RecruitingFull();
if (msg.value != (price * _count)) revert WrongPrice();
_mint(msg.sender, _count);
IInventory inventory = IInventory(itemContractAddress);
inventory.supplyPaidAgents(msg.sender, _count);
}
function giftAnAgent(address _to, uint _count)
external
onlyOwner
{
if (totalSupply() + _count > MAX_SUPPLY) revert RecruitingFull();
_mint(_to, _count);
}
// Go, Team.
function recruitTeamAgents()
external
onlyOwner
{
if (teamHasBeenRecruited) revert AlreadyRecruited();
_mint(theAgency, TEAM_MINT_SUPPLY);
teamHasBeenRecruited = true;
}
// Set.
function setEarlyRecruitmentIsOpen(bool _val)
external
onlyOwner
{
earlyRecruitmentIsOpen = _val;
}
function setItsRecruitingSeason(bool _val)
external
onlyOwner
{
itsRecruitingSeason = _val;
}
function setTheSpecialists(address[] calldata _whom, uint8[] calldata _counts)
external
onlyOwner
{
require(_whom.length == _counts.length, "Length mismatch");
for(uint i; i < _whom.length;)
{
theSpecialists[_whom[i]] = _counts[i];
unchecked { ++i; }
}
}
function setNewAgency(address _where)
external
onlyOwner
{
theAgency = _where;
}
function setMaxPerTxn(uint _val)
external
onlyOwner
{
max_per_txn = _val;
}
function setBaseURI(string calldata _base)
external
onlyOwner
{
_baseTokenURI = _base;
}
function setPrice(uint _val)
external
onlyOwner
{
price = _val;
}
function setMerkleRoot(bytes32 _root)
external
onlyOwner
{
merkleRoot = _root;
}
function setMissionsAreGo(bool _val)
external
onlyOwner
{
missionsAreGo = _val;
}
function setItemsAreUpgradeable(bool _val)
external
onlyOwner
{
itemsAreUpgradeable = _val;
}
function setItemsContractAddress(address _address)
external
onlyOwner
{
itemContractAddress = _address;
}
// Details.
function _baseURI()
internal
view
virtual
override
returns (string memory)
{
return _baseTokenURI;
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721A, ERC2981)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
// Receive. Send right back. (Use at your own risk)
function onERC721Received(address, address from, uint256 tokenId, bytes memory)
public
returns(bytes4)
{
if (missionsAreGo == false) revert MissionsNotYetBegun();
// Transfer it back to the address that sent it to this contract
safeTransferFrom(address(this), from, tokenId);
emit AgentShouldReceiveUpdate(from, tokenId);
return this.onERC721Received.selector;
}
function onERC1155Received(address, address from, uint256 id, uint256, bytes calldata)
external
returns (bytes4)
{
if (itemsAreUpgradeable == false) revert ItemsNotUpgradeable();
// Send it back
IInventory inventory = IInventory(itemContractAddress);
inventory.safeTransferFrom(address(this), from, id, 1, "");
emit ItemShouldReceiveUpdate(from, id);
return this.onERC1155Received.selector;
}
// W.
function withdraw()
external
onlyOwner
{
(bool success, ) = payable(theAgency).call{value: address(this).balance}("");
require(success, "Withdraw failed");
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
Read Contract
_baseTokenURI 0xcfc86f7b → string
addressHasMinted 0xb2a098d9 → bool
balanceOf 0x70a08231 → uint256
earlyRecruitmentIsOpen 0xc49430fd → bool
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
itemContractAddress 0x3089f68f → address
itemsAreUpgradeable 0x2a31a830 → bool
itsRecruitingSeason 0x897fa65f → bool
max_per_txn 0xd685b645 → uint256
merkleRoot 0x2eb4a7ab → bytes32
missionsAreGo 0x1e7b8c4b → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
price 0xa035b1fe → uint256
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
teamHasBeenRecruited 0xa29fb55e → bool
theSpecialists 0x0d007f94 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 25 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
earlyRecruit 0x70b2e6a4
bytes32[] _proof
giftAnAgent 0x4090c469
address _to
uint256 _count
onERC1155Received 0xf23a6e61
address
address from
uint256 id
uint256
bytes
returns: bytes4
onERC721Received 0x150b7a02
address
address from
uint256 tokenId
bytes
returns: bytes4
recruitTeamAgents 0xf2e73a0d
No parameters
recruitYourAgent 0xef72bae7
uint256 _count
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 _base
setEarlyRecruitmentIsOpen 0x5e13c7e9
bool _val
setItemsAreUpgradeable 0x93c72ff2
bool _val
setItemsContractAddress 0x6eba8784
address _address
setItsRecruitingSeason 0x91306d3e
bool _val
setMaxPerTxn 0xb6f3ce00
uint256 _val
setMerkleRoot 0x7cb64759
bytes32 _root
setMissionsAreGo 0x8f1a01cf
bool _val
setNewAgency 0x47645216
address _where
setPrice 0x91b7f5ed
uint256 _val
setTheSpecialists 0x081a8c9d
address[] _whom
uint8[] _counts
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Top Interactions
| Address | Txns | Sent | Received |
|---|---|---|---|
| 0x2B0D6807...2d12 | 1 | 1 |
Recent Transactions
|
| Hash | Block | Age | From/To | Value | |
|---|---|---|---|---|---|
| 0x89241c01...d4f712 | 24,317,367 | IN | 0x2B0D6807...2d12 | 0 ETH |