Skip to main content
PulseScanner.io

Address

0x3facf37bc7d46fe899a3fe4991c3ee8a8e7ab489
Current Holdings
$0.00
TXs sent
not counted
First Active
2025-11-12
block 25,000,001
Last Active
307 days ago
block 25,017,901
Funded By
not identified

Net worth historyi

No net-worth snapshots recorded yet
exact matchCornTokensolc 0.8.24+commit.e11b9ed9runtime exact · creation exact
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

interface IUniswapV2PairLike { } // marker only

contract CornToken is ERC20, Ownable {
    uint256 public constant MAX_SUPPLY = 1_000_000 * 1e18;

    address public taxRecipient;
    uint16  public buySellTaxBps = 500; // 5% = 500 bps
    address public dexPair;             // set after creating the pair

    mapping(address => bool) public isExcludedFromFee;

    event SetTaxRecipient(address indexed);
    event SetBuySellTaxBps(uint16 oldBps, uint16 newBps);
    event SetDexPair(address indexed);
    event SetExcluded(address indexed, bool excluded);

    constructor(address _treasury) ERC20("veCORN", "veCORN") Ownable(msg.sender) {
        _mint(msg.sender, MAX_SUPPLY);
        taxRecipient = _treasury;
        isExcludedFromFee[msg.sender] = true;
        isExcludedFromFee[_treasury] = true;
    }

    function setTaxRecipient(address a) external onlyOwner {
        require(a != address(0), "zero");
        taxRecipient = a;
        emit SetTaxRecipient(a);
    }

    function setBuySellTaxBps(uint16 bps) external onlyOwner {
        require(bps <= 1000, "max 10%");
        emit SetBuySellTaxBps(buySellTaxBps, bps);
        buySellTaxBps = bps;
    }

    function setDexPair(address pair) external onlyOwner {
        require(pair != address(0), "zero");
        dexPair = pair;
        emit SetDexPair(pair);
    }

    function setExcluded(address a, bool v) external onlyOwner {
        isExcludedFromFee[a] = v;
        emit SetExcluded(a, v);
    }

    function _update(address from, address to, uint256 amount) internal override {
        if (
            buySellTaxBps == 0 ||
            isExcludedFromFee[from] ||
            isExcludedFromFee[to] ||
            taxRecipient == address(0)
        ) {
            super._update(from, to, amount);
            return;
        }

        bool isBuy  = from == dexPair && dexPair != address(0);
        bool isSell = to   == dexPair && dexPair != address(0);

        if (isBuy || isSell) {
            uint256 fee = (amount * buySellTaxBps) / 10_000;
            uint256 net = amount - fee;
            super._update(from, taxRecipient, fee);
            super._update(from, to, net);
        } else {
            super._update(from, to, amount);
        }
    }
}