Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin committed Sep 23, 2024
1 parent 9a259a1 commit 73da686
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions x/iro/keeper/trade.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ func (k Keeper) Buy(ctx sdk.Context, planId string, buyer sdk.AccAddress, amount

// Calculate cost for buying amountTokensToBuy over fixed price curve
cost := sdk.NewCoin(appparams.BaseDenom, plan.BondingCurve.Cost(plan.SoldAmt, plan.SoldAmt.Add(amountTokensToBuy)))
costWithTakerFee, takerFee, err := k.ApplyTakerFee(cost, k.GetParams(ctx).TakerFee, true)
costPlusTakerFee, takerFee, err := k.ApplyTakerFee(cost, k.GetParams(ctx).TakerFee, true)
if err != nil {
return err
}

// Validate expected out amount
if costWithTakerFee.Amount.GT(maxCostAmt) {
if costPlusTakerFee.Amount.GT(maxCostAmt) {
return errorsmod.Wrapf(types.ErrInvalidExpectedOutAmount, "maxCost: %s, cost: %s, fee: %s", maxCostAmt.String(), cost.String(), takerFee.String())
}

Expand Down Expand Up @@ -116,13 +116,13 @@ func (k Keeper) Sell(ctx sdk.Context, planId string, seller sdk.AccAddress, amou

// Calculate cost over fixed price curve
cost := sdk.NewCoin(appparams.BaseDenom, plan.BondingCurve.Cost(plan.SoldAmt.Sub(amountTokensToSell), plan.SoldAmt))
costWithTakerFee, takerFee, err := k.ApplyTakerFee(cost, k.GetParams(ctx).TakerFee, false)
costMinusTakerFee, takerFee, err := k.ApplyTakerFee(cost, k.GetParams(ctx).TakerFee, false)
if err != nil {
return err
}

// Validate expected out amount
if costWithTakerFee.Amount.LT(minCostAmt) {
if costMinusTakerFee.Amount.LT(minCostAmt) {
return errorsmod.Wrapf(types.ErrInvalidMinCost, "minCost: %s, cost: %s, fee: %s", minCostAmt.String(), cost.String(), takerFee.String())
}

Expand Down
2 changes: 1 addition & 1 deletion x/iro/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (p Params) Validate() error {
}

if p.IncentivesMinStartTimeAfterSettlement <= 0 {
return fmt.Errorf("incentive plan start time after settlement must be greater than 0: %s", p.IncentivesMinStartTimeAfterSettlement)
return fmt.Errorf("incentive plan start time after settlement must be greater than 0: %v", p.IncentivesMinStartTimeAfterSettlement)
}

return nil
Expand Down
3 changes: 2 additions & 1 deletion x/sequencer/keeper/msg_server_create_sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ func (k msgServer) CreateSequencer(goCtx context.Context, msg *types.MsgCreateSe
return nil, types.ErrNotInitialSequencer
}

// check pre launch time
// check pre launch time.
// skipped if no pre launch time is set
if rollapp.PreLaunchTime.After(ctx.BlockTime()) {
return nil, types.ErrBeforePreLaunchTime
}
Expand Down

0 comments on commit 73da686

Please sign in to comment.