Skip to content

Commit

Permalink
Pool initialization fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Dusek committed Jun 6, 2024
1 parent ffa5d54 commit 8b379cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion x/market/keeper/msg_server_create_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper

import (
"context"
"math/big"
"strings"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -62,7 +63,13 @@ func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) (
}

// Drops define proportional ownership to the liquidity in the pool
drops := coinPair.AmountOf(denom1).Mul(coinPair.AmountOf(denom2))
// Constant Product Model
// f(x, y) = value of liquidity
// We will define f(x, y) = sqrt(xy)
// InitDrops = Sqrt(denom1.Amount * denom2.Amount)
tmp := big.NewInt(0)
tmp.Sqrt((coinPair.AmountOf(denom1).Mul(coinPair.AmountOf(denom2))).BigInt())
drops := sdk.NewIntFromBigInt(tmp)

leader := types.Leader{
Address: msg.Creator,
Expand Down

0 comments on commit 8b379cc

Please sign in to comment.