Address Contract Verified
Address
0x988d49616DeBE09Ebd0D7E6869c36F2e66582219
Balance
0 ETH
Nonce
1
Code Size
20114 bytes
Creator
0xfaE6f05f...C693 at tx 0x57c167b4...58b8e9
Indexed Transactions
0
Contract Bytecode
20114 bytes
0x6080604052600436106102675760003560e01c80635c975abb11610144578063b88d4fde116100b6578063d5abeb011161007a578063d5abeb01146108fe578063d936547e14610929578063da3ef23f14610966578063e985e9c51461098f578063f2c4ce1e146109cc578063f2fde38b146109f557610267565b8063b88d4fde14610819578063ba7d2c7614610842578063c66828621461086d578063c87b56dd14610898578063d0eb26b0146108d557610267565b80638da5cb5b116101085780638da5cb5b1461073c57806395d89b41146107675780639c70b51214610792578063a0712d68146107bd578063a22cb465146107d9578063a475b5dd1461080257610267565b80635c975abb146106575780636352211e1461068257806370a08231146106bf578063715018a6146106fc5780637f00c7a61461071357610267565b80632f745c59116101dd578063438b6300116101a1578063438b63001461053757806344a0d68a146105745780634a4c560d1461059d5780634f6ccce7146105c6578063518302271461060357806355f804b31461062e57610267565b80632f745c591461047557806330cc7ae0146104b25780633c952764146104db5780633ccfd60b1461050457806342842e0e1461050e57610267565b8063095ea7b31161022f578063095ea7b31461036557806313faede61461038e57806318160ddd146103b957806318cae269146103e4578063239c70ae1461042157806323b872dd1461044c57610267565b806301ffc9a71461026c57806302329a29146102a957806306fdde03146102d2578063081812fc146102fd578063081c8c441461033a575b600080fd5b34801561027857600080fd5b50610293600480360381019061028e919061383f565b610a1e565b6040516102a09190613f40565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190613812565b610a98565b005b3480156102de57600080fd5b506102e7610b31565b6040516102f49190613f5b565b60405180910390f35b34801561030957600080fd5b50610324600480360381019061031f91906138e2565b610bc3565b6040516103319190613eb7565b60405180910390f35b34801561034657600080fd5b5061034f610c48565b60405161035c9190613f5b565b60405180910390f35b34801561037157600080fd5b5061038c600480360381019061038791906137d2565b610cd6565b005b34801561039a57600080fd5b506103a3610dee565b6040516103b0919061429d565b60405180910390f35b3480156103c557600080fd5b506103ce610df4565b6040516103db919061429d565b60405180910390f35b3480156103f057600080fd5b5061040b6004803603810190610406919061364f565b610e01565b604051610418919061429d565b60405180910390f35b34801561042d57600080fd5b50610436610e19565b604051610443919061429d565b60405180910390f35b34801561045857600080fd5b50610473600480360381019061046e91906136bc565b610e1f565b005b34801561048157600080fd5b5061049c600480360381019061049791906137d2565b610e7f565b6040516104a9919061429d565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d4919061364f565b610f24565b005b3480156104e757600080fd5b5061050260048036038101906104fd9190613812565b610ffb565b005b61050c611094565b005b34801561051a57600080fd5b50610535600480360381019061053091906136bc565b611190565b005b34801561054357600080fd5b5061055e6004803603810190610559919061364f565b6111b0565b60405161056b9190613f1e565b60405180910390f35b34801561058057600080fd5b5061059b600480360381019061059691906138e2565b61125e565b005b3480156105a957600080fd5b506105c460048036038101906105bf919061364f565b6112e4565b005b3480156105d257600080fd5b506105ed60048036038101906105e891906138e2565b6113bb565b6040516105fa919061429d565b60405180910390f35b34801561060f57600080fd5b5061061861142c565b6040516106259190613f40565b60405180910390f35b34801561063a57600080fd5b5061065560048036038101906106509190613899565b61143f565b005b34801561066357600080fd5b5061066c6114d5565b6040516106799190613f40565b60405180910390f35b34801561068e57600080fd5b506106a960048036038101906106a491906138e2565b6114e8565b6040516106b69190613eb7565b60405180910390f35b3480156106cb57600080fd5b506106e660048036038101906106e1919061364f565b61159a565b6040516106f3919061429d565b60405180910390f35b34801561070857600080fd5b50610711611652565b005b34801561071f57600080fd5b5061073a600480360381019061073591906138e2565b6116da565b005b34801561074857600080fd5b50610751611760565b60405161075e9190613eb7565b60405180910390f35b34801561077357600080fd5b5061077c61178a565b6040516107899190613f5b565b60405180910390f35b34801561079e57600080fd5b506107a761181c565b6040516107b49190613f40565b60405180910390f35b6107d760048036038101906107d291906138e2565b61182f565b005b3480156107e557600080fd5b5061080060048036038101906107fb9190613792565b611bbc565b005b34801561080e57600080fd5b50610817611bd2565b005b34801561082557600080fd5b50610840600480360381019061083b919061370f565b611c6b565b005b34801561084e57600080fd5b50610857611ccd565b604051610864919061429d565b60405180910390f35b34801561087957600080fd5b50610882611cd3565b60405161088f9190613f5b565b60405180910390f35b3480156108a457600080fd5b506108bf60048036038101906108ba91906138e2565b611d61565b6040516108cc9190613f5b565b60405180910390f35b3480156108e157600080fd5b506108fc60048036038101906108f791906138e2565b611eba565b005b34801561090a57600080fd5b50610913611f40565b604051610920919061429d565b60405180910390f35b34801561093557600080fd5b50610950600480360381019061094b919061364f565b611f46565b60405161095d9190613f40565b60405180910390f35b34801561097257600080fd5b5061098d60048036038101906109889190613899565b611f66565b005b34801561099b57600080fd5b506109b660048036038101906109b1919061367c565b611ffc565b6040516109c39190613f40565b60405180910390f35b3480156109d857600080fd5b506109f360048036038101906109ee9190613899565b612090565b005b348015610a0157600080fd5b50610a1c6004803603810190610a17919061364f565b612126565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610a915750610a908261221e565b5b9050919050565b610aa0612300565b73ffffffffffffffffffffffffffffffffffffffff16610abe611760565b73ffffffffffffffffffffffffffffffffffffffff1614610b14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0b9061417d565b60405180910390fd5b80601260006101000a81548160ff02191690831515021790555050565b606060008054610b40906145a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6c906145a6565b8015610bb95780601f10610b8e57610100808354040283529160200191610bb9565b820191906000526020600020905b815481529060010190602001808311610b9c57829003601f168201915b5050505050905090565b6000610bce82612308565b610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c049061415d565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600d8054610c55906145a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610c81906145a6565b8015610cce5780601f10610ca357610100808354040283529160200191610cce565b820191906000526020600020905b815481529060010190602001808311610cb157829003601f168201915b505050505081565b6000610ce1826114e8565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d499061421d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610d71612300565b73ffffffffffffffffffffffffffffffffffffffff161480610da05750610d9f81610d9a612300565b611ffc565b5b610ddf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd69061409d565b60405180910390fd5b610de98383612374565b505050565b600e5481565b6000600880549050905090565b60146020528060005260406000206000915090505481565b60105481565b610e30610e2a612300565b8261242d565b610e6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e669061423d565b60405180910390fd5b610e7a83838361250b565b505050565b6000610e8a8361159a565b8210610ecb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec290613f7d565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610f2c612300565b73ffffffffffffffffffffffffffffffffffffffff16610f4a611760565b73ffffffffffffffffffffffffffffffffffffffff1614610fa0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f979061417d565b60405180910390fd5b6000601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611003612300565b73ffffffffffffffffffffffffffffffffffffffff16611021611760565b73ffffffffffffffffffffffffffffffffffffffff1614611077576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106e9061417d565b60405180910390fd5b80601260026101000a81548160ff02191690831515021790555050565b61109c612300565b73ffffffffffffffffffffffffffffffffffffffff166110ba611760565b73ffffffffffffffffffffffffffffffffffffffff1614611110576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111079061417d565b60405180910390fd5b600061111a611760565b73ffffffffffffffffffffffffffffffffffffffff164760405161113d90613ea2565b60006040518083038185875af1925050503d806000811461117a576040519150601f19603f3d011682016040523d82523d6000602084013e61117f565b606091505b505090508061118d57600080fd5b50565b6111ab83838360405180602001604052806000815250611c6b565b505050565b606060006111bd8361159a565b905060008167ffffffffffffffff8111156111db576111da61476e565b5b6040519080825280602002602001820160405280156112095781602001602082028036833780820191505090505b50905060005b82811015611253576112218582610e7f565b8282815181106112345761123361473f565b5b602002602001018181525050808061124b90614609565b91505061120f565b508092505050919050565b611266612300565b73ffffffffffffffffffffffffffffffffffffffff16611284611760565b73ffffffffffffffffffffffffffffffffffffffff16146112da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d19061417d565b60405180910390fd5b80600e8190555050565b6112ec612300565b73ffffffffffffffffffffffffffffffffffffffff1661130a611760565b73ffffffffffffffffffffffffffffffffffffffff1614611360576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113579061417d565b60405180910390fd5b6001601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006113c5610df4565b8210611406576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113fd9061425d565b60405180910390fd5b6008828154811061141a5761141961473f565b5b90600052602060002001549050919050565b601260019054906101000a900460ff1681565b611447612300565b73ffffffffffffffffffffffffffffffffffffffff16611465611760565b73ffffffffffffffffffffffffffffffffffffffff16146114bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b29061417d565b60405180910390fd5b80600b90805190602001906114d1929190613463565b5050565b601260009054906101000a900460ff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611591576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611588906140dd565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561160b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611602906140bd565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61165a612300565b73ffffffffffffffffffffffffffffffffffffffff16611678611760565b73ffffffffffffffffffffffffffffffffffffffff16146116ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c59061417d565b60405180910390fd5b6116d86000612767565b565b6116e2612300565b73ffffffffffffffffffffffffffffffffffffffff16611700611760565b73ffffffffffffffffffffffffffffffffffffffff1614611756576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174d9061417d565b60405180910390fd5b8060108190555050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054611799906145a6565b80601f01602080910402602001604051908101604052809291908181526020018280546117c5906145a6565b80156118125780601f106117e757610100808354040283529160200191611812565b820191906000526020600020905b8154815290600101906020018083116117f557829003601f168201915b5050505050905090565b601260029054906101000a900460ff1681565b601260009054906101000a900460ff161561187f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118769061419d565b60405180910390fd5b6000611889610df4565b9050600082116118ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c59061427d565b60405180910390fd5b601054821115611913576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190a9061411d565b60405180910390fd5b600f54828261192291906143db565b1115611963576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195a906140fd565b60405180910390fd5b61196b611760565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b2c5760011515601260029054906101000a900460ff1615151415611adb57601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611a45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3c9061407d565b60405180910390fd5b6000601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506011548382611a9891906143db565b1115611ad9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ad0906141fd565b60405180910390fd5b505b81600e54611ae99190614462565b341015611b2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b229061405d565b60405180910390fd5b5b6000600190505b828111611bb757601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b8a90614609565b9190505550611ba4338284611b9f91906143db565b61282d565b8080611baf90614609565b915050611b33565b505050565b611bce611bc7612300565b838361284b565b5050565b611bda612300565b73ffffffffffffffffffffffffffffffffffffffff16611bf8611760565b73ffffffffffffffffffffffffffffffffffffffff1614611c4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c459061417d565b60405180910390fd5b6001601260016101000a81548160ff021916908315150217905550565b611c7c611c76612300565b8361242d565b611cbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cb29061423d565b60405180910390fd5b611cc7848484846129b8565b50505050565b60115481565b600c8054611ce0906145a6565b80601f0160208091040260200160405190810160405280929190818152602001828054611d0c906145a6565b8015611d595780601f10611d2e57610100808354040283529160200191611d59565b820191906000526020600020905b815481529060010190602001808311611d3c57829003601f168201915b505050505081565b6060611d6c82612308565b611dab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da2906141dd565b60405180910390fd5b60001515601260019054906101000a900460ff1615151415611e5957600d8054611dd4906145a6565b80601f0160208091040260200160405190810160405280929190818152602001828054611e00906145a6565b8015611e4d5780601f10611e2257610100808354040283529160200191611e4d565b820191906000526020600020905b815481529060010190602001808311611e3057829003601f168201915b50505050509050611eb5565b6000611e63612a14565b90506000815111611e835760405180602001604052806000815250611eb1565b80611e8d84612aa6565b600c604051602001611ea193929190613e71565b6040516020818303038152906040525b9150505b919050565b611ec2612300565b73ffffffffffffffffffffffffffffffffffffffff16611ee0611760565b73ffffffffffffffffffffffffffffffffffffffff1614611f36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f2d9061417d565b60405180910390fd5b8060118190555050565b600f5481565b60136020528060005260406000206000915054906101000a900460ff1681565b611f6e612300565b73ffffffffffffffffffffffffffffffffffffffff16611f8c611760565b73ffffffffffffffffffffffffffffffffffffffff1614611fe2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd99061417d565b60405180910390fd5b80600c9080519060200190611ff8929190613463565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b612098612300565b73ffffffffffffffffffffffffffffffffffffffff166120b6611760565b73ffffffffffffffffffffffffffffffffffffffff161461210c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121039061417d565b60405180910390fd5b80600d9080519060200190612122929190613463565b5050565b61212e612300565b73ffffffffffffffffffffffffffffffffffffffff1661214c611760565b73ffffffffffffffffffffffffffffffffffffffff16146121a2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121999061417d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612212576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161220990613fbd565b60405180910390fd5b61221b81612767565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806122e957507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806122f957506122f882612c07565b5b9050919050565b600033905090565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166123e7836114e8565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061243882612308565b612477576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161246e9061403d565b60405180910390fd5b6000612482836114e8565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806124f157508373ffffffffffffffffffffffffffffffffffffffff166124d984610bc3565b73ffffffffffffffffffffffffffffffffffffffff16145b8061250257506125018185611ffc565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661252b826114e8565b73ffffffffffffffffffffffffffffffffffffffff1614612581576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612578906141bd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156125f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e890613ffd565b60405180910390fd5b6125fc838383612c71565b612607600082612374565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461265791906144bc565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546126ae91906143db565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612847828260405180602001604052806000815250612d85565b5050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156128ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128b19061401d565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516129ab9190613f40565b60405180910390a3505050565b6129c384848461250b565b6129cf84848484612de0565b612a0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a0590613f9d565b60405180910390fd5b50505050565b6060600b8054612a23906145a6565b80601f0160208091040260200160405190810160405280929190818152602001828054612a4f906145a6565b8015612a9c5780601f10612a7157610100808354040283529160200191612a9c565b820191906000526020600020905b815481529060010190602001808311612a7f57829003601f168201915b5050505050905090565b60606000821415612aee576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612c02565b600082905060005b60008214612b20578080612b0990614609565b915050600a82612b199190614431565b9150612af6565b60008167ffffffffffffffff811115612b3c57612b3b61476e565b5b6040519080825280601f01601f191660200182016040528015612b6e5781602001600182028036833780820191505090505b5090505b60008514612bfb57600182612b8791906144bc565b9150600a85612b969190614652565b6030612ba291906143db565b60f81b818381518110612bb857612bb761473f565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612bf49190614431565b9450612b72565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612c7c838383612f77565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612cbf57612cba81612f7c565b612cfe565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612cfd57612cfc8382612fc5565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612d4157612d3c81613132565b612d80565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612d7f57612d7e8282613203565b5b5b505050565b612d8f8383613282565b612d9c6000848484612de0565b612ddb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dd290613f9d565b60405180910390fd5b505050565b6000612e018473ffffffffffffffffffffffffffffffffffffffff16613450565b15612f6a578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612e2a612300565b8786866040518563ffffffff1660e01b8152600401612e4c9493929190613ed2565b602060405180830381600087803b158015612e6657600080fd5b505af1925050508015612e9757506040513d601f19601f82011682018060405250810190612e94919061386c565b60015b612f1a573d8060008114612ec7576040519150601f19603f3d011682016040523d82523d6000602084013e612ecc565b606091505b50600081511415612f12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f0990613f9d565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612f6f565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001612fd28461159a565b612fdc91906144bc565b90506000600760008481526020019081526020016000205490508181146130c1576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b6000600160088054905061314691906144bc565b90506000600960008481526020019081526020016000205490506000600883815481106131765761317561473f565b5b9060005260206000200154905080600883815481106131985761319761473f565b5b9060005260206000200181905550816009600083815260200190815260200160002081905550600960008581526020019081526020016000206000905560088054806131e7576131e6614710565b5b6001900381819060005260206000200160009055905550505050565b600061320e8361159a565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156132f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132e99061413d565b60405180910390fd5b6132fb81612308565b1561333b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161333290613fdd565b60405180910390fd5b61334760008383612c71565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461339791906143db565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b82805461346f906145a6565b90600052602060002090601f01602090048101928261349157600085556134d8565b82601f106134aa57805160ff19168380011785556134d8565b828001600101855582156134d8579182015b828111156134d75782518255916020019190600101906134bc565b5b5090506134e591906134e9565b5090565b5b808211156135025760008160009055506001016134ea565b5090565b6000613519613514846142dd565b6142b8565b905082815260208101848484011115613535576135346147a2565b5b613540848285614564565b509392505050565b600061355b6135568461430e565b6142b8565b905082815260208101848484011115613577576135766147a2565b5b613582848285614564565b509392505050565b60008135905061359981614e00565b92915050565b6000813590506135ae81614e17565b92915050565b6000813590506135c381614e2e565b92915050565b6000815190506135d881614e2e565b92915050565b600082601f8301126135f3576135f261479d565b5b8135613603848260208601613506565b91505092915050565b600082601f8301126136215761362061479d565b5b8135613631848260208601613548565b91505092915050565b60008135905061364981614e45565b92915050565b600060208284031215613665576136646147ac565b5b60006136738482850161358a565b91505092915050565b60008060408385031215613693576136926147ac565b5b60006136a18582860161358a565b92505060206136b28582860161358a565b9150509250929050565b6000806000606084860312156136d5576136d46147ac565b5b60006136e38682870161358a565b93505060206136f48682870161358a565b92505060406137058682870161363a565b9150509250925092565b60008060008060808587031215613729576137286147ac565b5b60006137378782880161358a565b94505060206137488782880161358a565b93505060406137598782880161363a565b925050606085013567ffffffffffffffff81111561377a576137796147a7565b5b613786878288016135de565b91505092959194509250565b600080604083850312156137a9576137a86147ac565b5b60006137b78582860161358a565b92505060206137c88582860161359f565b9150509250929050565b600080604083850312156137e9576137e86147ac565b5b60006137f78582860161358a565b92505060206138088582860161363a565b9150509250929050565b600060208284031215613828576138276147ac565b5b60006138368482850161359f565b91505092915050565b600060208284031215613855576138546147ac565b5b6000613863848285016135b4565b91505092915050565b600060208284031215613882576138816147ac565b5b6000613890848285016135c9565b91505092915050565b6000602082840312156138af576138ae6147ac565b5b600082013567ffffffffffffffff8111156138cd576138cc6147a7565b5b6138d98482850161360c565b91505092915050565b6000602082840312156138f8576138f76147ac565b5b60006139068482850161363a565b91505092915050565b600061391b8383613e53565b60208301905092915050565b613930816144f0565b82525050565b600061394182614364565b61394b8185614392565b93506139568361433f565b8060005b8381101561398757815161396e888261390f565b975061397983614385565b92505060018101905061395a565b5085935050505092915050565b61399d81614502565b82525050565b60006139ae8261436f565b6139b881856143a3565b93506139c8818560208601614573565b6139d1816147b1565b840191505092915050565b60006139e78261437a565b6139f181856143bf565b9350613a01818560208601614573565b613a0a816147b1565b840191505092915050565b6000613a208261437a565b613a2a81856143d0565b9350613a3a818560208601614573565b80840191505092915050565b60008154613a53816145a6565b613a5d81866143d0565b94506001821660008114613a785760018114613a8957613abc565b60ff19831686528186019350613abc565b613a928561434f565b60005b83811015613ab457815481890152600182019150602081019050613a95565b838801955050505b50505092915050565b6000613ad2602b836143bf565b9150613add826147c2565b604082019050919050565b6000613af56032836143bf565b9150613b0082614811565b604082019050919050565b6000613b186026836143bf565b9150613b2382614860565b604082019050919050565b6000613b3b601c836143bf565b9150613b46826148af565b602082019050919050565b6000613b5e6024836143bf565b9150613b69826148d8565b604082019050919050565b6000613b816019836143bf565b9150613b8c82614927565b602082019050919050565b6000613ba4602c836143bf565b9150613baf82614950565b604082019050919050565b6000613bc76012836143bf565b9150613bd28261499f565b602082019050919050565b6000613bea6017836143bf565b9150613bf5826149c8565b602082019050919050565b6000613c0d6038836143bf565b9150613c18826149f1565b604082019050919050565b6000613c30602a836143bf565b9150613c3b82614a40565b604082019050919050565b6000613c536029836143bf565b9150613c5e82614a8f565b604082019050919050565b6000613c766016836143bf565b9150613c8182614ade565b602082019050919050565b6000613c996024836143bf565b9150613ca482614b07565b604082019050919050565b6000613cbc6020836143bf565b9150613cc782614b56565b602082019050919050565b6000613cdf602c836143bf565b9150613cea82614b7f565b604082019050919050565b6000613d026020836143bf565b9150613d0d82614bce565b602082019050919050565b6000613d256016836143bf565b9150613d3082614bf7565b602082019050919050565b6000613d486029836143bf565b9150613d5382614c20565b604082019050919050565b6000613d6b602f836143bf565b9150613d7682614c6f565b604082019050919050565b6000613d8e601c836143bf565b9150613d9982614cbe565b602082019050919050565b6000613db16021836143bf565b9150613dbc82614ce7565b604082019050919050565b6000613dd46000836143b4565b9150613ddf82614d36565b600082019050919050565b6000613df76031836143bf565b9150613e0282614d39565b604082019050919050565b6000613e1a602c836143bf565b9150613e2582614d88565b604082019050919050565b6000613e3d601b836143bf565b9150613e4882614dd7565b602082019050919050565b613e5c8161455a565b82525050565b613e6b8161455a565b82525050565b6000613e7d8286613a15565b9150613e898285613a15565b9150613e958284613a46565b9150819050949350505050565b6000613ead82613dc7565b9150819050919050565b6000602082019050613ecc6000830184613927565b92915050565b6000608082019050613ee76000830187613927565b613ef46020830186613927565b613f016040830185613e62565b8181036060830152613f1381846139a3565b905095945050505050565b60006020820190508181036000830152613f388184613936565b905092915050565b6000602082019050613f556000830184613994565b92915050565b60006020820190508181036000830152613f7581846139dc565b905092915050565b60006020820190508181036000830152613f9681613ac5565b9050919050565b60006020820190508181036000830152613fb681613ae8565b9050919050565b60006020820190508181036000830152613fd681613b0b565b9050919050565b60006020820190508181036000830152613ff681613b2e565b9050919050565b6000602082019050818103600083015261401681613b51565b9050919050565b6000602082019050818103600083015261403681613b74565b9050919050565b6000602082019050818103600083015261405681613b97565b9050919050565b6000602082019050818103600083015261407681613bba565b9050919050565b6000602082019050818103600083015261409681613bdd565b9050919050565b600060208201905081810360008301526140b681613c00565b9050919050565b600060208201905081810360008301526140d681613c23565b9050919050565b600060208201905081810360008301526140f681613c46565b9050919050565b6000602082019050818103600083015261411681613c69565b9050919050565b6000602082019050818103600083015261413681613c8c565b9050919050565b6000602082019050818103600083015261415681613caf565b9050919050565b6000602082019050818103600083015261417681613cd2565b9050919050565b6000602082019050818103600083015261419681613cf5565b9050919050565b600060208201905081810360008301526141b681613d18565b9050919050565b600060208201905081810360008301526141d681613d3b565b9050919050565b600060208201905081810360008301526141f681613d5e565b9050919050565b6000602082019050818103600083015261421681613d81565b9050919050565b6000602082019050818103600083015261423681613da4565b9050919050565b6000602082019050818103600083015261425681613dea565b9050919050565b6000602082019050818103600083015261427681613e0d565b9050919050565b6000602082019050818103600083015261429681613e30565b9050919050565b60006020820190506142b26000830184613e62565b92915050565b60006142c26142d3565b90506142ce82826145d8565b919050565b6000604051905090565b600067ffffffffffffffff8211156142f8576142f761476e565b5b614301826147b1565b9050602081019050919050565b600067ffffffffffffffff8211156143295761432861476e565b5b614332826147b1565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006143e68261455a565b91506143f18361455a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561442657614425614683565b5b828201905092915050565b600061443c8261455a565b91506144478361455a565b925082614457576144566146b2565b5b828204905092915050565b600061446d8261455a565b91506144788361455a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156144b1576144b0614683565b5b828202905092915050565b60006144c78261455a565b91506144d28361455a565b9250828210156144e5576144e4614683565b5b828203905092915050565b60006144fb8261453a565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015614591578082015181840152602081019050614576565b838111156145a0576000848401525b50505050565b600060028204905060018216806145be57607f821691505b602082108114156145d2576145d16146e1565b5b50919050565b6145e1826147b1565b810181811067ffffffffffffffff82111715614600576145ff61476e565b5b80604052505050565b60006146148261455a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561464757614646614683565b5b600182019050919050565b600061465d8261455a565b91506146688361455a565b925082614678576146776146b2565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f496e73756666696369656e742066756e64730000000000000000000000000000600082015250565b7f55736572206973206e6f742077686974656c6973746564000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f6d6178204e4654206c696d697420657863656564656400000000000000000000600082015250565b7f6d6178206d696e7420616d6f756e74207065722073657373696f6e206578636560008201527f6564656400000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f74686520636f6e74726163742069732070617573656400000000000000000000600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4d6178204e465420706572206164647265737320657863656564656400000000600082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f6e65656420746f206d696e74206174206c656173742031204e46540000000000600082015250565b614e09816144f0565b8114614e1457600080fd5b50565b614e2081614502565b8114614e2b57600080fd5b50565b614e378161450e565b8114614e4257600080fd5b50565b614e4e8161455a565b8114614e5957600080fd5b5056fea2646970667358221220b6c552b575691d504656ef9fe0f118bd0af84c9ae1df3189546ebbbbc983933064736f6c63430008070033
Verified Source Code Full Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: No
testing.sol 1428 lines
// SPDX-License-Identifier: GPL-3.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/IERC721Enumerable.sol
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
// 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: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/ERC721Enumerable.sol)
pragma solidity ^0.8.0;
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @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` cannot be the zero address.
* - `to` cannot be the zero address.
*
* 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 override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
// File: contracts/tft123.sol
pragma solidity >=0.7.0 <0.9.0;
contract test1 is ERC721Enumerable, Ownable {
using Strings for uint256;
string private baseURI;
string public baseExtension = ".json";
string public notRevealedUri;
uint256 public cost = 50000000 ether;
uint256 public maxSupply = 10000;
uint256 public maxMintAmount = 10;
uint256 public nftPerAddressLimit = 1000;
bool public paused = false;
bool public revealed = false;
bool public onlyWhitelisted = false;
mapping(address => bool) public whitelisted;
mapping(address => uint256) public addressMintedBalance;
constructor(
string memory _name,
string memory _symbol,
string memory _initBaseURI,
string memory _initNotRevealedUri
) ERC721(_name, _symbol) {
setBaseURI(_initBaseURI);
setNotRevealedURI(_initNotRevealedUri);
}
// internal
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
// public
function mint(uint256 _mintAmount) public payable {
require(!paused, "the contract is paused");
uint256 supply = totalSupply();
require(_mintAmount > 0, "need to mint at least 1 NFT");
require(_mintAmount <= maxMintAmount, "max mint amount per session exceeded");
require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded");
if (msg.sender != owner()) {
if(onlyWhitelisted == true) {
require(whitelisted[msg.sender], "User is not whitelisted");
uint256 ownerMintedCount = addressMintedBalance[msg.sender];
require(ownerMintedCount + _mintAmount <= nftPerAddressLimit, "Max NFT per address exceeded");
}
require(msg.value >= cost * _mintAmount, "Insufficient funds");
}
for (uint256 i = 1; i <= _mintAmount; i++) {
addressMintedBalance[msg.sender]++;
_safeMint(msg.sender, supply + i);
}
}
function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256[](ownerTokenCount);
for (uint256 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIds;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
if(revealed == false) {
return notRevealedUri;
}
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension))
: "";
}
//only owner
function reveal() public onlyOwner {
revealed = true;
}
function setNftPerAddressLimit(uint256 _limit) public onlyOwner {
nftPerAddressLimit = _limit;
}
function setCost(uint256 _newCost) public onlyOwner {
cost = _newCost;
}
function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner {
maxMintAmount = _newmaxMintAmount;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function setBaseExtension(string memory _newBaseExtension) public onlyOwner {
baseExtension = _newBaseExtension;
}
function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner {
notRevealedUri = _notRevealedURI;
}
function pause(bool _state) public onlyOwner {
paused = _state;
}
function setOnlyWhitelisted(bool _state) public onlyOwner {
onlyWhitelisted = _state;
}
function whitelistUser(address _user) public onlyOwner {
whitelisted[_user] = true;
}
function removeWhitelistUser(address _user) public onlyOwner {
whitelisted[_user] = false;
}
function withdraw() public payable onlyOwner {
(bool os, ) = payable(owner()).call{value: address(this).balance}("");
require(os);
}
}
Read Contract
addressMintedBalance 0x18cae269 → uint256
balanceOf 0x70a08231 → uint256
baseExtension 0xc6682862 → string
cost 0x13faede6 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxMintAmount 0x239c70ae → uint256
maxSupply 0xd5abeb01 → uint256
name 0x06fdde03 → string
nftPerAddressLimit 0xba7d2c76 → uint256
notRevealedUri 0x081c8c44 → string
onlyWhitelisted 0x9c70b512 → bool
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
revealed 0x51830227 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
whitelisted 0xd936547e → bool
Write Contract 20 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
mint 0xa0712d68
uint256 _mintAmount
pause 0x02329a29
bool _state
removeWhitelistUser 0x30cc7ae0
address _user
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
setCost 0x44a0d68a
uint256 _newCost
setNftPerAddressLimit 0xd0eb26b0
uint256 _limit
setNotRevealedURI 0xf2c4ce1e
string _notRevealedURI
setOnlyWhitelisted 0x3c952764
bool _state
setmaxMintAmount 0x7f00c7a6
uint256 _newmaxMintAmount
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistUser 0x4a4c560d
address _user
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address