Skip to content

Commit

Permalink
Add denom to IRO buy, sell and claim events
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 committed Nov 11, 2024
1 parent c7a8a2c commit 098bdf9
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.SettledDenom,
})
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.SettledDenom,
})
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.SettledDenom,
})
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.SettledDenom,
})
if err != nil {
return err
Expand Down
Loading

0 comments on commit 098bdf9

Please sign in to comment.