Address Contract Verified
Address
0x146F3582EBE45c46B2f88fB71681fA582BA53A79
Balance
0 ETH
Nonce
1
Code Size
9158 bytes
Creator
0xEddf3aA4...3858 at tx 0x1ec8689e...11ca48
Indexed Transactions
0
Contract Bytecode
9158 bytes
0x6080604052600436106102695760003560e01c80638238642e11610143578063bc337182116100bb578063e5e31b1311610077578063e5e31b13146107d8578063f2cda82e14610808578063f2fde38b14610828578063f887ea4014610848578063f8b45b0514610868578063ff796a871461087e57005b8063bc337182146106eb578063c2b7bbb61461070b578063cb4ca6311461072b578063cc1776d31461075b578063dd62ed3e1461077c578063e3c5a291146107c257005b8063908bb2ae1161010a578063908bb2ae1461063557806395d89b4114610655578063a8aa1b311461066a578063a9059cbb1461068a578063aacebbe3146106aa578063aed04fae146106ca57005b80638238642e146105a157806385141a77146105c1578063886f039a146105d75780638da5cb5b146105f75780638ea5220f1461061557005b80634f7041a5116101e157806370a082311161019d57806370a08231146104b8578063715018a6146104ee57806371dd7497146105035780637437681e1461053357806375f0a874146105495780637f4fd5791461058157005b80634f7041a5146103f457806351bc3c85146104155780635bf99a381461042a5780635d0044ca1461044a5780636081752b1461046a5780636efc30a91461048a57005b8063203a421f11610230578063203a421f1461032c57806323b872dd1461035c5780632d4310c01461037c5780632daa387114610392578063313ce567146103b257806349abdc14146103d457005b806306fdde0314610272578063095ea7b31461029d57806318160ddd146102cd5780631816467f146102ec5780631a1d3a2d1461030c57005b3661027057005b005b34801561027e57600080fd5b5061028761089e565b6040516102949190611e72565b60405180910390f35b3480156102a957600080fd5b506102bd6102b8366004611ed6565b610930565b6040519015158152602001610294565b3480156102d957600080fd5b506002545b604051908152602001610294565b3480156102f857600080fd5b50610270610307366004611f02565b61094a565b34801561031857600080fd5b50610270610327366004611f34565b610a11565b34801561033857600080fd5b506102bd610347366004611f02565b60076020526000908152604090205460ff1681565b34801561036857600080fd5b506102bd610377366004611f6d565b610ab3565b34801561038857600080fd5b506102de600e5481565b34801561039e57600080fd5b506102706103ad366004611fae565b610ad7565b3480156103be57600080fd5b5060125b60405160ff9091168152602001610294565b3480156103e057600080fd5b506102706103ef366004612034565b610bd9565b34801561040057600080fd5b506012546103c290600160301b900460ff1681565b34801561042157600080fd5b50610270610c5f565b34801561043657600080fd5b50610270610445366004612057565b610cb0565b34801561045657600080fd5b50610270610465366004612057565b610d45565b34801561047657600080fd5b50610270610485366004612034565b610db8565b34801561049657600080fd5b506012546104a59061ffff1681565b60405161ffff9091168152602001610294565b3480156104c457600080fd5b506102de6104d3366004611f02565b6001600160a01b031660009081526020819052604090205490565b3480156104fa57600080fd5b50610270610e36565b34801561050f57600080fd5b506102bd61051e366004611f02565b60086020526000908152604090205460ff1681565b34801561053f57600080fd5b506102de60105481565b34801561055557600080fd5b50600b54610569906001600160a01b031681565b6040516001600160a01b039091168152602001610294565b34801561058d57600080fd5b5061027061059c366004611f34565b610e4a565b3480156105ad57600080fd5b506102706105bc366004612087565b610eaa565b3480156105cd57600080fd5b5061056961dead81565b3480156105e357600080fd5b506102706105f23660046120ba565b610f63565b34801561060357600080fd5b506005546001600160a01b0316610569565b34801561062157600080fd5b50600a54610569906001600160a01b031681565b34801561064157600080fd5b50610270610650366004611f02565b61104d565b34801561066157600080fd5b506102876111a8565b34801561067657600080fd5b50600d54610569906001600160a01b031681565b34801561069657600080fd5b506102bd6106a5366004611ed6565b6111b7565b3480156106b657600080fd5b506102706106c5366004611f02565b6111c5565b3480156106d657600080fd5b506012546104a59062010000900461ffff1681565b3480156106f757600080fd5b50610270610706366004612057565b61128c565b34801561071757600080fd5b50610270610726366004611f02565b611300565b34801561073757600080fd5b506102bd610746366004611f02565b60066020526000908152604090205460ff1681565b34801561076757600080fd5b506012546103c290600160381b900460ff1681565b34801561078857600080fd5b506102de6107973660046120ba565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156107ce57600080fd5b506102de600f5481565b3480156107e457600080fd5b506102bd6107f3366004611f02565b60096020526000908152604090205460ff1681565b34801561081457600080fd5b50610270610823366004611ed6565b611392565b34801561083457600080fd5b50610270610843366004611f02565b611413565b34801561085457600080fd5b50600c54610569906001600160a01b031681565b34801561087457600080fd5b506102de60115481565b34801561088a57600080fd5b50610270610899366004611f34565b611453565b6060600380546108ad906120e8565b80601f01602080910402602001604051908101604052809291908181526020018280546108d9906120e8565b80156109265780601f106108fb57610100808354040283529160200191610926565b820191906000526020600020905b81548152906001019060200180831161090957829003601f168201915b5050505050905090565b60003361093e8185856114b3565b60019150505b92915050565b600a546001600160a01b0316331480159061097057506005546001600160a01b03163314155b1561098e57604051635dbca81160e11b815260040160405180910390fd5b6001600160a01b0381166109b557604051630d14b28d60e21b815260040160405180910390fd5b600a546040516001600160a01b038084169216907f923334f00a08147112838c5c41f68a92979493ae7af34177449883db5743427790600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b610a196114c0565b6001600160a01b03821660009081526009602052604090205460ff1615610a5357604051630d14b28d60e21b815260040160405180910390fd5b6001600160a01b038216600081815260076020908152604091829020805460ff191685151590811790915591519182527f4a187de95f18bd0a9a020730b1d5a6fa3f909ec312c9c5d46f1e6b7db5dd52b891015b60405180910390a25050565b600033610ac18582856114ed565b610acc858585611565565b506001949350505050565b610adf6114c0565b6000829003610b015760405163fb492d4b60e01b815260040160405180910390fd5b60005b82811015610bd3578160066000868685818110610b2357610b23612122565b9050602002016020810190610b389190611f02565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055838382818110610b7257610b72612122565b9050602002016020810190610b879190611f02565b6001600160a01b03167fee385e3edbe20b5bd36c0060389cdf1acf975758fa596713d6a4252751ab427583604051610bc3911515815260200190565b60405180910390a2600101610b04565b50505050565b610be16114c0565b60288160ff161115610c0657604051636e5504cd60e01b815260040160405180910390fd5b6012805467ff000000000000001916600160381b60ff8416908102919091179091556040519081527f2d16b529cd6f4d8d1af62fe74e0801442778f50967ec8b5994f628052c59c73a906020015b60405180910390a150565b610c676114c0565b601254600160401b900460ff16600114610c94576040516370ef825360e11b815260040160405180910390fd5b30600090815260208190526040902054610cad816115c4565b50565b610cb86114c0565b610ccf6103e86a52b7d2dcc80cd2e400000061214e565b811180610cf25750610cef620186a06a52b7d2dcc80cd2e400000061214e565b81105b15610d1057604051630d14b28d60e21b815260040160405180910390fd5b600e8190556040518181527fcfbc3e24bcdbf875f7af2b101605919fdbd3cb0b217ae54c372ae49417c58d0190602001610c54565b610d4d6114c0565b610d6360646a52b7d2dcc80cd2e400000061214e565b811015610d8357604051630d14b28d60e21b815260040160405180910390fd5b60118190556040518181527fdd4ef051c4c49233ec73abfc2ee1514725d2a818fbcde46ee5d34a49034922f990602001610c54565b610dc06114c0565b60288160ff161115610de557604051636e5504cd60e01b815260040160405180910390fd5b6012805466ff0000000000001916600160301b60ff8416908102919091179091556040519081527f2d16b529cd6f4d8d1af62fe74e0801442778f50967ec8b5994f628052c59c73a90602001610c54565b610e3e6114c0565b610e48600061196e565b565b610e526114c0565b6001600160a01b038216600081815260066020908152604091829020805460ff191685151590811790915591519182527fee385e3edbe20b5bd36c0060389cdf1acf975758fa596713d6a4252751ab42759101610aa7565b610eb26114c0565b610ebc8183612170565b6012805465ffff00000000191664010000000061ffff93841681029190911791829055900416600003610f0257604051630d14b28d60e21b815260040160405180910390fd5b6012805461ffff84811663ffffffff19909216821762010000918516918202179092556040805191825260208201929092527f788e163a6e2c7974d0448f44b040a08173549d0e37a8357a99907cf29a326dab910160405180910390a15050565b610f6b6114c0565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610fb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd69190612192565b60405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390529192509084169063a9059cbb906044016020604051808303816000875af1158015611029573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bd391906121ab565b6110556114c0565b806001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611093573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b791906121c8565b6001600160a01b0316600c60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611113573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113791906121c8565b6001600160a01b03161461115e57604051630d14b28d60e21b815260040160405180910390fd5b600c80546001600160a01b0319166001600160a01b0383169081179091556040517fbdfcd0f1d13d7b7322d52a6a9a6a758ba8f47be4985ff2ff6fcf5c217c3e06fb90600090a250565b6060600480546108ad906120e8565b60003361093e818585611565565b600b546001600160a01b031633148015906111eb57506005546001600160a01b03163314155b1561120957604051636a8ff08960e11b815260040160405180910390fd5b6001600160a01b03811661123057604051630d14b28d60e21b815260040160405180910390fd5b600b546040516001600160a01b038084169216907facf03c50dcf01e53e2775267d12acd0158d87c2f20fb84226837142693b36ae790600090a3600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6112946114c0565b6112ab6101f46a52b7d2dcc80cd2e400000061214e565b8110156112cb57604051630d14b28d60e21b815260040160405180910390fd5b60108190556040518181527fcedd579bb16a110f8fc769828da3ec64f5b19963e8f71d7fb5214d37fdce2c4290602001610c54565b6113086114c0565b6001600160a01b03811661132f57604051630d14b28d60e21b815260040160405180910390fd5b6001600160a01b03811660008181526009602090815260408083208054600160ff1991821681179092556007909352818420805490931617909155517f43a9fee15527bb6ef23fe553fb1e6c1ea946a49cbeec8f294cb4a40eba739b819190a250565b61139a6114c0565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146113e7576040519150601f19603f3d011682016040523d82523d6000602084013e6113ec565b606091505b505090508061140e57604051634923c2f960e11b815260040160405180910390fd5b505050565b61141b6114c0565b6001600160a01b03811661144a57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610cad8161196e565b61145b6114c0565b6001600160a01b038216600081815260086020908152604091829020805460ff191685151590811790915591519182527fa42bbec6725edfd96851ed0b8cad40906864445d5b16b570ef3abc6c148b00bb9101610aa7565b61140e83838360016119c0565b6005546001600160a01b03163314610e485760405163118cdaa760e01b8152336004820152602401611441565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610bd3578181101561155657604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401611441565b610bd3848484840360006119c0565b6001600160a01b03831661158f57604051634b637e8f60e11b815260006004820152602401611441565b6001600160a01b0382166115b95760405163ec442f0560e01b815260006004820152602401611441565b61140e838383611a95565b6012805460ff60401b198116600160401b9182900460011b60fe16909102179055600081900361160757604051636091f4cf60e11b815260040160405180910390fd5b604080516002808252606082018352600092602083019080368337019050509050308160008151811061163c5761163c612122565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611695573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b991906121c8565b816001815181106116cc576116cc612122565b6001600160a01b039283166020918202929092010152600c5460405163d06ca61f60e01b8152600092919091169063d06ca61f906117109086908690600401612240565b600060405180830381865afa15801561172d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117559190810190612259565b60018151811061176757611767612122565b60200260200101519050600a8160076117809190612317565b61178a919061214e565b600c5460405163791ac94760e01b81529192506001600160a01b03169063791ac947906117c3908690859087903090429060040161232e565b600060405180830381600087803b1580156117dd57600080fd5b505af11580156117f1573d6000803e3d6000fd5b5050601254479250640100000000900461ffff1660000390506118145750505050565b60125460009061ffff6401000000008204811691611833911684612317565b61183d919061214e565b9050600061184b828461236a565b905081156118c957600b546040516000916001600160a01b03169084908381818185875af1925050503d80600081146118a0576040519150601f19603f3d011682016040523d82523d6000602084013e6118a5565b606091505b50509050806118c757604051634923c2f960e11b815260040160405180910390fd5b505b801561194557600a546040516000916001600160a01b03169083908381818185875af1925050503d806000811461191c576040519150601f19603f3d011682016040523d82523d6000602084013e611921565b606091505b505090508061194357604051634923c2f960e11b815260040160405180910390fd5b505b50506012805460ff60401b198116600160401b9182900460011c607f1690910217905550505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0384166119ea5760405163e602df0560e01b815260006004820152602401611441565b6001600160a01b038316611a1457604051634a1406b160e11b815260006004820152602401611441565b6001600160a01b0380851660009081526001602090815260408083209387168352929052208290558015610bd357826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051611a8791815260200190565b60405180910390a350505050565b6001600160a01b03808416600081815260096020908152604080832054948716835280832054938352600690915281205460ff93841693928316921680611af457506001600160a01b03851660009081526006602052604090205460ff165b6001600160a01b03871660009081526008602052604090205490915060ff16158015611b3957506001600160a01b03851660009081526008602052604090205460ff16155b8015611b46575060105484115b15611b6457604051632b8cb7f560e01b815260040160405180910390fd5b3060009081526020819052604090205483158015611b835750600e5481115b8015611b8d575081155b8015611ba55750601254600160401b900460ff166001145b15611bb357611bb3816115c4565b600082611c02576000611bc68686611c9f565b90506064611bd760ff831689612317565b611be1919061214e565b91508115611c0057611bf3828861236a565b9650611c00893084611d48565b505b838015611c0f5750600f54155b15611c195742600f555b6001600160a01b03871660009081526007602052604090205460ff16158015611c6c575060115486611c60896001600160a01b031660009081526020819052604090205490565b611c6a919061237d565b115b15611c8a57604051630124846360e21b815260040160405180910390fd5b611c95888888611d48565b5050505050505050565b600082158015611cad575081155b80611cb85750600f54155b15611cc557506000610944565b6000600f5442611cd5919061236a565b90506109608110611d1e578315611cfa575050601254600160301b900460ff16610944565b8215611d14575050601254600160381b900460ff16610944565b6000915050610944565b611d2a61012c8261214e565b611d35906005612317565b611d4090602861236a565b949350505050565b6001600160a01b038316611d73578060026000828254611d68919061237d565b90915550611de59050565b6001600160a01b03831660009081526020819052604090205481811015611dc65760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401611441565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216611e0157600280548290039055611e20565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e6591815260200190565b60405180910390a3505050565b60006020808352835180602085015260005b81811015611ea057858101830151858201604001528201611e84565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114610cad57600080fd5b60008060408385031215611ee957600080fd5b8235611ef481611ec1565b946020939093013593505050565b600060208284031215611f1457600080fd5b8135611f1f81611ec1565b9392505050565b8015158114610cad57600080fd5b60008060408385031215611f4757600080fd5b8235611f5281611ec1565b91506020830135611f6281611f26565b809150509250929050565b600080600060608486031215611f8257600080fd5b8335611f8d81611ec1565b92506020840135611f9d81611ec1565b929592945050506040919091013590565b600080600060408486031215611fc357600080fd5b833567ffffffffffffffff80821115611fdb57600080fd5b818601915086601f830112611fef57600080fd5b813581811115611ffe57600080fd5b8760208260051b850101111561201357600080fd5b6020928301955093505084013561202981611f26565b809150509250925092565b60006020828403121561204657600080fd5b813560ff81168114611f1f57600080fd5b60006020828403121561206957600080fd5b5035919050565b803561ffff8116811461208257600080fd5b919050565b6000806040838503121561209a57600080fd5b6120a383612070565b91506120b160208401612070565b90509250929050565b600080604083850312156120cd57600080fd5b82356120d881611ec1565b91506020830135611f6281611ec1565b600181811c908216806120fc57607f821691505b60208210810361211c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008261216b57634e487b7160e01b600052601260045260246000fd5b500490565b61ffff81811683821601908082111561218b5761218b612138565b5092915050565b6000602082840312156121a457600080fd5b5051919050565b6000602082840312156121bd57600080fd5b8151611f1f81611f26565b6000602082840312156121da57600080fd5b8151611f1f81611ec1565b634e487b7160e01b600052604160045260246000fd5b60008151808452602080850194506020840160005b838110156122355781516001600160a01b031687529582019590820190600101612210565b509495945050505050565b828152604060208201526000611d4060408301846121fb565b6000602080838503121561226c57600080fd5b825167ffffffffffffffff8082111561228457600080fd5b818501915085601f83011261229857600080fd5b8151818111156122aa576122aa6121e5565b8060051b604051601f19603f830116810181811085821117156122cf576122cf6121e5565b6040529182528482019250838101850191888311156122ed57600080fd5b938501935b8285101561230b578451845293850193928501926122f2565b98975050505050505050565b808202811582820484141761094457610944612138565b85815284602082015260a06040820152600061234d60a08301866121fb565b6001600160a01b0394909416606083015250608001529392505050565b8181038181111561094457610944612138565b808201808211156109445761094461213856fea264697066735822122092974546a267c5ca452422413efd26455f5f3e456d0a143e5fdf2dd5aea09f3964736f6c63430008180033
Verified Source Code Full Match
Compiler: v0.8.24+commit.e11b9ed9
EVM: paris
Optimization: Yes (200 runs)
GoodTrouble.sol 457 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
// OPENZEPPELIN IMPORTS
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
// UNISWAP INTERFACES
import {IUniswapRouter02, IUniswapFactory, IUniswapPair} from "./interface/IUniswapV2.sol";
/**
* @title Good Trouble
* @author AssureDefi
* @notice This is the token for Good Trouble on the ETH chain. It is an ERC20 token with a fixed supply.
* Total Init Supply: 100,000,000 GTRB
* Decimals: 18
* Symbol: GTRB
* Name: Good Trouble
* This contract contains editable taxes for GTRB
* Buy and Sell taxes will start at 40% and decrease by 5% every 5 minutes until it reaches 5%
* Majority of taxes is converted to ETH, a small portion is kept to create liquidity, others are split between
* marketing and dev.
*/
contract GoodTrouble is ERC20, Ownable {
//-------------------------------------------------------------------------
// Errors
//-------------------------------------------------------------------------
error GTRB__InvalidNewTax();
error GTRB__InvalidValue();
error GTRB__MaxTxExceeded();
error GTRB__MaxWalletExceeded();
error GTRB__InvalidListLength();
error GTRB__OnlyDevWallet();
error GTRB__OnlyMktWallet();
error GTRB__OnlyBBWallet();
error GTRB_NativeTransferFailed();
error GTRB__NoBalance();
error GTRB__AlreadySwapping();
//-------------------------------------------------------------------------
// STATE VARIABLES
//-------------------------------------------------------------------------
mapping(address => bool) public isExcludedFromTax;
mapping(address => bool) public isMaxWalletExcluded;
mapping(address => bool) public isMaxTxExcluded;
// We can add more pairs to tax them when necessary
mapping(address => bool) public isPair;
address public devWallet;
address public marketingWallet;
address public constant deadWallet =
0x000000000000000000000000000000000000dEaD;
IUniswapRouter02 public router;
IUniswapPair public pair;
uint public sellThreshold;
uint public startTaxTime;
uint public maxTx;
uint public maxWallet;
uint16 public mktShare = 375;
uint16 public devShare = 125;
uint16 private totalShares = 500;
uint8 public buyTax = 5;
uint8 public sellTax = 5;
uint8 private swapping = 1;
uint private constant _TAX_INTERVAL = 5 minutes;
uint private constant MAX_TAX_TIME = 40 minutes;
uint256 private constant _INIT_SUPPLY = 100_000_000 ether;
uint256 private constant PERCENTILE = 100;
//-------------------------------------------------------------------------
// EVENTS
//-------------------------------------------------------------------------
event UpdateSellTax(uint tax);
event UpdateBuyTax(uint tax);
event UpdateDevWallet(
address indexed prevWallet,
address indexed newWallet
);
event UpdateMarketingWallet(
address indexed prevWallet,
address indexed newWallet
);
event UpdateTaxExclusionStatus(address indexed account, bool status);
event UpdateMaxTxExclusionStatus(address indexed account, bool status);
event UpdateMaxWalletExclusionStatus(address indexed account, bool status);
event UpdateMaxTx(uint maxTx);
event UpdateMaxWallet(uint maxWallet);
event UpdateThreshold(uint threshold);
event SetNewPair(address indexed pair);
event UpdateShares(uint16 mktShare, uint16 devShare);
event UpdateUniswapRouter(address indexed router);
//-------------------------------------------------------------------------
// CONSTRUCTOR
//-------------------------------------------------------------------------
constructor(
address _devWallet,
address _marketingWallet,
address newOwner
) ERC20("Good Trouble", "GTRB") Ownable(newOwner) {
// Sell Threshold is 0.1% of the total supply
sellThreshold = _INIT_SUPPLY / (10 * PERCENTILE);
// Setup PancakeSwap Contracts
router = IUniswapRouter02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
IUniswapFactory factory = IUniswapFactory(router.factory());
pair = IUniswapPair(factory.createPair(address(this), router.WETH()));
isPair[address(pair)] = true;
_approve(address(this), address(router), type(uint256).max);
isExcludedFromTax[address(this)] = true;
isExcludedFromTax[owner()] = true;
isMaxWalletExcluded[owner()] = true;
isMaxWalletExcluded[address(this)] = true;
isMaxWalletExcluded[address(router)] = true;
isMaxWalletExcluded[deadWallet] = true;
isMaxWalletExcluded[address(pair)] = true;
isMaxTxExcluded[owner()] = true;
isMaxTxExcluded[address(this)] = true;
isMaxTxExcluded[address(router)] = true;
isMaxTxExcluded[address(0)] = true;
devWallet = _devWallet;
marketingWallet = _marketingWallet;
maxTx = _INIT_SUPPLY / PERCENTILE; // 1% of total supply
maxWallet = _INIT_SUPPLY / PERCENTILE; // 1% of total supply
_mint(owner(), _INIT_SUPPLY);
}
//-------------------------------------------------------------------------
// EXTERNAL / PUBLIC FUNCTIONS
//-------------------------------------------------------------------------
// Allow contract to receive Native tokens
receive() external payable {}
fallback() external payable {}
//-------------------------------------------------------------------------
// Owner Functions
//-------------------------------------------------------------------------
/**
* @notice This function is called to edit the buy tax for GTRB
* @param _buyTax The new buy tax to set
* @dev the tax can only be a max of 40%
*/
function setBuyTax(uint8 _buyTax) external onlyOwner {
if (_buyTax > 40) {
revert GTRB__InvalidNewTax();
}
buyTax = _buyTax;
emit UpdateBuyTax(_buyTax);
}
/**
* @notice This function is called to edit the buy tax for GTRB
* @param _sellTax The new buy tax to set
* @dev the tax can only be a max of 40%
*/
function setSellTax(uint8 _sellTax) external onlyOwner {
if (_sellTax > 40) {
revert GTRB__InvalidNewTax();
}
sellTax = _sellTax;
emit UpdateBuyTax(_sellTax);
}
/**
* @notice Changes the tax exclusion status for an address
* @param _address The address to set the tax exclusion status for
* @param _status The exclusion status, TRUE for excluded, FALSE for not excluded
*/
function setTaxExclusionStatus(
address _address,
bool _status
) external onlyOwner {
isExcludedFromTax[_address] = _status;
emit UpdateTaxExclusionStatus(_address, _status);
}
/**
* @notice Changes the tax exclusion status for multiple addresses
* @param addresses The list of addresses to set the tax exclusion status for
* @param _status The exclusion status, TRUE for excluded, FALSE for not excluded for all addresses
*/
function setMultipleTaxExclusionStatus(
address[] calldata addresses,
bool _status
) external onlyOwner {
if (addresses.length == 0) {
revert GTRB__InvalidListLength();
}
for (uint256 i = 0; i < addresses.length; i++) {
isExcludedFromTax[addresses[i]] = _status;
emit UpdateTaxExclusionStatus(addresses[i], _status);
}
}
/**
* @notice changes the max tx exclusion status for an address
* @param _address The address to change the exclusion of max tx status of
* @param _status The new exclusion status for the address || TRUE for excluded, FALSE for not excluded
*/
function setMaxTxExclusionStatus(
address _address,
bool _status
) external onlyOwner {
isMaxTxExcluded[_address] = _status;
emit UpdateMaxTxExclusionStatus(_address, _status);
}
/**
* @notice changes the max wallet exclusion status for an address
* @param _address The address to change the exclusion of max wallet status of
* @param _status The new exclusion status for the address || TRUE for excluded, FALSE for not excluded
*/
function setMaxWalletExclusionStatus(
address _address,
bool _status
) external onlyOwner {
// Can't change the status of a pair since it'll always be excluded from max wallet
if (isPair[_address]) revert GTRB__InvalidValue();
isMaxWalletExcluded[_address] = _status;
emit UpdateMaxWalletExclusionStatus(_address, _status);
}
/**
* @notice sets the max transaction amount for GTRB
* @param _maxTx The new max transaction amount to set
* @dev the max transaction amount cannot be less than 0.2% of the total supply
*/
function setMaxTx(uint _maxTx) external onlyOwner {
if (_maxTx < _INIT_SUPPLY / 500) revert GTRB__InvalidValue();
maxTx = _maxTx;
emit UpdateMaxTx(_maxTx);
}
/**
* @notice sets the max wallet amount for GTRB
* @param _maxWallet The new max wallet amount to set
* @dev the max wallet amount cannot be less than 1% of the total supply
*/
function setMaxWallet(uint _maxWallet) external onlyOwner {
if (_maxWallet < _INIT_SUPPLY / 100) revert GTRB__InvalidValue();
maxWallet = _maxWallet;
emit UpdateMaxWallet(_maxWallet);
}
/**
* @notice Set a different wallet to receive the swapped out funds
* @param _devWallet The new wallet to receive buy funds
* @dev ONLY CURRENT BUY TAX WALLET AND OWNER CAN CHANGE THIS
*/
function updateDevWallet(address _devWallet) external {
if (msg.sender != devWallet && msg.sender != owner())
revert GTRB__OnlyDevWallet();
if (_devWallet == address(0)) revert GTRB__InvalidValue();
emit UpdateDevWallet(devWallet, _devWallet);
devWallet = _devWallet;
}
/**
* @notice Set a different wallet to receive the swapped out funds for marketing
* @param _marketingwallet The new sell wallet to receive sell funds
* @dev ONLY CURRENT MARKETING WALLET AND OWNER CAN CHANGE THIS
*/
function updateMarketingWallet(address _marketingwallet) external {
if (msg.sender != marketingWallet && msg.sender != owner())
revert GTRB__OnlyMktWallet();
if (_marketingwallet == address(0)) revert GTRB__InvalidValue();
emit UpdateMarketingWallet(marketingWallet, _marketingwallet);
marketingWallet = _marketingwallet;
}
/**
* @notice The sell threshold is the amount of GTRB that needs to be collected before a sell for Native happens
* @param _sellThreshold The new sell threshold to set
*/
function updateSellThreshold(uint _sellThreshold) external onlyOwner {
// Sell threshold cannot be more than 0.1% of the total supply
// or less than 0.0001% of the total supply
if (
_sellThreshold > _INIT_SUPPLY / 1000 ||
_sellThreshold < _INIT_SUPPLY / 100000
) revert GTRB__InvalidValue();
sellThreshold = _sellThreshold;
emit UpdateThreshold(_sellThreshold);
}
/**
* @notice regardless of the collected amount, the contract will swap, liquidate and transfer the funds to the respective wallets
*/
function manualSwap() external onlyOwner {
if (swapping != 1) revert GTRB__AlreadySwapping();
uint balance = balanceOf(address(this));
_swapAndTransfer(balance);
}
/**
* @notice sets an address as a new pair to charge taxes on it
* @param _pair The pair to add to the list of pairs to tax
*/
function addPair(address _pair) external onlyOwner {
if (_pair == address(0)) revert GTRB__InvalidValue();
isPair[_pair] = true;
isMaxWalletExcluded[_pair] = true;
emit SetNewPair(_pair);
}
/**
* @notice updates the shares for tax spread
* @param _mktShare Amount to be shared to the marketing wallet
* @param _devShare Amount to be shared to the dev wallet
*/
function updateShares(
uint16 _mktShare,
uint16 _devShare
) external onlyOwner {
totalShares = _mktShare + _devShare;
// Total Shares cannot be zero
if (totalShares == 0) revert GTRB__InvalidValue();
mktShare = _mktShare;
devShare = _devShare;
emit UpdateShares(_mktShare, _devShare);
}
function updateUniswapRouter(address _router) external onlyOwner {
if (router.WETH() != IUniswapRouter02(_router).WETH())
revert GTRB__InvalidValue();
router = IUniswapRouter02(_router);
emit UpdateUniswapRouter(_router);
}
function recoverNative(address _to, uint _amount) external onlyOwner {
(bool success, ) = payable(_to).call{value: _amount}("");
if (!success) revert GTRB_NativeTransferFailed();
}
function recoverERC20(address _token, address _to) external onlyOwner {
uint amount = ERC20(_token).balanceOf(address(this));
ERC20(_token).transfer(_to, amount);
}
//-------------------------------------------------------------------------
// INTERNAL/PRIVATE FUNCTIONS
//-------------------------------------------------------------------------
/**
* @notice This function overrides the ERC20 `_transfer` function to apply taxes and swap and transfer.
* @param from Address that is sending tokens
* @param to Address that is receiving tokens
* @param amount Amount of tokens being transfered
* @dev Although this is an override, it still uses the original `_transfer` function from the ERC20 contract to finalize the updatess
* @dev On first adding liquidity, the contract will enable the high tax timer
*/
function _update(address from, address to, uint amount) internal override {
bool isBuy = isPair[from];
bool isSell = isPair[to];
bool anyExcluded = isExcludedFromTax[from] || isExcludedFromTax[to];
// check max tx if sender or receiver are excluded or amount surpasses max tx revert
if (!isMaxTxExcluded[from] && !isMaxTxExcluded[to] && amount > maxTx)
revert GTRB__MaxTxExceeded();
uint currentBalance = balanceOf(address(this));
if (
!isBuy &&
currentBalance > sellThreshold &&
!anyExcluded &&
swapping == 1
) {
_swapAndTransfer(currentBalance);
}
uint fee = 0;
if (!anyExcluded) {
uint8 tax = _getTimedTax(isBuy, isSell);
fee = (amount * tax) / PERCENTILE;
if (fee > 0) {
amount -= fee;
super._update(from, address(this), fee);
}
}
if (isSell && startTaxTime == 0) {
startTaxTime = block.timestamp;
}
// check max wallet
if (!isMaxWalletExcluded[to] && balanceOf(to) + amount > maxWallet)
revert GTRB__MaxWalletExceeded();
// Transfer rest
super._update(from, to, amount);
}
function _swapAndTransfer(uint balance) private {
swapping <<= 1;
if (balance == 0) revert GTRB__NoBalance();
// Sell half of liqAmount to ETH
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
uint minAmount = router.getAmountsOut(balance, path)[1];
minAmount = (minAmount * 7) / 10;
// Sell rest
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
balance,
minAmount,
path,
address(this),
block.timestamp
);
// Distribute to rest
uint nativeBalance = address(this).balance;
if (totalShares == 0) return;
uint mktAmount = (nativeBalance * mktShare) / totalShares;
uint devAmount = nativeBalance - mktAmount;
// Transfer to wallets
if (mktAmount > 0) {
(bool success, ) = payable(marketingWallet).call{value: mktAmount}(
""
);
if (!success) revert GTRB_NativeTransferFailed();
}
if (devAmount > 0) {
(bool success, ) = payable(devWallet).call{value: devAmount}("");
if (!success) revert GTRB_NativeTransferFailed();
}
swapping >>= 1;
}
/**
* @notice This function is called to get the tax for the current block
* @param isBuy dictates if the tax is for a buy
* @param isSell dictates if the tax is for a sell
* @return the tax to be applied %
* @dev the tax will decrease by 5% every 5 minutes until it reaches 5%
*/
function _getTimedTax(
bool isBuy,
bool isSell
) private view returns (uint8) {
// if startTaxTime is not set or both isBuy and isSell are false, return 0
if ((!isBuy && !isSell) || startTaxTime == 0) return 0;
uint timePassed = block.timestamp - startTaxTime;
// If above max tax time, return the minimum tax
if (timePassed >= MAX_TAX_TIME) {
if (isBuy) return buyTax;
if (isSell) return sellTax;
return 0;
}
// it'll decrease by 5% every 5 minutes
return uint8(40 - (5 * (timePassed / _TAX_INTERVAL)));
}
}
IUniswapV2.sol 328 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapRouter01 {
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);
}
interface IUniswapRouter02 is IUniswapRouter01 {
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;
}
interface IUniswapPair {
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;
}
interface IUniswapFactory {
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;
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}
ERC20.sol 316 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.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}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* 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.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* 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 returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual 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 default value returned by this function, unless
* it's 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 returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual 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 `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` 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 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
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 `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` 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.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` 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.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
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);
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
buyTax 0x4f7041a5 → uint8
deadWallet 0x85141a77 → address
decimals 0x313ce567 → uint8
devShare 0xaed04fae → uint16
devWallet 0x8ea5220f → address
isExcludedFromTax 0xcb4ca631 → bool
isMaxTxExcluded 0x71dd7497 → bool
isMaxWalletExcluded 0x203a421f → bool
isPair 0xe5e31b13 → bool
marketingWallet 0x75f0a874 → address
maxTx 0x7437681e → uint256
maxWallet 0xf8b45b05 → uint256
mktShare 0x6efc30a9 → uint16
name 0x06fdde03 → string
owner 0x8da5cb5b → address
pair 0xa8aa1b31 → address
router 0xf887ea40 → address
sellTax 0xcc1776d3 → uint8
sellThreshold 0x2d4310c0 → uint256
startTaxTime 0xe3c5a291 → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 22 functions
These functions modify contract state and require a wallet transaction to execute.
addPair 0xc2b7bbb6
address _pair
approve 0x095ea7b3
address spender
uint256 value
returns: bool
manualSwap 0x51bc3c85
No parameters
recoverERC20 0x886f039a
address _token
address _to
recoverNative 0xf2cda82e
address _to
uint256 _amount
renounceOwnership 0x715018a6
No parameters
setBuyTax 0x6081752b
uint8 _buyTax
setMaxTx 0xbc337182
uint256 _maxTx
setMaxTxExclusionStatus 0xff796a87
address _address
bool _status
setMaxWallet 0x5d0044ca
uint256 _maxWallet
setMaxWalletExclusionStatus 0x1a1d3a2d
address _address
bool _status
setMultipleTaxExclusionStatus 0x2daa3871
address[] addresses
bool _status
setSellTax 0x49abdc14
uint8 _sellTax
setTaxExclusionStatus 0x7f4fd579
address _address
bool _status
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
updateDevWallet 0x1816467f
address _devWallet
updateMarketingWallet 0xaacebbe3
address _marketingwallet
updateSellThreshold 0x5bf99a38
uint256 _sellThreshold
updateShares 0x8238642e
uint16 _mktShare
uint16 _devShare
updateUniswapRouter 0x908bb2ae
address _router
Recent Transactions
No transactions found for this address