Address Contract Verified
Address
0x407AF4979e863775A106aE6f43d8Fb80697Da2FA
Balance
0 ETH
Nonce
1
Code Size
16666 bytes
Creator
0x3c72329B...0bCc at tx 0x216ccf8a...700fce
Indexed Transactions
0
Contract Bytecode
16666 bytes
0x60806040526004361061021d5760003560e01c80636ddd171311610123578063a5ece941116100ab578063dd62ed3e1161006f578063dd62ed3e14610805578063e01af92c14610842578063e30081a01461086b578063f2fde38b14610894578063f887ea40146108bd57610224565b8063a5ece9411461070c578063a8b0898214610737578063a9059cbb14610762578063ae9b6e101461079f578063b36d6919146107c857610224565b8063844d591c116100f2578063844d591c146106255780638da5cb5b1461064e57806395d89b41146106795780639ab4a445146106a4578063a457c2d7146106cf57610224565b80636ddd17131461057d57806370a08231146105a8578063715018a6146105e557806381d3c435146105fc57610224565b806339509351116101a6578063553193ca11610175578063553193ca146104c05780635e64f769146104eb5780636612e66f1461051457806368092bd91461053d5780636c5808011461056657610224565b806339509351146103de5780633ecad2711461041b57806348cd4cb1146104585780635342acb41461048357610224565b806318160ddd116101ed57806318160ddd146102e357806323b872dd1461030e57806327c8f8351461034b578063313ce5671461037657806333f3d628146103a157610224565b8062ae3bf81461022957806306fdde0314610252578063095ea7b31461027d578063105222f9146102ba57610224565b3661022457005b600080fd5b34801561023557600080fd5b50610250600480360381019061024b919061309d565b6108e8565b005b34801561025e57600080fd5b50610267610a89565b6040516102749190613691565b60405180910390f35b34801561028957600080fd5b506102a4600480360381019061029f91906131f7565b610b1b565b6040516102b19190613676565b60405180910390f35b3480156102c657600080fd5b506102e160048036038101906102dc9190613237565b610b39565b005b3480156102ef57600080fd5b506102f8610c4a565b6040516103059190613853565b60405180910390f35b34801561031a57600080fd5b5061033560048036038101906103309190613164565b610c54565b6040516103429190613676565b60405180910390f35b34801561035757600080fd5b50610360610d2d565b60405161036d9190613632565b60405180910390f35b34801561038257600080fd5b5061038b610d51565b60405161039891906138c8565b60405180910390f35b3480156103ad57600080fd5b506103c860048036038101906103c391906131f7565b610d68565b6040516103d59190613676565b60405180910390f35b3480156103ea57600080fd5b50610405600480360381019061040091906131f7565b610e7b565b6040516104129190613676565b60405180910390f35b34801561042757600080fd5b50610442600480360381019061043d919061309d565b610f2e565b60405161044f9190613676565b60405180910390f35b34801561046457600080fd5b5061046d610f4e565b60405161047a9190613853565b60405180910390f35b34801561048f57600080fd5b506104aa60048036038101906104a5919061309d565b610f54565b6040516104b79190613676565b60405180910390f35b3480156104cc57600080fd5b506104d5610f74565b6040516104e29190613853565b60405180910390f35b3480156104f757600080fd5b50610512600480360381019061050d91906130f7565b610f7a565b005b34801561052057600080fd5b5061053b600480360381019061053691906131b7565b611040565b005b34801561054957600080fd5b50610564600480360381019061055f91906131b7565b611117565b005b34801561057257600080fd5b5061057b6111ee565b005b34801561058957600080fd5b506105926112b8565b60405161059f9190613676565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca919061309d565b6112cb565b6040516105dc9190613853565b60405180910390f35b3480156105f157600080fd5b506105fa611314565b005b34801561060857600080fd5b50610623600480360381019061061e919061309d565b61139c565b005b34801561063157600080fd5b5061064c600480360381019061064791906131b7565b61145c565b005b34801561065a57600080fd5b50610663611533565b6040516106709190613632565b60405180910390f35b34801561068557600080fd5b5061068e61155c565b60405161069b9190613691565b60405180910390f35b3480156106b057600080fd5b506106b96115ee565b6040516106c69190613632565b60405180910390f35b3480156106db57600080fd5b506106f660048036038101906106f191906131f7565b611614565b6040516107039190613676565b60405180910390f35b34801561071857600080fd5b506107216116e1565b60405161072e9190613632565b60405180910390f35b34801561074357600080fd5b5061074c611707565b6040516107599190613632565b60405180910390f35b34801561076e57600080fd5b50610789600480360381019061078491906131f7565b61172d565b6040516107969190613676565b60405180910390f35b3480156107ab57600080fd5b506107c660048036038101906107c19190613237565b61174b565b005b3480156107d457600080fd5b506107ef60048036038101906107ea919061309d565b61185c565b6040516107fc9190613676565b60405180910390f35b34801561081157600080fd5b5061082c60048036038101906108279190613124565b61187c565b6040516108399190613853565b60405180910390f35b34801561084e57600080fd5b5061086960048036038101906108649190613293565b611903565b005b34801561087757600080fd5b50610892600480360381019061088d919061309d565b61199c565b005b3480156108a057600080fd5b506108bb60048036038101906108b6919061309d565b611ad6565b005b3480156108c957600080fd5b506108d2611bce565b6040516108df9190613632565b60405180910390f35b6108f0611bf4565b73ffffffffffffffffffffffffffffffffffffffff1661090e611533565b73ffffffffffffffffffffffffffffffffffffffff1614610964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095b90613773565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ca90613833565b60405180910390fd5b610a86338273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610a109190613632565b60206040518083038186803b158015610a2857600080fd5b505afa158015610a3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6091906132ed565b8373ffffffffffffffffffffffffffffffffffffffff16611bfc9092919063ffffffff16565b50565b606060018054610a9890613b60565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac490613b60565b8015610b115780601f10610ae657610100808354040283529160200191610b11565b820191906000526020600020905b815481529060010190602001808311610af457829003601f168201915b5050505050905090565b6000610b2f610b28611bf4565b8484611c82565b6001905092915050565b610b41611bf4565b73ffffffffffffffffffffffffffffffffffffffff16610b5f611533565b73ffffffffffffffffffffffffffffffffffffffff1614610bb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bac90613773565b60405180910390fd5b60005b8251811015610c45578160086000858481518110610bd957610bd8613c99565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610c3d90613bc3565b915050610bb8565b505050565b6000600d54905090565b6000610c61848484611e4d565b610d2284610c6d611bf4565b610d1d8560405180606001604052806028815260200161409860289139600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610cd3611bf4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461249a9092919063ffffffff16565b611c82565b600190509392505050565b7f000000000000000000000000000000000000000000000000000000000000dead81565b6000600360009054906101000a900460ff16905090565b6000610d72611bf4565b73ffffffffffffffffffffffffffffffffffffffff16610d90611533565b73ffffffffffffffffffffffffffffffffffffffff1614610de6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ddd90613773565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401610e2192919061364d565b602060405180830381600087803b158015610e3b57600080fd5b505af1158015610e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7391906132c0565b905092915050565b6000610f24610e88611bf4565b84610f1f8560066000610e99611bf4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ef90919063ffffffff16565b611c82565b6001905092915050565b60076020528060005260406000206000915054906101000a900460ff1681565b600b5481565b60086020528060005260406000206000915054906101000a900460ff1681565b600a5481565b610f82611bf4565b73ffffffffffffffffffffffffffffffffffffffff16610fa0611533565b73ffffffffffffffffffffffffffffffffffffffff1614610ff6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fed90613773565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561103c573d6000803e3d6000fd5b5050565b611048611bf4565b73ffffffffffffffffffffffffffffffffffffffff16611066611533565b73ffffffffffffffffffffffffffffffffffffffff16146110bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b390613773565b60405180910390fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b61111f611bf4565b73ffffffffffffffffffffffffffffffffffffffff1661113d611533565b73ffffffffffffffffffffffffffffffffffffffff1614611193576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118a90613773565b60405180910390fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6111f6611bf4565b73ffffffffffffffffffffffffffffffffffffffff16611214611533565b73ffffffffffffffffffffffffffffffffffffffff161461126a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126190613773565b60405180910390fd5b600a546000146112af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a690613753565b60405180910390fd5b43600a81905550565b600c60009054906101000a900460ff1681565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61131c611bf4565b73ffffffffffffffffffffffffffffffffffffffff1661133a611533565b73ffffffffffffffffffffffffffffffffffffffff1614611390576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138790613773565b60405180910390fd5b61139a6000612505565b565b6113a4611bf4565b73ffffffffffffffffffffffffffffffffffffffff166113c2611533565b73ffffffffffffffffffffffffffffffffffffffff1614611418576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140f90613773565b60405180910390fd5b80600360016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611464611bf4565b73ffffffffffffffffffffffffffffffffffffffff16611482611533565b73ffffffffffffffffffffffffffffffffffffffff16146114d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cf90613773565b60405180910390fd5b80600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606002805461156b90613b60565b80601f016020809104026020016040519081016040528092919081815260200182805461159790613b60565b80156115e45780601f106115b9576101008083540402835291602001916115e4565b820191906000526020600020905b8154815290600101906020018083116115c757829003601f168201915b5050505050905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006116d7611621611bf4565b846116d2856040518060600160405280602581526020016140c0602591396006600061164b611bf4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461249a9092919063ffffffff16565b611c82565b6001905092915050565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061174161173a611bf4565b8484611e4d565b6001905092915050565b611753611bf4565b73ffffffffffffffffffffffffffffffffffffffff16611771611533565b73ffffffffffffffffffffffffffffffffffffffff16146117c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117be90613773565b60405180910390fd5b60005b82518110156118575781600960008584815181106117eb576117ea613c99565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061184f90613bc3565b9150506117ca565b505050565b60096020528060005260406000206000915054906101000a900460ff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61190b611bf4565b73ffffffffffffffffffffffffffffffffffffffff16611929611533565b73ffffffffffffffffffffffffffffffffffffffff161461197f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197690613773565b60405180910390fd5b80600c60006101000a81548160ff02191690831515021790555050565b6119a4611bf4565b73ffffffffffffffffffffffffffffffffffffffff166119c2611533565b73ffffffffffffffffffffffffffffffffffffffff1614611a18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0f90613773565b60405180910390fd5b80600360016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160086000600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611ade611bf4565b73ffffffffffffffffffffffffffffffffffffffff16611afc611533565b73ffffffffffffffffffffffffffffffffffffffff1614611b52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4990613773565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611bc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb9906136d3565b60405180910390fd5b611bcb81612505565b50565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600033905090565b611c7d8363a9059cbb60e01b8484604051602401611c1b92919061364d565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506125c9565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611cf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce9906137d3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d59906136f3565b60405180910390fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611e409190613853565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ebd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eb4906137b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f24906136b3565b60405180910390fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611fd15750600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b612010576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161200790613793565b60405180910390fd5b600f60149054906101000a900460ff161561203657612030838383612690565b50612494565b60008114156120d95761209181600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ef90919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612495565b612162816040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461249a9092919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600b541480156122005750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561220d5743600b819055505b600c60009054906101000a900460ff1680156122725750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8015612298575061228d60028261286390919063ffffffff16565b612296306112cb565b115b156122dd576122dc6122b460028361286390919063ffffffff16565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16612879565b5b6000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806123805750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b6123945761238f848484612b02565b612396565b815b90506123ea81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ef90919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161248a9190613853565b60405180910390a3505b5b505050565b60008383111582906124e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124d99190613691565b60405180910390fd5b5082840390509392505050565b600081836124fd919061399f565b905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600061262b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d8a9092919063ffffffff16565b905060008151111561268b578080602001905181019061264b91906132c0565b61268a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161268190613813565b60405180910390fd5b5b505050565b600061271b826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461249a9092919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127b082600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ef90919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516128509190613853565b60405180910390a3600190509392505050565b6000818361287191906139f5565b905092915050565b6001600f60146101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156128b1576128b0613cc8565b5b6040519080825280602002602001820160405280156128df5781602001602082028036833780820191505090505b50905030816000815181106128f7576128f6613c99565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561299957600080fd5b505afa1580156129ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129d191906130ca565b816001815181106129e5576129e4613c99565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612a4c30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685611c82565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478460008486426040518663ffffffff1660e01b8152600401612ab095949392919061386e565b600060405180830381600087803b158015612aca57600080fd5b505af1158015612ade573d6000803e3d6000fd5b50505050506000600f60146101000a81548160ff0219169083151502179055505050565b60008060009050600085905060008490506000600a5411612b58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b4f90613713565b60405180910390fd5b600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612bbf5750436032600a54612bbc919061399f565b10155b15612d6a57612beb6064612bdd606384612da290919063ffffffff16565b61286390919063ffffffff16565b9250612c618360056000600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ef90919063ffffffff16565b60056000600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612d459190613853565b60405180910390a3612d608382612db890919063ffffffff16565b9350505050612d83565b612d7d8382612db890919063ffffffff16565b93505050505b9392505050565b6060612d998484600085612dce565b90509392505050565b60008183612db09190613a26565b905092915050565b60008183612dc69190613a80565b905092915050565b606082471015612e13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e0a90613733565b60405180910390fd5b612e1c85612ee2565b612e5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e52906137f3565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e84919061361b565b60006040518083038185875af1925050503d8060008114612ec1576040519150601f19603f3d011682016040523d82523d6000602084013e612ec6565b606091505b5091509150612ed6828286612f05565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60608315612f1557829050612f65565b600083511115612f285782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f5c9190613691565b60405180910390fd5b9392505050565b6000612f7f612f7a84613908565b6138e3565b90508083825260208201905082856020860282011115612fa257612fa1613cfc565b5b60005b85811015612fd25781612fb88882612fdc565b845260208401935060208301925050600181019050612fa5565b5050509392505050565b600081359050612feb8161403b565b92915050565b6000815190506130008161403b565b92915050565b60008135905061301581614052565b92915050565b600082601f8301126130305761302f613cf7565b5b8135613040848260208601612f6c565b91505092915050565b60008135905061305881614069565b92915050565b60008151905061306d81614069565b92915050565b60008135905061308281614080565b92915050565b60008151905061309781614080565b92915050565b6000602082840312156130b3576130b2613d06565b5b60006130c184828501612fdc565b91505092915050565b6000602082840312156130e0576130df613d06565b5b60006130ee84828501612ff1565b91505092915050565b60006020828403121561310d5761310c613d06565b5b600061311b84828501613006565b91505092915050565b6000806040838503121561313b5761313a613d06565b5b600061314985828601612fdc565b925050602061315a85828601612fdc565b9150509250929050565b60008060006060848603121561317d5761317c613d06565b5b600061318b86828701612fdc565b935050602061319c86828701612fdc565b92505060406131ad86828701613073565b9150509250925092565b600080604083850312156131ce576131cd613d06565b5b60006131dc85828601612fdc565b92505060206131ed85828601613049565b9150509250929050565b6000806040838503121561320e5761320d613d06565b5b600061321c85828601612fdc565b925050602061322d85828601613073565b9150509250929050565b6000806040838503121561324e5761324d613d06565b5b600083013567ffffffffffffffff81111561326c5761326b613d01565b5b6132788582860161301b565b925050602061328985828601613049565b9150509250929050565b6000602082840312156132a9576132a8613d06565b5b60006132b784828501613049565b91505092915050565b6000602082840312156132d6576132d5613d06565b5b60006132e48482850161305e565b91505092915050565b60006020828403121561330357613302613d06565b5b600061331184828501613088565b91505092915050565b60006133268383613332565b60208301905092915050565b61333b81613ab4565b82525050565b61334a81613ab4565b82525050565b600061335b82613944565b6133658185613972565b935061337083613934565b8060005b838110156133a1578151613388888261331a565b975061339383613965565b925050600181019050613374565b5085935050505092915050565b6133b781613ad8565b82525050565b60006133c88261394f565b6133d28185613983565b93506133e2818560208601613b2d565b80840191505092915050565b6133f781613b1b565b82525050565b60006134088261395a565b613412818561398e565b9350613422818560208601613b2d565b61342b81613d0b565b840191505092915050565b600061344360238361398e565b915061344e82613d1c565b604082019050919050565b600061346660268361398e565b915061347182613d6b565b604082019050919050565b600061348960228361398e565b915061349482613dba565b604082019050919050565b60006134ac600f8361398e565b91506134b782613e09565b602082019050919050565b60006134cf60268361398e565b91506134da82613e32565b604082019050919050565b60006134f260078361398e565b91506134fd82613e81565b602082019050919050565b600061351560208361398e565b915061352082613eaa565b602082019050919050565b600061353860098361398e565b915061354382613ed3565b602082019050919050565b600061355b60258361398e565b915061356682613efc565b604082019050919050565b600061357e60248361398e565b915061358982613f4b565b604082019050919050565b60006135a1601d8361398e565b91506135ac82613f9a565b602082019050919050565b60006135c4602a8361398e565b91506135cf82613fc3565b604082019050919050565b60006135e760148361398e565b91506135f282614012565b602082019050919050565b61360681613b04565b82525050565b61361581613b0e565b82525050565b600061362782846133bd565b915081905092915050565b60006020820190506136476000830184613341565b92915050565b60006040820190506136626000830185613341565b61366f60208301846135fd565b9392505050565b600060208201905061368b60008301846133ae565b92915050565b600060208201905081810360008301526136ab81846133fd565b905092915050565b600060208201905081810360008301526136cc81613436565b9050919050565b600060208201905081810360008301526136ec81613459565b9050919050565b6000602082019050818103600083015261370c8161347c565b9050919050565b6000602082019050818103600083015261372c8161349f565b9050919050565b6000602082019050818103600083015261374c816134c2565b9050919050565b6000602082019050818103600083015261376c816134e5565b9050919050565b6000602082019050818103600083015261378c81613508565b9050919050565b600060208201905081810360008301526137ac8161352b565b9050919050565b600060208201905081810360008301526137cc8161354e565b9050919050565b600060208201905081810360008301526137ec81613571565b9050919050565b6000602082019050818103600083015261380c81613594565b9050919050565b6000602082019050818103600083015261382c816135b7565b9050919050565b6000602082019050818103600083015261384c816135da565b9050919050565b600060208201905061386860008301846135fd565b92915050565b600060a08201905061388360008301886135fd565b61389060208301876133ee565b81810360408301526138a28186613350565b90506138b16060830185613341565b6138be60808301846135fd565b9695505050505050565b60006020820190506138dd600083018461360c565b92915050565b60006138ed6138fe565b90506138f98282613b92565b919050565b6000604051905090565b600067ffffffffffffffff82111561392357613922613cc8565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60006139aa82613b04565b91506139b583613b04565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156139ea576139e9613c0c565b5b828201905092915050565b6000613a0082613b04565b9150613a0b83613b04565b925082613a1b57613a1a613c3b565b5b828204905092915050565b6000613a3182613b04565b9150613a3c83613b04565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613a7557613a74613c0c565b5b828202905092915050565b6000613a8b82613b04565b9150613a9683613b04565b925082821015613aa957613aa8613c0c565b5b828203905092915050565b6000613abf82613ae4565b9050919050565b6000613ad182613ae4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613b2682613b04565b9050919050565b60005b83811015613b4b578082015181840152602081019050613b30565b83811115613b5a576000848401525b50505050565b60006002820490506001821680613b7857607f821691505b60208210811415613b8c57613b8b613c6a565b5b50919050565b613b9b82613d0b565b810181811067ffffffffffffffff82111715613bba57613bb9613cc8565b5b80604052505050565b6000613bce82613b04565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613c0157613c00613c0c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4e6f742073746172742074726164650000000000000000000000000000000000600082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6700000000000000000000000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f426c61636b4c6973740000000000000000000000000000000000000000000000600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f63616e6e6f74206265207468697320746f6b656e000000000000000000000000600082015250565b61404481613ab4565b811461404f57600080fd5b50565b61405b81613ac6565b811461406657600080fd5b50565b61407281613ad8565b811461407d57600080fd5b50565b61408981613b04565b811461409457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f1d6ddf4c075f72d35c01f5daa45a8ea9ac63164c69c4e3f134d58ac17b9e75964736f6c63430008060033
Verified Source Code Full Match
Compiler: v0.8.6+commit.11564f7e
EVM: berlin
Optimization: No
Token.sol 352 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "./utils/Ownable.sol";
import "./utils/SafeERC20.sol";
import "./utils/IERC20.sol";
import "./utils/ERC20.sol";
import "./utils/SafeMath.sol";
import "./utils/Address.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
contract Token is Context, IERC20, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Address for address;
receive() external payable {}
string private _name;
string private _symbol;
uint8 private _decimals = 18;
address public marketingAddress;
address public usdtAddress;
mapping(address => uint256) _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) public isMarketPair;
mapping(address => bool) public isExcludedFromFee;
mapping(address => bool) public isBlackList;
uint256 public startTradeBlock;
uint256 public startBlock;
bool public swapEnabled;
address public immutable deadAddress =
0x000000000000000000000000000000000000dEaD;
uint256 private _totalSupply = 102400000000 * 10 ** _decimals;
address public router;
address public pairAddress;
bool inSwap;
constructor(
address _marketing,
address _router
) {
_name = "FrogGaga";
_symbol = "GAGA";
router = _router;
marketingAddress = _marketing;
pairAddress = IUniswapV2Factory(IUniswapV2Router01(router).factory())
.createPair(address(this), IUniswapV2Router01(router).WETH());
isExcludedFromFee[_marketing] = true;
isExcludedFromFee[owner()] = true;
isExcludedFromFee[address(this)] = true;
isMarketPair[address(pairAddress)] = true;
swapEnabled = false;
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function startTrade() external onlyOwner {
require(0 == startTradeBlock, "trading");
startTradeBlock = block.number;
}
function setAddresses(
address _marketing
) public onlyOwner {
marketingAddress = _marketing;
}
function setSwapEnabled(bool _enabled) public onlyOwner {
swapEnabled = _enabled;
}
function setExcludedFromFee(address _address, bool _excluded) public onlyOwner {
isExcludedFromFee[_address] = _excluded;
}
function setExcludedFromFees(address[] memory _address, bool _excluded) public onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
isExcludedFromFee[_address[i]] = _excluded;
}
}
function setBlackList(address _address, bool _excluded) public onlyOwner {
isBlackList[_address] = _excluded;
}
function setBlackLists(address[] memory _address, bool _excluded) public onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
isBlackList[_address[i]] = _excluded;
}
}
function rescueToken(address tokenAddress, uint256 tokens)
public
onlyOwner
returns (bool success)
{
return IERC20(tokenAddress).transfer(msg.sender, tokens);
}
function rescueBNB(address payable _recipient) public onlyOwner {
_recipient.transfer(address(this).balance);
}
modifier lockTheSwap() {
inSwap = true;
_;
inSwap = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].add(addedValue)
);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setMarketPairStatus(address account, bool newValue)
public
onlyOwner
{
isMarketPair[account] = newValue;
}
function setAddress(address _marketing) external onlyOwner {
marketingAddress = _marketing;
isExcludedFromFee[marketingAddress] = true;
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(!isBlackList[sender] && !isBlackList[recipient], "BlackList");
if (inSwap) {
_basicTransfer(sender, recipient, amount);
} else {
if (amount == 0) {
_balances[recipient] = _balances[recipient].add(amount);
return;
}
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
if (startBlock == 0 && isMarketPair[recipient]) {
startBlock = block.number;
}
if (
swapEnabled &&
isMarketPair[recipient] &&
balanceOf(address(this)) > amount.div(2)
) {
swapTokensForETH(amount.div(2), marketingAddress);
}
uint256 finalAmount = (isExcludedFromFee[sender] ||
isExcludedFromFee[recipient])
? amount
: takeFee(sender, recipient, amount);
_balances[recipient] = _balances[recipient].add(finalAmount);
emit Transfer(sender, recipient, finalAmount);
}
}
function _basicTransfer(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function swapTokensForETH(uint256 tokenAmount, address to)
private
lockTheSwap
{
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = IUniswapV2Router01(router).WETH();
_approve(address(this), address(router), tokenAmount);
IUniswapV2Router02(router)
.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
to,
block.timestamp
);
}
/**
* @notice It allows the admin to recover wrong tokens sent to the contract
* @param _tokenAddress: the address of the token to withdraw
*/
function rescueTokens(address _tokenAddress) external onlyOwner {
require(_tokenAddress != address(this), "cannot be this token");
IERC20(_tokenAddress).safeTransfer(
address(msg.sender),
IERC20(_tokenAddress).balanceOf(address(this))
);
}
function takeFee(
address sender,
address recipient,
uint256 amount
) internal returns (uint256) {
uint256 feeAmount = 0;
address _sender = sender;
uint256 _amount = amount;
require(startTradeBlock > 0, "Not start trade");
if (isMarketPair[sender] && startTradeBlock + 50 >= block.number) {
feeAmount = _amount.mul(99).div(100);
_balances[marketingAddress] = _balances[marketingAddress].add(feeAmount);
emit Transfer(sender, marketingAddress, feeAmount);
return _amount.sub(feeAmount);
}
return _amount.sub(feeAmount);
}
}
ERC20.sol 383 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./IERC20Metadata.sol";
import "./Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, _allowances[owner][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = _allowances[owner][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Spend `amount` form the allowance of `owner` toward `spender`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens 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 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
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);
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Ownable.sol 80 lines
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
import "./Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
SafeMath.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
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 generally not needed starting with Solidity 0.8, since 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;
}
}
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
IUniswapV2Pair.sol 52 lines
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
IUniswapV2Factory.sol 17 lines
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
IUniswapV2Router01.sol 95 lines
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
IUniswapV2Router02.sol 44 lines
pragma solidity >=0.6.2;
import './IUniswapV2Router01.sol';
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
deadAddress 0x27c8f835 → address
decimals 0x313ce567 → uint8
isBlackList 0xb36d6919 → bool
isExcludedFromFee 0x5342acb4 → bool
isMarketPair 0x3ecad271 → bool
marketingAddress 0xa5ece941 → address
name 0x06fdde03 → string
owner 0x8da5cb5b → address
pairAddress 0xa8b08982 → address
router 0xf887ea40 → address
startBlock 0x48cd4cb1 → uint256
startTradeBlock 0x553193ca → uint256
swapEnabled 0x6ddd1713 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
usdtAddress 0x9ab4a445 → address
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
renounceOwnership 0x715018a6
No parameters
rescueBNB 0x5e64f769
address _recipient
rescueToken 0x33f3d628
address tokenAddress
uint256 tokens
returns: bool
rescueTokens 0x00ae3bf8
address _tokenAddress
setAddress 0xe30081a0
address _marketing
setAddresses 0x81d3c435
address _marketing
setBlackList 0x68092bd9
address _address
bool _excluded
setBlackLists 0xae9b6e10
address[] _address
bool _excluded
setExcludedFromFee 0x6612e66f
address _address
bool _excluded
setExcludedFromFees 0x105222f9
address[] _address
bool _excluded
setMarketPairStatus 0x844d591c
address account
bool newValue
setSwapEnabled 0xe01af92c
bool _enabled
startTrade 0x6c580801
No parameters
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address