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

fix: remove rex profits from balance breakdown #688

Merged
merged 1 commit into from
Apr 17, 2023
Merged
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
23 changes: 4 additions & 19 deletions src/components/AccountCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ export default defineComponent({
};

const loadBalances = async () => {
const { staked, profits } = await getRexBalance();
const total = await getRexBalance();
rexDeposits.value = await getRexFund();
rexStaked.value = staked;
rexProfits.value = profits;
rexStaked.value = total;
};

const loadResources = () => {
Expand Down Expand Up @@ -254,14 +253,11 @@ export default defineComponent({

const rexBal = ((await api.getTableRows(paramsrexbal)) as RexbalRows)
.rows[0];

const totalRexBalance =
rexBal?.rex_balance
? Number(rexBal.rex_balance.split(' ')[0])
: 0;
const staked =
rexBal?.vote_stake
? Number(rexBal.vote_stake.split(' ')[0])
: 0;

const paramsrexpool = {
code: 'eosio',
Expand All @@ -279,12 +275,7 @@ export default defineComponent({
const tlosRexRatio = totalRex > 0 ? totalLendable / totalRex : 1;

const total = totalRex > 0 ? tlosRexRatio * totalRexBalance : 0.0;
const profits = total - staked;
return {
total,
profits,
staked,
};
return total;
};

const fixDec = (val: number): number => parseFloat(val.toFixed(3));
Expand Down Expand Up @@ -349,7 +340,6 @@ export default defineComponent({
totalTokens.value = '--';
stakedResources.value = delegatedByOthers.value = 0;
rexStaked.value = 0;
rexProfits.value = 0;
rexDeposits.value = 0;
};

Expand Down Expand Up @@ -395,7 +385,6 @@ export default defineComponent({
totalValueString,
rex,
rexStaked,
rexProfits,
rexDeposits,
none,
system_account,
Expand Down Expand Up @@ -560,10 +549,6 @@ export default defineComponent({
<td class="text-left">REX staked (includes savings)</td>
<td class="text-right">{{ formatAsset(rexStaked) }}</td>
</tr>
<tr>
<td class="text-left">REX profits</td>
<td class="text-right">{{ formatAsset(rexProfits) }}</td>
</tr>
<tr>
<td class="text-left">REX liquid deposits</td>
<td class="text-right">{{ formatAsset(rexDeposits) }}</td>
Expand Down