Skip to content

Commit

Permalink
fix: unrug cosmos SDK rewards (#5213)
Browse files Browse the repository at this point in the history
  • Loading branch information
gomesalexandre authored Sep 4, 2023
1 parent ef0e964 commit 94bd9aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/chain-adapters/src/cosmossdk/CosmosSdkBaseAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,13 @@ export abstract class CosmosSdkBaseAdapter<T extends CosmosSdkChainId> implement

const rewards = data.rewards.map<ValidatorReward>(validatorReward => ({
validator: transformValidator(validatorReward.validator),
rewards: validatorReward.rewards.map<Reward>(reward => ({
assetId: this.assetId,
amount: reward.amount,
})),
rewards: validatorReward.rewards
// We only support same-denom rewards for now
.filter(reward => reward.denom === this.denom)
.map<Reward>(reward => ({
assetId: this.assetId,
amount: reward.amount,
})),
}))

const assets = data.assets.map<CosmosSDKToken>(asset => ({
Expand Down
1 change: 1 addition & 0 deletions src/state/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export const migrations = {
1: clearOpportunities,
2: clearPortfolio,
3: clearOpportunities,
4: clearOpportunities,
}

0 comments on commit 94bd9aa

Please sign in to comment.