Skip to content
Verified contractPartialMIT

CultPadToken

Address0x233e572b8b8cfaad75fc3dfbf65424d26e5de7e6
Balance

0 ETH

 

Transactions

22

 

Compiler

solc 0.8.24

 

Same code

1 more contract

 

Details

Compiler
solc 0.8.24+commit.e11b9ed9
Language
solidity
Optimization
Yes, 200 runs
Via IR
yes
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,626,689
Creation transaction
0x528136bee1…172970e03d

CultPadFactory.sol

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

/*
    cultpad factory · ethereum mainnet
    every pair is a cult pair

    - fixed supply erc20, all supply into a one-sided uniswap v3 position
    - pool is always TOKEN/CULT, 1% fee tier
    - CULT = Milady Cult Coin, 0x0000000000c5dc95539589fbD24BE07c6C14eCa4, 18 decimals

    QUOTE DECIMALS: CULT is 18 decimals, same as the launched token, so the raw
    pool price equals the human price and there is NO 10^(dec-18) tick shift.
    (verified on-chain, see script/probe-cult.mjs. an 8-decimal quote like bridged
    doge would have shifted every tick by -230270 -- not the case here.)

    ADDRESS ORDERING: CULT's address begins with ten zero bytes, so essentially
    every token this factory deploys sorts ABOVE it. token1 == the new token and
    token0 == CULT is the normal path, not the exception. startTick is supplied in
    TOKEN-as-token0 orientation (CULT per token) and negated internally.

    LIQUIDITY IS PERMANENT:
    - the LP NFT is minted to THIS FACTORY and there is no code path anywhere in
      this contract that transfers it, approves it, decreases its liquidity, or
      burns it. the factory also has NO OWNER and NO ADMIN FUNCTIONS, so no such
      path can ever be added. the position cannot be withdrawn by anyone, ever.
    - the ONLY position call exposed is collect(), which the position manager
      restricts to accrued swap fees while liquidity remains. principal is
      unreachable by construction.
    - claimFees(token) is permissionless and always pays that launch's creator.

    scanner profile (gmgn / goplus / honeypot checkers):
    - token has no owner, no mint, no tax, no blacklist, no pause, no proxy
    - plain transfer path, honeypot sims pass
    - liquidity reads as non-removable: the LP holder is a contract with no
      transfer/decrease path. note that some scanners only flag "locked" for
      addresses they recognise as lockers or for a 0x…dEaD burn, so a given tool
      may show the LP as held-by-contract rather than the word "locked".
    - verify the factory on etherscan, then verify the first token; later tokens
      are byte-identical and auto-match.

    deploy (solc 0.8.24+, optimizer 200 runs): constructor takes no arguments.
*/

// ---------------------------------------------------------------- interfaces

interface IERC20 {
    function transfer(address to, uint256 amt) external returns (bool);
    function transferFrom(address from, address to, uint256 amt) external returns (bool);
    function approve(address spender, uint256 amt) external returns (bool);
    function balanceOf(address who) external view returns (uint256);
}

interface INonfungiblePositionManager {
    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }
    struct CollectParams {
        uint256 tokenId;
        address recipient;
        uint128 amount0Max;
        uint128 amount1Max;
    }
    function createAndInitializePoolIfNecessary(
        address token0, address token1, uint24 fee, uint160 sqrtPriceX96
    ) external payable returns (address pool);
    function mint(MintParams calldata p) external payable
        returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
    function collect(CollectParams calldata p) external payable
        returns (uint256 amount0, uint256 amount1);
}

interface ISwapRouter {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }
    function exactInputSingle(ExactInputSingleParams calldata p)
        external payable returns (uint256 amountOut);
}

// ---------------------------------------------------------------- tick math

library TickMath {
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        unchecked {
            uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
            require(absTick <= 887272, "T");

            uint256 ratio = absTick & 0x1 != 0
                ? 0xfffcb933bd6fad37aa2d162d1a594001
                : 0x100000000000000000000000000000000;
            if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
            if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
            if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
            if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
            if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
            if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
            if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
            if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
            if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
            if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
            if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
            if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
            if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
            if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
            if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
            if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
            if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
            if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
            if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

            if (tick > 0) ratio = type(uint256).max / ratio;
            sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
        }
    }
}

// ---------------------------------------------------------------- token

