Fetcher

This class contains static methods for constructing instances of pairs and tokens from on-chain data. It cannot be constructed.

Static Methods

fetchTokenData

Initializes a Token class instance from a token address, if the decimals of the token are unknown and cannot be fetched externally.

fetchTokenData(
    address: string,
    symbol?: string,
    name?: string
  ): Promise<Token>

fetchPoolData

Initializes a Pool class instance from a pool address, if the performance fee of the pool is unknown and cannot be fetched externally.

fetchPoolData(
    address: string,
    managerAddress?: string,
    name?: string
  ): Promise<Pool>

getPoolAvailableFunds

Given a pool address, returns the amount of cUSD in the pool.

getPoolAvailableFunds(
    address: string,
  ): Promise<string>

getUserUSDBalance

Given a pool address and a user address, returns the USD value of the user's investment in the pool.

getUserUSDBalance(
    address: string,
    user: string,
  ): Promise<string>

getPoolPositionsAndTotal

Returns the address of each position, the balance of each position, and the total USD value for the given pool.

getPoolPositionsAndTotal(
    address: string,
  ): Promise<[string[], string[], string]>

getSupportedCurrencies

Returns the address of each currency supported on the Tradegen platform.

getSupportedCurrencies(
  ): Promise<string[]>

getAvailablePools

Returns the address of each available pool on the Tradegen platform.

getAvailablePools(
  ): Promise<string[]>

fetchTokensFromAddresses

Given an array of token addresses, returns a Token instance for each address.

fetchTokensFromAddresses(
    addresses: string[],
  ): Promise<Token[]>

fetchPoolsFromAddresses

Given an array of pool addresses, returns a Pool instance for each address.

fetchPoolsFromAddresses(
    addresses: string[]
  ): Promise<Pool[]>

Last updated