From 2407255989207e90287ef8a71f4d59d0a7b575c6 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 27 Sep 2023 12:08:26 +0200 Subject: [PATCH] fix: use bank decimals to scale emissions calc --- packages/marginfi-client-v2/src/models/balance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/marginfi-client-v2/src/models/balance.ts b/packages/marginfi-client-v2/src/models/balance.ts index 5795f5dbfc..58c4faacd2 100644 --- a/packages/marginfi-client-v2/src/models/balance.ts +++ b/packages/marginfi-client-v2/src/models/balance.ts @@ -142,7 +142,7 @@ class Balance { const lastUpdate = this.lastUpdate; const period = new BigNumber(currentTimestamp - lastUpdate); const emissionsRate = new BigNumber(bank.emissionsRate); - const emissions = period.times(balanceAmount).times(emissionsRate).div(31_536_000_000_000); + const emissions = period.times(balanceAmount).times(emissionsRate).div(31_536_000 * Math.pow(10, bank.mintDecimals)); const emissionsReal = BigNumber.min(emissions, new BigNumber(bank.emissionsRemaining)); return emissionsReal;