Skip to content

Commit c4bf788

Browse files
authored
Erc4626 6 decimal asset support (#4623)
* fix: normalize erc4626 conversion rates to 18 decimals for all assets * fix: add explicity type annotations to fix bifrost typescript errors
1 parent ec03722 commit c4bf788

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

helpers/curators/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,16 @@ async function getVaultERC4626Info(options: FetchOptions, vaults: Array<string>)
146146
for (let i = 0; i < vaults.length; i++) {
147147
const asset = assets[i]
148148
if (asset) {
149+
const assetDecimals = Number(decimals[i]);
150+
const decimalAdjustment = BigInt(10 ** (18 - assetDecimals));
151+
149152
vaultInfo.push({
150153
vault: vaults[i],
151154
asset,
152155
assetDecimals: Number(decimals[i]),
153156
balance: BigInt(balances[i] ? balances[i] : 0),
154-
rateBefore: BigInt(ratesBefore[i] ? ratesBefore[i] : 0),
155-
rateAfter: BigInt(ratesAfter[i] ? ratesAfter[i] : 0),
157+
rateBefore: BigInt(ratesBefore[i] ? ratesBefore[i] : 0) * decimalAdjustment,
158+
rateAfter: BigInt(ratesAfter[i] ? ratesAfter[i] : 0) * decimalAdjustment,
156159
})
157160
}
158161
}

package-lock.json

Lines changed: 15 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)