Address Contract Verified
Address
0x33825285eB66c11237Cc68CC182c1e9BF01bA00B
Balance
0.005486 ETH
Nonce
1
Code Size
20953 bytes
Creator
0x875b1ce1...8Dd4 at tx 0xabebfa2e...6d27ab
Indexed Transactions
0
Contract Bytecode
20953 bytes
0x6080604052600436106102cc5760003560e01c8063715018a611610175578063ab0bcc41116100dc578063d5abeb0111610095578063e985e9c51161006f578063e985e9c514610a83578063eb73900b14610ac0578063ed74094614610afd578063f2fde38b14610b26576102d3565b8063d5abeb01146109f0578063dc1fb5a514610a1b578063e8e7426e14610a46576102d3565b8063ab0bcc41146108e0578063ac959f9f1461090b578063b88d4fde14610934578063bf0d96c31461095d578063c87b56dd14610988578063cce3c857146109c5576102d3565b806390ddedd51161012e57806390ddedd5146107d257806395d89b411461080f5780639727151a1461083a5780639abc832014610863578063a0bcfc7f1461088e578063a22cb465146108b7576102d3565b8063715018a61461072657806371699e3d1461073d57806377a9f5c61461076857806382554489146107725780638507bc321461079d5780638da5cb5b146107a7576102d3565b80633a51cd80116102345780634f558e79116101ed5780636352211e116101c75780636352211e1461065657806368bd580e146106935780636c143862146106be57806370a08231146106e9576102d3565b80634f558e79146105c357806354e584f6146106005780635a7adf7f1461062b576102d3565b80633a51cd80146104e65780633ccfd60b146105115780633d9287fa1461051b5780633e9755b21461054657806342842e0e1461057157806342966c681461059a576102d3565b80631f0439fd116102865780631f0439fd146103e85780632142ab29146103ff57806323b872dd1461042a578063240798681461045357806331ffd6f11461047e578063379c5131146104a9576102d3565b80620e7fa8146102d857806301ffc9a71461030357806306fdde0314610340578063081812fc1461036b578063095ea7b3146103a85780631d1468d4146103d1576102d3565b366102d357005b600080fd5b3480156102e457600080fd5b506102ed610b4f565b6040516102fa9190614629565b60405180910390f35b34801561030f57600080fd5b5061032a60048036038101906103259190613b75565b610b5a565b604051610337919061426c565b60405180910390f35b34801561034c57600080fd5b50610355610c3c565b6040516103629190614287565b60405180910390f35b34801561037757600080fd5b50610392600480360381019061038d9190613c44565b610cce565b60405161039f91906141ba565b60405180910390f35b3480156103b457600080fd5b506103cf60048036038101906103ca9190613a33565b610d53565b005b3480156103dd57600080fd5b506103e6610e6b565b005b3480156103f457600080fd5b506103fd610fa1565b005b34801561040b57600080fd5b5061041461103a565b6040516104219190614629565b60405180910390f35b34801561043657600080fd5b50610451600480360381019061044c919061392d565b611040565b005b34801561045f57600080fd5b506104686110a0565b6040516104759190614629565b60405180910390f35b34801561048a57600080fd5b506104936110a6565b6040516104a0919061426c565b60405180910390f35b3480156104b557600080fd5b506104d060048036038101906104cb91906138c8565b6110b9565b6040516104dd919061424a565b60405180910390f35b3480156104f257600080fd5b506104fb61129c565b60405161050891906141ba565b60405180910390f35b6105196112b3565b005b34801561052757600080fd5b506105306114a2565b60405161053d9190614629565b60405180910390f35b34801561055257600080fd5b5061055b6114a8565b604051610568919061426c565b60405180910390f35b34801561057d57600080fd5b506105986004803603810190610593919061392d565b6114bb565b005b3480156105a657600080fd5b506105c160048036038101906105bc9190613c44565b6114db565b005b3480156105cf57600080fd5b506105ea60048036038101906105e59190613c44565b611537565b6040516105f7919061426c565b60405180910390f35b34801561060c57600080fd5b50610615611549565b604051610622919061426c565b60405180910390f35b34801561063757600080fd5b5061064061155c565b60405161064d919061426c565b60405180910390f35b34801561066257600080fd5b5061067d60048036038101906106789190613c44565b61156f565b60405161068a91906141ba565b60405180910390f35b34801561069f57600080fd5b506106a8611621565b6040516106b5919061426c565b60405180910390f35b3480156106ca57600080fd5b506106d3611634565b6040516106e09190614629565b60405180910390f35b3480156106f557600080fd5b50610710600480360381019061070b91906138c8565b611645565b60405161071d9190614629565b60405180910390f35b34801561073257600080fd5b5061073b6116fd565b005b34801561074957600080fd5b50610752611785565b60405161075f91906141ba565b60405180910390f35b61077061179d565b005b34801561077e57600080fd5b50610787611bc9565b604051610794919061426c565b60405180910390f35b6107a5611bdc565b005b3480156107b357600080fd5b506107bc611d5c565b6040516107c991906141ba565b60405180910390f35b3480156107de57600080fd5b506107f960048036038101906107f491906138c8565b611d86565b604051610806919061426c565b60405180910390f35b34801561081b57600080fd5b50610824611da6565b6040516108319190614287565b60405180910390f35b34801561084657600080fd5b50610861600480360381019061085c9190613bc7565b611e38565b005b34801561086f57600080fd5b50610878611f46565b6040516108859190614287565b60405180910390f35b34801561089a57600080fd5b506108b560048036038101906108b09190613c03565b611fd4565b005b3480156108c357600080fd5b506108de60048036038101906108d991906139f7565b6120ba565b005b3480156108ec57600080fd5b506108f561223b565b604051610902919061426c565b60405180910390f35b34801561091757600080fd5b50610932600480360381019061092d9190613aec565b61224e565b005b34801561094057600080fd5b5061095b6004803603810190610956919061397c565b61236e565b005b34801561096957600080fd5b506109726123d0565b60405161097f9190614629565b60405180910390f35b34801561099457600080fd5b506109af60048036038101906109aa9190613c44565b6123d6565b6040516109bc9190614287565b60405180910390f35b3480156109d157600080fd5b506109da61247d565b6040516109e791906141ba565b60405180910390f35b3480156109fc57600080fd5b50610a05612495565b604051610a129190614629565b60405180910390f35b348015610a2757600080fd5b50610a3061249b565b604051610a3d91906141ba565b60405180910390f35b348015610a5257600080fd5b50610a6d6004803603810190610a6891906138c8565b6124b3565b604051610a7a919061426c565b60405180910390f35b348015610a8f57600080fd5b50610aaa6004803603810190610aa591906138f1565b6124d3565b604051610ab7919061426c565b60405180910390f35b348015610acc57600080fd5b50610ae76004803603810190610ae291906138c8565b612567565b604051610af4919061426c565b60405180910390f35b348015610b0957600080fd5b50610b246004803603810190610b1f9190613a6f565b612587565b005b348015610b3257600080fd5b50610b4d6004803603810190610b4891906138c8565b6127c1565b005b66470de4df82000081565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610c2557507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610c355750610c34826128f0565b5b9050919050565b606060008054610c4b906148f6565b80601f0160208091040260200160405190810160405280929190818152602001828054610c77906148f6565b8015610cc45780601f10610c9957610100808354040283529160200191610cc4565b820191906000526020600020905b815481529060010190602001808311610ca757829003601f168201915b5050505050905090565b6000610cd98261295a565b610d18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0f90614449565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610d5e8261156f565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dcf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc690614509565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610dee6129c6565b73ffffffffffffffffffffffffffffffffffffffff161480610e1d5750610e1c81610e176129c6565b6124d3565b5b610e5c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e53906143a9565b60405180910390fd5b610e6683836129ce565b505050565b600960029054906101000a900460ff168015610e9e57506103e8610e9b6001600a54612a8790919063ffffffff16565b11155b610edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed4906142a9565b60405180910390fd5b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610f9f576001600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a6000815480929190610f9990614959565b91905055505b565b610fa96129c6565b73ffffffffffffffffffffffffffffffffffffffff16610fc7611d5c565b73ffffffffffffffffffffffffffffffffffffffff161461101d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101490614489565b60405180910390fd5b6001600960056101000a81548160ff021916908315150217905550565b6107d081565b61105161104b6129c6565b82612a9d565b611090576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108790614529565b60405180910390fd5b61109b838383612b7b565b505050565b600b5481565b600960019054906101000a900460ff1681565b606060006110c683611645565b9050600081141561114957600067ffffffffffffffff811115611112577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156111405781602001602082028036833780820191505090505b50915050611297565b60008167ffffffffffffffff81111561118b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156111b95781602001602082028036833780820191505090505b50905060006111c860076128cf565b9050600080600190505b82811161128e576111e28161295a565b801561122157508673ffffffffffffffffffffffffffffffffffffffff166112098261156f565b73ffffffffffffffffffffffffffffffffffffffff16145b1561127b5780848381518110611260577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018181525050818061127790614959565b9250505b808061128690614959565b9150506111d2565b50829450505050505b919050565b72796e910bd0228ddf4cd79e3f353871a61c351c81565b6112bb6129c6565b73ffffffffffffffffffffffffffffffffffffffff166112d9611d5c565b73ffffffffffffffffffffffffffffffffffffffff161461132f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132690614489565b60405180910390fd5b6000600360024761134091906147c9565b61134a91906147c9565b905072796e910bd0228ddf4cd79e3f353871a61c351c73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505061139d57600080fd5b73f05155f792819710da259c103d30e4b70178ea9f73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050506113ef57600080fd5b737745e475a272c825f191737f69793a05d28d6eb373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505061144157600080fd5b73a2f58259ac7c83fb33b12827235a19a51c868ea273ffffffffffffffffffffffffffffffffffffffff166108fc60024761147c91906147c9565b9081150290604051600060405180830381858888f1935050505061149f57600080fd5b50565b600a5481565b600960049054906101000a900460ff1681565b6114d68383836040518060200160405280600081525061236e565b505050565b6114ec6114e66129c6565b82612a9d565b61152b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611522906145e9565b60405180910390fd5b61153481612dd7565b50565b60006115428261295a565b9050919050565b600960069054906101000a900460ff1681565b600960039054906101000a900460ff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611618576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160f906143e9565b60405180910390fd5b80915050919050565b600960059054906101000a900460ff1681565b600061164060076128cf565b905090565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ad906143c9565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6117056129c6565b73ffffffffffffffffffffffffffffffffffffffff16611723611d5c565b73ffffffffffffffffffffffffffffffffffffffff1614611779576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177090614489565b60405180910390fd5b6117836000612ee8565b565b737745e475a272c825f191737f69793a05d28d6eb381565b60006117a960076128cf565b9050600960009054906101000a900460ff166117fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f1906145c9565b60405180910390fd5b611388611811600183612a8790919063ffffffff16565b1115611852576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184990614609565b60405180910390fd5b600960069054906101000a900460ff16156118f557600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb906144e9565b60405180910390fd5b5b600960019054906101000a900460ff16801561191d5750600960039054906101000a900460ff165b15611a0757600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806119c35750600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f990614549565b60405180910390fd5b611b51565b600960019054906101000a900460ff1615611aad57600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611aa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9f90614589565b60405180910390fd5b611b50565b600960039054906101000a900460ff1615611b4f57600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4590614469565b60405180910390fd5b5b5b5b611b5b60076128b9565b611b6e33611b6960076128cf565b612fae565b6001600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600960029054906101000a900460ff1681565b600960049054906101000a900460ff168015611c0f57506107d0611c0c6001600b54612a8790919063ffffffff16565b11155b611c4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4590614569565b60405180910390fd5b66470de4df820000341015611c98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8f90614429565b60405180910390fd5b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611d5a576001600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600b6000815480929190611d5490614959565b91905055505b565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600c6020528060005260406000206000915054906101000a900460ff1681565b606060018054611db5906148f6565b80601f0160208091040260200160405190810160405280929190818152602001828054611de1906148f6565b8015611e2e5780601f10611e0357610100808354040283529160200191611e2e565b820191906000526020600020905b815481529060010190602001808311611e1157829003601f168201915b5050505050905090565b611e406129c6565b73ffffffffffffffffffffffffffffffffffffffff16611e5e611d5c565b73ffffffffffffffffffffffffffffffffffffffff1614611eb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eab90614489565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401611eef929190614221565b602060405180830381600087803b158015611f0957600080fd5b505af1158015611f1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f419190613ac3565b505050565b60088054611f53906148f6565b80601f0160208091040260200160405190810160405280929190818152602001828054611f7f906148f6565b8015611fcc5780601f10611fa157610100808354040283529160200191611fcc565b820191906000526020600020905b815481529060010190602001808311611faf57829003601f168201915b505050505081565b611fdc6129c6565b73ffffffffffffffffffffffffffffffffffffffff16611ffa611d5c565b73ffffffffffffffffffffffffffffffffffffffff1614612050576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161204790614489565b60405180910390fd5b600960059054906101000a900460ff16156120a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612097906145a9565b60405180910390fd5b80600890805190602001906120b692919061362c565b5050565b6120c26129c6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612130576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212790614349565b60405180910390fd5b806005600061213d6129c6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff166121ea6129c6565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161222f919061426c565b60405180910390a35050565b600960009054906101000a900460ff1681565b6122566129c6565b73ffffffffffffffffffffffffffffffffffffffff16612274611d5c565b73ffffffffffffffffffffffffffffffffffffffff16146122ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122c190614489565b60405180910390fd5b85600960006101000a81548160ff02191690831515021790555084600960016101000a81548160ff02191690831515021790555083600960026101000a81548160ff02191690831515021790555082600960036101000a81548160ff02191690831515021790555081600960046101000a81548160ff02191690831515021790555080600960066101000a81548160ff021916908315150217905550505050505050565b61237f6123796129c6565b83612a9d565b6123be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123b590614529565b60405180910390fd5b6123ca84848484612fcc565b50505050565b6103e881565b60606123e18261295a565b612420576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612417906144c9565b60405180910390fd5b600061242a613028565b9050600081511161244a5760405180602001604052806000815250612475565b80612454846130ba565b604051602001612465929190614196565b6040516020818303038152906040525b915050919050565b73f05155f792819710da259c103d30e4b70178ea9f81565b61138881565b73a2f58259ac7c83fb33b12827235a19a51c868ea281565b600e6020528060005260406000206000915054906101000a900460ff1681565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600d6020528060005260406000206000915054906101000a900460ff1681565b61258f6129c6565b73ffffffffffffffffffffffffffffffffffffffff166125ad611d5c565b73ffffffffffffffffffffffffffffffffffffffff1614612603576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125fa90614489565b60405180910390fd5b6103e861261b82600a54612a8790919063ffffffff16565b111561265c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161265390614369565b60405180910390fd5b60005b818110156127bc57600d60008483815181106126a4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166127a9576001600d6000858481518110612737577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a60008154809291906127a390614959565b91905055505b80806127b490614959565b91505061265f565b505050565b6127c96129c6565b73ffffffffffffffffffffffffffffffffffffffff166127e7611d5c565b73ffffffffffffffffffffffffffffffffffffffff161461283d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283490614489565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156128ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128a4906142e9565b60405180910390fd5b6128b681612ee8565b50565b6001816000016000828254019250508190555050565b600081600001549050919050565b600080823b905060008111915050919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612a418361156f565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008183612a959190614773565b905092915050565b6000612aa88261295a565b612ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ade90614389565b60405180910390fd5b6000612af28361156f565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612b6157508373ffffffffffffffffffffffffffffffffffffffff16612b4984610cce565b73ffffffffffffffffffffffffffffffffffffffff16145b80612b725750612b7181856124d3565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612b9b8261156f565b73ffffffffffffffffffffffffffffffffffffffff1614612bf1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612be8906144a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612c61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c5890614329565b60405180910390fd5b612c6c838383613267565b612c776000826129ce565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612cc791906147fa565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612d1e9190614773565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000612de28261156f565b9050612df081600084613267565b612dfb6000836129ce565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612e4b91906147fa565b925050819055506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612fc882826040518060200160405280600081525061326c565b5050565b612fd7848484612b7b565b612fe3848484846132c7565b613022576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613019906142c9565b60405180910390fd5b50505050565b606060088054613037906148f6565b80601f0160208091040260200160405190810160405280929190818152602001828054613063906148f6565b80156130b05780601f10613085576101008083540402835291602001916130b0565b820191906000526020600020905b81548152906001019060200180831161309357829003601f168201915b5050505050905090565b60606000821415613102576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613262565b600082905060005b6000821461313457808061311d90614959565b915050600a8261312d91906147c9565b915061310a565b60008167ffffffffffffffff811115613176577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156131a85781602001600182028036833780820191505090505b5090505b6000851461325b576001826131c191906147fa565b9150600a856131d091906149a2565b60306131dc9190614773565b60f81b818381518110613218577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561325491906147c9565b94506131ac565b8093505050505b919050565b505050565b613276838361345e565b61328360008484846132c7565b6132c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132b9906142c9565b60405180910390fd5b505050565b60006132e88473ffffffffffffffffffffffffffffffffffffffff166128dd565b15613451578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026133116129c6565b8786866040518563ffffffff1660e01b815260040161333394939291906141d5565b602060405180830381600087803b15801561334d57600080fd5b505af192505050801561337e57506040513d601f19601f8201168201806040525081019061337b9190613b9e565b60015b613401573d80600081146133ae576040519150601f19603f3d011682016040523d82523d6000602084013e6133b3565b606091505b506000815114156133f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133f0906142c9565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613456565b600190505b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156134ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134c590614409565b60405180910390fd5b6134d78161295a565b15613517576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161350e90614309565b60405180910390fd5b61352360008383613267565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546135739190614773565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b828054613638906148f6565b90600052602060002090601f01602090048101928261365a57600085556136a1565b82601f1061367357805160ff19168380011785556136a1565b828001600101855582156136a1579182015b828111156136a0578251825591602001919060010190613685565b5b5090506136ae91906136b2565b5090565b5b808211156136cb5760008160009055506001016136b3565b5090565b60006136e26136dd84614669565b614644565b9050808382526020820190508285602086028201111561370157600080fd5b60005b85811015613731578161371788826137b7565b845260208401935060208301925050600181019050613704565b5050509392505050565b600061374e61374984614695565b614644565b90508281526020810184848401111561376657600080fd5b6137718482856148b4565b509392505050565b600061378c613787846146c6565b614644565b9050828152602081018484840111156137a457600080fd5b6137af8482856148b4565b509392505050565b6000813590506137c681615130565b92915050565b600082601f8301126137dd57600080fd5b81356137ed8482602086016136cf565b91505092915050565b60008135905061380581615147565b92915050565b60008151905061381a81615147565b92915050565b60008135905061382f8161515e565b92915050565b6000815190506138448161515e565b92915050565b600082601f83011261385b57600080fd5b813561386b84826020860161373b565b91505092915050565b60008135905061388381615175565b92915050565b600082601f83011261389a57600080fd5b81356138aa848260208601613779565b91505092915050565b6000813590506138c28161518c565b92915050565b6000602082840312156138da57600080fd5b60006138e8848285016137b7565b91505092915050565b6000806040838503121561390457600080fd5b6000613912858286016137b7565b9250506020613923858286016137b7565b9150509250929050565b60008060006060848603121561394257600080fd5b6000613950868287016137b7565b9350506020613961868287016137b7565b9250506040613972868287016138b3565b9150509250925092565b6000806000806080858703121561399257600080fd5b60006139a0878288016137b7565b94505060206139b1878288016137b7565b93505060406139c2878288016138b3565b925050606085013567ffffffffffffffff8111156139df57600080fd5b6139eb8782880161384a565b91505092959194509250565b60008060408385031215613a0a57600080fd5b6000613a18858286016137b7565b9250506020613a29858286016137f6565b9150509250929050565b60008060408385031215613a4657600080fd5b6000613a54858286016137b7565b9250506020613a65858286016138b3565b9150509250929050565b60008060408385031215613a8257600080fd5b600083013567ffffffffffffffff811115613a9c57600080fd5b613aa8858286016137cc565b9250506020613ab9858286016138b3565b9150509250929050565b600060208284031215613ad557600080fd5b6000613ae38482850161380b565b91505092915050565b60008060008060008060c08789031215613b0557600080fd5b6000613b1389828a016137f6565b9650506020613b2489828a016137f6565b9550506040613b3589828a016137f6565b9450506060613b4689828a016137f6565b9350506080613b5789828a016137f6565b92505060a0613b6889828a016137f6565b9150509295509295509295565b600060208284031215613b8757600080fd5b6000613b9584828501613820565b91505092915050565b600060208284031215613bb057600080fd5b6000613bbe84828501613835565b91505092915050565b60008060408385031215613bda57600080fd5b6000613be885828601613874565b9250506020613bf9858286016138b3565b9150509250929050565b600060208284031215613c1557600080fd5b600082013567ffffffffffffffff811115613c2f57600080fd5b613c3b84828501613889565b91505092915050565b600060208284031215613c5657600080fd5b6000613c64848285016138b3565b91505092915050565b6000613c798383614178565b60208301905092915050565b613c8e8161482e565b82525050565b6000613c9f82614707565b613ca98185614735565b9350613cb4836146f7565b8060005b83811015613ce5578151613ccc8882613c6d565b9750613cd783614728565b925050600181019050613cb8565b5085935050505092915050565b613cfb81614840565b82525050565b6000613d0c82614712565b613d168185614746565b9350613d268185602086016148c3565b613d2f81614a8f565b840191505092915050565b6000613d458261471d565b613d4f8185614757565b9350613d5f8185602086016148c3565b613d6881614a8f565b840191505092915050565b6000613d7e8261471d565b613d888185614768565b9350613d988185602086016148c3565b80840191505092915050565b6000613db1601b83614757565b9150613dbc82614aa0565b602082019050919050565b6000613dd4603283614757565b9150613ddf82614ac9565b604082019050919050565b6000613df7602683614757565b9150613e0282614b18565b604082019050919050565b6000613e1a601c83614757565b9150613e2582614b67565b602082019050919050565b6000613e3d602483614757565b9150613e4882614b90565b604082019050919050565b6000613e60601983614757565b9150613e6b82614bdf565b602082019050919050565b6000613e83601d83614757565b9150613e8e82614c08565b602082019050919050565b6000613ea6602c83614757565b9150613eb182614c31565b604082019050919050565b6000613ec9603883614757565b9150613ed482614c80565b604082019050919050565b6000613eec602a83614757565b9150613ef782614ccf565b604082019050919050565b6000613f0f602983614757565b9150613f1a82614d1e565b604082019050919050565b6000613f32602083614757565b9150613f3d82614d6d565b602082019050919050565b6000613f55601683614757565b9150613f6082614d96565b602082019050919050565b6000613f78602c83614757565b9150613f8382614dbf565b604082019050919050565b6000613f9b601583614757565b9150613fa682614e0e565b602082019050919050565b6000613fbe602083614757565b9150613fc982614e37565b602082019050919050565b6000613fe1602983614757565b9150613fec82614e60565b604082019050919050565b6000614004602f83614757565b915061400f82614eaf565b604082019050919050565b6000614027601283614757565b915061403282614efe565b602082019050919050565b600061404a602183614757565b915061405582614f27565b604082019050919050565b600061406d603183614757565b915061407882614f76565b604082019050919050565b6000614090602383614757565b915061409b82614fc5565b604082019050919050565b60006140b3601983614757565b91506140be82615014565b602082019050919050565b60006140d6601783614757565b91506140e18261503d565b602082019050919050565b60006140f9601c83614757565b915061410482615066565b602082019050919050565b600061411c601b83614757565b91506141278261508f565b602082019050919050565b600061413f603083614757565b915061414a826150b8565b604082019050919050565b6000614162601583614757565b915061416d82615107565b602082019050919050565b614181816148aa565b82525050565b614190816148aa565b82525050565b60006141a28285613d73565b91506141ae8284613d73565b91508190509392505050565b60006020820190506141cf6000830184613c85565b92915050565b60006080820190506141ea6000830187613c85565b6141f76020830186613c85565b6142046040830185614187565b81810360608301526142168184613d01565b905095945050505050565b60006040820190506142366000830185613c85565b6142436020830184614187565b9392505050565b600060208201905081810360008301526142648184613c94565b905092915050565b60006020820190506142816000830184613cf2565b92915050565b600060208201905081810360008301526142a18184613d3a565b905092915050565b600060208201905081810360008301526142c281613da4565b9050919050565b600060208201905081810360008301526142e281613dc7565b9050919050565b6000602082019050818103600083015261430281613dea565b9050919050565b6000602082019050818103600083015261432281613e0d565b9050919050565b6000602082019050818103600083015261434281613e30565b9050919050565b6000602082019050818103600083015261436281613e53565b9050919050565b6000602082019050818103600083015261438281613e76565b9050919050565b600060208201905081810360008301526143a281613e99565b9050919050565b600060208201905081810360008301526143c281613ebc565b9050919050565b600060208201905081810360008301526143e281613edf565b9050919050565b6000602082019050818103600083015261440281613f02565b9050919050565b6000602082019050818103600083015261442281613f25565b9050919050565b6000602082019050818103600083015261444281613f48565b9050919050565b6000602082019050818103600083015261446281613f6b565b9050919050565b6000602082019050818103600083015261448281613f8e565b9050919050565b600060208201905081810360008301526144a281613fb1565b9050919050565b600060208201905081810360008301526144c281613fd4565b9050919050565b600060208201905081810360008301526144e281613ff7565b9050919050565b600060208201905081810360008301526145028161401a565b9050919050565b600060208201905081810360008301526145228161403d565b9050919050565b6000602082019050818103600083015261454281614060565b9050919050565b6000602082019050818103600083015261456281614083565b9050919050565b60006020820190508181036000830152614582816140a6565b9050919050565b600060208201905081810360008301526145a2816140c9565b9050919050565b600060208201905081810360008301526145c2816140ec565b9050919050565b600060208201905081810360008301526145e28161410f565b9050919050565b6000602082019050818103600083015261460281614132565b9050919050565b6000602082019050818103600083015261462281614155565b9050919050565b600060208201905061463e6000830184614187565b92915050565b600061464e61465f565b905061465a8282614928565b919050565b6000604051905090565b600067ffffffffffffffff82111561468457614683614a60565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156146b0576146af614a60565b5b6146b982614a8f565b9050602081019050919050565b600067ffffffffffffffff8211156146e1576146e0614a60565b5b6146ea82614a8f565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600061477e826148aa565b9150614789836148aa565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156147be576147bd6149d3565b5b828201905092915050565b60006147d4826148aa565b91506147df836148aa565b9250826147ef576147ee614a02565b5b828204905092915050565b6000614805826148aa565b9150614810836148aa565b925082821015614823576148226149d3565b5b828203905092915050565b60006148398261488a565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006148838261482e565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b838110156148e15780820151818401526020810190506148c6565b838111156148f0576000848401525b50505050565b6000600282049050600182168061490e57607f821691505b6020821081141561492257614921614a31565b5b50919050565b61493182614a8f565b810181811067ffffffffffffffff821117156149505761494f614a60565b5b80604052505050565b6000614964826148aa565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614997576149966149d3565b5b600182019050919050565b60006149ad826148aa565b91506149b8836148aa565b9250826149c8576149c7614a02565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f4e6f7420656c696769626c6520666f722077686974656c6973742e0000000000600082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f576f756c642065786365656420746f74616c2077686974656c6973742e000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f50726573616c65207072696365206e6f74206d65742e00000000000000000000600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f6e6c792070726573616c65206d696e746572732e0000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4f6e6c792031207065722077616c6c65742e0000000000000000000000000000600082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f4f6e6c792077686974656c69737420616e642070726573616c65206d696e746560008201527f72732e0000000000000000000000000000000000000000000000000000000000602082015250565b7f4e6f7420656c696769626c6520666f722070726573616c652e00000000000000600082015250565b7f4f6e6c792077686974656c697374206d696e746572732e000000000000000000600082015250565b7f436f6e7472616374206d757374206e6f74206265207365616c65642e00000000600082015250565b7f5761697420666f72207468652073616c6520746f207374617274210000000000600082015250565b7f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656400000000000000000000000000000000602082015250565b7f457863656564696e67206d617820737570706c79210000000000000000000000600082015250565b6151398161482e565b811461514457600080fd5b50565b61515081614840565b811461515b57600080fd5b50565b6151678161484c565b811461517257600080fd5b50565b61517e81614878565b811461518957600080fd5b50565b615195816148aa565b81146151a057600080fd5b5056fea264697066735822122087b09828e70264771442ae7026cf71825491766b52b7a7ea578bcf118837128664736f6c63430008040033
Verified Source Code Full Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: No
Address.sol 216 lines
// SPDX-License-Identifier: MIT
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);
}
}
}
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT
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;
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
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);
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_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 {
_setOwner(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");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Counters.sol 42 lines
// SPDX-License-Identifier: MIT
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;
}
}
IERC20.sol 81 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @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 {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//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 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 {}
}
SafeMath.sol 226 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, 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;
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
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);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
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);
}
ERC721Burnable.sol 25 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "../../../utils/Context.sol";
/**
* @title ERC721 Burnable Token
* @dev ERC721 Token that can be irreversibly burned (destroyed).
*/
abstract contract ERC721Burnable is Context, ERC721 {
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
Glitches.sol 206 lines
//
// _____ _ _____ _ _ _ _
// |_ _| |_ ___ | __| |_| |_ ___| |_ ___ ___
// | | | | -_| | | | | | _| _| | -_|_ -|
// |_| |_|_|___| |_____|_|_|_| |___|_|_|___|___|
//
//
// The Glitches
// A free to mint 5k PFP project, focused on diversity and inclusion. We are community oriented.
//
// Twitter: https://twitter.com/theglitches_
//
// Project by: @daniel100eth
// Art by: @maxwell_step
// Code by: @altcryp
//
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "@openzeppelin/contracts/utils/Counters.sol";
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
contract Glitches is ERC721Burnable, Ownable {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
// Team
address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C;
address public constant daniel = 0xF05155F792819710Da259C103D30e4B70178eA9f;
address public constant maxwell = 0x7745e475A272c825F191737f69793A05d28D6eb3;
address public constant community = 0xA2F58259ac7c83FB33B12827235A19a51c868ea2;
// Glitches
string public baseUri = 'https://api.theglitches.art/json/';
// Sales
bool public saleStart;
bool public whitelistSale;
bool public openForWhitelist;
bool public preSale;
bool public openForPresale;
bool public sealContract;
bool public enforceOnePerWallet = true;
uint256 public constant presalePrice = .02 * 1e18;
uint public constant maxSupply = 5000;
uint public constant maxWhitelist = 1000;
uint public constant maxPresale = 2000;
uint256 public whitelisted;
uint256 public presales;
mapping (address => bool) public Minted;
mapping (address => bool) public Whitelist;
mapping (address => bool) public Presale;
// Constructor
constructor() ERC721("Glitches", "GLITCH") {
for(uint256 i=0; i<10; i++) {
_tokenIds.increment();
_safeMint(sara, _tokenIds.current());
}
for(uint256 i=0; i<10; i++) {
_tokenIds.increment();
_safeMint(daniel, _tokenIds.current());
}
for(uint256 i=0; i<10; i++) {
_tokenIds.increment();
_safeMint(maxwell, _tokenIds.current());
}
for(uint256 i=0; i<30; i++) {
_tokenIds.increment();
_safeMint(community, _tokenIds.current());
}
}
/*
* Getters.
*/
function getCurrentId() public view returns(uint256) {
return _tokenIds.current();
}
function exists(uint256 tokenId) public view returns(bool) {
return _exists(tokenId);
}
/**
* Public function for minting.
*/
function mintGlitch() public payable {
uint256 totalIssued = _tokenIds.current();
require(saleStart, "Wait for the sale to start!");
require(totalIssued.add(1) <= maxSupply, "Exceeding max supply!");
if(enforceOnePerWallet) {
require(!Minted[msg.sender], "Only 1 per wallet.");
}
if(whitelistSale && preSale) {
require(Whitelist[msg.sender] || Presale[msg.sender], "Only whitelist and presale minters.");
} else if(whitelistSale) {
require(Whitelist[msg.sender], "Only whitelist minters.");
} else if(preSale) {
require(Presale[msg.sender], "Only presale minters.");
}
_tokenIds.increment();
_safeMint(msg.sender, _tokenIds.current());
Minted[msg.sender] = true;
}
/**
* External function for getting all tokens by a specific owner.
*/
function getByOwner(address _owner) view public returns(uint256[] memory) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalTokens = _tokenIds.current();
uint256 resultIndex = 0;
for (uint256 t = 1; t <= totalTokens; t++) {
if (_exists(t) && ownerOf(t) == _owner) {
result[resultIndex] = t;
resultIndex++;
}
}
return result;
}
}
/*
* Owner setters.
*/
function setBaseUri(string memory _baseUri) public onlyOwner {
require(!sealContract, "Contract must not be sealed.");
baseUri = _baseUri;
}
function contractSettings(bool _saleStart, bool _whitelistSale, bool _openForWhitelist, bool _preSale, bool _openForPresale, bool _enforceOnePerWallet) public onlyOwner {
saleStart = _saleStart;
whitelistSale = _whitelistSale;
openForWhitelist = _openForWhitelist;
preSale = _preSale;
openForPresale = _openForPresale;
enforceOnePerWallet = _enforceOnePerWallet;
}
function setSealContract() public onlyOwner {
sealContract = true;
}
function addSelfToPresale() public payable {
require(openForPresale && presales.add(1) <= maxPresale, "Not eligible for presale.");
require(msg.value >= presalePrice, "Presale price not met.");
if(!Presale[msg.sender]) {
Presale[msg.sender] = true;
presales++;
}
}
function addSelfToWhitelist() public {
require(openForWhitelist && whitelisted.add(1) <= maxWhitelist, "Not eligible for whitelist.");
if(!Whitelist[msg.sender]) {
Whitelist[msg.sender] = true;
whitelisted++;
}
}
function addToWhitelist(address[] memory whitelist, uint256 total) public onlyOwner {
require(whitelisted.add(total) <= maxWhitelist, "Would exceed total whitelist.");
for(uint256 i=0; i<total; i++) {
if(!Whitelist[whitelist[i]]) {
Whitelist[whitelist[i]] = true;
whitelisted++;
}
}
}
/*
* Money management.
*/
function withdraw() public payable onlyOwner {
uint256 _each = (address(this).balance / 2) / 3;
require(payable(sara).send(_each));
require(payable(daniel).send(_each));
require(payable(maxwell).send(_each));
require(payable(community).send(address(this).balance / 2)); // 50% for community
}
function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner {
_token.transfer(msg.sender, _amount);
}
/*
* Overrides
*/
function _baseURI() internal view override returns (string memory) {
return baseUri;
}
receive () external payable virtual {}
}
Read Contract
Minted 0x90ddedd5 → bool
Presale 0xe8e7426e → bool
Whitelist 0xeb73900b → bool
balanceOf 0x70a08231 → uint256
baseUri 0x9abc8320 → string
community 0xdc1fb5a5 → address
daniel 0xcce3c857 → address
enforceOnePerWallet 0x54e584f6 → bool
exists 0x4f558e79 → bool
getApproved 0x081812fc → address
getByOwner 0x379c5131 → uint256[]
getCurrentId 0x6c143862 → uint256
isApprovedForAll 0xe985e9c5 → bool
maxPresale 0x2142ab29 → uint256
maxSupply 0xd5abeb01 → uint256
maxWhitelist 0xbf0d96c3 → uint256
maxwell 0x71699e3d → address
name 0x06fdde03 → string
openForPresale 0x3e9755b2 → bool
openForWhitelist 0x82554489 → bool
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
preSale 0x5a7adf7f → bool
presalePrice 0x000e7fa8 → uint256
presales 0x24079868 → uint256
saleStart 0xab0bcc41 → bool
sara 0x3a51cd80 → address
sealContract 0x68bd580e → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
whitelistSale 0x31ffd6f1 → bool
whitelisted 0x3d9287fa → uint256
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
addSelfToPresale 0x8507bc32
No parameters
addSelfToWhitelist 0x1d1468d4
No parameters
addToWhitelist 0xed740946
address[] whitelist
uint256 total
approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 tokenId
contractSettings 0xac959f9f
bool _saleStart
bool _whitelistSale
bool _openForWhitelist
bool _preSale
bool _openForPresale
bool _enforceOnePerWallet
forwardERC20s 0x9727151a
address _token
uint256 _amount
mintGlitch 0x77a9f5c6
No parameters
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseUri 0xa0bcfc7f
string _baseUri
setSealContract 0x1f0439fd
No parameters
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address