Skip to content

Commit

Permalink
Hotfix/my shares calculation (#2893)
Browse files Browse the repository at this point in the history
* Only add totalLockedshares when pool is veBal

* Bump version
  • Loading branch information
agualis authored Feb 21, 2023
1 parent d4c2e58 commit dbb16ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@balancer-labs/frontend-v2",
"version": "1.90.4",
"version": "1.90.5",
"engines": {
"node": "=16",
"npm": ">=8"
Expand Down
13 changes: 9 additions & 4 deletions src/composables/useUserPoolPercentage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@ export function useUserPoolPercentage(pool: Ref<Pool>) {
const { balanceFor } = useTokens();
const { stakedShares } = usePoolStaking();

const isVeBal = computed(() => isVeBalPool(pool.value.id));

const { totalLockedShares } = useLock({
// Avoid lock queries when pool is not veBAL:
enabled: isVeBalPool(pool.value.id),
enabled: isVeBal.value,
});
const { fNum } = useNumbers();

const userPoolPercentage = computed(() => {
const bptBalance = bnum(balanceFor(pool.value.address))
.plus(stakedShares.value)
.plus(totalLockedShares.value);
let bptBalance = bnum(balanceFor(pool.value.address)).plus(
stakedShares.value
);
if (isVeBal.value && totalLockedShares.value) {
bptBalance = bptBalance.plus(totalLockedShares.value);
}
return bptBalance.div(bnum(pool.value.totalShares)).multipliedBy(100);
});

Expand Down

0 comments on commit dbb16ec

Please sign in to comment.