Address Contract Partially Verified
Address
0xde2129f4b118264a4745Fd1Ebb66942d9b605b0C
Balance
0 ETH
Nonce
1
Code Size
19754 bytes
Creator
0xeF294eC1...3356 at tx 0x522adc26...d02f60
Indexed Transactions
0
Contract Bytecode
19754 bytes
0x60806040526004361061028c5760003560e01c80638d117d1f1161015a578063bd6af9e4116100c1578063dd62ed3e1161007a578063dd62ed3e146109e4578063e086e5ec14610a21578063e624c4bc14610a38578063f2fde38b14610a61578063f52d2c0014610a8a578063fe575a8714610ab557610293565b8063bd6af9e4146108e7578063bdeab5c514610910578063bf845ea814610939578063c607ca5a14610962578063c6a276c214610990578063ce2ddd4e146109b957610293565b8063a457c2d711610113578063a457c2d7146107b3578063a9059cbb146107f0578063ac44d2c21461082d578063b119490e1461086a578063b319c6b714610893578063b70143c9146108be57610293565b80638d117d1f146106a55780638da5cb5b146106ce5780638f70ccf7146106f957806395d89b411461072257806399f7854a1461074d5780639d0014b11461078a57610293565b806339509351116101fe5780636ff73201116101b75780636ff73201146105ad57806370a08231146105d6578063715018a614610613578063755b5e221461062a5780638705fcd4146106535780638bb171bc1461067c57610293565b8063395093511461048d57806342844b04146104ca578063453be18e146104f3578063457385f21461051c5780636c1c1905146105595780636e9087db1461058257610293565b80631694505e116102505780631694505e1461037d57806318160ddd146103a857806321415c51146103d357806323b872dd146103fc578063313ce56714610439578063315a095d1461046457610293565b80630445b6671461029857806306fdde03146102c3578063095ea7b3146102ee5780631419841d1461032b57806315a029941461035457610293565b3661029357005b600080fd5b3480156102a457600080fd5b506102ad610af2565b6040516102ba9190613159565b60405180910390f35b3480156102cf57600080fd5b506102d8610afc565b6040516102e59190613204565b60405180910390f35b3480156102fa57600080fd5b50610315600480360381019061031091906132c4565b610b8e565b604051610322919061331f565b60405180910390f35b34801561033757600080fd5b50610352600480360381019061034d919061333a565b610bb1565b005b34801561036057600080fd5b5061037b600480360381019061037691906133a0565b610c6c565b005b34801561038957600080fd5b50610392610d9c565b60405161039f9190613452565b60405180910390f35b3480156103b457600080fd5b506103bd610dc6565b6040516103ca9190613159565b60405180910390f35b3480156103df57600080fd5b506103fa60048036038101906103f5919061333a565b610dd0565b005b34801561040857600080fd5b50610423600480360381019061041e919061346d565b610e2a565b604051610430919061331f565b60405180910390f35b34801561044557600080fd5b5061044e610e59565b60405161045b91906134cf565b60405180910390f35b34801561047057600080fd5b5061048b600480360381019061048691906134ea565b610e62565b005b34801561049957600080fd5b506104b460048036038101906104af91906132c4565b610ed6565b6040516104c1919061331f565b60405180910390f35b3480156104d657600080fd5b506104f160048036038101906104ec919061333a565b610f0d565b005b3480156104ff57600080fd5b5061051a60048036038101906105159190613543565b610f67565b005b34801561052857600080fd5b50610543600480360381019061053e919061333a565b610fe1565b604051610550919061331f565b60405180910390f35b34801561056557600080fd5b50610580600480360381019061057b919061333a565b611037565b005b34801561058e57600080fd5b50610597611109565b6040516105a4919061331f565b60405180910390f35b3480156105b957600080fd5b506105d460048036038101906105cf91906134ea565b611120565b005b3480156105e257600080fd5b506105fd60048036038101906105f8919061333a565b611176565b60405161060a9190613159565b60405180910390f35b34801561061f57600080fd5b506106286111bf565b005b34801561063657600080fd5b50610651600480360381019061064c919061333a565b6111d3565b005b34801561065f57600080fd5b5061067a6004803603810190610675919061333a565b6112a5565b005b34801561068857600080fd5b506106a3600480360381019061069e919061333a565b611360565b005b3480156106b157600080fd5b506106cc60048036038101906106c7919061333a565b611432565b005b3480156106da57600080fd5b506106e361148c565b6040516106f0919061357f565b60405180910390f35b34801561070557600080fd5b50610720600480360381019061071b9190613543565b6114b6565b005b34801561072e57600080fd5b50610737611530565b6040516107449190613204565b60405180910390f35b34801561075957600080fd5b50610774600480360381019061076f919061333a565b6115c2565b604051610781919061331f565b60405180910390f35b34801561079657600080fd5b506107b160048036038101906107ac91906134ea565b611618565b005b3480156107bf57600080fd5b506107da60048036038101906107d591906132c4565b611676565b6040516107e7919061331f565b60405180910390f35b3480156107fc57600080fd5b50610817600480360381019061081291906132c4565b6116ed565b604051610824919061331f565b60405180910390f35b34801561083957600080fd5b50610854600480360381019061084f919061333a565b611710565b604051610861919061331f565b60405180910390f35b34801561087657600080fd5b50610891600480360381019061088c91906136cf565b611766565b005b34801561089f57600080fd5b506108a86118bb565b6040516108b59190613159565b60405180910390f35b3480156108ca57600080fd5b506108e560048036038101906108e091906134ea565b6118c5565b005b3480156108f357600080fd5b5061090e6004803603810190610909919061333a565b611945565b005b34801561091c57600080fd5b506109376004803603810190610932919061333a565b61199f565b005b34801561094557600080fd5b50610960600480360381019061095b9190613543565b611a71565b005b34801561096e57600080fd5b50610977611aeb565b604051610987949392919061375a565b60405180910390f35b34801561099c57600080fd5b506109b760048036038101906109b2919061333a565b611b52565b005b3480156109c557600080fd5b506109ce611bac565b6040516109db919061331f565b60405180910390f35b3480156109f057600080fd5b50610a0b6004803603810190610a06919061379f565b611bc3565b604051610a189190613159565b60405180910390f35b348015610a2d57600080fd5b50610a36611c4a565b005b348015610a4457600080fd5b50610a5f6004803603810190610a5a919061333a565b611c6d565b005b348015610a6d57600080fd5b50610a886004803603810190610a83919061333a565b611d3f565b005b348015610a9657600080fd5b50610a9f611dc2565b604051610aac919061331f565b60405180910390f35b348015610ac157600080fd5b50610adc6004803603810190610ad7919061333a565b611dd9565b604051610ae9919061331f565b60405180910390f35b6000609c54905090565b606060368054610b0b9061380e565b80601f0160208091040260200160405190810160405280929190818152602001828054610b379061380e565b8015610b845780601f10610b5957610100808354040283529160200191610b84565b820191906000526020600020905b815481529060010190602001808311610b6757829003601f168201915b5050505050905090565b600080610b99611e2f565b9050610ba6818585611e37565b600191505092915050565b610bb9612000565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1f906138b1565b60405180910390fd5b80609d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610c74612000565b60148360ff1610610cba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb190613943565b60405180910390fd5b60148260ff1610610d00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf7906139d5565b60405180910390fd5b60148160ff1610610d46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3d90613a67565b60405180910390fd5b82609760026101000a81548160ff021916908360ff16021790555081609760036101000a81548160ff021916908360ff16021790555080609760046101000a81548160ff021916908360ff160217905550505050565b6000609d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000603554905090565b610dd8612000565b60a160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b600080610e35611e2f565b9050610e4285828561207e565b610e4d85858561210a565b60019150509392505050565b60006012905090565b610e6a612000565b610e7330611176565b8111158015610e825750600081115b610ec1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb890613ad3565b60405180910390fd5b610ed330610ecd61148c565b8361210a565b50565b600080610ee1611e2f565b9050610f02818585610ef38589611bc3565b610efd9190613b22565b611e37565b600191505092915050565b610f15612000565b609f60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b610f6f612000565b801515609b60019054906101000a900460ff16151503610fc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbb90613ba2565b60405180910390fd5b80609b60016101000a81548160ff02191690831515021790555050565b6000609860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b61103f612000565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a590613c34565b60405180910390fd5b600160a160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000609760019054906101000a900460ff16905090565b611128612000565b61012c811061116c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116390613cc6565b60405180910390fd5b8060a08190555050565b6000603360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6111c7612000565b6111d1600061264f565b565b6111db612000565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361124a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124190613c34565b60405180910390fd5b6001609f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6112ad612000565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361131c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131390613d32565b60405180910390fd5b80609760056101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611368612000565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036113d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ce90613dc4565b60405180910390fd5b6001609a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b61143a612000565b609860008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6114be612000565b801515609760019054906101000a900460ff16151503611513576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150a90613ba2565b60405180910390fd5b80609760016101000a81548160ff02191690831515021790555050565b60606037805461153f9061380e565b80601f016020809104026020016040519081016040528092919081815260200182805461156b9061380e565b80156115b85780601f1061158d576101008083540402835291602001916115b8565b820191906000526020600020905b81548152906001019060200180831161159b57829003601f168201915b5050505050905090565b6000609960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b611620612000565b6954b40b1f852bda000000811061166c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166390613ad3565b60405180910390fd5b80609c8190555050565b600080611681611e2f565b9050600061168f8286611bc3565b9050838110156116d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cb90613e56565b60405180910390fd5b6116e18286868403611e37565b60019250505092915050565b6000806116f8611e2f565b905061170581858561210a565b600191505092915050565b6000609f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060019054906101000a900460ff161590508080156117975750600160008054906101000a900460ff1660ff16105b806117c457506117a630612715565b1580156117c35750600160008054906101000a900460ff1660ff16145b5b611803576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117fa90613ee8565b60405180910390fd5b60016000806101000a81548160ff021916908360ff1602179055508015611840576001600060016101000a81548160ff0219169083151502179055505b61184a8484612738565b6118543383612795565b61185c6128f5565b80156118b55760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516118ac9190613f43565b60405180910390a15b50505050565b600060a054905090565b6118cd612000565b6118d630611176565b81111580156118e55750600081115b80156118fa575069098774738bc82220000081105b611939576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193090613ad3565b60405180910390fd5b6119428161294e565b50565b61194d612000565b609960008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b6119a7612000565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611a16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0d90613fd0565b60405180910390fd5b6001609860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611a79612000565b801515609760009054906101000a900460ff16151503611ace576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac590613ba2565b60405180910390fd5b80609760006101000a81548160ff02191690831515021790555050565b600080600080609760029054906101000a900460ff16609760039054906101000a900460ff16609760049054906101000a900460ff16609760059054906101000a900473ffffffffffffffffffffffffffffffffffffffff16935093509350935090919293565b611b5a612000565b609a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b6000609b60019054906101000a900460ff16905090565b6000603460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611c52612000565b60004790506000811115611c6a57611c6981612bc7565b5b50565b611c75612000565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611ce4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cdb90614062565b60405180910390fd5b6001609960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611d47612000565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611db6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dad906140f4565b60405180910390fd5b611dbf8161264f565b50565b6000609760009054906101000a900460ff16905090565b6000609a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611ea6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9d90614186565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f0c90614218565b60405180910390fd5b80603460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611ff39190613159565b60405180910390a3505050565b612008611e2f565b73ffffffffffffffffffffffffffffffffffffffff1661202661148c565b73ffffffffffffffffffffffffffffffffffffffff161461207c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207390614284565b60405180910390fd5b565b600061208a8484611bc3565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461210457818110156120f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ed906142f0565b60405180910390fd5b6121038484848403611e37565b5b50505050565b6000819050609860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156121b35750609860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561263e57609a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561225c5750609a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61229b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229290614382565b60405180910390fd5b609760009054906101000a900460ff166122ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122e190614414565b60405180910390fd5b609960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061238b5750609960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156123e057609760019054906101000a900460ff166123df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d690614480565b60405180910390fd5b5b60006123eb30611176565b90506000609c54821190506000609c541180156124055750805b801561241e5750609b60009054906101000a900460ff16155b80156124745750609960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156124e05750609b60019054906101000a900460ff16806124df575060a160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b5b1561250a576124f0609c5461294e565b600047905060008111156125085761250781612bc7565b5b505b6000609960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561257857609760029054906101000a900460ff1660ff1690506125fb565b609960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156125e457609760039054906101000a900460ff1660ff1690506125fa565b609760049054906101000a900460ff1660ff1690505b5b6000811461263a5760006064828661261391906144a0565b61261d9190614511565b905061262a883083612c33565b80856126369190614542565b9450505b5050505b612649848483612c33565b50505050565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16612787576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161277e906145e8565b60405180910390fd5b6127918282612eb5565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612804576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127fb90614654565b60405180910390fd5b61281060008383612f28565b80603560008282546128229190613b22565b9250508190555080603360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546128789190613b22565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516128dd9190613159565b60405180910390a36128f16000838361301d565b5050565b600060019054906101000a900460ff16612944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293b906145e8565b60405180910390fd5b61294c6130df565b565b6001609b60006101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612986576129856135a4565b5b6040519080825280602002602001820160405280156129b45781602001602082028036833780820191505090505b50905030816000815181106129cc576129cb614674565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050609d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a9791906146b8565b81600181518110612aab57612aaa614674565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612b1230609d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611e37565b609d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612b769594939291906147de565b600060405180830381600087803b158015612b9057600080fd5b505af1158015612ba4573d6000803e3d6000fd5b50505050506000609b60006101000a81548160ff02191690831515021790555050565b609760059054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612c2f573d6000803e3d6000fd5b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612ca2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c99906148aa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612d11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d089061493c565b60405180910390fd5b612d1c838383612f28565b6000603360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612da3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d9a906149ce565b60405180910390fd5b818103603360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081603360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612e389190613b22565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612e9c9190613159565b60405180910390a3612eaf84848461301d565b50505050565b600060019054906101000a900460ff16612f04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612efb906145e8565b60405180910390fd5b8160369081612f139190614b90565b508060379081612f239190614b90565b505050565b609f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16613018574263ffffffff16609e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1663ffffffff161115613017576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161300e90614cd4565b60405180910390fd5b5b505050565b609f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166130da5760a0544261307c9190613b22565b609e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b505050565b600060019054906101000a900460ff1661312e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613125906145e8565b60405180910390fd5b61313e613139611e2f565b61264f565b565b6000819050919050565b61315381613140565b82525050565b600060208201905061316e600083018461314a565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156131ae578082015181840152602081019050613193565b60008484015250505050565b6000601f19601f8301169050919050565b60006131d682613174565b6131e0818561317f565b93506131f0818560208601613190565b6131f9816131ba565b840191505092915050565b6000602082019050818103600083015261321e81846131cb565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006132658261323a565b9050919050565b6132758161325a565b811461328057600080fd5b50565b6000813590506132928161326c565b92915050565b6132a181613140565b81146132ac57600080fd5b50565b6000813590506132be81613298565b92915050565b600080604083850312156132db576132da613230565b5b60006132e985828601613283565b92505060206132fa858286016132af565b9150509250929050565b60008115159050919050565b61331981613304565b82525050565b60006020820190506133346000830184613310565b92915050565b6000602082840312156133505761334f613230565b5b600061335e84828501613283565b91505092915050565b600060ff82169050919050565b61337d81613367565b811461338857600080fd5b50565b60008135905061339a81613374565b92915050565b6000806000606084860312156133b9576133b8613230565b5b60006133c78682870161338b565b93505060206133d88682870161338b565b92505060406133e98682870161338b565b9150509250925092565b6000819050919050565b600061341861341361340e8461323a565b6133f3565b61323a565b9050919050565b600061342a826133fd565b9050919050565b600061343c8261341f565b9050919050565b61344c81613431565b82525050565b60006020820190506134676000830184613443565b92915050565b60008060006060848603121561348657613485613230565b5b600061349486828701613283565b93505060206134a586828701613283565b92505060406134b6868287016132af565b9150509250925092565b6134c981613367565b82525050565b60006020820190506134e460008301846134c0565b92915050565b600060208284031215613500576134ff613230565b5b600061350e848285016132af565b91505092915050565b61352081613304565b811461352b57600080fd5b50565b60008135905061353d81613517565b92915050565b60006020828403121561355957613558613230565b5b60006135678482850161352e565b91505092915050565b6135798161325a565b82525050565b60006020820190506135946000830184613570565b92915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6135dc826131ba565b810181811067ffffffffffffffff821117156135fb576135fa6135a4565b5b80604052505050565b600061360e613226565b905061361a82826135d3565b919050565b600067ffffffffffffffff82111561363a576136396135a4565b5b613643826131ba565b9050602081019050919050565b82818337600083830152505050565b600061367261366d8461361f565b613604565b90508281526020810184848401111561368e5761368d61359f565b5b613699848285613650565b509392505050565b600082601f8301126136b6576136b561359a565b5b81356136c684826020860161365f565b91505092915050565b6000806000606084860312156136e8576136e7613230565b5b600084013567ffffffffffffffff81111561370657613705613235565b5b613712868287016136a1565b935050602084013567ffffffffffffffff81111561373357613732613235565b5b61373f868287016136a1565b9250506040613750868287016132af565b9150509250925092565b600060808201905061376f60008301876134c0565b61377c60208301866134c0565b61378960408301856134c0565b6137966060830184613570565b95945050505050565b600080604083850312156137b6576137b5613230565b5b60006137c485828601613283565b92505060206137d585828601613283565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061382657607f821691505b602082108103613839576138386137df565b5b50919050565b7f5a65726f20616464726573732063616e6e6f7420626520756e6973776170207660008201527f3220726f75746572000000000000000000000000000000000000000000000000602082015250565b600061389b60288361317f565b91506138a68261383f565b604082019050919050565b600060208201905081810360008301526138ca8161388e565b9050919050565b7f42757920666565206e6565647320746f206265206c6f776572207468616e203260008201527f3025000000000000000000000000000000000000000000000000000000000000602082015250565b600061392d60228361317f565b9150613938826138d1565b604082019050919050565b6000602082019050818103600083015261395c81613920565b9050919050565b7f53656c6c20666565206e6565647320746f206265206c6f776572207468616e2060008201527f3230250000000000000000000000000000000000000000000000000000000000602082015250565b60006139bf60238361317f565b91506139ca82613963565b604082019050919050565b600060208201905081810360008301526139ee816139b2565b9050919050565b7f5472616e7366657220666565206e6565647320746f206265206c6f776572207460008201527f68616e2032302500000000000000000000000000000000000000000000000000602082015250565b6000613a5160278361317f565b9150613a5c826139f5565b604082019050919050565b60006020820190508181036000830152613a8081613a44565b9050919050565b7f57726f6e6720616d6f756e740000000000000000000000000000000000000000600082015250565b6000613abd600c8361317f565b9150613ac882613a87565b602082019050919050565b60006020820190508181036000830152613aec81613ab0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613b2d82613140565b9150613b3883613140565b9250828201905080821115613b5057613b4f613af3565b5b92915050565b7f56616c756520616c726561647920736574000000000000000000000000000000600082015250565b6000613b8c60118361317f565b9150613b9782613b56565b602082019050919050565b60006020820190508181036000830152613bbb81613b7f565b9050919050565b7f5a65726f20616464726573732063616e6e6f7420626520636f6f6c646f776e2060008201527f77686974656c6973740000000000000000000000000000000000000000000000602082015250565b6000613c1e60298361317f565b9150613c2982613bc2565b604082019050919050565b60006020820190508181036000830152613c4d81613c11565b9050919050565b7f54686520636f6f6c646f776e2074696d65206e6565647320746f206265206c6f60008201527f776572207468616e2035206d696e757465730000000000000000000000000000602082015250565b6000613cb060328361317f565b9150613cbb82613c54565b604082019050919050565b60006020820190508181036000830152613cdf81613ca3565b9050919050565b7f5a65726f20616464726573732063616e6e6f7420636f6c6c6563742066656573600082015250565b6000613d1c60208361317f565b9150613d2782613ce6565b602082019050919050565b60006020820190508181036000830152613d4b81613d0f565b9050919050565b7f5a65726f20616464726573732063616e6e6f7420626520626c61636b6c69737460008201527f6564000000000000000000000000000000000000000000000000000000000000602082015250565b6000613dae60228361317f565b9150613db982613d52565b604082019050919050565b60006020820190508181036000830152613ddd81613da1565b9050919050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000613e4060258361317f565b9150613e4b82613de4565b604082019050919050565b60006020820190508181036000830152613e6f81613e33565b9050919050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b6000613ed2602e8361317f565b9150613edd82613e76565b604082019050919050565b60006020820190508181036000830152613f0181613ec5565b9050919050565b6000819050919050565b6000613f2d613f28613f2384613f08565b6133f3565b613367565b9050919050565b613f3d81613f12565b82525050565b6000602082019050613f586000830184613f34565b92915050565b7f5a65726f20616464726573732063616e6e6f74206265206f7065726174696f6e60008201527f616c000000000000000000000000000000000000000000000000000000000000602082015250565b6000613fba60228361317f565b9150613fc582613f5e565b604082019050919050565b60006020820190508181036000830152613fe981613fad565b9050919050565b7f5a65726f20616464726573732063616e6e6f742062652061206c69717569646960008201527f74792070726f7669646572000000000000000000000000000000000000000000602082015250565b600061404c602b8361317f565b915061405782613ff0565b604082019050919050565b6000602082019050818103600083015261407b8161403f565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006140de60268361317f565b91506140e982614082565b604082019050919050565b6000602082019050818103600083015261410d816140d1565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061417060248361317f565b915061417b82614114565b604082019050919050565b6000602082019050818103600083015261419f81614163565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061420260228361317f565b915061420d826141a6565b604082019050919050565b60006020820190508181036000830152614231816141f5565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061426e60208361317f565b915061427982614238565b602082019050919050565b6000602082019050818103600083015261429d81614261565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b60006142da601d8361317f565b91506142e5826142a4565b602082019050919050565b60006020820190508181036000830152614309816142cd565b9050919050565b7f5468652073656e646572206f7220726563697069656e7420697320626c61636b60008201527f6c69737465640000000000000000000000000000000000000000000000000000602082015250565b600061436c60268361317f565b915061437782614310565b604082019050919050565b6000602082019050818103600083015261439b8161435f565b9050919050565b7f4c69717569646974792050726f766964657220697320696e697469616c697a6960008201527f6e67000000000000000000000000000000000000000000000000000000000000602082015250565b60006143fe60228361317f565b9150614409826143a2565b604082019050919050565b6000602082019050818103600083015261442d816143f1565b9050919050565b7f54726164696e6720697320506175736564000000000000000000000000000000600082015250565b600061446a60118361317f565b915061447582614434565b602082019050919050565b600060208201905081810360008301526144998161445d565b9050919050565b60006144ab82613140565b91506144b683613140565b92508282026144c481613140565b915082820484148315176144db576144da613af3565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061451c82613140565b915061452783613140565b925082614537576145366144e2565b5b828204905092915050565b600061454d82613140565b915061455883613140565b92508282039050818111156145705761456f613af3565b5b92915050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b60006145d2602b8361317f565b91506145dd82614576565b604082019050919050565b60006020820190508181036000830152614601816145c5565b9050919050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b600061463e601f8361317f565b915061464982614608565b602082019050919050565b6000602082019050818103600083015261466d81614631565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815190506146b28161326c565b92915050565b6000602082840312156146ce576146cd613230565b5b60006146dc848285016146a3565b91505092915050565b6000819050919050565b600061470a614705614700846146e5565b6133f3565b613140565b9050919050565b61471a816146ef565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6147558161325a565b82525050565b6000614767838361474c565b60208301905092915050565b6000602082019050919050565b600061478b82614720565b614795818561472b565b93506147a08361473c565b8060005b838110156147d15781516147b8888261475b565b97506147c383614773565b9250506001810190506147a4565b5085935050505092915050565b600060a0820190506147f3600083018861314a565b6148006020830187614711565b81810360408301526148128186614780565b90506148216060830185613570565b61482e608083018461314a565b9695505050505050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061489460258361317f565b915061489f82614838565b604082019050919050565b600060208201905081810360008301526148c381614887565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061492660238361317f565b9150614931826148ca565b604082019050919050565b6000602082019050818103600083015261495581614919565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006149b860268361317f565b91506149c38261495c565b604082019050919050565b600060208201905081810360008301526149e7816149ab565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302614a507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614a13565b614a5a8683614a13565b95508019841693508086168417925050509392505050565b6000614a8d614a88614a8384613140565b6133f3565b613140565b9050919050565b6000819050919050565b614aa783614a72565b614abb614ab382614a94565b848454614a20565b825550505050565b600090565b614ad0614ac3565b614adb818484614a9e565b505050565b5b81811015614aff57614af4600082614ac8565b600181019050614ae1565b5050565b601f821115614b4457614b15816149ee565b614b1e84614a03565b81016020851015614b2d578190505b614b41614b3985614a03565b830182614ae0565b50505b505050565b600082821c905092915050565b6000614b6760001984600802614b49565b1980831691505092915050565b6000614b808383614b56565b9150826002028217905092915050565b614b9982613174565b67ffffffffffffffff811115614bb257614bb16135a4565b5b614bbc825461380e565b614bc7828285614b03565b600060209050601f831160018114614bfa5760008415614be8578287015190505b614bf28582614b74565b865550614c5a565b601f198416614c08866149ee565b60005b82811015614c3057848901518255600182019150602085019450602081019050614c0b565b86831015614c4d5784890151614c49601f891682614b56565b8355505b6001600288020188555050505b505050505050565b7f506c656173652077616974206120626974206265666f7265207472616e73666560008201527f7272696e67206f722073656c6c696e6720796f757220746f6b656e732e000000602082015250565b6000614cbe603d8361317f565b9150614cc982614c62565b604082019050919050565b60006020820190508181036000830152614ced81614cb1565b905091905056fea264697066735822122091e21e0d2ecffb746d3f49baa7ffc4572c80a147f22b5a7068050a6dbf1bc35a64736f6c63430008110033
Verified Source Code Partial Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: No
ERC20Upgradeable.sol 395 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
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.
*/
function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
__ERC20_init_unchained(name_, symbol_);
}
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
_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, allowance(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 = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* 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 Updates `owner` s allowance for `spender` based on spent `amount`.
*
* 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 {}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[45] private __gap;
}
Initializable.sol 138 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
* initialization step. This is essential to configure modules that are added through upgrades and that require
* initialization.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
}
OwnableUpgradeable.sol 95 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
CCXA.sol 676 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
/**
* @title ClearCryptos Transparent Upgradeable Proxy
* @author ClearCryptos Blockchain Team - G3NOM3
* @dev This contract inherits OpenZeppelin extra secure and audited contracts
* for implementing the ERC20 standard with fees.
*/
contract CCXA is ERC20Upgradeable, OwnableUpgradeable {
bool private s_initializedLiquidityProvider;
bool private s_trading;
uint8 private s_buyFee;
uint8 private s_sellFee;
uint8 private s_transferFee;
address private s_feeAddress;
mapping(address => bool) private s_isOperational;
mapping(address => bool) private s_isLiquidityProvider;
mapping(address => bool) private s_isBlacklisted;
bool private s_inSwap;
bool private s_internalSwapEnabled;
uint256 private s_swapThreshold;
IUniswapV2Router02 private s_uniswapV2Router;
mapping(address => uint32) private s_cooldowns;
mapping(address => bool) private s_cooldownWhitelist;
uint256 private s_cooldownTime;
mapping(address => bool) private s_testingAddress;
modifier lockTheSwap() {
s_inSwap = true;
_;
s_inSwap = false;
}
function initialize(
string memory _name,
string memory _symbol,
uint256 _supply
) public initializer {
__ERC20_init(_name, _symbol);
_mint(msg.sender, _supply);
__Ownable_init();
}
/**
* @dev Returns the current storage values of the fee infrastructure.
*
* @return s_buyFee the fee applied in {buy} transactions.
* @return s_sellFee the fee applied in {sell} transactions.
* @return s_transferFee the fee applied in {wallet-to-wallet} transactions.
* @return s_feeAddress the address that collects the fee.
*/
function getFeeState()
external
view
virtual
returns (
uint8,
uint8,
uint8,
address
)
{
return (s_buyFee, s_sellFee, s_transferFee, s_feeAddress);
}
/**
* @dev Returns the current storage value of the trading state.
*
* @return s_trading is the trading state.
*/
function isTrading() external view virtual returns (bool) {
return s_trading;
}
/**
* @dev If a new liquidity provider is set, the transfers need to be paused to
* avoid vulnerability exploits and fee issues.
*
* @return s_initializedLiquidityProvider is the current liquidity provider initializing state.
*/
function isInitializedLiquidityProvider()
external
view
virtual
returns (bool)
{
return s_initializedLiquidityProvider;
}
/**
* @dev Checks if the input address is an operations provider.
*
* @param _operationalAddress is a possible operations provider's address.
*/
function isOperational(address _operationalAddress)
external
view
virtual
returns (bool)
{
return s_isOperational[_operationalAddress];
}
/**
* @dev Checks if an address is a liquidity provider
*
* @param _liquidityprovider is a possible liquidity provider's address
*/
function isLiquidityProvider(address _liquidityprovider)
external
view
virtual
returns (bool)
{
return s_isLiquidityProvider[_liquidityprovider];
}
/**
* @dev Checks if an address is blacklisted
*
* @param _blacklistedAddress is a possible blacklisted address
*/
function isBlacklisted(address _blacklistedAddress)
external
view
virtual
returns (bool)
{
return s_isBlacklisted[_blacklistedAddress];
}
/**
* @dev Add Operational Address. This address represents an operations provider like a
* smart contracts infrastructure (e.g. staking, flash loan etc.)
*
* Requirements:
*
* - `_operationalAddress` cannot be the zero address.
*
* @param _operationalAddress is a new operations provider's address.
*/
function setOperational(address _operationalAddress)
external
virtual
onlyOwner
{
require(
_operationalAddress != address(0),
"Zero address cannot be operational"
);
s_isOperational[_operationalAddress] = true;
}
/**
* @dev Remove Operational Address
*
* @param _operationalAddress is an existing operations provider's address.
*/
function removeOperational(address _operationalAddress)
external
virtual
onlyOwner
{
delete s_isOperational[_operationalAddress];
}
/**
* @dev Add new Liquidity Provider / Decentralized Exchange.
*
* Requirements:
*
* - `_liquidityProvider` cannot be the zero address.
*
* @param _liquidityProvider is a new liquidity provider's address.
*/
function setLiquidityProvider(address _liquidityProvider)
external
virtual
onlyOwner
{
require(
_liquidityProvider != address(0),
"Zero address cannot be a liquidity provider"
);
s_isLiquidityProvider[_liquidityProvider] = true;
}
/**
* @dev Remove Liquidity Provider / Decentralized Exchange Address.
*
* @param _liquidityProvider is an existing liquidity provider's address
*/
function removeLiquidityProvider(address _liquidityProvider)
external
virtual
onlyOwner
{
delete s_isLiquidityProvider[_liquidityProvider];
}
/**
* @dev Add new Blacklisted Address
*
* Requirements:
*
* - `_blacklistedAddress` cannot be the zero address.
*
* @param _blacklistedAddress is a new blacklisted address.
*/
function setBlacklisted(address _blacklistedAddress)
external
virtual
onlyOwner
{
require(
_blacklistedAddress != address(0),
"Zero address cannot be blacklisted"
);
s_isBlacklisted[_blacklistedAddress] = true;
}
/**
* @dev Remove Blacklisted Address
*
* @param _blacklistedAddress is an existing blacklisted address
*/
function removeBlacklisted(address _blacklistedAddress)
external
virtual
onlyOwner
{
delete s_isBlacklisted[_blacklistedAddress];
}
/**
* @dev Set wallet for collecting fees.
*
* Requirements:
*
* - `_feeAddress` cannot be the zero address.
*
* @param _feeAddress is the new address that collects the fees.
*/
function setFeeAddress(address _feeAddress) external virtual onlyOwner {
require(_feeAddress != address(0), "Zero address cannot collect fees");
s_feeAddress = _feeAddress;
}
/**
* @dev Pause / Resume Trading.
* This feature helps in mitigating unknown vulnerability exploits.
*
* Requirements:
*
* - `_trading` needs to have a different value from `s_trading`.
*
* @param _trading is the new trading state.
*/
function setTrading(bool _trading) external virtual onlyOwner {
require(s_trading != _trading, "Value already set");
s_trading = _trading;
}
/**
* @dev Pause / Resume transfers to initialize new liquidity provider.
*
* Requirements:
*
* - `_initializedLiquidityProvider` needs to have a different value from `s_initializedLiquidityProvider`.
*
* @param _initializedLiquidityProvider is the new liquidity provider initializing state.
*/
function setInitializedLiquidityProvider(bool _initializedLiquidityProvider)
external
virtual
onlyOwner
{
require(
s_initializedLiquidityProvider != _initializedLiquidityProvider,
"Value already set"
);
s_initializedLiquidityProvider = _initializedLiquidityProvider;
}
/**
* @dev Returns the internal swapping state
*
* @return s_internalSwapEnabled is the internal swapping state
*/
function internalSwapEnabled() external view virtual returns (bool) {
return s_internalSwapEnabled;
}
/**
* @dev Pause / Resume internal swaps of the fee
*
* @param _internalSwapEnabled is the new internal swapping state
*/
function setInternalSwapEnabled(bool _internalSwapEnabled)
external
virtual
onlyOwner
{
require(
s_internalSwapEnabled != _internalSwapEnabled,
"Value already set"
);
s_internalSwapEnabled = _internalSwapEnabled;
}
/**
* @dev Returns the UniswapV2 router
*
* @return s_uniswapV2Router is the UniswapV2 router
*/
function uniswapV2Router()
external
view
virtual
returns (IUniswapV2Router02)
{
return s_uniswapV2Router;
}
/**
* @dev Set UniswapV2 router for internal swaps
*
* @param _uniswapV2Router is the new UniswapV2 router address
*/
function setUniswapV2Router(address _uniswapV2Router)
external
virtual
onlyOwner
{
require(
_uniswapV2Router != address(0),
"Zero address cannot be uniswap v2 router"
);
s_uniswapV2Router = IUniswapV2Router02(_uniswapV2Router);
}
/**
* @dev Returns the threshold amount
*
* @return s_swapThreshold is the threshold amount
*/
function swapThreshold() external view virtual returns (uint256) {
return s_swapThreshold;
}
/**
* @dev Set threshold for internal swaps
*
* @param _swapThreshold is the new threshold amount
*/
function setSwapThreshold(uint256 _swapThreshold)
external
virtual
onlyOwner
{
require(_swapThreshold < 400_000e18, "Wrong amount");
s_swapThreshold = _swapThreshold;
}
/**
* @dev Checks if the input address is an whitelisted regarding cooldown.
*
* @param _cooldownWhitelist is a possible cooldown whitelisted address.
*/
function isCooldownWhitelist(address _cooldownWhitelist)
external
view
virtual
returns (bool)
{
return s_cooldownWhitelist[_cooldownWhitelist];
}
/**
* @dev Whitelist address from the cooldown system
*
* @param _cooldownWhitelist is a new whitelisted address
*/
function setCooldownWhitelist(address _cooldownWhitelist)
external
virtual
onlyOwner
{
require(
_cooldownWhitelist != address(0),
"Zero address cannot be cooldown whitelist"
);
s_cooldownWhitelist[_cooldownWhitelist] = true;
}
/**
* @dev Remove address from the whitelist cooldown system
*
* @param _cooldownWhitelist is a possible whitelisted address
*/
function removeCooldownWhitelist(address _cooldownWhitelist)
external
virtual
onlyOwner
{
delete s_cooldownWhitelist[_cooldownWhitelist];
}
/**
* @dev Returns the cooldown time
*
* @return s_cooldownTime is the cooldown time
*/
function cooldownTime() external view virtual returns (uint256) {
return s_cooldownTime;
}
/**
* @dev MEV / bots attack solution: Set cooldown time for sells and transfers
*
* @param _cooldownTime is the new cooldown time
*/
function setCooldownTime(uint256 _cooldownTime) external virtual onlyOwner {
require(
_cooldownTime < 5 minutes,
"The cooldown time needs to be lower than 5 minutes"
);
s_cooldownTime = _cooldownTime;
}
/**
* @dev Set new testing address
*
* @param _testingAddress is a new testing address
*/
function setTestingAddress(address _testingAddress)
external
virtual
onlyOwner
{
require(
_testingAddress != address(0),
"Zero address cannot be cooldown whitelist"
);
s_testingAddress[_testingAddress] = true;
}
/**
* @dev Remove testing address
*
* @param _testingAddress is a possible testing address
*/
function removeTestingAddress(address _testingAddress)
external
virtual
onlyOwner
{
delete s_testingAddress[_testingAddress];
}
/**
* @dev Set new fees.
*
* Requirements:
*
* - `_buyFee` needs to be lower than 20%.
* - `_sellFee` needs to be lower than 20%
* - `_transferFee` needs to be lower than 20%
*
* @param _buyFee the fee applied in {buy} transactions.
* @param _sellFee the fee applied in {sell} transactions.
* @param _transferFee the fee applied in {wallet-to-wallet} transactions.
*/
function setFee(
uint8 _buyFee,
uint8 _sellFee,
uint8 _transferFee
) external virtual onlyOwner {
require(_buyFee < 20, "Buy fee needs to be lower than 20%");
require(_sellFee < 20, "Sell fee needs to be lower than 20%");
require(_transferFee < 20, "Transfer fee needs to be lower than 20%");
s_buyFee = _buyFee;
s_sellFee = _sellFee;
s_transferFee = _transferFee;
}
/**
* @dev Moves `amount` of tokens from `from` to `to` deducting a fee when necessary.
* In case of operational transfers, no fee is deducted.
*
* In the case of fee deduction, 2 {Transfers} are triggered:
* 1. from `from` to `contract address`: `amount` * fee / 100
* 2. from `from` to `to`: `amount` - (`amount` * fee / 100)
*
* @param from is the sender address
* @param to is the recipient address
* @param amount is the transfered quantity of tokens
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual override {
uint256 tempAmount = amount;
if (!s_isOperational[from] && !s_isOperational[to]) {
require(
!s_isBlacklisted[from] && !s_isBlacklisted[to],
"The sender or recipient is blacklisted"
);
require(
s_initializedLiquidityProvider,
"Liquidity Provider is initializing"
);
if (s_isLiquidityProvider[to] || s_isLiquidityProvider[from]) {
require(s_trading, "Trading is Paused");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool overThreshold = contractTokenBalance > s_swapThreshold;
if (
s_swapThreshold > 0 &&
overThreshold &&
!s_inSwap &&
!s_isLiquidityProvider[from] &&
(s_internalSwapEnabled || s_testingAddress[from])
) {
swapTokensForEth(s_swapThreshold);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(contractETHBalance);
}
}
uint256 currentFee = 0;
if (s_isLiquidityProvider[from]) {
currentFee = s_buyFee;
} else if (s_isLiquidityProvider[to]) {
currentFee = s_sellFee;
} else {
currentFee = s_transferFee;
}
if (currentFee != 0) {
uint256 feeAmount = (tempAmount * currentFee) / 100;
super._transfer(from, address(this), feeAmount);
tempAmount = tempAmount - feeAmount;
}
}
super._transfer(from, to, tempAmount);
}
/**
* @dev Check to see whether the `from` address is not included in the cooldown whitelist.
* If not, make sure the cooldown period is not in effect; if it is, stop the transfer.
*/
function _beforeTokenTransfer(
address from,
address,
uint256
) internal virtual override {
if (!s_cooldownWhitelist[from]) {
require(
s_cooldowns[from] <= uint32(block.timestamp),
"Please wait a bit before transferring or selling your tokens."
);
}
}
/**
* @dev If the `to` address is not in the cooldown whitelist, add cooldown to it.
*/
function _afterTokenTransfer(
address,
address to,
uint256
) internal virtual override {
if (!s_cooldownWhitelist[to]) {
s_cooldowns[to] = uint32(block.timestamp + s_cooldownTime);
}
}
/**
* @dev function used for internally swap tokens (collected as fee) from within
* the contract to ETH.
*
* @param amountTokens total of tokens used for swap
*/
function swapTokensForEth(uint256 amountTokens) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = s_uniswapV2Router.WETH();
_approve(address(this), address(s_uniswapV2Router), amountTokens);
s_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountTokens,
0,
path,
address(this),
block.timestamp
);
}
/**
* @dev send the ETH from within the contract to the fee wallet
*
* @param amountETH total of ETH to be sent to the fee address
*/
function sendETHToFee(uint256 amountETH) private {
payable(s_feeAddress).transfer(amountETH);
}
/**
* @dev withdraw tokens from the contract and send to the owner
*
* @param amountTokens total of tokens to be withdrawn
*/
function withdrawTokens(uint256 amountTokens) external virtual onlyOwner {
require(
amountTokens <= balanceOf(address(this)) && amountTokens > 0,
"Wrong amount"
);
_transfer(address(this), owner(), amountTokens);
}
/**
* @dev withdraw ETH from the contract and send to the owner
*/
function withdrawETH() external virtual onlyOwner {
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(contractETHBalance);
}
}
/**
* @dev manual swap of tokens from within the contract
*
* @param amountTokens total of tokens used for swap
*/
function manualSwap(uint256 amountTokens) external virtual onlyOwner {
require(
amountTokens <= balanceOf(address(this)) &&
amountTokens > 0 &&
amountTokens < 45_000e18,
"Wrong amount"
);
swapTokensForEth(amountTokens);
}
receive() external payable {}
}
ContextUpgradeable.sol 37 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
AddressUpgradeable.sol 195 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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 Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
IERC20MetadataUpgradeable.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
/**
* @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);
}
IERC20Upgradeable.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @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);
/**
* @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);
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
cooldownTime 0xb319c6b7 → uint256
decimals 0x313ce567 → uint8
getFeeState 0xc607ca5a → uint8, uint8, uint8, address
internalSwapEnabled 0xce2ddd4e → bool
isBlacklisted 0xfe575a87 → bool
isCooldownWhitelist 0xac44d2c2 → bool
isInitializedLiquidityProvider 0xf52d2c00 → bool
isLiquidityProvider 0x99f7854a → bool
isOperational 0x457385f2 → bool
isTrading 0x6e9087db → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
swapThreshold 0x0445b667 → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uniswapV2Router 0x1694505e → address
Write Contract 29 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
initialize 0xb119490e
string _name
string _symbol
uint256 _supply
manualSwap 0xb70143c9
uint256 amountTokens
removeBlacklisted 0xc6a276c2
address _blacklistedAddress
removeCooldownWhitelist 0x42844b04
address _cooldownWhitelist
removeLiquidityProvider 0xbd6af9e4
address _liquidityProvider
removeOperational 0x8d117d1f
address _operationalAddress
removeTestingAddress 0x21415c51
address _testingAddress
renounceOwnership 0x715018a6
No parameters
setBlacklisted 0x8bb171bc
address _blacklistedAddress
setCooldownTime 0x6ff73201
uint256 _cooldownTime
setCooldownWhitelist 0x755b5e22
address _cooldownWhitelist
setFee 0x15a02994
uint8 _buyFee
uint8 _sellFee
uint8 _transferFee
setFeeAddress 0x8705fcd4
address _feeAddress
setInitializedLiquidityProvider 0xbf845ea8
bool _initializedLiquidityProvider
setInternalSwapEnabled 0x453be18e
bool _internalSwapEnabled
setLiquidityProvider 0xe624c4bc
address _liquidityProvider
setOperational 0xbdeab5c5
address _operationalAddress
setSwapThreshold 0x9d0014b1
uint256 _swapThreshold
setTestingAddress 0x6c1c1905
address _testingAddress
setTrading 0x8f70ccf7
bool _trading
setUniswapV2Router 0x1419841d
address _uniswapV2Router
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
withdrawETH 0xe086e5ec
No parameters
withdrawTokens 0x315a095d
uint256 amountTokens
Recent Transactions
No transactions found for this address