Skip to content

Commit

Permalink
chore: fix to prevent generating swap more than MaxSwaps
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeseung-bae committed May 3, 2024
1 parent d15f3e5 commit 18075f4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions x/fswap/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import (
)

func (k Keeper) MakeSwap(ctx sdk.Context, swap types.Swap, toDenomMetadata bank.Metadata) error {
if len(k.getAllSwaps(ctx)) >= k.config.MaxSwaps && !k.isUnlimited() {
return types.ErrCanNotHaveMoreSwap.Wrapf("cannot initialize genesis state, there are more than %d swaps", k.config.MaxSwaps)
}
isNewSwap := true
if _, err := k.getSwap(ctx, swap.FromDenom, swap.ToDenom); err == nil {
isNewSwap = false
Expand Down

0 comments on commit 18075f4

Please sign in to comment.