Skip to content

Commit

Permalink
fix: amm price calc
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-vagabond committed Feb 1, 2024
1 parent a47971d commit 70497f8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion x/amm/client/cli/tx_join_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func CmdJoinPool() *cobra.Command {
Use: "join-pool [pool-id] [max-amounts-in] [share-amount-out]",
Short: "join a new pool and provide the liquidity to it",
Example: `elysd tx amm join-pool 0 2000uatom,2000uusdc 200000000000000000 --from=treasury --keyring-backend=test --chain-id=elystestnet-1 --yes --gas=1000000`,
Args: cobra.ExactArgs(4),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) (err error) {
poolId, err := cast.ToUint64E(args[0])
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions x/amm/keeper/calc_in_route_spot_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ func (k Keeper) CalcInRouteSpotPrice(ctx sdk.Context, tokenIn sdk.Coin, routes [
// Calculate the token out amount
tokenOutAmt := sdk.NewDecFromInt(tokenIn.Amount).Mul(spotPrice)

// invert the spot price
spotPrice = sdk.OneDec().Quo(spotPrice)

// Construct the token out coin
tokenOut := sdk.NewCoin(tokenOutDenom, tokenOutAmt.TruncateInt())

Expand Down

0 comments on commit 70497f8

Please sign in to comment.