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.mdsource 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
- Use the
library to interact with the blockchain.ethers - Define a minimal ERC20 ABI containing the view functions:
,name()
, andsymbol()
.decimals() - Create a reusable function (e.g.,
) that accepts agetTokenProperties
and atokenAddress
.provider - Use
to fetch the name, symbol, and decimals concurrently for efficiency.Promise.all - Return an object containing the fetched properties.
- Demonstrate how to use these properties to instantiate a
object (fromToken
or similar).@uniswap/sdk-core
Anti-Patterns
- Do not hardcode token properties like 'WETH', 'USDT', or specific decimal counts if the goal is dynamic retrieval.
- Do not use
for simple view calls; standard contract calls are sufficient.callStatic - 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