Skip to content

Commit

Permalink
Add getHumanPriceFromReserves
Browse files Browse the repository at this point in the history
  • Loading branch information
metaproph3t committed Dec 1, 2024
1 parent 23492cb commit 697a663
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sdk/src/v0.3/utils/ammMath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ export type RemoveLiquiditySimulation = {
};

export class AmmMath {
public static getHumanPriceFromReserves(
baseReserves: BN,
quoteReserves: BN,
baseDecimals: number,
quoteDecimals: number
): number {
return this.getHumanPrice(
this.getAmmPriceFromReserves(baseReserves, quoteReserves),
baseDecimals,
quoteDecimals
);
}

public static getAmmPriceFromReserves(
baseReserves: BN,
quoteReserves: BN
Expand Down
1 change: 1 addition & 0 deletions sdk/src/v0.4/utils/priceMath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export type RemoveLiquiditySimulation = {

export class AmmMath {
// Re-export common methods from v0.3
public static getHumanPriceFromReserves = V3AmmMath.getHumanPriceFromReserves;
public static getAmmPriceFromReserves = V3AmmMath.getAmmPriceFromReserves;
public static getChainAmount = V3AmmMath.getChainAmount;
public static getHumanAmount = V3AmmMath.getHumanAmount;
Expand Down

0 comments on commit 697a663

Please sign in to comment.