Options
All
  • Public
  • Public/Protected
  • All
Menu

LeveragedPool class initiated with an an address and an rpcURL. Stores relevant LeveragedPool information. It is optional for the user to provide additional pool information, reducing the number of RPC calls. This optional info is static information of the pool, such as names and addresses The constructor is private so must be instantiated with Pool.Create

Hierarchy

  • Pool

Index

Constructors

  • Private constructor to initialise a Pool instance

    Returns Pool

Properties

_contract?: LeveragedPool
_keeper?: PoolKeeper
address: string
chainId: undefined | number
committer: Committer
connect: (provider: Provider | Signer) => void = ...

Type declaration

    • (provider: Provider | Signer): void
    • Replaces the provider and connects the contract instance, also connects the settlementToken, short and long tokens and Committer instance

      Parameters

      • provider: Provider | Signer

        The new provider to connect to

      Returns void

fee: BigNumber
fetchLastPrice: () => Promise<BigNumber> = ...

Type declaration

    • (): Promise<BigNumber>
    • Sets and gets the most up to date pool price. This is the price the pool used last upkeep

      Returns Promise<BigNumber>

fetchLastPriceTimestamp: () => Promise<BigNumber> = ...

Type declaration

    • (): Promise<BigNumber>
    • Sets and gets the most up to date pool price. This is the price the pool used last upkeep

      Returns Promise<BigNumber>

fetchOraclePrice: () => Promise<BigNumber> = ...

Type declaration

    • (): Promise<BigNumber>
    • Sets and gets the most up to date oraclePrice

      Returns Promise<BigNumber>

fetchPoolBalances: () => Promise<{ longBalance: BigNumber; shortBalance: BigNumber }> = ...

Type declaration

    • (): Promise<{ longBalance: BigNumber; shortBalance: BigNumber }>
    • Fetches and sets the pools long and short balances from the contract state

      Returns Promise<{ longBalance: BigNumber; shortBalance: BigNumber }>

      the fetched long and short balances

frontRunningInterval: BigNumber
getAnnualFee: () => BigNumber = ...

Type declaration

    • (): BigNumber
    • Returns BigNumber

getExpectedPoolState: (atEndOf: "frontRunningInterval" | "updateInterval", forceRefreshInputs?: boolean) => Promise<PoolStatePreview> = ...

Type declaration

    • (atEndOf: "frontRunningInterval" | "updateInterval", forceRefreshInputs?: boolean): Promise<PoolStatePreview>
    • calculate expected pool state via on chain state calculations contract

      Parameters

      • atEndOf: "frontRunningInterval" | "updateInterval"

        whether to fetch preview for end of update interval or front running interval

      • Optional forceRefreshInputs: boolean

      Returns Promise<PoolStatePreview>

getFeeAndLeverage: (poolInfo: IPool, chainId: number, name: string, provider: Provider, contract: LeveragedPool) => Promise<[string | BigNumber, number | BigNumber]> = ...

Type declaration

    • (poolInfo: IPool, chainId: number, name: string, provider: Provider, contract: LeveragedPool): Promise<[string | BigNumber, number | BigNumber]>
    • Calculates and returns the fee and leverage for the current Pool address. Compares to a list of known deprecated Pool addresses and uses old method if necessary.

      Parameters

      • poolInfo: IPool
      • chainId: number
      • name: string
      • provider: Provider
      • contract: LeveragedPool

      Returns Promise<[string | BigNumber, number | BigNumber]>

      the fee and leverage amounts

getLongTokenPrice: () => BigNumber = ...

Type declaration

    • (): BigNumber
    • Calculates and returns the long token price. Uses calcTokenPrice.

      Returns BigNumber

      the long token price in quote token units (eg USD)

getNextLongTokenPrice: () => BigNumber = ...

Type declaration

    • (): BigNumber
    • Calculates and returns the long token price as if the rebalance occured at t = now. Uses calcTokenPrice.

      Returns BigNumber

      the long token price in quote token units (eg USD)

getNextShortTokenPrice: () => BigNumber = ...

Type declaration

    • (): BigNumber
    • Calculates and returns the short token price as if the rebalance occured at t = now. Uses calcTokenPrice.

      Returns BigNumber

      the long token price in quote token units (eg USD)

