Skip to content

Commit

Permalink
fix: use correct value for vault capacity indicator (#1465)
Browse files Browse the repository at this point in the history
* fix: use correct value for vault capacity indicator

* fix: capacity ratio when there are no backed tokens
  • Loading branch information
sander2 authored Jul 19, 2023
1 parent 013f0e0 commit 488434f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/Vaults/Vault/VaultDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const VaultDashboard = (): JSX.Element => {
<ProgressCircle
aria-label='BTC remaining capacity'
diameter='65'
value={(1 - Number(vault.remainingCapacity.ratio)) * 100}
value={100 - Number(vault.remainingCapacity.ratio)}
/>
);

Expand Down
3 changes: 2 additions & 1 deletion src/utils/hooks/api/vaults/get-vault-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ interface VaultData {
};
}

// note: returns percentage, so range is 0-100
const getRemainingCapacity = (issuableTokens: Big, vaultExt: VaultExt): number => {
if (!issuableTokens.gt(0)) return 0;

const backedTokens = vaultExt.getBackedTokens().toBig();

if (!backedTokens.gt(0)) return 1;
if (!backedTokens.gt(0)) return 100;

const totalTokens = issuableTokens.add(backedTokens);

Expand Down

2 comments on commit 488434f

@vercel
Copy link

@vercel vercel bot commented on 488434f Jul 19, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 488434f Jul 19, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.