Skip to main content
Git Source Author: @oscarsernarosero @mpetersoCode55 @cirsteve @palmerg4

State Variables

FLOAT_2

FLOAT_NEG_1

FLOAT_0

FLOAT_1

FLOAT_WAD

Functions

calculateBn

The result will be a packedFloat Bn is equal to V / (Xn + C) in the spec This function calculates B(n) and stores it in the tbc definition as b.
Parameters

calculatefx

The result for f(x) will be a packedFloat. This equation is used to calculate the spot price of the x token and is equal to (bn * x) + cn This function calculates f(x) at n.
Parameters Returns

calculateDn

The result for Dn will be a packedFloat This equation is used to calculate the area under the curve at n and is equal to (1/2)(bnx^2) + cnx This function calculates D at n.
Parameters Returns

calculateH

This method is implemented using packedFloats and the float128 library This equation in the spec is equal to (Ln + Zn) / (Wn - wInactive) + phi This function calculates h at n which is the total revenue per unit of liquidity at time n.
Parameters Returns

calculateXofNPlus1

This method is implemented using packedFloats and the float128 library This equation in the spec is equal to 2Dn / (c + sqrt(c^2 + 2bDn)) This function calculates the value of Xn+1.
Parameters Returns

calculateC

This function calculates the parameter c and stores it in the tbc definition.
Parameters

calculateLastRevenueClaim

The result for last revenue claim will be a Float. This function calculates the last revenue claim to be stored in the associated LPToken variable rj. The result will be a WAD value.
Parameters

calculateL

This function calculates the parameter L.
Parameters Returns

calculateZ

This function calculates the parameter Z, which is a balancing quantity used to ensure fair LP accounting.
Parameters

calculateQ

This function calculates q.
Parameters Returns

calculateRevenueAvailable

This function calculates the revenue available for a given LPToken.
Parameters Returns

_liquidityUpdateHelper

This function updates related tbc variables when a liquidity deposit or withdrawal is made
Parameters Returns