getNextValueTransfer: () => { longValueTransfer: BigNumber; shortValueTransfer: BigNumber } = ...

Type declaration

    • (): { longValueTransfer: BigNumber; shortValueTransfer: BigNumber }
    • Calculates the pools next value transfer in quote token units (eg USD). Uses getNextValueTransfer.

      Returns { longValueTransfer: BigNumber; shortValueTransfer: BigNumber }

      and object containing short and long value transfer. The values will be a negation of eachother but this way reads better than returning a winning side as well as a value

      • longValueTransfer: BigNumber
      • shortValueTransfer: BigNumber
getPendingCommitsInFrontRunningInterval: () => Promise<TotalPoolCommitmentsBN[]> = ...

Type declaration

getPendingCommitsInUpdateInterval: () => Promise<TotalPoolCommitmentsBN> = ...

Type declaration

getPoolStatePreview: (atEndOf: "frontRunningInterval" | "updateInterval", forceRefreshInputs?: boolean) => Promise<PoolStatePreview> = ...

Type declaration

    • (atEndOf: "frontRunningInterval" | "updateInterval", forceRefreshInputs?: boolean): Promise<PoolStatePreview>
    • deprecated

      Parameters

      • atEndOf: "frontRunningInterval" | "updateInterval"

        whether to fetch preview for end of update interval or front running interval

      • Optional forceRefreshInputs: boolean

        if true, will refresh this.longBalance, this.shortBalance, this.longToken.supply, this.shortToken.supply, this.lastPrice and this.oraclePrice before calculating pool state preview

      Returns Promise<PoolStatePreview>

getShortTokenPrice: () => BigNumber = ...

Type declaration

    • (): BigNumber
    • Calculates and returns the short token price. Uses calcTokenPrice.

      Returns BigNumber

      the long token price in quote token units (eg USD)

getSkew: () => BigNumber = ...

Type declaration

    • (): BigNumber
    • Calculates the pools current skew between long and short balances. This is the ratio between the long and short pools

      Returns BigNumber

      the pool skew

init: (poolInfo: IPool) => Promise<void> = ...

Type declaration

keeper: string
lastPrice: BigNumber
lastUpdate: BigNumber
leverage: number
longBalance: BigNumber
longToken: PoolToken
multicallProvider: undefined | Signer | MulticallProvider
name: string
oracle: SMAOracle
oraclePrice: BigNumber
oraclePriceTransformer: OraclePriceTransformer
poolStateHelper: PoolStateHelper
provider: undefined | Provider | Signer
setLastPrice: (price: BigNumber) => void = ...

Type declaration

    • (price: BigNumber): void
    • Sets the pools last price

      Parameters

      • price: BigNumber

        new price to set

      Returns void

setLastPriceTimestamp: (timestamp: BigNumber) => void = ...

Type declaration

    • (timestamp: BigNumber): void
    • Sets the pools last price

      Parameters

      • timestamp: BigNumber

      Returns void

setLongBalance: (longBalance: BigNumber) => void = ...

Type declaration

    • (longBalance: BigNumber): void
    • Sets the pools long balance

      Parameters

      • longBalance: BigNumber

        balance to set

      Returns void

setOraclePrice: (price: BigNumber) => void = ...

Type declaration

    • (price: BigNumber): void
    • Sets the pools oracle price

      Parameters

      • price: BigNumber

        new price to set

      Returns void

setShortBalance: (shortbalance: BigNumber) => void = ...

Type declaration

    • (shortbalance: BigNumber): void
    • Sets the pools short balance

      Parameters

      • shortbalance: BigNumber

      Returns void

settlementToken: Token
shortBalance: BigNumber
shortToken: PoolToken
updateInterval: BigNumber
Create: (poolInfo: IPool) => Promise<Pool> = ...

Type declaration

    • Replacement constructor pattern to support async initialisations

      Parameters

      Returns Promise<Pool>

      a Promise containing an initialised Pool class ready to be used

CreateDefault: () => Pool = ...

Type declaration

    • Creates an empty pool that can be used as a default

      Returns Pool

DeployPool: () => void

Type declaration

    • (): void
    • TODO

      Returns void

Generated using TypeDoc