Skip to content

Commit

Permalink
Add response fields and drop end accounting
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Dusek committed Jun 9, 2024
1 parent d870467 commit f59d680
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions x/market/keeper/msg_server_redeem_drop.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ func (k msgServer) RedeemDrop(goCtx context.Context, msg *types.MsgRedeemDrop) (
return nil, sdkError
}

// Deactivate drop
// Deactivate drop and add final accounting
drop.Active = false
drop.TimeEnd = ctx.BlockHeader().Time.Unix()
drop.Coin1End = coinOwner1
drop.Coin2End = coinOwner2
drop.ProductEnd = total1.Mul(total2)

// Set Pool Member and Drop
k.SetDrop(
Expand Down Expand Up @@ -128,5 +132,16 @@ func (k msgServer) RedeemDrop(goCtx context.Context, msg *types.MsgRedeemDrop) (
member2,
)

return &types.MsgRedeemDropResponse{}, nil
return &types.MsgRedeemDropResponse{
Creator: msg.Creator,
Uid: uid,
Pair: drop.Pair,
Drops: drop.Drops.String(),
TimeBeg: strconv.FormatInt(drop.TimeBeg, 10),
Coin1Beg: drop.Coin1Beg.String(),
Coin2Beg: drop.Coin2Beg.String(),
TimeEnd: strconv.FormatInt(drop.TimeEnd, 10),
Coin1End: coinOwner1.String(),
Coin2End: coinOwner2.String(),
}, nil
}

0 comments on commit f59d680

Please sign in to comment.