/// @notice fixed-supply erc20. no owner, no mint, no burn-from, no tax,
///         no blacklist, no pause, no proxy, no hooks. nothing to renounce
///         because there was never an admin.
contract CultPadToken is IERC20 {
    string public name;
    string public symbol;
    uint8 public constant decimals = 18;
    uint256 public constant totalSupply = 1_000_000_000e18;

    /// @notice per-launch metadata, written once at construction and never again.
    ///         NOTE: no ERC-20 socials standard exists and no aggregator reads these
    ///         automatically -- gmgn/dexscreener take socials from their own token
    ///         profiles or from etherscan's token-info record. these are here because
    ///         they are cheap, permanent, and the honest place for the data; treat
    ///         them as a source for our own frontend and future indexers, not as a
    ///         way to populate a scanner.
    string public description;
    string public imageUri;
    string public twitter;

    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);

    constructor(
        string memory _name,
        string memory _symbol,
        string memory _description,
        string memory _imageUri,
        string memory _twitter
    ) {
        name = _name;
        symbol = _symbol;
        description = _description;
        imageUri = _imageUri;
        twitter = _twitter;
        balanceOf[msg.sender] = totalSupply;
        emit Transfer(address(0), msg.sender, totalSupply);
    }

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

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

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

    function _transfer(address from, address to, uint256 amt) internal {
        require(balanceOf[from] >= amt, "balance");
        unchecked {
            balanceOf[from] -= amt;
            balanceOf[to] += amt;
        }
        emit Transfer(from, to, amt);
    }
}

// ---------------------------------------------------------------- factory

