Service exposing functions to do basic math calculations that a frontend would require

Hierarchy

Constructors

Properties

level: LogLevel
sdk: eBTC

Accessors

  • get address(): undefined | string
  • Returns undefined | string

  • get connector(): Signer | MulticallProvider
  • Returns Signer | MulticallProvider

  • get provider(): MulticallProvider
  • Returns MulticallProvider

  • get signer(): undefined | Signer
  • Returns undefined | Signer

Methods

  • Parameters

    • level: LogLevel
    • Optional message: any
    • Rest ...optionalParams: any[]

    Returns void

  • Parameters

    • __namedParameters: {
          borrowAmount: number;
          collWithoutGasStipend: number;
          collateralRatio: number;
          stEthBtcRatio: number;
      }
      • borrowAmount: number
      • collWithoutGasStipend: number
      • collateralRatio: number
      • stEthBtcRatio: number

    Returns number

  • Parameters

    • __namedParameters: {
          collateral: BigNumber;
          leverageRatio: BigNumber;
          ratio: BigNumber;
          stEthBtcRatio: BigNumber;
      }
      • collateral: BigNumber
      • leverageRatio: BigNumber
      • ratio: BigNumber
      • stEthBtcRatio: BigNumber

    Returns BigNumber

  • Calculate the amount of stEth (collateral) as a balance (not shares) as an 18 decimal BigNumber

    Parameters

    • debt: BigNumber

      Amount of ebtc debt as an 18 decimal BigNumber

    • stEthBtcRatio: BigNumber

      Ratio between the stEth balance (collateral NOT in shares) and eBTC from the pricefeed as an 18 decimal BigNumber

    • collateralRatio: BigNumber

      The Collateral (stEth Balance) to Debt Ratio (ICR)

    Returns BigNumber

    Amount of ebtc debt as an 18 decimal BigNumber

  • Calculate the Collateral (stEth Balance) to Debt Ratio (ICR)

    Parameters

    • collateral: BigNumber

      Amount of stEth (balance not shares) as a balance (not shares) in Ether unit

    • debt: BigNumber

      Amount of ebtc debt in Ether unit

    • stEthBtcRatio: BigNumber

      Ratio between stEth balance (collateral NOT in shares) and eBTC from the pricefeed in Ether unit

    Returns BigNumber

    stEth balance in Ether unit

  • Calculate the amount of debt that can be generated for a given stEth balance and the desired collateral ratio

    Parameters

    • collateral: BigNumber

      Amount of stEth (balance not shares) as a balance (not shares) as an 18 decimal BigNumber

    • stEthBtcRatio: BigNumber

      Ratio between the stEth balance (collateral NOT in shares) and eBTC from the pricefeed as an 18 decimal BigNumber

    • collateralRatio: BigNumber

      The Collateral (stEth Balance) to Debt Ratio (ICR)

    Returns BigNumber

    Amount of ebtc debt as an 18 decimal BigNumber

  • Calculate at what stEth-Ebtc ratio the cdp will be liquidated (note: this does not account for fluctions in the stEth share price)

    Parameters

    • collateral: BigNumber

      Amount of stEth (balance not shares) as a balance (not shares) as an 18 decimal BigNumber

    • debt: BigNumber

      Amount of ebtc debt as an 18 decimal BigNumber

    • liquidationRatio: BigNumber = ...

      The ratio at which the cdp will be liquidated as an 18 decimal BigNumber (default: 110% = 1_100_000_000_000_000_000, if recovery mode is on use 125%)

    Returns BigNumber

    The stEthBtcRatio at which the cdp will be liquidated as an 18 decimal BigNumber

  • Parameters

    • debt: BigNumber
    • stEthBtcRatio: BigNumber
    • collateralRatio: BigNumber

    Returns BigNumber

  • Parameters

    • __namedParameters: {
          borrowAmount: number;
          collWithoutGasStipend: number;
          collateralRatio: number;
          stEthBtcRatio: number;
      }
      • borrowAmount: number
      • collWithoutGasStipend: number
      • collateralRatio: number
      • stEthBtcRatio: number

    Returns number

  • Calculate the stethBalance from the share amount and the stEth share ratio

    Parameters

    • collateralInShares: BigNumber

      Amount of stEth in shares (not the stEth balance) in Ether unit

    • stEthShareRatio: BigNumber

      stEth share ratio in Ether unit

    Returns BigNumber

    stEth balance in smallest

  • Calculate the steth shares from the steth balance amount and the stEth share ratio

    Parameters

    • collateral: BigNumber

      Amount of stEth balance (not the stEth shares) in Ether unit

    • stEthShareRatio: BigNumber

      stEth share ratio in Ether unit

    Returns BigNumber

    stEth balance in smallest

  • Parameters

    • Optional message: any
    • Rest ...optionalParams: any[]

    Returns void

  • Parameters

    • Optional message: any
    • Rest ...optionalParams: any[]

    Returns void

  • Parameters

    • Optional message: any
    • Rest ...optionalParams: any[]

    Returns void

  • Parameters

    • Optional message: any
    • Rest ...optionalParams: any[]

    Returns void

  • Parameters

    • Optional message: any
    • Rest ...optionalParams: any[]

    Returns void

Generated using TypeDoc