Address Contract Partially Verified
Address
0x8f3fF4BebaB846aB06E487b2aAC28E12e4dbBc2C
Balance
0 ETH
Nonce
1
Code Size
18394 bytes
Creator
0x97150d93...E065 at tx 0x081b03cf...617193
Indexed Transactions
0
Contract Bytecode
18394 bytes
0x6080604052600436106102465760003560e01c806370a0823111610139578063ad6cb319116100b6578063da3ef23f1161007a578063da3ef23f146107fe578063db8cc8fa14610827578063e514c7e114610850578063e985e9c514610879578063f2c4ce1e146108b6578063f2fde38b146108df57610246565b8063ad6cb31914610717578063b88d4fde14610742578063c66828621461076b578063c87b56dd14610796578063d5abeb01146107d357610246565b8063a22cb465116100fd578063a22cb46514610658578063a475b5dd14610681578063a58fdc1114610698578063a6d23e10146106c1578063aafdff7c146106ec57610246565b806370a0823114610583578063715018a6146105c05780638da5cb5b146105d757806395d89b4114610602578063970703d01461062d57610246565b8063203b1581116101c75780634704b6771161018b5780634704b677146104ab57806351830227146104c757806355f804b3146104f25780635fd1bbc41461051b5780636352211e1461054657610246565b8063203b15811461041c57806323b872dd1461044557806326092b831461046e5780633ccfd60b1461047857806342842e0e1461048257610246565b8063095ea7b31161020e578063095ea7b3146103375780631237e5e81461036057806318160ddd1461039d5780631c7e49b5146103c85780632018e884146103f157610246565b80630186d1371461024b57806301ffc9a71461026757806306fdde03146102a4578063081812fc146102cf578063081c8c441461030c575b600080fd5b610265600480360381019061026091906132cc565b610908565b005b34801561027357600080fd5b5061028e60048036038101906102899190613346565b610b62565b60405161029b91906139c5565b60405180910390f35b3480156102b057600080fd5b506102b9610c44565b6040516102c691906139fb565b60405180910390f35b3480156102db57600080fd5b506102f660048036038101906102f191906133e9565b610cd6565b6040516103039190613943565b60405180910390f35b34801561031857600080fd5b50610321610d5b565b60405161032e91906139fb565b60405180910390f35b34801561034357600080fd5b5061035e6004803603810190610359919061328c565b610de9565b005b34801561036c57600080fd5b5061038760048036038101906103829190613109565b610f01565b60405161039491906139c5565b60405180910390f35b3480156103a957600080fd5b506103b2610f21565b6040516103bf9190613cfd565b60405180910390f35b3480156103d457600080fd5b506103ef60048036038101906103ea91906133e9565b610f32565b005b3480156103fd57600080fd5b50610406610fb8565b6040516104139190613cfd565b60405180910390f35b34801561042857600080fd5b50610443600480360381019061043e91906133e9565b610fbe565b005b34801561045157600080fd5b5061046c60048036038101906104679190613176565b611044565b005b6104766110a4565b005b610480611243565b005b34801561048e57600080fd5b506104a960048036038101906104a49190613176565b61133f565b005b6104c560048036038101906104c091906132cc565b61135f565b005b3480156104d357600080fd5b506104dc6115b9565b6040516104e991906139c5565b60405180910390f35b3480156104fe57600080fd5b50610519600480360381019061051491906133a0565b6115cc565b005b34801561052757600080fd5b50610530611662565b60405161053d9190613cfd565b60405180910390f35b34801561055257600080fd5b5061056d600480360381019061056891906133e9565b611668565b60405161057a9190613943565b60405180910390f35b34801561058f57600080fd5b506105aa60048036038101906105a59190613109565b61171a565b6040516105b79190613cfd565b60405180910390f35b3480156105cc57600080fd5b506105d56117d2565b005b3480156105e357600080fd5b506105ec61185a565b6040516105f99190613943565b60405180910390f35b34801561060e57600080fd5b50610617611884565b60405161062491906139fb565b60405180910390f35b34801561063957600080fd5b50610642611916565b60405161064f91906139e0565b60405180910390f35b34801561066457600080fd5b5061067f600480360381019061067a919061324c565b61191c565b005b34801561068d57600080fd5b50610696611932565b005b3480156106a457600080fd5b506106bf60048036038101906106ba9190613319565b6119cb565b005b3480156106cd57600080fd5b506106d6611a51565b6040516106e3919061395e565b60405180910390f35b3480156106f857600080fd5b50610701611a77565b60405161070e9190613cfd565b60405180910390f35b34801561072357600080fd5b5061072c611a7d565b60405161073991906139e0565b60405180910390f35b34801561074e57600080fd5b50610769600480360381019061076491906131c9565b611a83565b005b34801561077757600080fd5b50610780611ae5565b60405161078d91906139fb565b60405180910390f35b3480156107a257600080fd5b506107bd60048036038101906107b891906133e9565b611b73565b6040516107ca91906139fb565b60405180910390f35b3480156107df57600080fd5b506107e8611ccc565b6040516107f59190613cfd565b60405180910390f35b34801561080a57600080fd5b50610825600480360381019061082091906133a0565b611cd2565b005b34801561083357600080fd5b5061084e600480360381019061084991906133e9565b611d68565b005b34801561085c57600080fd5b5061087760048036038101906108729190613319565b611dee565b005b34801561088557600080fd5b506108a0600480360381019061089b9190613136565b611e74565b6040516108ad91906139c5565b60405180910390f35b3480156108c257600080fd5b506108dd60048036038101906108d891906133a0565b611f08565b005b3480156108eb57600080fd5b5061090660048036038101906109019190613109565b611f9e565b005b601054421161094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094390613b5d565b60405180910390fd5b60006109586007612096565b9050600a5460018261096a9190613e02565b11156109ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a290613cbd565b60405180910390fd5b601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610a38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2f90613bfd565b60405180910390fd5b600033604051602001610a4b91906138e2565b604051602081830303815290604052805190602001209050610ab1848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050600e54836120cd565b610af0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae790613c9d565b60405180910390fd5b6001601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610b5260076120a4565b610b5c33836120e4565b50505050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610c2d57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610c3d5750610c3c82612102565b5b9050919050565b606060008054610c5390613f8f565b80601f0160208091040260200160405190810160405280929190818152602001828054610c7f90613f8f565b8015610ccc5780601f10610ca157610100808354040283529160200191610ccc565b820191906000526020600020905b815481529060010190602001808311610caf57829003601f168201915b5050505050905090565b6000610ce18261216c565b610d20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1790613bbd565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600c8054610d6890613f8f565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9490613f8f565b8015610de15780601f10610db657610100808354040283529160200191610de1565b820191906000526020600020905b815481529060010190602001808311610dc457829003601f168201915b505050505081565b6000610df482611668565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5c90613c5d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610e846121d8565b73ffffffffffffffffffffffffffffffffffffffff161480610eb35750610eb281610ead6121d8565b611e74565b5b610ef2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee990613add565b60405180910390fd5b610efc83836121e0565b505050565b60136020528060005260406000206000915054906101000a900460ff1681565b6000610f2d6007612096565b905090565b610f3a6121d8565b73ffffffffffffffffffffffffffffffffffffffff16610f5861185a565b73ffffffffffffffffffffffffffffffffffffffff1614610fae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa590613bdd565b60405180910390fd5b8060118190555050565b60115481565b610fc66121d8565b73ffffffffffffffffffffffffffffffffffffffff16610fe461185a565b73ffffffffffffffffffffffffffffffffffffffff161461103a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103190613bdd565b60405180910390fd5b8060108190555050565b61105561104f6121d8565b82612299565b611094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108b90613c7d565b60405180910390fd5b61109f838383612377565b505050565b60125442116110e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110df90613b9d565b60405180910390fd5b60006110f46007612096565b9050600a546001826111069190613e02565b1115611147576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113e90613cbd565b60405180910390fd5b601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111cb90613bfd565b60405180910390fd5b6001601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061123660076120a4565b61124033826120e4565b50565b61124b6121d8565b73ffffffffffffffffffffffffffffffffffffffff1661126961185a565b73ffffffffffffffffffffffffffffffffffffffff16146112bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b690613bdd565b60405180910390fd5b60006112c961185a565b73ffffffffffffffffffffffffffffffffffffffff16476040516112ec9061392e565b60006040518083038185875af1925050503d8060008114611329576040519150601f19603f3d011682016040523d82523d6000602084013e61132e565b606091505b505090508061133c57600080fd5b50565b61135a83838360405180602001604052806000815250611a83565b505050565b60115442116113a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139a90613b3d565b60405180910390fd5b60006113af6007612096565b9050600a546001826113c19190613e02565b1115611402576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f990613cbd565b60405180910390fd5b601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561148f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148690613bfd565b60405180910390fd5b6000336040516020016114a291906138e2565b604051602081830303815290604052805190602001209050611508848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050600e54836120cd565b611547576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153e90613cdd565b60405180910390fd5b6001601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506115a960076120a4565b6115b333836120e4565b50505050565b600b60009054906101000a900460ff1681565b6115d46121d8565b73ffffffffffffffffffffffffffffffffffffffff166115f261185a565b73ffffffffffffffffffffffffffffffffffffffff1614611648576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163f90613bdd565b60405180910390fd5b806008908051906020019061165e929190612eb2565b5050565b60125481565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611711576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161170890613b1d565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613afd565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6117da6121d8565b73ffffffffffffffffffffffffffffffffffffffff166117f861185a565b73ffffffffffffffffffffffffffffffffffffffff161461184e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184590613bdd565b60405180910390fd5b61185860006125d3565b565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606001805461189390613f8f565b80601f01602080910402602001604051908101604052809291908181526020018280546118bf90613f8f565b801561190c5780601f106118e15761010080835404028352916020019161190c565b820191906000526020600020905b8154815290600101906020018083116118ef57829003601f168201915b5050505050905090565b600f5481565b61192e6119276121d8565b8383612699565b5050565b61193a6121d8565b73ffffffffffffffffffffffffffffffffffffffff1661195861185a565b73ffffffffffffffffffffffffffffffffffffffff16146119ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a590613bdd565b60405180910390fd5b6001600b60006101000a81548160ff021916908315150217905550565b6119d36121d8565b73ffffffffffffffffffffffffffffffffffffffff166119f161185a565b73ffffffffffffffffffffffffffffffffffffffff1614611a47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3e90613bdd565b60405180910390fd5b80600e8190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60105481565b600e5481565b611a94611a8e6121d8565b83612299565b611ad3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aca90613c7d565b60405180910390fd5b611adf84848484612806565b50505050565b60098054611af290613f8f565b80601f0160208091040260200160405190810160405280929190818152602001828054611b1e90613f8f565b8015611b6b5780601f10611b4057610100808354040283529160200191611b6b565b820191906000526020600020905b815481529060010190602001808311611b4e57829003601f168201915b505050505081565b6060611b7e8261216c565b611bbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb490613c3d565b60405180910390fd5b60001515600b60009054906101000a900460ff1615151415611c6b57600c8054611be690613f8f565b80601f0160208091040260200160405190810160405280929190818152602001828054611c1290613f8f565b8015611c5f5780601f10611c3457610100808354040283529160200191611c5f565b820191906000526020600020905b815481529060010190602001808311611c4257829003601f168201915b50505050509050611cc7565b6000611c75612862565b90506000815111611c955760405180602001604052806000815250611cc3565b80611c9f846128f4565b6009604051602001611cb3939291906138fd565b6040516020818303038152906040525b9150505b919050565b600a5481565b611cda6121d8565b73ffffffffffffffffffffffffffffffffffffffff16611cf861185a565b73ffffffffffffffffffffffffffffffffffffffff1614611d4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4590613bdd565b60405180910390fd5b8060099080519060200190611d64929190612eb2565b5050565b611d706121d8565b73ffffffffffffffffffffffffffffffffffffffff16611d8e61185a565b73ffffffffffffffffffffffffffffffffffffffff1614611de4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ddb90613bdd565b60405180910390fd5b8060128190555050565b611df66121d8565b73ffffffffffffffffffffffffffffffffffffffff16611e1461185a565b73ffffffffffffffffffffffffffffffffffffffff1614611e6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6190613bdd565b60405180910390fd5b80600f8190555050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611f106121d8565b73ffffffffffffffffffffffffffffffffffffffff16611f2e61185a565b73ffffffffffffffffffffffffffffffffffffffff1614611f84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f7b90613bdd565b60405180910390fd5b80600c9080519060200190611f9a929190612eb2565b5050565b611fa66121d8565b73ffffffffffffffffffffffffffffffffffffffff16611fc461185a565b73ffffffffffffffffffffffffffffffffffffffff161461201a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161201190613bdd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561208a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208190613a3d565b60405180910390fd5b612093816125d3565b50565b600081600001549050919050565b6001816000016000828254019250508190555050565b600080823b905060008111915050919050565b6000826120da8584612a55565b1490509392505050565b6120fe828260405180602001604052806000815250612aab565b5050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661225383611668565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006122a48261216c565b6122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da90613abd565b60405180910390fd5b60006122ee83611668565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061235d57508373ffffffffffffffffffffffffffffffffffffffff1661234584610cd6565b73ffffffffffffffffffffffffffffffffffffffff16145b8061236e575061236d8185611e74565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661239782611668565b73ffffffffffffffffffffffffffffffffffffffff16146123ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123e490613c1d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561245d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245490613a7d565b60405180910390fd5b612468838383612b06565b6124736000826121e0565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546124c39190613e89565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461251a9190613e02565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612708576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126ff90613a9d565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516127f991906139c5565b60405180910390a3505050565b612811848484612377565b61281d84848484612b0b565b61285c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161285390613a1d565b60405180910390fd5b50505050565b60606008805461287190613f8f565b80601f016020809104026020016040519081016040528092919081815260200182805461289d90613f8f565b80156128ea5780601f106128bf576101008083540402835291602001916128ea565b820191906000526020600020905b8154815290600101906020018083116128cd57829003601f168201915b5050505050905090565b6060600082141561293c576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612a50565b600082905060005b6000821461296e57808061295790613ff2565b915050600a826129679190613e58565b9150612944565b60008167ffffffffffffffff81111561298a5761298961414c565b5b6040519080825280601f01601f1916602001820160405280156129bc5781602001600182028036833780820191505090505b5090505b60008514612a49576001826129d59190613e89565b9150600a856129e4919061405f565b60306129f09190613e02565b60f81b818381518110612a0657612a0561411d565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612a429190613e58565b94506129c0565b8093505050505b919050565b60008082905060005b8451811015612aa057612a8b82868381518110612a7e57612a7d61411d565b5b6020026020010151612ca2565b91508080612a9890613ff2565b915050612a5e565b508091505092915050565b612ab58383612ccd565b612ac26000848484612b0b565b612b01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612af890613a1d565b60405180910390fd5b505050565b505050565b6000612b2c8473ffffffffffffffffffffffffffffffffffffffff166120ba565b15612c95578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612b556121d8565b8786866040518563ffffffff1660e01b8152600401612b779493929190613979565b602060405180830381600087803b158015612b9157600080fd5b505af1925050508015612bc257506040513d601f19601f82011682018060405250810190612bbf9190613373565b60015b612c45573d8060008114612bf2576040519150601f19603f3d011682016040523d82523d6000602084013e612bf7565b606091505b50600081511415612c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c3490613a1d565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612c9a565b600190505b949350505050565b6000818310612cba57612cb58284612e9b565b612cc5565b612cc48383612e9b565b5b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d3490613b7d565b60405180910390fd5b612d468161216c565b15612d86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d7d90613a5d565b60405180910390fd5b612d9260008383612b06565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612de29190613e02565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600082600052816020526040600020905092915050565b828054612ebe90613f8f565b90600052602060002090601f016020900481019282612ee05760008555612f27565b82601f10612ef957805160ff1916838001178555612f27565b82800160010185558215612f27579182015b82811115612f26578251825591602001919060010190612f0b565b5b509050612f349190612f38565b5090565b5b80821115612f51576000816000905550600101612f39565b5090565b6000612f68612f6384613d3d565b613d18565b905082815260208101848484011115612f8457612f8361418a565b5b612f8f848285613f4d565b509392505050565b6000612faa612fa584613d6e565b613d18565b905082815260208101848484011115612fc657612fc561418a565b5b612fd1848285613f4d565b509392505050565b600081359050612fe881614731565b92915050565b60008083601f84011261300457613003614180565b5b8235905067ffffffffffffffff8111156130215761302061417b565b5b60208301915083602082028301111561303d5761303c614185565b5b9250929050565b60008135905061305381614748565b92915050565b6000813590506130688161475f565b92915050565b60008135905061307d81614776565b92915050565b60008151905061309281614776565b92915050565b600082601f8301126130ad576130ac614180565b5b81356130bd848260208601612f55565b91505092915050565b600082601f8301126130db576130da614180565b5b81356130eb848260208601612f97565b91505092915050565b6000813590506131038161478d565b92915050565b60006020828403121561311f5761311e614194565b5b600061312d84828501612fd9565b91505092915050565b6000806040838503121561314d5761314c614194565b5b600061315b85828601612fd9565b925050602061316c85828601612fd9565b9150509250929050565b60008060006060848603121561318f5761318e614194565b5b600061319d86828701612fd9565b93505060206131ae86828701612fd9565b92505060406131bf868287016130f4565b9150509250925092565b600080600080608085870312156131e3576131e2614194565b5b60006131f187828801612fd9565b945050602061320287828801612fd9565b9350506040613213878288016130f4565b925050606085013567ffffffffffffffff8111156132345761323361418f565b5b61324087828801613098565b91505092959194509250565b6000806040838503121561326357613262614194565b5b600061327185828601612fd9565b925050602061328285828601613044565b9150509250929050565b600080604083850312156132a3576132a2614194565b5b60006132b185828601612fd9565b92505060206132c2858286016130f4565b9150509250929050565b600080602083850312156132e3576132e2614194565b5b600083013567ffffffffffffffff8111156133015761330061418f565b5b61330d85828601612fee565b92509250509250929050565b60006020828403121561332f5761332e614194565b5b600061333d84828501613059565b91505092915050565b60006020828403121561335c5761335b614194565b5b600061336a8482850161306e565b91505092915050565b60006020828403121561338957613388614194565b5b600061339784828501613083565b91505092915050565b6000602082840312156133b6576133b5614194565b5b600082013567ffffffffffffffff8111156133d4576133d361418f565b5b6133e0848285016130c6565b91505092915050565b6000602082840312156133ff576133fe614194565b5b600061340d848285016130f4565b91505092915050565b61341f81613ecf565b82525050565b61342e81613ebd565b82525050565b61344561344082613ebd565b61403b565b82525050565b61345481613ee1565b82525050565b61346381613eed565b82525050565b600061347482613db4565b61347e8185613dca565b935061348e818560208601613f5c565b61349781614199565b840191505092915050565b60006134ad82613dbf565b6134b78185613de6565b93506134c7818560208601613f5c565b6134d081614199565b840191505092915050565b60006134e682613dbf565b6134f08185613df7565b9350613500818560208601613f5c565b80840191505092915050565b6000815461351981613f8f565b6135238186613df7565b9450600182166000811461353e576001811461354f57613582565b60ff19831686528186019350613582565b61355885613d9f565b60005b8381101561357a5781548189015260018201915060208101905061355b565b838801955050505b50505092915050565b6000613598603283613de6565b91506135a3826141b7565b604082019050919050565b60006135bb602683613de6565b91506135c682614206565b604082019050919050565b60006135de601c83613de6565b91506135e982614255565b602082019050919050565b6000613601602483613de6565b915061360c8261427e565b604082019050919050565b6000613624601983613de6565b915061362f826142cd565b602082019050919050565b6000613647602c83613de6565b9150613652826142f6565b604082019050919050565b600061366a603883613de6565b915061367582614345565b604082019050919050565b600061368d602a83613de6565b915061369882614394565b604082019050919050565b60006136b0602983613de6565b91506136bb826143e3565b604082019050919050565b60006136d3601a83613de6565b91506136de82614432565b602082019050919050565b60006136f6601683613de6565b91506137018261445b565b602082019050919050565b6000613719602083613de6565b915061372482614484565b602082019050919050565b600061373c601a83613de6565b9150613747826144ad565b602082019050919050565b600061375f602c83613de6565b915061376a826144d6565b604082019050919050565b6000613782602083613de6565b915061378d82614525565b602082019050919050565b60006137a5601783613de6565b91506137b08261454e565b602082019050919050565b60006137c8602983613de6565b91506137d382614577565b604082019050919050565b60006137eb602f83613de6565b91506137f6826145c6565b604082019050919050565b600061380e602183613de6565b915061381982614615565b604082019050919050565b6000613831600083613ddb565b915061383c82614664565b600082019050919050565b6000613854603183613de6565b915061385f82614667565b604082019050919050565b6000613877601b83613de6565b9150613882826146b6565b602082019050919050565b600061389a601b83613de6565b91506138a5826146df565b602082019050919050565b60006138bd601f83613de6565b91506138c882614708565b602082019050919050565b6138dc81613f43565b82525050565b60006138ee8284613434565b60148201915081905092915050565b600061390982866134db565b915061391582856134db565b9150613921828461350c565b9150819050949350505050565b600061393982613824565b9150819050919050565b60006020820190506139586000830184613425565b92915050565b60006020820190506139736000830184613416565b92915050565b600060808201905061398e6000830187613425565b61399b6020830186613425565b6139a860408301856138d3565b81810360608301526139ba8184613469565b905095945050505050565b60006020820190506139da600083018461344b565b92915050565b60006020820190506139f5600083018461345a565b92915050565b60006020820190508181036000830152613a1581846134a2565b905092915050565b60006020820190508181036000830152613a368161358b565b9050919050565b60006020820190508181036000830152613a56816135ae565b9050919050565b60006020820190508181036000830152613a76816135d1565b9050919050565b60006020820190508181036000830152613a96816135f4565b9050919050565b60006020820190508181036000830152613ab681613617565b9050919050565b60006020820190508181036000830152613ad68161363a565b9050919050565b60006020820190508181036000830152613af68161365d565b9050919050565b60006020820190508181036000830152613b1681613680565b9050919050565b60006020820190508181036000830152613b36816136a3565b9050919050565b60006020820190508181036000830152613b56816136c6565b9050919050565b60006020820190508181036000830152613b76816136e9565b9050919050565b60006020820190508181036000830152613b968161370c565b9050919050565b60006020820190508181036000830152613bb68161372f565b9050919050565b60006020820190508181036000830152613bd681613752565b9050919050565b60006020820190508181036000830152613bf681613775565b9050919050565b60006020820190508181036000830152613c1681613798565b9050919050565b60006020820190508181036000830152613c36816137bb565b9050919050565b60006020820190508181036000830152613c56816137de565b9050919050565b60006020820190508181036000830152613c7681613801565b9050919050565b60006020820190508181036000830152613c9681613847565b9050919050565b60006020820190508181036000830152613cb68161386a565b9050919050565b60006020820190508181036000830152613cd68161388d565b9050919050565b60006020820190508181036000830152613cf6816138b0565b9050919050565b6000602082019050613d1260008301846138d3565b92915050565b6000613d22613d33565b9050613d2e8282613fc1565b919050565b6000604051905090565b600067ffffffffffffffff821115613d5857613d5761414c565b5b613d6182614199565b9050602081019050919050565b600067ffffffffffffffff821115613d8957613d8861414c565b5b613d9282614199565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000613e0d82613f43565b9150613e1883613f43565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613e4d57613e4c614090565b5b828201905092915050565b6000613e6382613f43565b9150613e6e83613f43565b925082613e7e57613e7d6140bf565b5b828204905092915050565b6000613e9482613f43565b9150613e9f83613f43565b925082821015613eb257613eb1614090565b5b828203905092915050565b6000613ec882613f23565b9050919050565b6000613eda82613f23565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613f7a578082015181840152602081019050613f5f565b83811115613f89576000848401525b50505050565b60006002820490506001821680613fa757607f821691505b60208210811415613fbb57613fba6140ee565b5b50919050565b613fca82614199565b810181811067ffffffffffffffff82111715613fe957613fe861414c565b5b80604052505050565b6000613ffd82613f43565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156140305761402f614090565b5b600182019050919050565b60006140468261404d565b9050919050565b6000614058826141aa565b9050919050565b600061406a82613f43565b915061407583613f43565b925082614085576140846140bf565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f436f6c6c6162206d696e74696e67206e6f742073746172746564000000000000600082015250565b7f4f47206d696e74696e67206e6f74207374617274656400000000000000000000600082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f5075626c6963206d696e74696e67206e6f742073746172746564000000000000600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4164647265737320616c726561647920636c61696d6564000000000000000000600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f496e76616c6964204d65726b6c652070726f6f6620666f72204f470000000000600082015250565b7f4d617820737570706c7920686173206265656e20726561636865640000000000600082015250565b7f496e76616c6964204d65726b6c652070726f6f6620666f7220436f6c6c616200600082015250565b61473a81613ebd565b811461474557600080fd5b50565b61475181613ee1565b811461475c57600080fd5b50565b61476881613eed565b811461477357600080fd5b50565b61477f81613ef7565b811461478a57600080fd5b50565b61479681613f43565b81146147a157600080fd5b5056fea2646970667358221220fa2e6020658fa404d45cdd29a6b81a15bb8858cf43a847224d2392a51c9edc5764736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: No
main.sol 1672 lines
// This contract is part of Zellic’s smart contract dataset, which is a collection of publicly available contract code gathered as of March 2023.
// SPDX-License-Identifier: MIT
// Author: Red
// Genesis
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts v4.4.1 (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)
}
}
}
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length)
internal
pure
returns (string memory)
{
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.0 (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;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.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 `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.0 (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);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId)
external
view
returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @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);
}
// File: @openzeppelin/contracts/token/ERC721/ERC721.sol
// OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @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
virtual
override
returns (uint256)
{
require(
owner != address(0),
"ERC721: balance query for the zero address"
);
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId)
public
view
virtual
override
returns (address)
{
address owner = _owners[tokenId];
require(
owner != address(0),
"ERC721: owner query for nonexistent token"
);
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
require(
_exists(tokenId),
"ERC721: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
_setApprovalForAll(_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 {
//solhint-disable-next-line max-line-length
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_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 {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_safeTransfer(from, to, tokenId, _data);
}
/**
* @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.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
require(
_exists(tokenId),
"ERC721: operator query for nonexistent token"
);
address owner = ERC721.ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* 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
) internal virtual {
require(
ERC721.ownerOf(tokenId) == from,
"ERC721: transfer of token that is not own"
);
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert(
"ERC721: transfer to non ERC721Receiver implementer"
);
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* 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, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
// File: contracts/NFT.sol
pragma solidity ^0.8.0;
contract NFT_ERC721 is ERC721, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenSupply;
using Strings for uint256;
string baseURI = "ipfs://QmPWckBjpmQSTGXMzMsez91ayKGbGjonJ2cTe2ms3iTzig/";
string public baseExtension = ".json";
uint256 public maxSupply = 1000;
bool public revealed = false;
string public notRevealedUri =
"ipfs://QmPWckBjpmQSTGXMzMsez91ayKGbGjonJ2cTe2ms3iTzig/hidden.json";
address payable public payments;
bytes32 public merkleRootOG =
0x3b0da7204ced669c3d8054621fa567e585f035b8583353fdc65d4d7a3aa7ffe4;
bytes32 public merkleRootCollab =
0x1515793cdc55dc782b4e6dd8c5bd013d8eb53973bcf7752abf2b167194b85b67;
// Phase 1 (OG & Partners): October 23, 8:30AM UTC / 4:30AM EST
// Phase 2 (Collabs): October 23, 4PM UTC / 12PM EST
// Phase 3 (Public): October 23, 7PM UTC / 3PM EST
uint256 public OGStartTime = 1666513800;
uint256 public collabStartTime = 1666540800;
uint256 public publicStartTime = 1666551600;
mapping(address => bool) public mintClaimed;
constructor() ERC721("Mandala Regens", "Regens") {
uint256 supply = _tokenSupply.current();
for (uint256 i = 0; i < 25; i++) {
_tokenSupply.increment();
_safeMint(0x809bFD2E376BF2E4C53F352B8bF07c812662f588, supply + i);
}
}
// internal
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
// public
function OGMint(bytes32[] calldata _merkleProof) public payable {
require(block.timestamp > OGStartTime, "OG minting not started");
uint256 supply = _tokenSupply.current();
require(supply + 1 <= maxSupply, "Max supply has been reached");
require(!mintClaimed[msg.sender], "Address already claimed");
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
require(
MerkleProof.verify(_merkleProof, merkleRootOG, leaf),
"Invalid Merkle proof for OG"
);
mintClaimed[msg.sender] = true;
_tokenSupply.increment();
_safeMint(msg.sender, supply);
}
function collabMint(bytes32[] calldata _merkleProof) public payable {
require(
block.timestamp > collabStartTime,
"Collab minting not started"
);
uint256 supply = _tokenSupply.current();
require(supply + 1 <= maxSupply, "Max supply has been reached");
require(!mintClaimed[msg.sender], "Address already claimed");
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
require(
MerkleProof.verify(_merkleProof, merkleRootOG, leaf),
"Invalid Merkle proof for Collab"
);
mintClaimed[msg.sender] = true;
_tokenSupply.increment();
_safeMint(msg.sender, supply);
}
function publicMint()...
// [truncated — 52505 bytes total]
Read Contract
OGStartTime 0xaafdff7c → uint256
balanceOf 0x70a08231 → uint256
baseExtension 0xc6682862 → string
collabStartTime 0x2018e884 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxSupply 0xd5abeb01 → uint256
merkleRootCollab 0x970703d0 → bytes32
merkleRootOG 0xad6cb319 → bytes32
mintClaimed 0x1237e5e8 → bool
name 0x06fdde03 → string
notRevealedUri 0x081c8c44 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
payments 0xa6d23e10 → address
publicStartTime 0x5fd1bbc4 → uint256
revealed 0x51830227 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 20 functions
These functions modify contract state and require a wallet transaction to execute.
OGMint 0x0186d137
bytes32[] _merkleProof
approve 0x095ea7b3
address to
uint256 tokenId
collabMint 0x4704b677
bytes32[] _merkleProof
publicMint 0x26092b83
No parameters
renounceOwnership 0x715018a6
No parameters
reveal 0xa475b5dd
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
setBaseExtension 0xda3ef23f
string _newBaseExtension
setBaseURI 0x55f804b3
string _newBaseURI
setCollabStartTime 0x1c7e49b5
uint256 _collabStartTime
setMerkleRootCollab 0xe514c7e1
bytes32 _merkleRoot
setMerkleRootOG 0xa58fdc11
bytes32 _merkleRoot
setNotRevealedURI 0xf2c4ce1e
string _notRevealedURI
setOGStartTime 0x203b1581
uint256 _OGStartTime
setPublicStartTime 0xdb8cc8fa
uint256 _publicStartTime
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address