Skip to content

Commit

Permalink
Add explanation for what the real reserves are and link to blackpaper
Browse files Browse the repository at this point in the history
  • Loading branch information
xbtmatt committed Dec 4, 2024
1 parent 325ccd4 commit c05f7d3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/typescript/sdk/src/markets/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ type ReservesAndBondingCurveState = Flatten<
>;

/**
* Calculates the circulating supply based on the current market state.
* Calculates the circulating supply based on the given market state.
*
* The logic for calculation is taken directly from the Move smart contract.
* @see assign_supply_minuend_reserves_ref_mut in `emojicoin_dot_fun.move`
Expand Down Expand Up @@ -383,11 +383,19 @@ export const fetchCirculatingSupply = async (
.catch(() => undefined);

/**
* Calculates the real reserves of a market given on information from the partial state of the
* market passed in.
* Calculates the real reserves of a market based on the given market state.
*
* The logic for calculating the real reserves of a market in the bonding curve is taken directly
* from the Move smart contract.
*
* Note that while the market is in the bonding curve, the current market price (the current
* position on the bonding curve) is represented by the clamm's virtual reserves, *not* the clamm's
* real reserves calculated here.
*
* Post bonding curve, the price is directly equal to the cpamm's real reserves.
*
* @see {@link https://github.com/econia-labs/emojicoin-dot-fun/blob/main/doc/blackpaper/emojicoin-dot-fun-blackpaper.pdf}
* for an in depth explanation of the math and behavior behind the bonding curve.
*/
export const calculateRealReserves = ({
clammVirtualReserves,
Expand Down

0 comments on commit c05f7d3

Please sign in to comment.