Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display paired token rewards per pool for an LP address #860

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app",
"version": "2.14.28",
"version": "2.14.29",
"private": true,
"scripts": {
"bump": "bump patch --tag --commit 'testnet release '",
Expand Down
8 changes: 8 additions & 0 deletions app/src/business/services/DataService/DataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type UserRewards = {
export type LPUserReward = {
poolLPDistributionReceivedInRowan: number;
poolRewardsReceivedInRowan: number;
poolRewardsReceivedInPairedToken: number;
};

export type LPUserRewards = {
Expand All @@ -72,6 +73,7 @@ export type LPUserRewards = {
totalRewardsReceivedInRowan: string;
poolLPDistributionReceivedInRowan: string;
poolRewardsReceivedInRowan: string;
poolRewardsReceivedInPairedToken: number;
};

export type LPUserRewardsResponse = {
Expand Down Expand Up @@ -298,14 +300,17 @@ export default class DataService {
poolLPDistributionReceivedInRowan: Math.random() * 10000,

poolRewardsReceivedInRowan: Math.random() * 10000,
poolRewardsReceivedInPairedToken: Math.random() * 10000,
},
ujuno: {
poolLPDistributionReceivedInRowan: Math.random() * 10000,
poolRewardsReceivedInRowan: Math.random() * 10000,
poolRewardsReceivedInPairedToken: Math.random() * 10000,
},
uatom: {
poolLPDistributionReceivedInRowan: Math.random() * 10000,
poolRewardsReceivedInRowan: Math.random() * 10000,
poolRewardsReceivedInPairedToken: Math.random() * 10000,
},
},
},
Expand All @@ -332,6 +337,9 @@ export default class DataService {
poolRewardsReceivedInRowan: Number(
entry.poolRewardsReceivedInRowan,
),
poolRewardsReceivedInPairedToken: Number(
entry.poolRewardsReceivedInPairedToken,
),
},
}),
{},
Expand Down
15 changes: 15 additions & 0 deletions app/src/views/PoolPage/PoolItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,21 @@ export default defineComponent({
],
...(this.lppdRewards
? [
Boolean(this.lppdRewards.poolRewardsReceivedInPairedToken) && [
<span class="flex items-center gap-1">
Your total rewards paid in the pool in the paired token
</span>,
<span class="flex items-center font-mono">
{prettyNumber(
this.lppdRewards.poolRewardsReceivedInPairedToken,
)}
<TokenIcon
assetValue={this.externalAmount.asset}
size={14}
class="ml-[3px]"
/>
</span>,
],
Boolean(
this.isLPDActive &&
this.lppdRewards.poolLPDistributionReceivedInRowan,
Expand Down
8 changes: 5 additions & 3 deletions app/src/views/PoolPage/usePoolPageData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,11 @@ export const usePoolPageData = () => {
);

const pool = useCore().store.pools[poolKey];

const denomOrSymbol =
pool.externalAmount.ibcDenom ?? pool.externalAmount.symbol;
const ibcDenom =
tokenRegistryEntriesQuery.data.value?.registry?.entries.find(
(y) => y.baseDenom === pool.externalAmount.symbol,
)?.denom;
const denomOrSymbol = ibcDenom ?? pool.externalAmount.symbol;
Comment on lines +183 to +187

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind explaining this? thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to introduce this code to get ibc hash of external token. For some reason it wasn't available as part of pool.externalAmount.ibcDenom


const lppdPoolRewards = lppdRewards?.value?.hasRewards
? lppdRewards.value.rewards.byPool[denomOrSymbol]
Expand Down
Loading