Skip to content

Commit

Permalink
Display paired token rewards per pool for an LP address (#860)
Browse files Browse the repository at this point in the history
* feat: display paired token rewards under pool details

* testnet release 2.14.29
  • Loading branch information
pgoos authored Dec 20, 2023
1 parent 045ca3a commit fc36970
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
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;

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

1 comment on commit fc36970

@vercel
Copy link

@vercel vercel bot commented on fc36970 Dec 20, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

sifchain-ui – ./

sifchain-ui-sifchain.vercel.app
dex.sifchain.finance
sifchain-ui-git-master-sifchain.vercel.app

Please sign in to comment.