token.ts
path: /src/utils/token.ts
fetchTokenSymbol()
Params:
- tokenAddress (Address): The ERC20 Token Address for which the symbol is returned
ReturnType: string
- Other-Chains
- Arbitrum-One
- Optimism
Returns the string value representing the ERC20 symbol read from the contract with address tokenAddress using symbol() method. If reverted, checks if the tokenAddres is present in StaticTokenDefinition. Returns unknown if not found.
ABI Dependencies:
- ERC20.json
- ERC20SymbolBytes.json
Dependencies:
Invoked at:
- Logic similar to mainnet except uses
StaticTokenDefitionfirst and proceeds to read from contract if not found.
- Logic similar to mainnet except uses
StaticTokenDefitionfirst and proceeds to read from contract if not found.
Additionally Invoked At:
fetchTokenName()
Params:
- tokenAddress (Address): The ERC20 Token Address for which the Name is returned
ReturnType: string
- Other-Chains
- Arbitrum-One
- Optimism
Returns the string value representing the ERC20 name read from the contract with address tokenAddress using name() method. If reverted, checks if the tokenAddres is present in StaticTokenDefinition. Returns unknown if not found.
ABI Dependencies:
- ERC20.json
- ERC20NameBytes.json
Dependencies:
Invoked at:
- Logic similar to mainnet except uses
StaticTokenDefitionfirst and proceeds to read from contract if not found.
- Logic similar to mainnet except uses
StaticTokenDefitionfirst and proceeds to read from contract if not found.
Additionally Invoked At:
fetchTokenTotalSupply()
Params:
- tokenAddress (Address): The ERC20 Token Address for which the Total Supply is
ReturnType: BigInt
- Other-Chains
- Optimism
fetchTokenDecimals()
Params:
- tokenAddress (Address): The ERC20 Token Address for which the number of decimals is returned
ReturnType: BigInt
- Other-Chains
- Arbitrum-One
- Optimism
Queries the ERC20 contract with address tokenAddress and returns the decimals value for the token decimals() method. If call reverts, check for tokenAddress in StaticTokenDefinition. If not found, typecasts null to i32 then to BigDecimal and returns the value.
ABI Dependencies:
- ERC20.json
Dependencies:
Invoked at:
- Logic similar to mainnet except uses
StaticTokenDefitionfirst and proceeds to read from contract if not found.
- Logic similar to mainnet except uses
StaticTokenDefitionfirst and proceeds to read from contract if not found.