Skip to content

Commit

Permalink
fix(billing): fix usdc balance calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed Dec 30, 2024
1 parent d2f4086 commit 18b6ef3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions apps/deploy-web/src/hooks/useWalletBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@ export const useWalletBalance = (): WalletBalanceReturnType => {
udenomToUsd(d.escrowAccount.balance.amount, d.escrowAccount.balance.denom),
0
);
const { deploymentGrant, deploymentGrantsUAKT, deploymentEscrowUAKT } = balances;
const { deploymentGrant } = balances;
const totalDeploymentGrantsUSD = deploymentGrant
? udenomToUsd(deploymentGrant.authorization.spend_limit.amount, deploymentGrant.authorization.spend_limit.denom)
: 0;

setWalletBalance({
totalUsd: aktUsdValue + totalUsdcValue + totalDeploymentEscrowUSD + totalDeploymentGrantsUSD,
balanceUAKT: balances.balanceUAKT + deploymentGrantsUAKT,
balanceUUSDC: balances.balanceUUSDC + deploymentEscrowUAKT,
totalUAKT: balances.balanceUAKT + balances.deploymentEscrowUAKT + deploymentGrantsUAKT,
totalUUSDC: balances.balanceUUSDC + balances.deploymentEscrowUUSDC + deploymentEscrowUAKT,
balanceUAKT: balances.balanceUAKT + balances.deploymentGrantsUAKT,
balanceUUSDC: balances.balanceUUSDC + balances.deploymentGrantsUUSDC,
totalUAKT: balances.balanceUAKT + balances.deploymentEscrowUAKT + balances.deploymentGrantsUAKT,
totalUUSDC: balances.balanceUUSDC + balances.deploymentEscrowUUSDC + balances.deploymentGrantsUUSDC,
totalDeploymentEscrowUAKT: balances.deploymentEscrowUAKT,
totalDeploymentEscrowUUSDC: balances.deploymentEscrowUUSDC,
totalDeploymentEscrowUSD: totalDeploymentEscrowUSD,
totalDeploymentGrantsUAKT: deploymentGrantsUAKT,
totalDeploymentGrantsUUSDC: deploymentEscrowUAKT,
totalDeploymentEscrowUSD: balances.totalDeploymentEscrowUSD,
totalDeploymentGrantsUAKT: balances.deploymentGrantsUAKT,
totalDeploymentGrantsUUSDC: balances.deploymentEscrowUAKT,
totalDeploymentGrantsUSD: totalDeploymentGrantsUSD
});
}
Expand Down

0 comments on commit 18b6ef3

Please sign in to comment.