Class MarketState

Constructors

  • Parameters

    • totalPt: bigint
    • totalSy: bigint
    • totalLp: bigint
    • treasury: string
    • scalarRoot: FixedX18
    • expiry: bigint
    • lnFeeRateRoot: FixedX18
    • reserveFeePercent: bigint
    • lastLnImpliedRate: FixedX18

    Returns MarketState

Properties

expiry: bigint
lastLnImpliedRate: FixedX18
lnFeeRateRoot: FixedX18
reserveFeePercent: bigint
scalarRoot: FixedX18
totalLp: bigint
totalPt: bigint
totalSy: bigint
treasury: string

Accessors

  • get impliedYield(): FixedX18
  • Returns FixedX18

Methods

  • Parameters

    • syDesired: bigint
    • ptDesired: bigint
    • Optional params: {
          blockTime_s?: bigint;
      }
      • Optional blockTime_s?: bigint

    Returns {
        lpToAccount: bigint;
        lpToReserve: bigint;
        ptUsed: bigint;
        syUsed: bigint;
    }

    • lpToAccount: bigint
    • lpToReserve: bigint
    • ptUsed: bigint
    • syUsed: bigint
  • Parameters

    • comp: MarketPrecomputeResult
    • pyIndex: PyIndex
    • netPtToAccount: bigint

    Returns {
        netSyFee: bigint;
        netSyToAccount: bigint;
        netSyToReserve: bigint;
    }

    • netSyFee: bigint
    • netSyToAccount: bigint
    • netSyToReserve: bigint
  • Returns MarketState

  • Parameters

    • pyIndex: PyIndex
    • netPtToAccount: bigint
    • blockTime_s: bigint

    Returns {
        netSyFee: bigint;
        netSyToAccount: bigint;
        netSyToReserve: bigint;
    }

    • netSyFee: bigint
    • netSyToAccount: bigint
    • netSyToReserve: bigint
  • Parameters

    • comp: MarketPrecomputeResult
    • netPtToAccount: bigint

    Returns {
        postFeeExchangeRate: MarketExchangeRate;
        preFeeExchangeRate: MarketExchangeRate;
    }

    • postFeeExchangeRate: MarketExchangeRate
    • preFeeExchangeRate: MarketExchangeRate
  • Parameters

    • timeToExpiry_s: bigint

    Returns FixedX18

  • Parameters

    • params: {
          now_s?: bigint;
          rateAnchor: FixedX18;
      }

      Contains the rateAnchor. MarketPrecomputeResult can also be passed in.

      • Optional now_s?: bigint
      • rateAnchor: FixedX18

    Returns undefined | {
        rateMax: FixedX18;
        rateMin: FixedX18;
    }

    The rateMin and rateMax of the yield range. undefined if the market is expired.

  • Parameters

    • pyIndex: PyIndex
    • blockTime_s: bigint

    Returns MarketPrecomputeResult

  • Parameters

    • lpToRemove: bigint

    Returns {
        netPtToAccount: bigint;
        netSyToAccount: bigint;
    }

    • netPtToAccount: bigint
    • netSyToAccount: bigint
  • Parameters

    • pyIndex: PyIndex
    • initialAnchor: FixedX18
    • blockTime_s: bigint

    Returns void

  • Parameters

    • params: {
          blockTime_s: bigint;
          netPtToAccount: bigint;
          netSyToAccount: bigint;
          netSyToReserve: bigint;
          precomputeResult: MarketPrecomputeResult;
          pyIndex: PyIndex;
      }
      • blockTime_s: bigint
      • netPtToAccount: bigint
      • netSyToAccount: bigint
      • netSyToReserve: bigint
      • precomputeResult: MarketPrecomputeResult
      • pyIndex: PyIndex

    Returns void

  • Parameters

    • pyIndex: PyIndex
    • exactPtToMarket: bigint
    • blockTime_s: bigint

    Returns {
        netSyFee: bigint;
        netSyToAccount: bigint;
        netSyToReserve: bigint;
    }

    • netSyFee: bigint
    • netSyToAccount: bigint
    • netSyToReserve: bigint
  • Parameters

    • pyIndex: PyIndex
    • exactPtToAccount: bigint
    • blockTime_s: bigint

    Returns {
        netSyFee: bigint;
        netSyToMarket: bigint;
        netSyToReserve: bigint;
    }

    • netSyFee: bigint
    • netSyToMarket: bigint
    • netSyToReserve: bigint
  • Returns MarketRawState

  • Parameters

    • rawState: MarketRawState

    Returns MarketState

  • Parameters

    • this: void
    • params: {
          netPtToAccount: bigint;
          rateAnchor: FixedX18;
          rateScalar: FixedX18;
          totalAsset: bigint;
          totalPt: bigint;
      }
      • netPtToAccount: bigint
      • rateAnchor: FixedX18
      • rateScalar: FixedX18
      • totalAsset: bigint
      • totalPt: bigint

    Returns MarketExchangeRate

  • Parameters

    • this: void
    • lnImpliedRate: FixedX18
    • timeToExpiry_s: bigint

    Returns MarketExchangeRate

    Deprecated

    use MarketExchangeRate.fromLnImpliedRate instead.

  • Parameters

    • this: void
    • params: {
          rateAnchor: FixedX18;
          rateScalar: FixedX18;
          timeToExpiry_s: bigint;
          totalAsset: bigint;
          totalPt: bigint;
      }
      • rateAnchor: FixedX18
      • rateScalar: FixedX18
      • timeToExpiry_s: bigint
      • totalAsset: bigint
      • totalPt: bigint

    Returns FixedX18

  • Parameters

    • this: void
    • params: {
          lastLnImpliedRate: FixedX18;
          rateScalar: FixedX18;
          timeToExpiry_s: bigint;
          totalAsset: bigint;
          totalPt: bigint;
      }
      • lastLnImpliedRate: FixedX18
      • rateScalar: FixedX18
      • timeToExpiry_s: bigint
      • totalAsset: bigint
      • totalPt: bigint

    Returns FixedX18

  • Parameters

    • scalarRoot: FixedX18
    • timeToExpiry_s: bigint

    Returns FixedX18

  • Parameters

    • this: void
    • params: {
          expiry: bigint;
          now_s: bigint;
          rateAnchor: FixedX18;
          scalarRoot: FixedX18;
      }
      • expiry: bigint
      • now_s: bigint
      • rateAnchor: FixedX18
      • scalarRoot: FixedX18

    Returns undefined | {
        rateMax: FixedX18;
        rateMin: FixedX18;
    }

    The rateMin and rateMax of the yield range. undefined if the market is expired.

  • Parameters

    • this: void
    • proportion: FixedX18

    Returns FixedX18

  • Parameters

    • this: void
    • lnValue: FixedX18
    • timeToExpiry_s: bigint

    Returns FixedX18

Generated using TypeDoc