Options
All
  • Public
  • Public/Protected
  • All
Menu

Controls interaction with an Oven.

Hierarchy

  • OvenClient

Index

Constructors

constructor

  • Create a new OvenClient.

    Parameters

    • nodeUrl: string

      The URL of the node to connect to.

    • wallet: InMemorySigner | TempleWallet

      The wallet which will interact with this Oven.

    • ovenAddress: string

      The address of the oven.

    • stableCoinClient: StableCoinClient

      The stable coin client

    • harbingerClient: HarbingerClient

      The harbinger price oracle client

    Returns OvenClient

Properties

Readonly harbingerClient

harbingerClient: HarbingerClient

Readonly ovenAddress

ovenAddress: string

Readonly stableCoinClient

stableCoinClient: StableCoinClient

Private Readonly tezos

tezos: TezosToolkit

A TezosToolkit

Methods

borrow

  • borrow(tokens: BigNumber): Promise<TransactionWalletOperation | TransactionOperation>
  • Borrow tokens against an Oven's collateral.

    Parameters

    • tokens: BigNumber

      The number of tokens to borrow.

    Returns Promise<TransactionWalletOperation | TransactionOperation>

    The operation hash.

deposit

  • deposit(mutez: BigNumber): Promise<TransactionWalletOperation | TransactionOperation>
  • Deposit XTZ into the Oven.

    Parameters

    • mutez: BigNumber

      The amount of XTZ to deposit, specified in mutez.

    Returns Promise<TransactionWalletOperation | TransactionOperation>

    The operation hash.

getBaker

  • getBaker(): Promise<null | string>
  • Retrieve the baker for the oven.

    Returns Promise<null | string>

    The baker for the oven.

getBalance

  • getBalance(): Promise<BigNumber>
  • Get the balance of the oven.

    Returns Promise<BigNumber>

    The oven balance in mutez.

getBorrowedTokens

  • getBorrowedTokens(ovenStorage?: any): Promise<BigNumber>
  • Retrieve the number of tokens borrowed against the oven.

    NOTE: This method does NOT include stability fees. Please see: getStabilityFees and getTotalOutstandingTokens.

    Parameters

    • ovenStorage: any = ...

    Returns Promise<BigNumber>

    The amount of tokens borrowed.

getCollateralUtilization

  • getCollateralUtilization(): Promise<BigNumber>
  • Retrieve the utilization of collateral in the oven.

    This number represents how much of the user's maximum borrow limit is used. If the number is greater than 1, the user may be liquidated.

    Mathematically, this is defined as: collateral utilization = (amount borrowed) / (amount you can borrow) collateral utilization = = (borrowed kUSD) / (amount of XTZ in Oven * Price of XTZ / collateral requirement)

    Returns Promise<BigNumber>

    The collateral utilization ratio as an integer with 18 digits of precision (ex. 80% is represented as 800_000_000_000_000_000)

getCollateralizationRatio

  • getCollateralizationRatio(): Promise<BigNumber>
  • Retrieve the collateralization ratio of the oven.

    deprecated

    This method returns a number that isn't particularly useful and may be removed in a future version of this library. Please use getCollateralUtilization instead. TODO(keefertaylor): Remove this method.

    Returns Promise<BigNumber>

    The collateralization ratio as a shard.

getOwner

  • getOwner(ovenStorage?: any): Promise<string>
  • Retrieve the owner of the oven.

    Parameters

    • ovenStorage: any = ...

    Returns Promise<string>

    The address which owns the oven.

getStabilityFees

  • getStabilityFees(time?: Date, ovenStorage?: any): Promise<BigNumber>
  • Retrieve the number of tokens owed in stability fees against the oven.

    Parameters

    • time: Date = ...

      The time to calculate the values at. Defaults to the current time.

    • ovenStorage: any = ...

      The pre-fetched oven storage

    Returns Promise<BigNumber>

    Interest rate data for the system.

getTotalOutstandingTokens

  • getTotalOutstandingTokens(time?: Date, ovenStorage?: any): Promise<BigNumber>
  • Retrieve the total number of tokens outstanding on the vault.

    This method includes the stability fees and borrowed tokens. For individual breakdowns, see getStabilityFees and getBorrowedTokens.

    Parameters

    • time: Date = ...

      The time to calculate the values at. Defaults to the current time.

    • ovenStorage: any = ...

      The pre-fetched oven storage

    Returns Promise<BigNumber>

    The amount of tokens owed in stability fees.

Private invokeOvenMethod

  • invokeOvenMethod(entrypoint: string, args: any, amount?: number): Promise<TransactionWalletOperation | TransactionOperation>
  • Invoke a method in the oven contract.

    Parameters

    • entrypoint: string

      The entry point to invoke.

    • args: any

      The arguments to send with the invocation.

    • amount: number = 0

      The amount of XTZ to send with the operation, specified in mutez.

    Returns Promise<TransactionWalletOperation | TransactionOperation>

    The operation hash.

isLiquidated

  • isLiquidated(ovenStorage?: any): Promise<boolean>
  • Query if the Oven is liquidated.

    Parameters

    • ovenStorage: any = ...

    Returns Promise<boolean>

    A boolean representing the liquidation state.

liquidate

  • liquidate(): Promise<TransactionWalletOperation | TransactionOperation>
  • Liquidate an Oven.

    Returns Promise<TransactionWalletOperation | TransactionOperation>

    The operation hash.

repay

  • repay(tokensToRepay: BigNumber): Promise<TransactionWalletOperation | TransactionOperation>
  • Repay borrowed tokens.

    Parameters

    • tokensToRepay: BigNumber

      The number of tokens to repay.

    Returns Promise<TransactionWalletOperation | TransactionOperation>

    The operation hash.

setBaker

  • setBaker(baker: null | string): Promise<TransactionWalletOperation | TransactionOperation>
  • Set the baker of the oven.

    Parameters

    • baker: null | string

      The baker for the oven.

    Returns Promise<TransactionWalletOperation | TransactionOperation>

    The operation hash

withdraw

  • withdraw(mutez: BigNumber): Promise<TransactionWalletOperation | TransactionOperation>
  • Withdraw XTZ from the Oven.

    Parameters

    • mutez: BigNumber

      The amount of XTZ to withdraw, specified in mutez.

    Returns Promise<TransactionWalletOperation | TransactionOperation>

    The operation hash.

Generated using TypeDoc