Token

0x8691cde5a7a6e68baf0adea4b321db3f0609db03

Verification
Verified
v0.8.30+commit.73712a01
Type
Contract
6,699 bytes
ABI entries
37
21 read · 6 write
License
none

Contract information

Address
0x8691cde5a7a6e68baf0adea4b321db3f0609db03
Chain
Robinhood Chain (4663)
Compiler
v0.8.30+commit.73712a01
Optimization
Enabled
Creation tx
0xb2041aa6c1…e2c50816ed

Token

Name
Swole Elon
Symbol
Swolon
Decimals
18
Holders
21

Read contract (21)

GRADUATION_WETH()uint256
allowance(address, address)uint256
balanceOf(address)uint256
decimals()uint8
deployer()address
description()string
launchBlock()uint256
launchpad()address
limitWindow()uint256
logoURI()string
maxWallet()uint256
metadataSet()bool
migrated()bool
name()string
pool()address
symbol()string
telegram()string
tokenURI()string
totalSupply()uint256
twitter()string
website()string

Events (4)

ApprovalMetadataUpdatedMigratedTransfer

ABI

[
  {
    "inputs": [
      {
        "internalType": "string",
        "name": "_name",
        "type": "string"
      },
      {
        "internalType": "string",
        "name": "_symbol",
        "type": "string"
      },
      {
        "internalType": "uint256",
        "name": "_totalSupply",
        "type": "uint256"
      },
      {
        "internalType": "address",
        "name": "_deployer",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "_maxWallet",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "_limitWindow",
        "type": "uint256"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "inputs": [],
    "name": "MaxWalletExceeded",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "MetadataAlreadySet",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OnlyLaunchpad",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "PoolAlreadySet",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "TradingNotActive",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "owner",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "spender",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "Approval",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": false,
        "internalType": "string",
        "name": "logoURI",
        "type": "string"
      },
      {
        "indexed": false,
        "internalType": "string",
        "name": "tokenURI",
        "type": "string"
      }
    ],
    "name": "MetadataUpdated",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "reserve",
        "type": "uint256"
      }
    ],
    "name": "Migrated",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "Transfer",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "GRADUATION_WETH",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "name": "allowance",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "spender",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "approve",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "name": "balanceOf",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "checkMigration",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "decimals",
    "outputs": [
      {
        "internalType": "uint8",
        "name": "",
        "type": "uint8"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "deployer",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "description",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "launchBlock",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "launchpad",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "limitWindow",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "logoURI",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "maxWallet",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "metadataSet",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "migrated",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "name",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "pool",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "components": [
          {
            "internalType": "string",
            "name": "description",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "website",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "telegram",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "twitter",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "logoURI",
            "type": "string"
          },
          {
            "internalType": "string",
            "name": "tokenURI",
            "type": "string"
          }
        ],
        "internalType": "struct Token.Metadata",
        "name": "data",
        "type": "tuple"
      }
    ],
    "name": "setMetadata",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_pool",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "_launchBlock",
        "type": "uint256"
      }
    ],
    "name": "setPool",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "symbol",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "telegram",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "tokenURI",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "totalSupply",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "transfer",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "transferFrom",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "twitter",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "website",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  }
]

Source code

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

interface IPool {
    function token0() external view returns (address);
    function token1() external view returns (address);
}

interface IERC20 {
    function balanceOf(address account) external view returns (uint256);
}

contract Token {
    string public name;
    string public symbol;

    uint256 public totalSupply;

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

    address public pool;
    uint256 public launchBlock;
    bool public migrated;

    string public description;
    string public website;
    string public telegram;
    string public twitter;
    string public logoURI;
    string public tokenURI;
    bool public metadataSet;

    address public immutable launchpad;
    address public immutable deployer;
    uint256 public immutable maxWallet;
    uint256 public immutable limitWindow;

    uint8 public constant decimals = 18;
    uint256 public constant GRADUATION_WETH = 3.7 ether;

    struct Metadata {
        string description;
        string website;
        string telegram;
        string twitter;
        string logoURI;
        string tokenURI;
    }

    event Transfer(address indexed from, address indexed to, uint256 amount);
    event Approval(address indexed owner, address indexed spender, uint256 amount);
    event MetadataUpdated(string logoURI, string tokenURI);
    event Migrated(uint256 reserve);

    error OnlyLaunchpad();
    error MetadataAlreadySet();
    error PoolAlreadySet();
    error MaxWalletExceeded();
    error TradingNotActive();

    constructor(
        string memory _name,
        string memory _symbol,
        uint256 _totalSupply,
        address _deployer,
        uint256 _maxWallet,
        uint256 _limitWindow
    ) {
        launchpad = msg.sender;
        name = _name;
        symbol = _symbol;
        deployer = _deployer;
        maxWallet = _maxWallet;
        limitWindow = _limitWindow;

        totalSupply = _totalSupply;
        balanceOf[msg.sender] = _totalSupply;
        emit Transfer(address(0), msg.sender, _totalSupply);
    }

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

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

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

    function setPool(address _pool, uint256 _launchBlock) external {
        if (msg.sender != launchpad) revert OnlyLaunchpad();
        if (pool != address(0)) revert PoolAlreadySet();
        pool = _pool;
        launchBlock = _launchBlock;
    }

    function setMetadata(Metadata calldata data) external {
        if (msg.sender != launchpad) revert OnlyLaunchpad();
        if (metadataSet) revert MetadataAlreadySet();
        metadataSet = true;

        description = data.description;
        website = data.website;
        telegram = data.telegram;
        twitter = data.twitter;
        logoURI = data.logoURI;
        tokenURI = data.tokenURI;

        emit MetadataUpdated(data.tokenURI, data.logoURI);
    }

    function checkMigration() external returns (bool) {
        _checkMigration();
        return migrated;
    }

    function _transfer(address from, address to, uint256 amount) internal {
        if (block.number < launchBlock && !_privileged(from) && !_privileged(to)) {
            revert TradingNotActive();
        }

        balanceOf[from] -= amount;

        unchecked {
            balanceOf[to] += amount;
        }

        if (
            block.number < launchBlock + limitWindow &&
            !(to == launchpad || to == deployer || to == pool || to == address(0)) &&
            balanceOf[to] > maxWallet
        ) {
            revert MaxWalletExceeded();
        }

        if (!migrated && pool != address(0) && (from == pool || to == pool)) {
            _checkMigration();
        }

        emit Transfer(from, to, amount);
    }

    function _privileged(address account) internal view returns (bool) {
        return account == launchpad || account == deployer;
    }

    function _checkMigration() internal {
        if (migrated || pool == address(0)) return;

        (bool ok, bytes memory data) = pool.staticcall(abi.encodeWithSelector(IPool.token0.selector));
        if (!ok || data.length < 32) return;

        address other = abi.decode(data, (address));
        if (other == address(this)) {
            (ok, data) = pool.staticcall(abi.encodeWithSelector(IPool.token1.selector));
            if (!ok || data.length < 32) return;
            other = abi.decode(data, (address));
        }

        (ok, data) = other.staticcall(abi.encodeWithSelector(IERC20.balanceOf.selector, pool));
        if (!ok || data.length < 32) return;

        if (abi.decode(data, (uint256)) >= GRADUATION_WETH) {
            migrated = true;
            emit Migrated(abi.decode(data, (uint256)));
        }
    }
}
Chain explorer3797msChain node75ms