How to Get a ERC20 Token Address via FewFactory
π Example Guide: How to Get an ERC20 Token Address via FewFactory
In Ring Swap, all tokens are wrapped using the Few Protocol and represented as FewTokens. However, there are cases where you may need to retrieve the original ERC20 token address from a given FewTokenβsuch as when displaying token metadata, checking balances, or interacting with external protocols.
To support this, FewToken contracts expose a token() method that returns the original token address they wrap.
This allows seamless integration with systems that rely on standard ERC20 interfaces.
π How to Retrieve the Original Token Address from a FewToken
π FewToken Interface
π Example: Solidity Code to Query the Original ERC20 Token Address
π§ͺ Use Case: Displaying Token Metadata
Suppose youβre building a dashboard that shows token symbols and decimals. You must first unwrap the FewToken to get its original ERC20 address, then use that to fetch metadata via standard ERC20 interfaces:
β
Summary
Use the token() method on a FewToken to get the underlying ERC20 token address.
This is useful for:
UI display (name, symbol, decimals)
Compatibility with other protocols
Balance checks or external API queries
Last updated