diff --git a/src/pages/earn/index.svelte b/src/pages/earn/index.svelte index 81ee07c1..047aed14 100644 --- a/src/pages/earn/index.svelte +++ b/src/pages/earn/index.svelte @@ -78,6 +78,23 @@ } ) + const maturedBalance: Readable = derived( + [currentAccount, stateREX, systemToken], + ([$currentAccount, $stateREX, $systemToken]) => { + let value = 0 + if ($currentAccount && $currentAccount.rex_info && $stateREX && $stateREX.value) { + if ($stateREX.value === 0.0001) { + value = + ($stateREX.total_lendable.value / $stateREX.total_rex.value) * + Number($currentAccount.rex_info.matured_rex) + } else { + value = $stateREX.value * Number($currentAccount.rex_info.matured_rex) + } + } + return Asset.fromUnits(value, $systemToken!.symbol) + } + ) + const rexToken: Readable = derived( [systemToken, rexBalance], ([$systemToken, $rexBalance]) => { @@ -248,6 +265,7 @@ /> {:else if $step === Step.Overview} switchStep(Step.Stake)} toUnstake={() => switchStep(Step.Unstake)} @@ -263,7 +281,7 @@ toStakeConfirm(Step.Unstake)} /> {:else if $step === Step.Confirm} diff --git a/src/pages/earn/step/overview.svelte b/src/pages/earn/step/overview.svelte index 097b7430..57230a3c 100644 --- a/src/pages/earn/step/overview.svelte +++ b/src/pages/earn/step/overview.svelte @@ -3,6 +3,7 @@ import Button from '~/components/elements/button.svelte' + export let maturedBalance: Asset export let rexBalance: Asset export let toStake: () => void export let toUnstake: () => void @@ -96,7 +97,8 @@
currently staked balance
- {rexBalance} + {maturedBalance.value} / {rexBalance.value} + {rexBalance.symbol.name}