Skip to content

Commit

Permalink
Merge pull request #72 from onomyprotocol/fix
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
cgdusek authored May 26, 2024
2 parents fc79ad7 + e3ad879 commit 1cf06bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions x/market/keeper/msg_server_redeem_drop.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ func (k msgServer) RedeemDrop(goCtx context.Context, msg *types.MsgRedeemDrop) (
return nil, sdkerrors.Wrapf(types.ErrDropNotFound, "%s", msg.Uid)
}

if !drop.Active {
return nil, sdkerrors.Wrapf(types.ErrDropNotActive, "%s", msg.Uid)
}

if drop.Owner != msg.Creator {
return nil, sdkerrors.Wrapf(types.ErrNotDrops, "%s", msg.Uid)
}
Expand Down
4 changes: 4 additions & 0 deletions x/market/keeper/msg_server_redeem_drop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ func TestRedeemDrop(t *testing.T) {
require.NoError(t, redeemdropErr2)
require.Contains(t, rd2.GetCreator(), createRedeemDropResponse2.String())

// Validate RedeemDrop Duplicate Error
_, redeemdropErr3 := keeper.NewMsgServerImpl(*testInput.MarketKeeper).RedeemDrop(sdk.WrapSDKContext(testInput.Context), &rd2)
require.Error(t, redeemdropErr3)

// Validate GetPool After Redeem Drop
rst, found = testInput.MarketKeeper.GetPool(testInput.Context, pair)
require.True(t, found)
Expand Down
2 changes: 2 additions & 0 deletions x/market/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ var (
ErrProductInvalid = sdkerrors.Register(ModuleName, 21, "product less than beg") // nolint: gomnd
// ErrDenomExists - denom already exists
ErrDenomExists = sdkerrors.Register(ModuleName, 22, "denom already exists") // nolint: gomnd
// DropNotActive - drop is no longer active
ErrDropNotActive = sdkerrors.Register(ModuleName, 23, "drop not active") // nolint: gomnd
)

0 comments on commit 1cf06bc

Please sign in to comment.