Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils

Index

Variables

pools: default<Attributes, Attributes, Attributes> = ...

A graph representation of APWine pools

Functions

  • applySlippage(n: BigNumber, slippagePercentage: number): BigNumber
  • Apply slippage to a BigNumber

    Parameters

    • n: BigNumber

      the input number

    • slippagePercentage: number

      the percentage applied, can be positive or negative.

    Returns BigNumber

    • a BigNumber with applied slippage.
  • findPoolPath(shortestPath: null | string[]): null | number[]
  • Show how many pools a swap involves.

    Parameters

    • shortestPath: null | string[]

      a token path.

    Returns null | number[]

    • a pool path.
  • findSwapPath(from: "PT" | "Underlying" | "FYT", to: "PT" | "Underlying" | "FYT"): { poolPath: null | number[]; tokenPath: (0 | 1)[] }
  • Parameters

    • from: "PT" | "Underlying" | "FYT"
    • to: "PT" | "Underlying" | "FYT"

    Returns { poolPath: null | number[]; tokenPath: (0 | 1)[] }

    • poolPath: null | number[]
    • tokenPath: (0 | 1)[]
  • findTokenPath(from: "PT" | "Underlying" | "FYT", to: "PT" | "Underlying" | "FYT"): { graphSearchResult: null | ShortestPath; namedTokenPath: ("PT" | "Underlying" | "FYT")[]; tokenPath: (0 | 1)[] }
  • Show different representations, of how to swap one token to another.

    Parameters

    • from: "PT" | "Underlying" | "FYT"

      APWToken, PT, Underlying or FYT.

    • to: "PT" | "Underlying" | "FYT"

      APWToken, PT, Underlying or FYT.

    Returns { graphSearchResult: null | ShortestPath; namedTokenPath: ("PT" | "Underlying" | "FYT")[]; tokenPath: (0 | 1)[] }

    • searchResult, a tokenPath, and a namedTokenPath.
    • graphSearchResult: null | ShortestPath
    • namedTokenPath: ("PT" | "Underlying" | "FYT")[]
    • tokenPath: (0 | 1)[]
  • Return the Token contract instances of an amm.

    Parameters

    • signerOrProvider: Signer | Provider
    • amm: AMM

      AMM instance on which the pool tokens are required.

    • pairId: 0 | 1

      token pair id - 0 or 1

    Returns Promise<(PT | FutureYieldToken | IERC20)[]>

    • a tuple of token contracts.
  • isError(input: unknown): input is Error
  • Parameters

    • input: unknown

    Returns input is Error

Generated using TypeDoc, the 4/22/2022