Skip to content
Verified contractExactMIT

CLAUDIS

Address0xad289ed8d0a1e2ca47c480d69d3cedc1ba64b24f
Balance

0 ETH

 

Transactions

15

 

Compiler

solc 0.8.25

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.25+commit.b61c2a91
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,045,731
Creation transaction
0x77e7b2dd55…7e437d389e

contracts/claudis.sol

// SPDX-License-Identifier: MIT

/*
   ╔══════════════════════════════════════════════════════════════╗
   ║                                                              ║
   ║                       $DIS  -  claudis                       ║
   ║                                                              ║
   ║         Telegram :  https://t.me/promptclaudis               ║
   ║                                                              ║
   ╚══════════════════════════════════════════════════════════════╝
*/

pragma solidity 0.8.25;

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
}

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

contract Ownable is Context {
    address private _owner;
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    constructor() {
        address sender = _msgSender();
        _owner = sender;
        emit OwnershipTransferred(address(0), sender);
    }

    function owner() public view returns (address) {
        return _owner;
    }

    modifier onlyOwner() {
        require(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

// ──────────────────────────────────────────────────────────────────────────────
// Uniswap V4 types & interfaces (inlined, mainnet)
// ──────────────────────────────────────────────────────────────────────────────

type Currency is address;

struct PoolKey {
    Currency currency0;
    Currency currency1;
    uint24 fee;
    int24 tickSpacing;
    address hooks;
}

interface IPoolManager {
    function initialize(PoolKey memory key, uint160 sqrtPriceX96) external returns (int24 tick);
}

interface IPositionManager {
    function modifyLiquidities(bytes calldata unlockData, uint256 deadline) external payable;
}

interface IUniversalRouter {
    function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable;
}

interface IPermit2 {
    function approve(address token, address spender, uint160 amount, uint48 expiration) external;
}

interface IV4Router {
    struct ExactInputSingleParams {
        PoolKey poolKey;
        bool zeroForOne;
        uint128 amountIn;
        uint128 amountOutMinimum;
        bytes hookData;
    }
}

// ──────────────────────────────────────────────────────────────────────────────
// FullMath (Uniswap V3 canonical, mulDiv with 512-bit intermediate)
// ──────────────────────────────────────────────────────────────────────────────

library FullMath {
    function mulDiv(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            uint256 prod0;
            uint256 prod1;
            assembly {
                let mm := mulmod(a, b, not(0))
                prod0 := mul(a, b)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }
            if (prod1 == 0) {
                require(denominator > 0);
                assembly { result := div(prod0, denominator) }
                return result;
            }
            require(denominator > prod1);
            uint256 remainder;
            assembly { remainder := mulmod(a, b, denominator) }
            assembly {
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                denominator := div(denominator, twos)
                prod0 := div(prod0, twos)
                twos := add(div(sub(0, twos), twos), 1)
            }
            prod0 |= prod1 * twos;
            uint256 inv = (3 * denominator) ^ 2;
            inv *= 2 - denominator * inv;
            inv *= 2 - denominator * inv;
            inv *= 2 - denominator * inv;
            inv *= 2 - denominator * inv;
            inv *= 2 - denominator * inv;
            inv *= 2 - denominator * inv;
            result = prod0 * inv;
        }
    }
}

contract CLAUDIS is Context, IERC20, Ownable {

    // unique deployment seed (hex of "claudis_v3")
    uint256 private constant _SEED = 0x636c61756469735f7633;

    // ── Uniswap V4 constants (Ethereum mainnet) ──────────────────────────────
    address public constant POOL_MANAGER     = 0x000000000004444c5dc75cB358380D2e3dE08A90;
    address public constant POSITION_MANAGER = 0xbD216513d74C8cf14cf4747E6AaA6420FF64ee9e;
    address public constant UNIVERSAL_ROUTER = 0x66a9893cC07D91D95644AEDD05D03f95e1dBA8Af;
    address public constant PERMIT2          = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
    uint24  public constant POOL_FEE         = 3000;
    int24   public constant TICK_SPACING     = 60;
    int24   public constant TICK_LOWER       = -887220;
    int24   public constant TICK_UPPER       =  887220;
    uint160 private constant SQRT_PRICE_LOWER = 4295128739;
    uint160 private constant SQRT_PRICE_UPPER = 1461446703485210103287273052203988822378723970341;
    uint160 private constant Q96 = 79228162514264337593543950336;

    // V4 action IDs
    uint8 private constant ACT_MINT_POSITION       = 0x02;
    uint8 private constant ACT_SWAP_EXACT_IN_SINGLE = 0x06;
    uint8 private constant ACT_SETTLE_ALL          = 0x0c;
    uint8 private constant ACT_SETTLE_PAIR         = 0x0d;
    uint8 private constant ACT_TAKE_ALL            = 0x0f;
    uint8 private constant ACT_SWEEP               = 0x14;
    uint8 private constant CMD_V4_SWAP             = 0x10;

    // Auto-remove of buy/wallet limits after this many blocks past launch.
    uint256 public constant LIMIT_RELEASE_BLOCKS = 6;

    // ── Token metadata ────────────────────────────────────────────────────────
    uint8 private constant _decimals = 9;
    uint256 private constant _supply = 100000000 * 10**_decimals;
    string private constant _name   = unicode"claudis";
    string private constant _symbol = unicode"DIS";

    // ── Storage ───────────────────────────────────────────────────────────────
    mapping(address => uint256) private _holdings;
    mapping(address => mapping(address => uint256)) private _grants;
    mapping(uint256 => uint256) private _blockBuyCount;
    mapping(address => bool) public tradingPairs;
    mapping(address => bool) private _whitelisted;

    address public tradingPair;
    address payable private _feeReceiver;

    // Limits (auto-released after LIMIT_RELEASE_BLOCKS)
    uint256 public maxTxAmount    = 2000000 * 10**_decimals;
    uint256 public maxWalletSize  = 2000000 * 10**_decimals;
    uint256 public swapThreshold  = 1000000 * 10**_decimals;
    uint256 public maxSwapAmount  = 1000000 * 10**_decimals;

    // Tax curve (5% start, 0% after threshold)
    uint256 private _buyFeeInit    = 5;
    uint256 private _sellFeeInit   = 5;
    uint256 private _buyFeeFinal   = 0;
    uint256 private _sellFeeFinal  = 0;
    uint256 private _buyFeeTrigger  = 15;
    uint256 private _sellFeeTrigger = 20;

    // Counters
    uint256 private _totalBuys;
    uint256 private _blockSells;
    uint256 private _lastSwapBlock;
    uint256 private _swapAfter = 20;

    // Anti-bot
    uint256 private _maxBlockSells = 3;
    uint256 private _maxFirstBlockBuys = 24;
    uint256 private _openBlock;

    // Flags
    bool private _live;
    bool private _swapping;
    bool private _autoSwap;
    bool private _limitsActive = true;

    event MaxTxAmountUpdated(uint maxTxAmount);
    event LimitsAutoReleased(uint256 atBlock);

    modifier swapLock() {
        _swapping = true;
        _;
        _swapping = false;
    }

    constructor() {
        address deployer = _msgSender();
        _feeReceiver = payable(deployer);
        _holdings[deployer] = _supply;

        _whitelisted[deployer] = true;
        _whitelisted[address(this)] = true;
        _whitelisted[POOL_MANAGER] = true;
        _whitelisted[POSITION_MANAGER] = true;
        _whitelisted[UNIVERSAL_ROUTER] = true;

        tradingPair = POOL_MANAGER;
        tradingPairs[POOL_MANAGER] = true;

        emit Transfer(address(0), deployer, _supply);

        _approve(address(this), PERMIT2, type(uint256).max);
        IPermit2(PERMIT2).approve(
            address(this), UNIVERSAL_ROUTER,
            type(uint160).max, type(uint48).max
        );
        IPermit2(PERMIT2).approve(
            address(this), POSITION_MANAGER,
            type(uint160).max, type(uint48).max
        );
    }

    function name() public pure returns (string memory) { return _name; }
    function symbol() public pure returns (string memory) { return _symbol; }
    function decimals() public pure returns (uint8) { return _decimals; }
    function totalSupply() public pure override returns (uint256) { return _supply; }

    function balanceOf(address account) public view override returns (uint256) {
        return _holdings[account];
    }

    function transfer(address recipient, uint256 amount) public override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    function allowance(address owner, address spender) public view override returns (uint256) {
        return _grants[owner][spender];
    }

    function approve(address spender, uint256 amount) public override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
        _transfer(sender, recipient, amount);
        uint256 currentAllowance = _grants[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        _approve(sender, _msgSender(), currentAllowance - amount);
        return true;
    }

    function _approve(address owner, address spender, uint256 amount) private {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");
        _grants[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    function _feeOn(uint256 amount, bool isBuy) private view returns (uint256) {
        uint256 rate;
        if (isBuy) {
            rate = _totalBuys > _buyFeeTrigger ? _buyFeeFinal : _buyFeeInit;
        } else {
            rate = _totalBuys > _sellFeeTrigger ? _sellFeeFinal : _sellFeeInit;
        }
        return amount * rate / 100;
    }

    function _maybeReleaseLimits() private {
        if (_limitsActive && _openBlock != 0 && block.number > _openBlock + LIMIT_RELEASE_BLOCKS) {
            maxTxAmount = _supply;
            maxWalletSize = _supply;
            _limitsActive = false;
            emit MaxTxAmountUpdated(_supply);
            emit LimitsAutoReleased(block.number);
        }
    }

    function _transfer(address from, address to, uint256 amount) private {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");
        require(amount > 0, "Amount must be greater than zero");

        // Internal contract operations are never taxed (auto-swap & LP mint).
        if (from == address(this)) {
            _holdings[from] -= amount;
            _holdings[to] += amount;
            emit Transfer(from, to, amount);
            return;
        }

        // Auto-release limits after LIMIT_RELEASE_BLOCKS past launch.
        _maybeReleaseLimits();

        uint256 fee = 0;

        if (from != owner() && to != owner()) {
            // First-block buy cap (anti-bot)
            if (block.number == _openBlock) {
                require(_blockBuyCount[block.number] < _maxFirstBlockBuys, "Exceeds buys on the first block.");
                _blockBuyCount[block.number]++;
            }

            bool isBuy  = tradingPairs[from] && !_whitelisted[to];
            bool isSell = tradingPairs[to];

            if (isBuy) {
                if (_limitsActive) {
                    require(amount <= maxTxAmount, "Exceeds maxTxAmount.");
                    require(_holdings[to] + amount <= maxWalletSize, "Exceeds maxWalletSize.");
                }
                _totalBuys++;
                fee = _feeOn(amount, true);
            } else if (isSell) {
                fee = _feeOn(amount, false);
            }

            // Plain wallet→wallet has no fee, but still respects max wallet (while active)
            if (!isBuy && !isSell && !_whitelisted[to] && _limitsActive) {
                require(_holdings[to] + amount <= maxWalletSize, "Exceeds maxWalletSize.");
            }

            // Trigger auto-swap on sells (when conditions met)
            uint256 contractBal = _holdings[address(this)];
            bool canSwap = !_swapping && isSell && _autoSwap
                && contractBal > swapThreshold
                && _totalBuys > _swapAfter;

            if (canSwap) {
                if (block.number > _lastSwapBlock) {
                    _blockSells = 0;
                }
                require(_blockSells < _maxBlockSells);
                _liquidate(_smaller(amount, _smaller(contractBal, maxSwapAmount)));
                if (address(this).balance > 0) {
                    _payout(address(this).balance);
                }
                _blockSells++;
                _lastSwapBlock = block.number;
            }
        }

        if (fee > 0) {
            _holdings[address(this)] += fee;
            emit Transfer(from, address(this), fee);
        }

        _holdings[from] -= amount;
        _holdings[to] += amount - fee;
        emit Transfer(from, to, amount - fee);
    }

    function _smaller(uint256 a, uint256 b) private pure returns (uint256) {
        return a < b ? a : b;
    }

    function _poolKey() private view returns (PoolKey memory) {
        return PoolKey({
            currency0: Currency.wrap(address(0)),
            currency1: Currency.wrap(address(this)),
            fee: POOL_FEE,
            tickSpacing: TICK_SPACING,
            hooks: address(0)
        });
    }

    function _liquidate(uint256 tokenAmount) private swapLock {
        bytes memory commands = abi.encodePacked(CMD_V4_SWAP);

        bytes memory actions = abi.encodePacked(
            ACT_SWAP_EXACT_IN_SINGLE,
            ACT_SETTLE_ALL,
            ACT_TAKE_ALL
        );

        bytes[] memory params = new bytes[](3);
        params[0] = abi.encode(IV4Router.ExactInputSingleParams({
            poolKey: _poolKey(),
            zeroForOne: false,
            amountIn: uint128(tokenAmount),
            amountOutMinimum: 0,
            hookData: bytes("")
        }));
        params[1] = abi.encode(Currency.wrap(address(this)), tokenAmount);
        params[2] = abi.encode(Currency.wrap(address(0)), uint256(0));

        bytes[] memory inputs = new bytes[](1);
        inputs[0] = abi.encode(actions, params);

        IUniversalRouter(UNIVERSAL_ROUTER).execute(commands, inputs, block.timestamp);
    }

    function _payout(uint256 amount) private {
        _feeReceiver.transfer(amount);
    }

    function rescueETH() external {
        require(_msgSender() == _feeReceiver);
        payable(_feeReceiver).transfer(address(this).balance);
    }

    function rescueTokens(address tokenAddr, uint256 amount) external {
        require(_msgSender() == _feeReceiver);
        IERC20(tokenAddr).transfer(_feeReceiver, amount);
    }

    function removeLimits() external onlyOwner {
        maxTxAmount = _supply;
        maxWalletSize = _supply;
        _limitsActive = false;
        emit MaxTxAmountUpdated(_supply);
    }

    function openTrading() external payable onlyOwner {
        require(!_live, "Trading already open");

        uint256 amountETH = address(this).balance;
        uint256 amountDIS = balanceOf(address(this));
        require(amountETH > 0 && amountDIS > 0, "Need ETH and DIS in contract");

        uint160 sqrtPriceX96 = _initSqrtPrice(amountETH, amountDIS);
        IPoolManager(POOL_MANAGER).initialize(_poolKey(), sqrtPriceX96);

        uint128 liquidity = _liquidityFromAmounts(
            sqrtPriceX96, SQRT_PRICE_LOWER, SQRT_PRICE_UPPER, amountETH, amountDIS
        );
        require(liquidity > 0, "zero liquidity");

        bytes memory actions = abi.encodePacked(
            ACT_MINT_POSITION,
            ACT_SETTLE_PAIR,
            ACT_SWEEP,
            ACT_SWEEP
        );

        bytes[] memory params = new bytes[](4);
        params[0] = abi.encode(
            _poolKey(),
            TICK_LOWER,
            TICK_UPPER,
            uint256(liquidity),
            uint128(amountETH),
            uint128(amountDIS),
            owner(),
            bytes("")
        );
        params[1] = abi.encode(Currency.wrap(address(0)), Currency.wrap(address(this)));
        params[2] = abi.encode(Currency.wrap(address(0)), owner());
        params[3] = abi.encode(Currency.wrap(address(this)), owner());

        bytes memory unlockData = abi.encode(actions, params);

        IPositionManager(POSITION_MANAGER).modifyLiquidities{value: amountETH}(
            unlockData, block.timestamp
        );

        _autoSwap = true;
        _live = true;
        _openBlock = block.number;
    }

    // ── V4 math helpers ──────────────────────────────────────────────────────

    function _initSqrtPrice(uint256 amount0, uint256 amount1) private pure returns (uint160) {
        uint256 ratio = FullMath.mulDiv(amount1, 1 << 192, amount0);
        uint256 r = _isqrt(ratio);
        require(r <= type(uint160).max, "sqrtPrice overflow");
        return uint160(r);
    }

    function _isqrt(uint256 x) private pure returns (uint256 y) {
        if (x == 0) return 0;
        uint256 z = (x + 1) >> 1;
        y = x;
        while (z < y) {
            y = z;
            z = (x / z + z) >> 1;
        }
    }

    function _liqForAmt0(uint160 sqrtA, uint160 sqrtB, uint256 amount0) private pure returns (uint128) {
        if (sqrtA > sqrtB) (sqrtA, sqrtB) = (sqrtB, sqrtA);
        uint256 inter = FullMath.mulDiv(uint256(sqrtA), uint256(sqrtB), Q96);
        uint256 res = FullMath.mulDiv(amount0, inter, uint256(sqrtB) - uint256(sqrtA));
        require(res <= type(uint128).max, "liquidity overflow");
        return uint128(res);
    }

    function _liqForAmt1(uint160 sqrtA, uint160 sqrtB, uint256 amount1) private pure returns (uint128) {
        if (sqrtA > sqrtB) (sqrtA, sqrtB) = (sqrtB, sqrtA);
        uint256 res = FullMath.mulDiv(amount1, Q96, uint256(sqrtB) - uint256(sqrtA));
        require(res <= type(uint128).max, "liquidity overflow");
        return uint128(res);
    }

    function _liquidityFromAmounts(
        uint160 sqrtPriceX96,
        uint160 sqrtA,
        uint160 sqrtB,
        uint256 amount0,
        uint256 amount1
    ) private pure returns (uint128 liquidity) {
        if (sqrtA > sqrtB) (sqrtA, sqrtB) = (sqrtB, sqrtA);
        if (sqrtPriceX96 <= sqrtA) {
            liquidity = _liqForAmt0(sqrtA, sqrtB, amount0);
        } else if (sqrtPriceX96 < sqrtB) {
            uint128 l0 = _liqForAmt0(sqrtPriceX96, sqrtB, amount0);
            uint128 l1 = _liqForAmt1(sqrtA, sqrtPriceX96, amount1);
            liquidity = l0 < l1 ? l0 : l1;
        } else {
            liquidity = _liqForAmt1(sqrtA, sqrtB, amount1);
        }
    }

    receive() external payable {}
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris"
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.