Перейти к содержимому
Проверенный контрактТочноеMIT

Block0LaunchToken

Адрес0xce03ffc22d67dec28379812e8df5f93a6a2e38c2
Баланс

0 ETH

 

Транзакций

51

 

Компилятор

solc 0.8.26

 

Тот же код

ещё 3 контракта

 

Подробности

Компилятор
solc 0.8.26+commit.8a97fa7a
Язык
solidity
Оптимизация
Да, 200 прогонов
Версия EVM
cancun
Лицензия
MIT
Совпадение
Точноекод создания: да, код в сети: да
Проверен на Sourcify
Создан в блоке
26 452 019
Транзакция создания
0xf99605253c…00018b789f

src/Block0LaunchToken.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

/*
 * Block0 launch token for Ethereum (the ETH Inc. model).
 *
 * - Fixed supply, all minted to this contract. No mint function exists. No tax on transfers.
 * - openTrading() (once, by the deployer) opens a Uniswap v4 ETH pool and puts the whole supply in it one-sided:
 *   no ETH is needed, the price starts at the chosen market cap and rises as people buy, with no ceiling.
 * - The pool position (an NFT) is sent to 0x…dEaD in the same call: the liquidity is burned, nobody can ever
 *   remove it or collect from it. Ownership is renounced in the same call.
 * - Links are stored on chain (website(), twitter(), telegram()).
 */

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

interface IPositionManager {
    function initializePool(PoolKey calldata key, uint160 sqrtPriceX96) external payable returns (int24);
    function modifyLiquidities(bytes calldata unlockData, uint256 deadline) external payable;
    function nextTokenId() external view returns (uint256);
    function transferFrom(address from, address to, uint256 id) external;
}

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

contract Block0LaunchToken {
    string public name;
    string public symbol;
    uint8 public constant decimals = 18;
    uint256 public constant totalSupply = 1_000_000_000 ether;

    string public website;
    string public twitter;
    string public telegram;

    address public constant DEAD = 0x000000000000000000000000000000000000dEaD;
    IPositionManager public immutable positionManager;
    IPermit2 public immutable permit2;
    address public immutable feeWallet;
    uint24 public immutable poolFee;
    int24 public immutable tickSpacing;

    address public owner;
    bool public tradingOpen;
    uint256 public positionId;

    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    event TradingOpened(uint256 positionId, uint160 sqrtPriceX96, int24 tickLower, int24 tickUpper, uint128 liquidity);

    constructor(
        string memory name_,
        string memory symbol_,
        string memory website_,
        string memory twitter_,
        string memory telegram_,
        address feeWallet_,
        uint24 poolFee_,
        int24 tickSpacing_,
        address positionManager_,
        address permit2_
    ) {
        require(feeWallet_ != address(0) && positionManager_ != address(0) && permit2_ != address(0), "zero address");
        require(poolFee_ <= 10_000 && tickSpacing_ > 0, "pool");
        name = name_;
        symbol = symbol_;
        website = website_;
        twitter = twitter_;
        telegram = telegram_;
        feeWallet = feeWallet_;
        poolFee = poolFee_;
        tickSpacing = tickSpacing_;
        positionManager = IPositionManager(positionManager_);
        permit2 = IPermit2(permit2_);
        owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);
        balanceOf[address(this)] = totalSupply;
        emit Transfer(address(0), address(this), totalSupply);
    }

    receive() external payable {}

    /// The pool: native ETH is always currency0, this token currency1, no hook.
    function poolKey() public view returns (PoolKey memory) {
        return PoolKey(address(0), address(this), poolFee, tickSpacing, address(0));
    }

    /// @notice One shot: open the pool, put the whole supply in one-sided, lock the position here, renounce.
    ///         The range is [tickLower, tickUpper] with the price starting at tickUpper (all token1).
    function openTrading(uint160 sqrtPriceX96, int24 tickLower, int24 tickUpper, uint128 liquidity) external {
        require(msg.sender == owner, "not owner");
        require(!tradingOpen, "already open");
        tradingOpen = true;
        PoolKey memory key = poolKey();
        positionManager.initializePool(key, sqrtPriceX96);

        uint256 tokens = balanceOf[address(this)];
        allowance[address(this)][address(permit2)] = type(uint256).max;
        permit2.approve(address(this), address(positionManager), type(uint160).max, type(uint48).max);

        positionId = positionManager.nextTokenId();
        bytes[] memory params = new bytes[](2);
        params[0] = abi.encode(key, tickLower, tickUpper, uint256(liquidity), uint128(0), uint128(tokens), address(this), bytes(""));
        params[1] = abi.encode(key.currency0, key.currency1);
        positionManager.modifyLiquidities(abi.encode(abi.encodePacked(uint8(0x02), uint8(0x0d)), params), block.timestamp);

        // Rounding dust that did not fit the position is burned, so nobody holds supply outside the pool.
        uint256 left = balanceOf[address(this)];
        if (left > 0) _move(address(this), DEAD, left);
        allowance[address(this)][address(permit2)] = 0;
        // Burn the position: nobody (this contract included) can touch the liquidity again.
        positionManager.transferFrom(address(this), DEAD, positionId);

        emit TradingOpened(positionId, sqrtPriceX96, tickLower, tickUpper, liquidity);
        emit OwnershipTransferred(owner, address(0));
        owner = address(0);
    }

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

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

    function transferFrom(address from, address to, uint256 value) external returns (bool) {
        uint256 a = allowance[from][msg.sender];
        if (a != type(uint256).max) {
            require(a >= value, "allowance");
            allowance[from][msg.sender] = a - value;
        }
        _move(from, to, value);
        return true;
    }

    function _move(address from, address to, uint256 value) private {
        require(to != address(0), "zero address");
        uint256 bal = balanceOf[from];
        require(bal >= value, "balance");
        unchecked {
            balanceOf[from] = bal - value;
            balanceOf[to] += value;
        }
        emit Transfer(from, to, value);
    }
}
Настройки компилятораПоказать
{
  "viaIR": false,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun"
}

Исходный код и метаданные: Sourcify.

Исходный код принадлежит авторам контракта.