Skip to content

Commit

Permalink
liquidity_pool.go edits for language, minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
barriebyron committed May 20, 2021
1 parent a4f37d5 commit 726301c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions x/liquidity/keeper/liquidity_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (k Keeper) ValidateMsgCreatePool(ctx sdk.Context, msg *types.MsgCreatePool)
params := k.GetParams(ctx)
var poolType types.PoolType

// check poolType exist, get poolType from param
// check if poolType exists, get poolType from param
if len(params.PoolTypes) >= int(msg.PoolTypeId) {
poolType = params.PoolTypes[msg.PoolTypeId-1]
if poolType.Id != msg.PoolTypeId {
Expand Down Expand Up @@ -172,7 +172,7 @@ func (k Keeper) DepositLiquidityPool(ctx sdk.Context, msg types.DepositMsgState,

reserveCoins := k.GetReserveCoins(ctx, pool)

// reinitialize pool in case of reserve coins has run out
// reinitialize pool in case the reserve coins have run out
if reserveCoins.IsZero() {
for _, depositCoin := range msg.Msg.DepositCoins {
if depositCoin.Amount.LT(params.MinInitDepositAmount) {
Expand Down Expand Up @@ -249,7 +249,7 @@ func (k Keeper) DepositLiquidityPool(ctx sdk.Context, msg types.DepositMsgState,
refundedCoinA := sdk.NewInt(0)
refundedCoinB := sdk.NewInt(0)

// handle when depositing coin A amount is less than, greater than or equal to depositable amount
// handle when depositing coin A amount is less than, greater than, or equal to depositable amount
if depositCoinA.Amount.LT(depositableCoinAmountA) {
depositCoinAmountB = depositCoinA.Amount.ToDec().QuoTruncate(lastReserveRatio).TruncateInt()
acceptedCoins = sdk.NewCoins(depositCoinA, sdk.NewCoin(depositCoinB.Denom, depositCoinAmountB))
Expand Down Expand Up @@ -543,7 +543,7 @@ func (k Keeper) RefundDepositLiquidityPool(ctx sdk.Context, batchMsg types.Depos
if err := k.ReleaseEscrow(ctx, batchMsg.Msg.GetDepositor(), batchMsg.Msg.DepositCoins); err != nil {
return err
}
// not delete now, set ToBeDeleted true for delete on next block beginblock
// do not delete now, and set ToBeDeleted true for delete on next block beginblock
batchMsg.ToBeDeleted = true
k.SetPoolBatchDepositMsgState(ctx, batchMsg.Msg.PoolId, batchMsg)
ctx.EventManager().EmitEvent(
Expand Down Expand Up @@ -583,7 +583,7 @@ func (k Keeper) RefundWithdrawLiquidityPool(ctx sdk.Context, batchMsg types.With
sdk.NewAttribute(types.AttributeValueSuccess, types.Failure),
))

// not delete now, set ToBeDeleted true for delete on next block beginblock
// do not delete now, and set ToBeDeleted true for delete on next block beginblock
batchMsg.ToBeDeleted = true
k.SetPoolBatchWithdrawMsgState(ctx, batchMsg.Msg.PoolId, batchMsg)
return nil
Expand Down Expand Up @@ -767,7 +767,7 @@ func (k Keeper) ValidateMsgSwapWithinBatch(ctx sdk.Context, msg types.MsgSwapWit

params := k.GetParams(ctx)

// can not exceed max order ratio of reserve coins that can be ordered at a order
// cannot exceed max order ratio of reserve coins for one order
reserveCoinAmt := k.GetReserveCoins(ctx, pool).AmountOf(msg.OfferCoin.Denom)

if !reserveCoinAmt.IsPositive() {
Expand Down Expand Up @@ -884,7 +884,7 @@ func (k Keeper) ValidatePoolRecord(ctx sdk.Context, record types.PoolRecord) err
return nil
}

// IsPoolCoinDenom checks is the denom poolcoin or not, need to additional checking the reserve account is existed
// IsPoolCoinDenom checks if the denom is already a poolcoin, need to additionally check if the reserve account exists
func (k Keeper) IsPoolCoinDenom(ctx sdk.Context, denom string) bool {
if err := sdk.ValidateDenom(denom); err != nil {
return false
Expand Down

0 comments on commit 726301c

Please sign in to comment.