Address Contract Verified
Address
0x7921613d694Da3e035FaE9a227cE61d1127a1D18
Balance
0 ETH
Nonce
1
Code Size
5551 bytes
Creator
0xB07272e0...d193 at tx 0x27d42f0f...04bbde
Indexed Transactions
0
Contract Bytecode
5551 bytes
0x608060405234801561000f575f80fd5b50600436106101d1575f3560e01c80638da5cb5b116100fe578063d257b34f1161009e578063e4748b9e1161006e578063e4748b9e14610422578063f25f4b5614610437578063f2fde38b1461044a578063f3d2350e1461045d575f80fd5b8063d257b34f146103de578063dd62ed3e146103f1578063e0f3ccf514610404578063e2f4560514610419575f80fd5b8063a9059cbb116100d9578063a9059cbb1461038a578063b384f7641461039d578063bc063e1a146103b0578063c0246668146103cb575f80fd5b80638da5cb5b1461035e57806395d89b411461036f578063a457c2d714610377575f80fd5b806339509351116101745780636671852411610144578063667185241461030c5780636ddd17131461032157806370a082311461032e578063715018a614610356575f80fd5b8063395093511461028e57806349bd5a5e146102a15780634fbee193146102c85780635c9a05b8146102ea575f80fd5b80631694505e116101af5780631694505e1461023357806318160ddd1461025a57806323b872dd1461026c578063313ce5671461027f575f80fd5b806303fd2a45146101d557806306fdde03146101fb578063095ea7b314610210575b5f80fd5b6101de61dead81565b6040516001600160a01b0390911681526020015b60405180910390f35b610203610470565b6040516101f291906111db565b61022361021e36600461123a565b610500565b60405190151581526020016101f2565b6101de7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6002545b6040519081526020016101f2565b61022361027a366004611264565b610519565b604051600981526020016101f2565b61022361029c36600461123a565b61053c565b6101de7f000000000000000000000000a357665f6d8f53771dbe6618f588abdc8cd9bbfc81565b6102236102d63660046112a2565b60086020525f908152604090205460ff1681565b6102236102f83660046112a2565b60096020525f908152604090205460ff1681565b61031f61031a3660046112a2565b61055d565b005b600a546102239060ff1681565b61025e61033c3660046112a2565b6001600160a01b03165f9081526020819052604090205490565b61031f6105d5565b6005546001600160a01b03166101de565b6102036105e8565b61022361038536600461123a565b6105f7565b61022361039836600461123a565b610676565b61031f6103ab3660046112c4565b610683565b6103b8600581565b60405161ffff90911681526020016101f2565b61031f6103d93660046112c4565b610740565b61031f6103ec3660046112ff565b6107e3565b61025e6103ff366004611316565b610843565b6005546103b890600160b01b900461ffff1681565b61025e60075481565b6005546103b890600160a01b900461ffff1681565b6006546101de906001600160a01b031681565b61031f6104583660046112a2565b61086d565b61031f61046b366004611358565b6108e6565b60606003805461047f90611389565b80601f01602080910402602001604051908101604052809291908181526020018280546104ab90611389565b80156104f65780601f106104cd576101008083540402835291602001916104f6565b820191905f5260205f20905b8154815290600101906020018083116104d957829003601f168201915b5050505050905090565b5f3361050d81858561098b565b60019150505b92915050565b5f33610526858285610aae565b610531858585610b26565b506001949350505050565b5f3361050d81858561054e8383610843565b61055891906113d5565b61098b565b610565610e21565b6001600160a01b03811661058c576040516342bcdf7f60e11b815260040160405180910390fd5b600680546001600160a01b0319166001600160a01b0383169081179091556040517f29acee77dafcfa0143d74a7ea236018f3a6e1fa71e27fc59bbfbc6b8ca8edccd905f90a250565b6105dd610e21565b6105e65f610e7b565b565b60606004805461047f90611389565b5f33816106048286610843565b9050838110156106695760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b610531828686840361098b565b5f3361050d818585610b26565b61068b610e21565b7f000000000000000000000000a357665f6d8f53771dbe6618f588abdc8cd9bbfc6001600160a01b0316826001600160a01b0316036106dd5760405163c41988a760e01b815260040160405180910390fd5b6001600160a01b0382165f81815260096020908152604091829020805460ff19168515159081179091558251938452908301527f35f8ff653a43436c7a79b967cb5f339996dfc0c017ff2f3ecce3314593144e8f91015b60405180910390a15050565b610748610e21565b6001600160a01b0382165f9081526008602052604090205481151560ff909116151503610788576040516363f958f760e11b815260040160405180910390fd5b6001600160a01b0382165f81815260086020908152604091829020805460ff19168515159081179091558251938452908301527f3499bfcf9673677ba552f3fe2ea274ec7e6246da31c3c87e115b45a9b0db2efb9101610734565b6107eb610e21565b64e8d4a5100081101561081157604051631fbaba3560e01b815260040160405180910390fd5b600781905560405181907f28ea3a80049e637c2f1bf658d47a07f688bea6e931f3c1930cf4a4daf97b1860905f90a250565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b610875610e21565b6001600160a01b0381166108da5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610660565b6108e381610e7b565b50565b6108ee610e21565b60056108fa82846113e8565b61ffff16111561091d576040516314c9b50160e21b815260040160405180910390fd5b6005805463ffffffff60a01b1916600160a01b61ffff85811691820261ffff60b01b191692909217600160b01b928516928302179092556040805192835260208301919091527f2ac80c14c28700f7b5e36f947d572149fe2e3947bac32c3a8c098f3e03722c119101610734565b6001600160a01b0383166109ed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610660565b6001600160a01b038216610a4e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610660565b6001600160a01b038381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f610ab98484610843565b90505f198114610b205781811015610b135760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610660565b610b20848484840361098b565b50505050565b6001600160a01b038316610b4c5760405162461bcd60e51b81526004016106609061140a565b6001600160a01b038216610b725760405162461bcd60e51b81526004016106609061144f565b5f8111610bd35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610660565b305f90815260208190526040902054610bf76103e868056bc75e2d63100000611492565b811115610c1657610c136103e868056bc75e2d63100000611492565b90505b600a5460ff168015610c305750600a54610100900460ff16155b8015610c5457506001600160a01b0384165f9081526009602052604090205460ff16155b8015610c7857506001600160a01b0384165f9081526008602052604090205460ff16155b8015610c9c57506001600160a01b0383165f9081526008602052604090205460ff16155b8015610caa57506007548110155b15610cd357600a805461ff001916610100179055610cc781610ecc565b600a805461ff00191690555b600a546001600160a01b0385165f9081526008602052604090205460ff610100909204821615911680610d1d57506001600160a01b0384165f9081526008602052604090205460ff165b15610d2557505f5b5f8115610e0e576001600160a01b0385165f9081526009602052604090205460ff168015610d5f5750600554600160b01b900461ffff1615155b15610d9057600554606490610d7f90600160b01b900461ffff16866114b1565b610d899190611492565b9050610df0565b6001600160a01b0386165f9081526009602052604090205460ff168015610dc35750600554600160a01b900461ffff1615155b15610df057600554606490610de390600160a01b900461ffff16866114b1565b610ded9190611492565b90505b8015610e0157610e018630836110b3565b610e0b81856114c8565b93505b610e198686866110b3565b505050505050565b6005546001600160a01b031633146105e65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610660565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6040805160028082526060820183525f9260208301908036833701905050905030815f81518110610eff57610eff6114db565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f7b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f9f91906114ef565b81600181518110610fb257610fb26114db565b60200260200101906001600160a01b031690816001600160a01b03168152505081610ffd307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d610843565b101561102f5761102f307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d5f1961098b565b60065460405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81169263791ac9479261108a9287925f9288929190911690429060040161150a565b5f604051808303815f87803b1580156110a1575f80fd5b505af1158015610e19573d5f803e3d5ffd5b6001600160a01b0383166110d95760405162461bcd60e51b81526004016106609061140a565b6001600160a01b0382166110ff5760405162461bcd60e51b81526004016106609061144f565b6001600160a01b0383165f90815260208190526040902054818110156111765760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610660565b6001600160a01b038481165f81815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610b20565b5f6020808352835180828501525f5b81811015611206578581018301518582016040015282016111ea565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b03811681146108e3575f80fd5b5f806040838503121561124b575f80fd5b823561125681611226565b946020939093013593505050565b5f805f60608486031215611276575f80fd5b833561128181611226565b9250602084013561129181611226565b929592945050506040919091013590565b5f602082840312156112b2575f80fd5b81356112bd81611226565b9392505050565b5f80604083850312156112d5575f80fd5b82356112e081611226565b9150602083013580151581146112f4575f80fd5b809150509250929050565b5f6020828403121561130f575f80fd5b5035919050565b5f8060408385031215611327575f80fd5b823561133281611226565b915060208301356112f481611226565b803561ffff81168114611353575f80fd5b919050565b5f8060408385031215611369575f80fd5b61137283611342565b915061138060208401611342565b90509250929050565b600181811c9082168061139d57607f821691505b6020821081036113bb57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610513576105136113c1565b61ffff818116838216019080821115611403576114036113c1565b5092915050565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b5f826114ac57634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417610513576105136113c1565b81810381811115610513576105136113c1565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156114ff575f80fd5b81516112bd81611226565b5f60a082018783526020878185015260a0604085015281875180845260c08601915082890193505f5b818110156115585784516001600160a01b031683529383019391830191600101611533565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220bede91a0c244924575413526bd8c3046cbc0033eea878f1a32f4daf9d70296cd64736f6c63430008150033
Verified Source Code Full Match
Compiler: v0.8.21+commit.d9974bed
EVM: shanghai
Optimization: Yes (200 runs)
coin12.sol 263 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
/// @title Coin12
/// @notice An erc20 token contract with buy/sell fees
/// @dev Inherits the OpenZepplin ERC20, Ownable implementation
contract Coin12 is ERC20, Ownable {
/// @notice custom errors
error MaxFeeLimitExceeded();
error ZeroAddressNotAllowed();
error UpdateBoolValue();
error AmountTooLow();
error CanNotModifyMainPair();
/// @notice Max Fee limit for buy and sell combined
uint16 constant public MAX_FEE = 5;
/// @notice Minimum swap threshold amount that can be set
/// to swap collected tax tokens to eth
uint256 constant private MIN_SWAP_AT_AMOUNT = 1e3 * 1e9;
/// @notice max supply of token
uint256 constant private maxSupply = 1e11 * 1e9; // 100 billion
///@notice max tokens that can swapped to convert fees to eth in single tx
uint256 constant private MAX_SWAP_AMOUNT = maxSupply / 1000;
///@notice burn address
address constant public DEAD = address(0xdead);
/// @notice fees on every buy
uint16 public buyFees = 2;
///@notice fees on every sell
uint16 public sellFees = 2;
/// @notice fee wallet to receive fees from buy/sell
address public feeWallet = address(0xd53dd7dF3f628fd73c3EE38e9dDa7bECde17e9ed);
/// @notice address of uniswap V2 pair
address public immutable uniswapV2Pair;
/// @notice address of router
IUniswapV2Router02 public immutable uniswapV2Router;
/// @notice token threshold after which collected fees will be swapped to ether
uint256 public swapTokensAtAmount = (maxSupply * 10) / 100000; // 0.01% of the supply
/// @notice mapping of user address which are excluded from fees
mapping(address => bool) public isExcludedFromFees;
/// @notice mapping of valid pair addresses
mapping(address=> bool) public isLiquidityPair;
/// @notice bool variable to indiacate if collected fees can be swapped
/// for ether or not
bool public swapEnabled = true;
/// @notice bool variable to be used while swapping
bool private swapping;
event SwapTokensAmountUpdated (uint256 indexed newAmount);
event FeeWalletUpdated(address indexed newFeeWallet);
event ExcludedFromFees (address account, bool value);
event NewLPUpdated(address lp, bool value);
event FeesUpdated(uint16 buyFee, uint16 sellFee);
/// @notice Deploys the smart contract, set the uniswap router address
/// create uniswap v2 pair address, exclude the deployer, token address,
/// burn wallet and fee wallet from fees. Mint the supply to owner.
constructor() ERC20("Coin12", "C12"){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D//uniswap V2 Router
);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
isLiquidityPair[uniswapV2Pair] = true;
isExcludedFromFees[msg.sender] = true;
isExcludedFromFees[address(this)] = true;
isExcludedFromFees[feeWallet] = true;
isExcludedFromFees[DEAD] = true;
_mint(owner(), maxSupply);
}
///@notice returns token decimals
function decimals () public pure override returns (uint8) {
return 9;
}
///@dev update fee wallet
///@param _newFeeWallet: new wallet address for fees
///Requirements -
/// _newFeeWallet address should not be zero address.
function updateFeeWallet (address _newFeeWallet) external onlyOwner {
if(_newFeeWallet == address(0)){
revert ZeroAddressNotAllowed();
}
feeWallet = _newFeeWallet;
emit FeeWalletUpdated(_newFeeWallet);
}
///@dev update fees for buy and sell
///@param buy: new buy fees
///@param sell: new sell fees
///Requirements-
/// sum of buy and sell should be less than equal to MAX_FEE
function updateFees (uint16 buy, uint16 sell) external onlyOwner {
if(buy+sell > MAX_FEE){
revert MaxFeeLimitExceeded();
}
buyFees = buy;
sellFees = sell;
emit FeesUpdated(buy, sell);
}
///@dev exclude or include in fee mapping
///@param user: user to exclude or include in fee
///Requirements -
/// owner must enter correct bool value
function excludeFromFees (address user, bool isExcluded) external onlyOwner {
if(isExcludedFromFees[user] == isExcluded){
revert UpdateBoolValue();
}
isExcludedFromFees[user] = isExcluded;
emit ExcludedFromFees(user, isExcluded);
}
///@dev add or remove new pairs
///@param newPair; new pair address
///@param value: boolean value true true for adding, false for removing
///Requirements -
///Can't modify uniswapV2Pair (main pair)
function manageLiquidityPairs (address newPair, bool value) external onlyOwner{
if(newPair == uniswapV2Pair){
revert CanNotModifyMainPair();
}
isLiquidityPair[newPair] = value;
emit NewLPUpdated(newPair, value);
}
///@dev update the swap token amount
///@param _newSwapAmount: new token amount to swap threshold
///Requirements--
/// amount must greator than equal to MIN_SWAP_AT_AMOUNT
function updateSwapTokensAtAmount (uint256 _newSwapAmount) external onlyOwner {
if(_newSwapAmount < MIN_SWAP_AT_AMOUNT){
revert AmountTooLow();
}
swapTokensAtAmount = _newSwapAmount;
emit SwapTokensAmountUpdated(_newSwapAmount);
}
///@notice transfer function to manage token transfer/fees/limits
///@param from: token sender
///@param to: token receiver
///@param amount: amount to transfer
///@dev Moves a `value` amount of tokens from `from` to `to`
/// there is fees on buy and sell transfer (based on liquidityPairAddress)
/// Requirements --
/// from and to address should not be zero address
/// amount must be greator than 0
/// trading should be enabled (owner and excluded address are exception)
function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
uint256 contractBalance = balanceOf(address(this));
if(contractBalance > MAX_SWAP_AMOUNT){
contractBalance = MAX_SWAP_AMOUNT;
}
if (
swapEnabled && //if this is true
!swapping && //if this is false
!isLiquidityPair[from] && //if this is false
!isExcludedFromFees[from] && //if this is false
!isExcludedFromFees[to] && //if this false
contractBalance >=swapTokensAtAmount //if this is true
) {
swapping = true;
swapTokensForEth(contractBalance);
swapping = false;
}
bool takeFee = !swapping;
// if any account belongs to _isExcludedFromFee account then remove the fee
if (isExcludedFromFees[from] || isExcludedFromFees[to]) {
takeFee = false;
}
uint256 fees = 0;
// only take fees on buys/sells, do not take on wallet transfers
if (takeFee) {
//on sell
if ( isLiquidityPair[to] && sellFees > 0) {
fees = (amount * sellFees) / 100;
}
// on buy
else if (isLiquidityPair[from] && buyFees > 0) {
fees = (amount * buyFees) / 100;
}
if (fees > 0) {
super._transfer(from, address(this), fees);
}
amount -= fees;
}
super._transfer(from, to, amount);
}
///@notice private function to swap tax to eth
///@param tokenAmount: token amount to swap for eth
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
if(allowance(address(this), address(uniswapV2Router)) < tokenAmount){
_approve(address(this), address(uniswapV2Router), type(uint256).max);
}
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
feeWallet,
block.timestamp
);
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_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. 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 {
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);
}
}
ERC20.sol 365 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.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.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the 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 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;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_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;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_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;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_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 {}
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @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 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);
}
IUniswapV2Factory.sol 17 lines
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
IUniswapV2Router01.sol 95 lines
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
IUniswapV2Router02.sol 44 lines
pragma solidity >=0.6.2;
import './IUniswapV2Router01.sol';
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
Read Contract
DEAD 0x03fd2a45 → address
MAX_FEE 0xbc063e1a → uint16
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
buyFees 0xe4748b9e → uint16
decimals 0x313ce567 → uint8
feeWallet 0xf25f4b56 → address
isExcludedFromFees 0x4fbee193 → bool
isLiquidityPair 0x5c9a05b8 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
sellFees 0xe0f3ccf5 → uint16
swapEnabled 0x6ddd1713 → bool
swapTokensAtAmount 0xe2f45605 → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uniswapV2Pair 0x49bd5a5e → address
uniswapV2Router 0x1694505e → address
Write Contract 12 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
excludeFromFees 0xc0246668
address user
bool isExcluded
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
manageLiquidityPairs 0xb384f764
address newPair
bool value
renounceOwnership 0x715018a6
No parameters
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
updateFeeWallet 0x66718524
address _newFeeWallet
updateFees 0xf3d2350e
uint16 buy
uint16 sell
updateSwapTokensAtAmount 0xd257b34f
uint256 _newSwapAmount
Recent Transactions
No transactions found for this address