Skip to content

Commit 45f436e

Browse files
committed
oethb_circ.sh
1 parent 9c15668 commit 45f436e

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

scripts/debug/oethb_circ.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
RPC_URL=
4+
BLOCK=29979726
5+
TOKEN="0xdbfefd2e8460a6ee4955a68582f85708baea60a3"
6+
CURVE_POOL="0x302a94e3c28c290eaf2a4605fc52e11eb915f378"
7+
CURVE_GAUGE="0x9da8420dbeebdfc4902b356017610259ef7eedd8"
8+
CURVE_STRATEGY="0x9cfcAF81600155e01c63e4D2993A8A81A8205829"
9+
AERO_FACTORY="0x68c19e13618c41158fe4baba1b8fb3a9c74bdb0a"
10+
AERO_ARGS="10 114 0xf611cc500eee7e4e4763a05fe623e2363c86d2af 0x5e7bb104d84c7cb9b682aac2f3d509f5f406809a"
11+
STRATEGY="0x80c864704dd06c3693ed5179190786ee38acf835"
12+
WETH="0x4200000000000000000000000000000000000006"
13+
14+
# 1. Call contract methods
15+
total_supply=$(cast call $TOKEN "totalSupply()(uint256)" -b $BLOCK -r $RPC_URL --json | jq -r '.[0]')
16+
curve_pool=$(cast call $TOKEN "balanceOf(address)(uint256)" $CURVE_POOL -b $BLOCK -r $RPC_URL --json | jq -r '.[0]')
17+
curve_pool_supply=$(cast call $CURVE_POOL "totalSupply()(uint256)" -b $BLOCK -r $RPC_URL --json | jq -r '.[0]')
18+
curve_gauge_supply=$(cast call $CURVE_GAUGE "totalSupply()(uint256)" -b $BLOCK -r $RPC_URL --json | jq -r '.[0]')
19+
curve_gauge_amo=$(cast call $CURVE_GAUGE "balanceOf(address)(uint256)" $CURVE_STRATEGY -b $BLOCK -r $RPC_URL --json | jq -r '.[0]')
20+
aero_data=$(cast call $AERO_FACTORY "positionsByFactory(uint256,uint256,address,address)" $AERO_ARGS -b $BLOCK -r $RPC_URL)
21+
woeth_bal=$(cast call $STRATEGY "checkBalance(address)(uint256)" $WETH -b $BLOCK -r $RPC_URL --json | jq -r '.[0]')
22+
23+
# 2. Extract staked1 (index 9) from aero_data
24+
staked1_hex=$(echo "$aero_data" | cut -c579-642)
25+
aero_amo=$(echo "$staked1_hex" | cast --to-dec)
26+
27+
28+
# 3. Math with bc
29+
curve_ownership=$(echo "($curve_gauge_supply * 1e18 / $curve_pool_supply) * ($curve_gauge_amo * 1e18 / $curve_gauge_supply) / 1e18" | bc)
30+
curve_amo=$(echo "$curve_pool * $curve_ownership / 1e18" | bc)
31+
sum_amo=$(echo "$curve_amo + $aero_amo" | bc)
32+
non_amo=$(echo "$total_supply - $sum_amo" | bc)
33+
adjusted=$(echo "$non_amo - $woeth_bal" | bc)
34+
35+
# 4. Output
36+
echo
37+
echo "=== Balances at block $BLOCK ==="
38+
echo "Curve Pool: $curve_pool"
39+
echo "Curve AMO ownership: $curve_ownership"
40+
echo "Curve AMO: $curve_amo"
41+
echo "Aerodrome AMO: $aero_amo"
42+
echo "Sum AMO: $sum_amo"
43+
echo
44+
echo "Strategy WETH Bal: $woeth_bal"
45+
echo
46+
echo "Total Supply: $total_supply"
47+
echo
48+
echo "Circulating Supply: $non_amo"
49+
echo " (Total - AMO) "
50+
echo "- WOETH Strat WETH: $adjusted"
51+
echo

0 commit comments

Comments
 (0)