Skip to content

Commit

Permalink
Improve token price calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed Mar 17, 2024
1 parent 6e75736 commit f1ad69b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/atlas/src/utils/crts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const calcBuyMarketPricePerToken = (
.add(bnAmount)
.pow(new BN(2))
.sub(totalSupply.pow(new BN(2)))
return new BN(ammSlopeParameter).muln(0.5).mul(allocation).add(new BN(ammInitPrice).mul(bnAmount))
return new BN(ammSlopeParameter).mul(allocation).divn(2).add(new BN(ammInitPrice).mul(bnAmount))
}

export const calcSellMarketPricePerToken = (
Expand All @@ -28,7 +28,7 @@ export const calcSellMarketPricePerToken = (
}
const totalSupply = new BN(mintedByAmm)
const allocation = totalSupply.pow(new BN(2)).sub(totalSupply.subn(amount).pow(new BN(2)))
return new BN(ammSlopeParameter).muln(0.5).mul(allocation).add(new BN(ammInitPrice).muln(amount))
return new BN(ammSlopeParameter).mul(allocation).divn(2).add(new BN(ammInitPrice).muln(amount))
}

type GetRevenueShareStatusForMemberProps = {
Expand Down

0 comments on commit f1ad69b

Please sign in to comment.