Skip to content

Commit

Permalink
SOV-3360: corrected dummy rbtc claiming (#2580)
Browse files Browse the repository at this point in the history
fix: corrected dummy rbtc claiming
  • Loading branch information
creed-victor authored Oct 19, 2023
1 parent 20c77bf commit 5aa7298
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
25 changes: 24 additions & 1 deletion src/app/pages/RewardPage/components/FeesEarnedTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@ export const FeesEarnedTab: React.FC<IFeesEarnedTabProps> = ({

const isClaimDisabled = useMemo(() => tx.loading, [tx.loading]);

const fees = useMemo(
() =>
earnedFees.reduce((p, c) => {
const asset = c.asset;
const index = p.findIndex(i => i.asset === asset);
if (index === -1) {
p.push({
asset,
value: c.value,
rbtcValue: c.rbtcValue,
contractAddress: c.contractAddress,
});
} else {
p[index].value = bignumber(p[index].value).add(c.value).toString();
p[index].rbtcValue = bignumber(p[index].rbtcValue)
.add(c.rbtcValue)
.toNumber();
}
return p;
}, [] as IEarnedFee[]),
[earnedFees],
);

return (
<div className="tw-flex tw-flex-col tw-w-full tw-justify-center tw-items-center">
<div className={styles['tab-main-section']}>
Expand Down Expand Up @@ -100,7 +123,7 @@ export const FeesEarnedTab: React.FC<IFeesEarnedTabProps> = ({
</tr>
</thead>
<tbody>
{earnedFees.map(earnedFee => (
{fees.map(earnedFee => (
<FeesEarnedClaimRow
amountToClaim={earnedFee.value}
contractAddress={earnedFee.contractAddress}
Expand Down
5 changes: 4 additions & 1 deletion src/app/pages/RewardPage/hooks/useGetFeesEarned.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ export const useGetFeesEarned = (): {
const results = tokens.map(
token =>
({
asset: assetByTokenAddress(token) || assetByLoanTokenAddress(token),
asset:
assetByTokenAddress(token) ||
assetByLoanTokenAddress(token) ||
Asset.RBTC,
contractAddress: token,
value: amounts.returnData[token].toString(),
rbtcValue: 0,
Expand Down

0 comments on commit 5aa7298

Please sign in to comment.