contract CultPadFactory {
    /// @notice Milady Cult Coin. 18 decimals (verified on-chain).
    address public constant CULT = 0x0000000000c5dc95539589fbD24BE07c6C14eCa4;
    INonfungiblePositionManager public constant NPM =
        INonfungiblePositionManager(0xC36442b4a4522E871399CD717aBDD847Ab11FE88);
    ISwapRouter public constant ROUTER =
        ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564);

    uint24 public constant FEE = 10000;        // 1% tier
    int24 public constant TICK_SPACING = 200;
    int24 public constant MAX_ALIGNED = 887200;
    uint256 public constant SUPPLY = 1_000_000_000e18;

    // ---- pad identity ------------------------------------------------------
    // constants, so they cost nothing to store and can never be changed.
    string public constant NAME = "cultpad";
    string public constant TWITTER = "https://x.com/cultpad";
    string public constant WEBSITE = "https://cultpad.netlify.app";

    /// @notice contract-level metadata, ERC-7572. safe to assemble inline because
    ///         every field here is a constant we control -- unlike the per-token
    ///         strings, which are user input and would need JSON escaping.
    function contractURI() external pure returns (string memory) {
        return string(
            abi.encodePacked(
                'data:application/json;utf8,{"name":"', NAME,
                '","description":"One-sided Uniswap V3 launchpad. Every token pairs against $CULT and the LP NFT is held by this factory forever.',
                '","external_link":"', WEBSITE,
                '","twitter":"', TWITTER,
                '"}'
            )
        );
    }

    struct Launch {
        address creator;
        uint256 lpTokenId;
        address token0;
        address token1;
    }

    address[] public allTokens;
    mapping(address => Launch) public launches;

    event Launched(
        address indexed token,
        address indexed creator,
        uint256 lpTokenId,
        int24 startTick,
        string name,
        string symbol,
        string imageUri,
        string description,
        string twitter
    );
    event FeesClaimed(address indexed token, address indexed to, uint256 amount0, uint256 amount1);

    // no owner, no constructor args, no admin surface. deliberately.

    /// @notice deploy a token and seed its one-sided CULT pair on uniswap v3.
    ///         the resulting LP NFT is held by this contract forever.
    /// @param startTick starting tick in TOKEN-as-token0 orientation (CULT per token).
    ///        must be a multiple of 200. flipped automatically for the real
    ///        address ordering, which for CULT is essentially always a flip.
    /// @param cultBuyAmount optional dev buy in CULT (18 decimals), pulled from
    ///        msg.sender -- approve this factory for that amount first.
    function launch(
        string calldata name_,
        string calldata symbol_,
        string calldata imageUri,
        string calldata description,
        string calldata twitter,
        int24 startTick,
        uint256 cultBuyAmount
    ) external returns (address token) {
        require(startTick % TICK_SPACING == 0, "tick spacing");
        require(startTick > -MAX_ALIGNED && startTick < MAX_ALIGNED, "tick range");

        token = address(new CultPadToken(name_, symbol_, description, imageUri, twitter));
        uint256 lpTokenId = _seed(token, startTick);
        allTokens.push(token);

        emit Launched(token, msg.sender, lpTokenId, startTick, name_, symbol_, imageUri, description, twitter);

        if (cultBuyAmount > 0) _devBuy(token, cultBuyAmount);
    }

    /// @dev create + init the pool, mint the one-sided position to THIS contract
    function _seed(address token, int24 startTick) internal returns (uint256 lpTokenId) {
        IERC20(token).approve(address(NPM), SUPPLY);

        bool tokenIs0 = token < CULT;
        address t0 = tokenIs0 ? token : CULT;
        address t1 = tokenIs0 ? CULT : token;
        int24 tick = tokenIs0 ? startTick : -startTick;

        NPM.createAndInitializePoolIfNecessary(t0, t1, FEE, TickMath.getSqrtRatioAtTick(tick));

        (lpTokenId,,,) = NPM.mint(
            INonfungiblePositionManager.MintParams({
                token0: t0,
                token1: t1,
                fee: FEE,
                tickLower: tokenIs0 ? tick : -MAX_ALIGNED,
                tickUpper: tokenIs0 ? MAX_ALIGNED : tick,
                amount0Desired: tokenIs0 ? SUPPLY : 0,
                amount1Desired: tokenIs0 ? 0 : SUPPLY,
                amount0Min: 0,
                amount1Min: 0,
                recipient: address(this),   // <-- liquidity never leaves the factory
                deadline: block.timestamp
            })
        );

        launches[token] = Launch({
            creator: msg.sender,
            lpTokenId: lpTokenId,
            token0: t0,
            token1: t1
        });
    }

    /// @dev optional dev buy in the launch tx, before anyone else can snipe
    function _devBuy(address token, uint256 cultBuyAmount) internal {
        IERC20(CULT).transferFrom(msg.sender, address(this), cultBuyAmount);
        IERC20(CULT).approve(address(ROUTER), cultBuyAmount);
        ROUTER.exactInputSingle(
            ISwapRouter.ExactInputSingleParams({
                tokenIn: CULT,
                tokenOut: token,
                fee: FEE,
                recipient: msg.sender,
                deadline: block.timestamp,
                amountIn: cultBuyAmount,
                amountOutMinimum: 0,
                sqrtPriceLimitX96: 0
            })
        );
    }

    // ------------------------------------------------------------ fees

    /// @notice sweep accrued swap fees for a launch to that launch's creator.
    ///         permissionless -- the destination is fixed at launch time and
    ///         cannot be redirected. this touches fees only: the position
    ///         manager will not release principal through collect() while
    ///         liquidity is outstanding, and nothing here ever decreases it.
    function claimFees(address token) external returns (uint256 amount0, uint256 amount1) {
        Launch memory l = launches[token];
        require(l.creator != address(0), "unknown token");

        (amount0, amount1) = NPM.collect(
            INonfungiblePositionManager.CollectParams({
                tokenId: l.lpTokenId,
                recipient: l.creator,
                amount0Max: type(uint128).max,
                amount1Max: type(uint128).max
            })
        );

        emit FeesClaimed(token, l.creator, amount0, amount1);
    }

    // ------------------------------------------------------------ views

    function tokenCount() external view returns (uint256) {
        return allTokens.length;
    }

    function tokensPage(uint256 start, uint256 n) external view returns (address[] memory out) {
        uint256 len = allTokens.length;
        if (start >= len) return new address[](0);
        uint256 end = start + n > len ? len : start + n;
        out = new address[](end - start);
        for (uint256 i = start; i < end; i++) out[i - start] = allTokens[i];
    }

    /// @dev required so the position manager can mint the LP NFT to this contract.
    ///      accepting the NFT is the whole point; there is no matching send path.
    function onERC721Received(address, address, uint256, bytes calldata)
        external pure returns (bytes4)
    {
        return this.onERC721Received.selector;
    }
}
Compiler settingsShow
{
  "viaIR": true,
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.