Skip to content

Commit c2e1bc4

Browse files
committed
os amo supply fix
1 parent f31ef14 commit c2e1bc4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/sonic/os.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { parseEther } from 'viem'
22

3+
import * as erc20 from '@abi/erc20'
34
import * as initializableAbstractStrategyAbi from '@abi/initializable-abstract-strategy'
45
import { createOTokenActivityProcessor } from '@templates/otoken/activity-processor/activity-processor'
56
import { createOTokenProcessor2 } from '@templates/otoken/otoken-2'
@@ -57,7 +58,13 @@ const otokenProcessor = createOTokenProcessor2({
5758
{ height },
5859
sonicAddresses.OS.amoSwapX.strategy.address,
5960
)
60-
return contract.checkBalance(sonicAddresses.tokens.wS)
61+
const balance = await contract.checkBalance(sonicAddresses.tokens.wS)
62+
const ws = new erc20.Contract(ctx, { height }, sonicAddresses.tokens.wS)
63+
const os = new erc20.Contract(ctx, { height }, sonicAddresses.tokens.OS)
64+
const wsBalance = await ws.balanceOf(sonicAddresses.OS.amoSwapX.pool)
65+
const osBalance = await os.balanceOf(sonicAddresses.OS.amoSwapX.pool)
66+
const ratio = (osBalance * 10n ** 18n) / (osBalance + wsBalance)
67+
return (balance * ratio) / 10n ** 18n
6168
},
6269
})
6370

0 commit comments

Comments
 (0)