Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

Properties

backend: any
mnemonic?: string
property

An optional string of 25 words seperated by spaces that can be used to recover an algorand account

network?: "LocalHost" | "MainNet" | "TestNet"
property

The desired network to connect to, the default value is LocalHost

networkAccount?: any
property

An optional instance of an account from the reach standard library. Used to reconnect via a frontend

provider?: any
property

An instance of the provider object for the signer specified

providerEnv?: any
property

providerEnv for indexer

reachAccount: any
property

An account created from the reach sdk

reachStdLib: any
property

An instance of the reach standard library

secretKey?: number[]
property

An optional array of numbers that can be used to recover an algorand account

signer?: string
propertyan

optional name of a signer or wallet provider that can be used to sign transactions, should be set along with the provider property. Only required when not using a mnemonic or secretKey

Methods

  • collectFees(params: { vault: Vault }): Promise<boolean>
  • Used by an account to collect fees from the contract

    Parameters

    • params: { vault: Vault }

      Contains key vault which indicates the contract this function should interact with

    Returns Promise<boolean>

    A boolean indicating of fees were collected or not

  • createVault(params: { collateral: number; maximumPrice: number; minimumPrice: number; mintAmount: number; vault: Vault }): Promise<boolean>
  • Used to create a vault in the contract

    Parameters

    • params: { collateral: number; maximumPrice: number; minimumPrice: number; mintAmount: number; vault: Vault }

      Contains keys collateral that indicates the amount of collateral that will be used to create the vault, mintAmount that indicates the amount of xusd tokens to be minted, vault that indicates the contract we are communicating with, minimumPrice that indicates the minimum price allowed for this transaction and maximumPrice that indicates the maximum price allowed for this transaction

      • collateral: number
      • maximumPrice: number
      • minimumPrice: number
      • mintAmount: number
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the vault was created or not

  • depositCollateral(params: { amount: number; vault: Vault }): Promise<boolean>
  • Parameters

    • params: { amount: number; vault: Vault }

      Contains the amount of tokens to be deposited as collateral as well as the vault

      • amount: number
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the collateral was deposited successfully

  • dripInterest(params: { address: string; vault: Vault }): Promise<boolean>
  • Will trigger interest to accrue on a specific user vault

    Parameters

    • params: { address: string; vault: Vault }

      Contains address of vault to accrue interest for. Also includes vault which indicates the contract this function should interact with.

      • address: string
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating of fees were collected or not

  • fundFromFaucet(): Promise<boolean>
  • Allows you to fund this account from the faucet when on the Reach devnet

    Returns Promise<boolean>

    A boolean indicating if this account was successfully funded or not

  • getAddress(): Promise<any>
  • getBalance(params: { tokenId: number }): Promise<number>
  • Parameters

    • params: { tokenId: number }

      An object with key tokenId that indicates the ASA id whose balance this function must return, this key's value should be set to zero for the native token balance

      • tokenId: number

    Returns Promise<number>

    The balance of the specified tokenId

  • getContractAbi(params: { backend: any; contractId: number }): Promise<AbiInterface>
  • Parameters

    • params: { backend: any; contractId: number }

      contractId which indicates the contract we want to interact with, and the backend to use (see utils.ts for backend options)

      • backend: any
      • contractId: number

    Returns Promise<AbiInterface>

  • getContractAddress(params: { backend: any; contractId: number }): Promise<string>
  • Returns the contract address

    Parameters

    • params: { backend: any; contractId: number }

      An object with key vault that indicates the contract whose address is to be retrieved, and the backend to use (see utils.ts for backend options)

      • backend: any
      • contractId: number

    Returns Promise<string>

    A formatted address of the specified contract as a string

  • getSecret(): Promise<any>
  • getUserInfo(params: { address: string; vault: Vault }): Promise<UserVaultReturnParams>
  • Parameters

    • params: { address: string; vault: Vault }

      Contains key address which indicates the vault we want to retrieve the info of as well as key vault that indicates the contract we want to interact with

      • address: string
      • vault: Vault

    Returns Promise<UserVaultReturnParams>

    the information for the specified vault

  • getVaultState(params: { vault: Vault }): Promise<VaultReturnParams>
  • Used to get the state of the contract

    Parameters

    • params: { vault: Vault }

      An object with key vault that indicates the contract whose state is to be retrieved

    Returns Promise<VaultReturnParams>

    The state of the vault of type [[VaultReturnParams]]

  • initialiseReachAccount(): Promise<void>
  • liquidateDuringShutdown(params: { address: string; debtAmount: number; dripInterest: false; maximumPrice: number; minimumPrice: number; vault: Vault }): Promise<boolean>
  • Parameters

    • params: { address: string; debtAmount: number; dripInterest: false; maximumPrice: number; minimumPrice: number; vault: Vault }

      Contains keys address, debtAmount, vault, dripInterest, minimumPrice allowed for this transaction and maximumPrice allowed for this transaction. Include dripInterest if you would like the vault debt to be updated before liquidation

      • address: string
      • debtAmount: number
      • dripInterest: false
      • maximumPrice: number
      • minimumPrice: number
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the vault was liquidated or not

  • liquidateVault(params: { address: string; debtAmount: number; dripInterest: false; maximumPrice: number; minimumPrice: number; vault: Vault }): Promise<boolean>
  • Parameters

    • params: { address: string; debtAmount: number; dripInterest: false; maximumPrice: number; minimumPrice: number; vault: Vault }

      Contains keys address, debtAmount, vault, dripInterest, minimumPrice allowed for this transaction and maximumPrice allowed for this transaction. Include dripInterest if you would like the vault debt to be updated before liquidation

      • address: string
      • debtAmount: number
      • dripInterest: false
      • maximumPrice: number
      • minimumPrice: number
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the vault was liquidated or not

  • mintToken(params: { amount: number; maximumPrice: number; minimumPrice: number; vault: Vault }): Promise<boolean>
  • Parameters

    • params: { amount: number; maximumPrice: number; minimumPrice: number; vault: Vault }

      Contains the amount of xUsd tokens to be minted, the vault in which the token should be minted, minimumPrice that indicates the minimum price allowed for this transaction and maximumPrice that indicates the maximum price allowed for this transaction

      • amount: number
      • maximumPrice: number
      • minimumPrice: number
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the xUsd tokens were successfully minted or not

  • optIntoToken(tokenID: number): Promise<void>
  • Allows an instance of the account class to opt into an Algorand standard Asset

    Parameters

    • tokenID: number

      The asa ID to opt into

    Returns Promise<void>

  • proposeVaultForRedemption(params: { address: string; vault: Vault }): Promise<boolean>
  • Propose the address of a vault that could be redeemable, to qualify the vault must be 'less healthy' than any of the other proposed vaults, or there must be a free slot.

    Parameters

    • params: { address: string; vault: Vault }

      Address of vault to propose, and target vault contract.

      • address: string
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating success of call.

  • redeemVault(params: { amountToRedeem: number; maximumPrice: number; minimumPrice: number; targetVault: string; vault: Vault }): Promise<boolean>
  • Attempt to redeem some of the Vault asset against a redeemable vault, to receive vault collateral.

    Parameters

    • params: { amountToRedeem: number; maximumPrice: number; minimumPrice: number; targetVault: string; vault: Vault }

      Contains the amount of xUSD to redeem, the vault to redeem it from, minimumPrice that indicates the minimum price allowed for this transaction and maximumPrice that indicates the maximum price allowed for this transaction

      • amountToRedeem: number
      • maximumPrice: number
      • minimumPrice: number
      • targetVault: string
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating success of call.

  • replenishSupply(params: { supplyAmt: number; vault: Vault }): Promise<boolean>
  • Used to relplenish the supply on the treasury address

    Parameters

    • params: { supplyAmt: number; vault: Vault }

      An object that contains the supply amount and the target Vault.

      • supplyAmt: number
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the supply was replenished or not

  • returnVaultDebt(params: { address: string; amount: number; close?: boolean; vault: Vault }): Promise<boolean>
  • Parameters

    • params: { address: string; amount: number; close?: boolean; vault: Vault }

      An object with key amount signifying the amount of debt tokens to return, key vault indicating the Contract and key close indicating if the vault should be closed

      • address: string
      • amount: number
      • Optional close?: boolean
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the vault debt was returned or not

  • setAdminProperties(params: { adminProperties: AdminProperties; vault: Vault }): Promise<boolean>
  • Used to set the admin properties of a vault

    Parameters

    • params: { adminProperties: AdminProperties; vault: Vault }

      An object that contains an [[AdminProperties]] object and the target Vault.

      • adminProperties: AdminProperties
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the properties were set or not

  • subscribeToEvents(params: { vault: Vault; createCallback: any; transactionCallback: any; updatePriceCallback: any }): Promise<void>
  • Subscribes to all vault events and calls the provided callbacks when the event is fired

    Parameters

    • params: { vault: Vault; createCallback: any; transactionCallback: any; updatePriceCallback: any }

      An object that contains key vaultId, key createCallback and key transactionCallback

      • vault: Vault
        property

        a uint that uniquely identifies the contract

      • createCallback:function
        • createCallback(address: string, state: UserVaultReturnParams): void
        • property

          callback that is called when a vault is created, it is called with the address that created the vault as well as its user vault state

          Parameters

          • address: string
          • state: UserVaultReturnParams

          Returns void

      • transactionCallback:function
        • transactionCallback(address: string, state: UserVaultReturnParams): void
        • property

          callback that is called when a transaction is made in any vault in the contract, it is called with the address that made the transaction as well as its uservault state

          Parameters

          • address: string
          • state: UserVaultReturnParams

          Returns void

      • updatePriceCallback:function
        • updatePriceCallback(address: string, newPrice: number): void

    Returns Promise<void>

  • updateAdminAddress(params: { address: string; vault: Vault }): Promise<boolean>
  • Used to update the admin address of a vault

    Parameters

    • params: { address: string; vault: Vault }

      An object that contains an address and the target Vault.

      • address: string
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the address was updated.

  • updatePrice(params: { price: number; vault: Vault }): Promise<boolean>
  • Parameters

    • params: { price: number; vault: Vault }

      Contains the new price and the vault whose price should be updated

      • price: number
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the price was successfully updated or not

  • withdrawCollateral(params: { amount: number; maximumPrice: number; minimumPrice: number; vault: Vault }): Promise<boolean>
  • Parameters

    • params: { amount: number; maximumPrice: number; minimumPrice: number; vault: Vault }

      Contains amount of collateral to be withdrawn, the vault they should be withdrawn from, minimumPrice that indicates the minimum price allowed for this transaction and maximumPrice that indicates the maximum price allowed for this transaction

      • amount: number
      • maximumPrice: number
      • minimumPrice: number
      • vault: Vault

    Returns Promise<boolean>

    A boolean indicating if the collaterals were successfully withdrawn or not

Generated using TypeDoc