@@ -44,6 +44,8 @@ const otokenProcessor = createOTokenProcessor2({
44
44
} ,
45
45
] ,
46
46
getAmoSupply : async ( ctx , height ) => {
47
+ // Aerodrome Calculation
48
+ // =================
47
49
const positions = await getPositions (
48
50
ctx ,
49
51
height ,
@@ -55,9 +57,32 @@ const otokenProcessor = createOTokenProcessor2({
55
57
( acc , position ) => acc + BigInt ( position . amount1 ) + BigInt ( position . staked1 ) ,
56
58
0n ,
57
59
)
60
+ // =================
58
61
62
+ // Curve Calculation
63
+ // =================
64
+ // Our OETHb AMO balance = Pool OETHb balance * Gauge Pool Ownership * AMO Gauge Ownership
65
+ // Pool OETHb Balance
59
66
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
+ // =================
61
86
62
87
return aerodromeAMO + curveAmoBalance
63
88
} ,
0 commit comments