Skip to content

Commit 9c15668

Browse files
committed
fix oethb curve amo supply calculation
1 parent c7e4bd0 commit 9c15668

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/base/strategies.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const baseCurveAMO: IStrategyData = {
1313
kind: 'CurveAMO',
1414
curvePoolInfo: {
1515
poolAddress: '0x302a94e3c28c290eaf2a4605fc52e11eb915f378',
16+
gaugeAddress: '0x9da8420dbeebdfc4902b356017610259ef7eedd8',
1617
rewardsPoolAddress: '0x9da8420dbeebdfc4902b356017610259ef7eedd8',
1718
},
1819
base: { address: baseAddresses.tokens.WETH, decimals: 18 },

src/base/super-oeth-b.ts

+26-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ const otokenProcessor = createOTokenProcessor2({
4444
},
4545
],
4646
getAmoSupply: async (ctx, height) => {
47+
// Aerodrome Calculation
48+
// =================
4749
const positions = await getPositions(
4850
ctx,
4951
height,
@@ -55,9 +57,32 @@ const otokenProcessor = createOTokenProcessor2({
5557
(acc, position) => acc + BigInt(position.amount1) + BigInt(position.staked1),
5658
0n,
5759
)
60+
// =================
5861

62+
// Curve Calculation
63+
// =================
64+
// Our OETHb AMO balance = Pool OETHb balance * Gauge Pool Ownership * AMO Gauge Ownership
65+
// Pool OETHb Balance
5966
const superOETHb = new erc20Abi.Contract(ctx, { height }, baseAddresses.superOETHb.address)
60-
const curveAmoBalance = await superOETHb.balanceOf(baseCurveAMO.curvePoolInfo!.poolAddress)
67+
const poolOETHbBalance = await superOETHb.balanceOf(baseCurveAMO.curvePoolInfo!.poolAddress)
68+
69+
// Gauge Pool Ownership
70+
const curvePool = new erc20Abi.Contract(ctx, { height }, baseCurveAMO.curvePoolInfo!.poolAddress)
71+
const curvePoolSupply = await curvePool.totalSupply()
72+
const curveGauge = new erc20Abi.Contract(ctx, { height }, baseCurveAMO.curvePoolInfo!.gaugeAddress!)
73+
const curveGaugeSupply = await curveGauge.totalSupply()
74+
const gaugePoolOwnership = (curveGaugeSupply * 10n ** 18n) / curvePoolSupply
75+
76+
// AMO Gauge Ownership
77+
const amoGaugeBalance = await curveGauge.balanceOf(baseCurveAMO.address)
78+
const amoGaugeOwnership = (amoGaugeBalance * 10n ** 18n) / curveGaugeSupply
79+
80+
// AMO Ownership
81+
const amoOwnership = (gaugePoolOwnership * amoGaugeOwnership) / 10n ** 18n
82+
83+
// AMO OETHb Balance
84+
const curveAmoBalance = (poolOETHbBalance * amoOwnership) / 10n ** 18n
85+
// =================
6186

6287
return aerodromeAMO + curveAmoBalance
6388
},

src/templates/strategy/strategy.ts

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export type IBalancerPoolInfo = {
1919

2020
export type ICurveAMOInfo = {
2121
poolAddress: string
22+
gaugeAddress?: string
2223
rewardsPoolAddress: string
2324
}
2425

0 commit comments

Comments
 (0)