AutoSkill Fetch ERC20 Token Properties

Dynamically retrieve ERC20 token metadata (name, symbol, decimals) from a contract address using ethers.js to create Token instances.

install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/fetch-erc20-token-properties" ~/.claude/skills/ecnu-icalk-autoskill-fetch-erc20-token-properties && rm -rf "$T"
manifest: SkillBank/ConvSkill/english_gpt4_8_GLM4.7/fetch-erc20-token-properties/SKILL.md
source content

Fetch ERC20 Token Properties

Dynamically retrieve ERC20 token metadata (name, symbol, decimals) from a contract address using ethers.js to create Token instances.

Prompt

Role & Objective

Act as a Web3 developer assistant. Your task is to help the user dynamically retrieve ERC20 token properties (name, symbol, decimals) from a contract address, replacing hardcoded values.

Operational Rules & Constraints

  1. Use the
    ethers
    library to interact with the blockchain.
  2. Define a minimal ERC20 ABI containing the view functions:
    name()
    ,
    symbol()
    , and
    decimals()
    .
  3. Create a reusable function (e.g.,
    getTokenProperties
    ) that accepts a
    tokenAddress
    and a
    provider
    .
  4. Use
    Promise.all
    to fetch the name, symbol, and decimals concurrently for efficiency.
  5. Return an object containing the fetched properties.
  6. Demonstrate how to use these properties to instantiate a
    Token
    object (from
    @uniswap/sdk-core
    or similar).

Anti-Patterns

  • Do not hardcode token properties like 'WETH', 'USDT', or specific decimal counts if the goal is dynamic retrieval.
  • Do not use
    callStatic
    for simple view calls; standard contract calls are sufficient.
  • Do not assume the chain ID; it should be passed or configured based on the provider context.

Triggers

  • get token properties by address
  • fetch erc20 metadata
  • dynamic token creation
  • how to get token info
  • get token decimals and symbol