Skip to content
Verified contractExactMIT

TokiSarafonTS

Address0x63593c6d859a00a6b695d1bb2ca69549ca6a93c3
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,397,398
Creation transaction
0x7ffee7f83a…c35293ec07

contracts/1_Storage.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IUniswapV3Pool {
    function slot0() external view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked);
}

contract TokiSarafonTS {
    string public constant name = "Toki Sarafon TS";
    string public constant symbol = "TS";
    uint8 public constant decimals = 18;
    
    uint256 private constant _totalSupply = 15000000 * 10**18;
    
    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;
    
    address public immutable contractAuthor;
    uint256 public minSqrtPriceX96;
    address public uniswapV3PoolAddress;

    // Anti-bot limits (0 = disabled)
    uint256 public maxTxAmount;
    uint256 public maxWalletAmount;

    // Reentrancy guard state variable
    uint8 private _unlocked = 1;
    modifier nonReentrant() {
        require(_unlocked == 1, "TS: Reentrancy guard locked");
        _unlocked = 0;
        _;
        _unlocked = 1;
    }

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event PriceFloorUpdated(uint256 newMinPriceX96);
    event LimitsUpdated(uint256 newMaxTx, uint256 newMaxWallet);

    constructor() {
        contractAuthor = msg.sender;
        _balances[msg.sender] = _totalSupply;
        emit Transfer(address(0), msg.sender, _totalSupply);
        
        // Initial protective limits for the launch phase (adjustable via setLimits)
        maxTxAmount = 1000 * 10**18;     // Max purchase per tx - 1,000 TS
        maxWalletAmount = 2000 * 10**18; // Max balance per wallet - 2,000 TS
    }

    function totalSupply() external pure returns (uint256) { 
        return _totalSupply; 
    }
    
    function balanceOf(address account) external view returns (uint256) { 
        return _balances[account]; 
    }

    // Adjust the price floor corridor (Only author, only upward)
    function setPriceFloor(address _pool, uint256 _minSqrtPriceX96) external {
        require(msg.sender == contractAuthor, "TS: Caller is not the author");
        require(_minSqrtPriceX96 >= minSqrtPriceX96, "TS: Floor can only move upward");
        uniswapV3PoolAddress = _pool;
        minSqrtPriceX96 = _minSqrtPriceX96;
        emit PriceFloorUpdated(_minSqrtPriceX96);
    }

    // Dynamic anti-bot limits management (Set to 0,0 to disable completely)
    function setLimits(uint256 _maxTxAmount, uint256 _maxWalletAmount) external {
        require(msg.sender == contractAuthor, "TS: Caller is not the author");
        maxTxAmount = _maxTxAmount;
        maxWalletAmount = _maxWalletAmount;
        emit LimitsUpdated(_maxTxAmount, _maxWalletAmount);
    }

    function transfer(address to, uint256 value) external nonReentrant returns (bool) {
        _transferTokens(msg.sender, to, value);
        return true;
    }

    function allowance(address owner, address spender) external view returns (uint256) { 
        return _allowances[owner][spender]; 
    }
    
    function approve(address spender, uint256 value) external returns (bool) {
        _allowances[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    // Standard ERC-20 extension to prevent approval front-running
    function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
        _allowances[msg.sender][spender] += addedValue;
        emit Approval(msg.sender, spender, _allowances[msg.sender][spender]);
        return true;
    }

    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
        uint256 currentAllowance = _allowances[msg.sender][spender];
        require(currentAllowance >= subtractedValue, "TS: Decreased allowance below zero");
        _allowances[msg.sender][spender] = currentAllowance - subtractedValue;
        emit Approval(msg.sender, spender, _allowances[msg.sender][spender]);
        return true;
    }

    function transferFrom(address from, address to, uint256 value) external nonReentrant returns (bool) {
        require(_allowances[from][msg.sender] >= value, "TS: Insufficient allowance");
        _allowances[from][msg.sender] -= value;
        _transferTokens(from, to, value);
        return true;
    }

    function _transferTokens(address from, address to, uint256 value) internal {
        require(_balances[from] >= value, "TS: Insufficient balance");

        // 1. Price Floor Protection (Triggers only when selling into the Uniswap Pool)
        if (to == uniswapV3PoolAddress && minSqrtPriceX96 > 0) {
            (uint160 sqrtPriceX96,,,,,,) = IUniswapV3Pool(uniswapV3PoolAddress).slot0();
            require(sqrtPriceX96 >= minSqrtPriceX96, "TS: Price below the floor limit");
        }

        uint256 fee = 0;
        
        // 2. Uniswap Tax Exemption
        // 0.15% fee applies strictly to peer-to-peer transfers between users
        if (from != uniswapV3PoolAddress && to != uniswapV3PoolAddress && from != contractAuthor && to != contractAuthor) {
            fee = (value * 15) / 10000; // 0.15%
        }

        uint256 tokensToTransfer = value - fee;

        // 3. Anti-Sniper Bot Protection (Triggers when buying from the Uniswap Pool)
        // Exempts contract author to allow liquidity management
        if (from == uniswapV3PoolAddress && to != contractAuthor) {
            if (maxTxAmount > 0) {
                require(value <= maxTxAmount, "TS: Exceeds max transaction limit");
            }
            if (maxWalletAmount > 0) {
                require(_balances[to] + tokensToTransfer <= maxWalletAmount, "TS: Exceeds max wallet limit");
            }
        }

        _balances[from] -= value;
        _balances[to] += tokensToTransfer;

        emit Transfer(from, to, tokensToTransfer);
        
        if (fee > 0) {
            _balances[contractAuthor] += fee;
            emit Transfer(from, contractAuthor, fee);
        }
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.