Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • SwapCalculator

Implemented by

Index

Properties

pool: Pool

Methods

  • getMintedLiquidityTokens(addedLiqA: bigint, addedLiqB: bigint): bigint
  • Returns amount of liquidity tokens that are going to be minted when adding liquidity.

    Parameters

    • addedLiqA: bigint

      Amount of primary asset to add to the pool.

    • addedLiqB: bigint

      Amount of secondary asset to add to the pool.

    Returns bigint

    Amount of liquidity tokens that will be minted and given to user.

  • getPrice(decimalLiqA: number, decimalLiqB: number): number
  • Calculates the price of assets. Accepts and returns decimal values.

    Parameters

    • decimalLiqA: number

      Primary liquidity if calculating price for primary asset, secondary otherwise.

    • decimalLiqB: number

      Secondary liquidity if calculating price for primary asset, primary otherwise.

    Returns number

    The price of one asset in relation to the other.

  • getSwapAmountDeposited(liqA: bigint, liqB: bigint, amountReceived: bigint): bigint
    • Converts amountReceived to amountDeposited. Ignores fee calculations.

    Parameters

    • liqA: bigint

      Primary liquidity if swapping primary asset, secondary otherwise.

    • liqB: bigint

      Secondary liquidity if swapping primary asset, primary otherwise.

    • amountReceived: bigint

      Amount of asset the user want to receive from the swap.

    Returns bigint

    Amount of the asset the user has to deposit in the contract.

  • getSwapGrossAmountReceived(liqA: bigint, liqB: bigint, amountDeposited: bigint): bigint
  • Converts amountDeposited to amountReceived. Ignores fee calculations.

    Parameters

    • liqA: bigint

      Primary liquidity if swapping primary asset, secondary otherwise.

    • liqB: bigint

      Secondary liquidity if swapping primary asset, primary otherwise.

    • amountDeposited: bigint

      Amount of the asset deposited in the contract.

    Returns bigint

    Amount of asset received from the contract after swap.

Generated using TypeDoc