Skip to content

Commit

Permalink
feat(iro): add denom to buy, sell and claim events (#1460)
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 authored Nov 12, 2024
1 parent 7c2a71f commit 42e2184
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 40 deletions.
6 changes: 6 additions & 0 deletions proto/dymensionxyz/dymension/iro/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ message EventBuy {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

string denom = 8;
}

message EventSell {
Expand All @@ -66,6 +68,8 @@ message EventSell {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

string denom = 8;
}

message EventClaim {
Expand All @@ -76,6 +80,8 @@ message EventClaim {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];

string denom = 5;
}

message EventSettle {
Expand Down
1 change: 1 addition & 0 deletions x/iro/keeper/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func (k Keeper) Claim(ctx sdk.Context, planId string, claimer sdk.AccAddress) er
PlanId: planId,
RollappId: plan.RollappId,
Amount: availableTokens.Amount,
Denom: plan.GetIRODenom(),
})
if err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions x/iro/keeper/trade.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func (k Keeper) Buy(ctx sdk.Context, planId string, buyer sdk.AccAddress, amount
Cost: costAmt,
TakerFee: takerFeeAmt,
ClosingPrice: plan.SpotPrice(),
Denom: plan.GetIRODenom(),
})
if err != nil {
return err
Expand Down Expand Up @@ -186,6 +187,7 @@ func (k Keeper) BuyExactSpend(ctx sdk.Context, planId string, buyer sdk.AccAddre
Cost: toSpendMinusTakerFeeAmt,
TakerFee: takerFeeAmt,
ClosingPrice: plan.SpotPrice(),
Denom: plan.GetIRODenom(),
})
if err != nil {
return err
Expand Down Expand Up @@ -247,6 +249,7 @@ func (k Keeper) Sell(ctx sdk.Context, planId string, seller sdk.AccAddress, amou
Revenue: costAmt,
TakerFee: takerFeeAmt,
ClosingPrice: plan.SpotPrice(),
Denom: plan.GetIRODenom(),
})
if err != nil {
return err
Expand Down
Loading

0 comments on commit 42e2184

Please sign in to comment.