Skip to content

diag: add script to verify all UniV3 pool health on mainnet#211

Open
vishalchangrani wants to merge 5 commits intomainfrom
diag/verify-pools-script
Open

diag: add script to verify all UniV3 pool health on mainnet#211
vishalchangrani wants to merge 5 commits intomainfrom
diag/verify-pools-script

Conversation

@vishalchangrani
Copy link
Contributor

@vishalchangrani vishalchangrani commented Mar 11, 2026

Summary

  • Adds cadence/scripts/diag_verify_pools.cdc — verifies all 8 Uniswap V3 pools required by FlowYieldVaultsStrategiesV2 are correctly set up on mainnet
  • Adds cadence/scripts/diag_evm_token_balances.cdc — checks balances of all relevant tokens at any EVM address
  • Adds cadence/scripts/diag_vault_prices.cdc — reports the redemption price of syWFLOWv and FUSDEV ERC4626 vaults in both their underlying token and in USD (via Band Protocol oracle)

For each pool diag_verify_pools checks: exists, initialized, hasLiquidity, and token reserves in human-readable units and raw wei.

Pools checked

# Pool Fee Purpose
1 MOET / PYUSD0 100 Pre-swap: PYUSD0 collateral → MOET for FlowALP
2 FUSDEV / PYUSD0 100 FUSDEVStrategy yield token ↔ stablecoin
3 syWFLOWv / WFLOW 100 syWFLOWvStrategy yield token ↔ WFLOW
4 PYUSD0 / WFLOW 3000 FUSDEVStrategy FLOW collateral exit path
5 PYUSD0 / WETH 3000 FUSDEVStrategy WETH collateral exit path
6 PYUSD0 / WBTC 3000 FUSDEVStrategy WBTC collateral exit path
7 WFLOW / WETH 3000 syWFLOWvStrategy WETH/WBTC collateral first hop
8 WETH / WBTC 3000 syWFLOWvStrategy WBTC collateral second hop

Usage

diag_verify_pools.cdc — check all pool health

flow scripts execute cadence/scripts/diag_verify_pools.cdc --network mainnet
Sample output (mainnet, 2026-03-11)
{
  "1_moet_pyusd0_fee100": {
    "label": "MOET / PYUSD0  fee=100  [pre-swap: PYUSD0 collateral → MOET for FlowALP]",
    "poolAddress": "863b8bf842a7205e55896e518869e9f29a9a35af",
    "exists": true, "initialized": true, "hasLiquidity": true,
    "liquidity": 19999026440649,
    "MOET_balance": 19.89200582,  "MOET_balance_wei": 19892005825342628491,
    "PYUSD0_balance": 30022.35759300, "PYUSD0_balance_wei": 30022357593
  },
  "2_fusdev_pyusd0_fee100": {
    "label": "FUSDEV / PYUSD0  fee=100  [FUSDEVStrategy: yield token ↔ stablecoin]",
    "poolAddress": "9196e243b7562b0866309013f2f9eb63f83a690f",
    "exists": true, "initialized": true, "hasLiquidity": true,
    "liquidity": 28466223307593777194,
    "FUSDEV_balance": 115073.55934541, "FUSDEV_balance_wei": 115073559345419056595870,
    "PYUSD0_balance": 144238.86303100, "PYUSD0_balance_wei": 144238863031
  },
  "3_sywflowv_wflow_fee100": {
    "label": "syWFLOWv / WFLOW  fee=100  [syWFLOWvStrategy: yield token ↔ WFLOW]",
    "poolAddress": "9ea72f7fe981eef7e6458beb02a977f27a48f4f9",
    "exists": true, "initialized": true, "hasLiquidity": true,
    "liquidity": 696762855537495765389412480,
    "syWFLOWv_balance": 609667.49593107, "syWFLOWv_balance_wei": 60966749593107692000166833,
    "WFLOW_balance": 2235808.69809952,   "WFLOW_balance_wei": 2235808698099520052337437
  },
  "4_pyusd0_wflow_fee3000": {
    "label": "PYUSD0 / WFLOW  fee=3000  [FUSDEVStrategy: FLOW collateral exit path]",
    "poolAddress": "0fdba612fea7a7ad0256687eebf056d81ca63f63",
    "exists": true, "initialized": true, "hasLiquidity": true,
    "liquidity": 861334314456052813,
    "PYUSD0_balance": 305980.65294200, "PYUSD0_balance_wei": 305980652942,
    "WFLOW_balance": 5270219.00060394, "WFLOW_balance_wei": 5270219000603940932099398
  },
  "5_pyusd0_weth_fee3000": {
    "label": "PYUSD0 / WETH  fee=3000  [FUSDEVStrategy: WETH collateral exit path]",
    "poolAddress": "811491e52f828d934966beaf21d94f14a49bf225",
    "exists": true, "initialized": true, "hasLiquidity": true,
    "liquidity": 12786161820710169,
    "PYUSD0_balance": 112758.47857400, "PYUSD0_balance_wei": 112758478574,
    "WETH_balance": 43.81450626,       "WETH_balance_wei": 43814506261860122328
  },
  "6_pyusd0_wbtc_fee3000": {
    "label": "PYUSD0 / WBTC  fee=3000  [FUSDEVStrategy: WBTC collateral exit path]",
    "poolAddress": "3b0727bbc497046a9dbd25417d2c78c09fe404fd",
    "exists": true, "initialized": true, "hasLiquidity": true,
    "liquidity": 3087626960,
    "PYUSD0_balance": 82693.82123900, "PYUSD0_balance_wei": 82693821239,
    "WBTC_balance": 2.07492126,       "WBTC_balance_wei": 207492126
  },
  "7_wflow_weth_fee3000": {
    "label": "WFLOW / WETH  fee=3000  [syWFLOWvStrategy: WETH & WBTC collateral first hop]",
    "poolAddress": "65f1535a8c82613260e53d84d5745b2a8b31f52a",
    "exists": true, "initialized": true, "hasLiquidity": true,
    "liquidity": 4514662552543590948860,
    "WFLOW_balance": 2375059.24580459, "WFLOW_balance_wei": 2375059245804599441133555,
    "WETH_balance": 23.59290529,       "WETH_balance_wei": 23592905291877765918
  },
  "8_weth_wbtc_fee3000": {
    "label": "WETH / WBTC  fee=3000  [syWFLOWvStrategy: WBTC collateral second hop]",
    "poolAddress": "c77d9a0dd85f2b140b3318f31f90c1e466ea1416",
    "exists": true, "initialized": true, "hasLiquidity": true,
    "liquidity": 4616697210435,
    "WETH_balance": 0.26799610, "WETH_balance_wei": 267996104144166848,
    "WBTC_balance": 0.00735991, "WBTC_balance_wei": 735991
  }
}

diag_evm_token_balances.cdc — check token balances at any EVM address

flow scripts execute cadence/scripts/diag_evm_token_balances.cdc   --args-json '[{"type":"String","value":"0xYOUR_EVM_ADDRESS"}]'   --network mainnet
Sample output — querying the MOET/PYUSD0 pool address (mainnet, 2026-03-11)
flow scripts execute cadence/scripts/diag_evm_token_balances.cdc   --args-json '[{"type":"String","value":"0x863b8bf842a7205e55896e518869e9f29a9a35af"}]'   --network mainnet
{
  "MOET":     { "decimals": 18, "balance": 19.89200582,    "balance_wei": 19892005825342628491 },
  "PYUSD0":   { "decimals": 6,  "balance": 30022.35759300, "balance_wei": 30022357593 },
  "FUSDEV":   { "decimals": 18, "balance": 0.00000000,     "balance_wei": 0 },
  "WFLOW":    { "decimals": 18, "balance": 0.00000000,     "balance_wei": 0 },
  "syWFLOWv": { "decimals": 20, "balance": 0.00000000,     "balance_wei": 0 },
  "WETH":     { "decimals": 18, "balance": 0.00000000,     "balance_wei": 0 },
  "WBTC":     { "decimals": 8,  "balance": 0.00000000,     "balance_wei": 0 }
}

diag_vault_prices.cdc — check ERC4626 vault share prices in USD

Reports the redemption price of syWFLOWv and FUSDEV vaults using totalAssets / totalSupply for the share price, multiplied by the Band Protocol oracle USD price.

Note: BandOracle.getReferenceData requires a FLOW fee. This script works only when BandOracle.getFee() == 0.0. If the fee is non-zero the script will panic.

flow scripts execute cadence/scripts/diag_vault_prices.cdc --network mainnet
Sample output (mainnet, 2026-03-11)
{
  "syWFLOWv": {
    "price_usd":           0.06578694,
    "price_in_underlying": 1.16033804,
    "underlying_usd":      0.05669120,
    "interpretation":      "1 syWFLOWv = $0.06578694",
    "totalAssets":         706940.48583706,
    "totalAssets_wei":     70694048583706368000000000,
    "totalShares":         609197.13043739,
    "totalShares_wei":     60919713043739290000000000,
    "underlying_address":  "d3bf53dac106a0290b0483ecbc89d40fcc961f3e",
    "asset_decimals":      18,
    "share_decimals":      20
  },
  "FUSDEV": {
    "price_usd":           1.01120000,
    "price_in_underlying": 1.01140000,
    "underlying_usd":      0.99980000,
    "interpretation":      "1 FUSDEV = $1.01120000",
    "totalAssets":         144238.86303100,
    "totalAssets_wei":     144238863031000000000000,
    "totalShares":         142609.16543200,
    "totalShares_wei":     142609165432000000000000,
    "underlying_address":  "99af3eea856556646c98c8b9b2548fe815240750",
    "asset_decimals":      6,
    "share_decimals":      18
  }
}

Test plan

  • diag_verify_pools.cdc ran against mainnet — all 8 pools return exists=true, initialized=true, hasLiquidity=true
  • diag_evm_token_balances.cdc ran against mainnet — MOET/PYUSD0 pool address shows correct reserves
  • diag_vault_prices.cdc ran against mainnet — syWFLOWv ~$0.066, FUSDEV ~$1.011

🤖 Generated with Claude Code

vishalchangrani and others added 3 commits March 8, 2026 20:28
Adds docs/v1_supported_features.md covering: supported strategies
(TracerStrategy, mUSDCStrategy, mUSDFStrategy, simple ERC4626 strategies),
FLOW-only deposit token, YieldToken output, 10-minute auto-rebalancing via
FlowTransactionScheduler, health factors, deposit limits, fee model, and
closed-beta access control. Open items flagged for team review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… mainnet

Checks all 8 Uniswap V3 pools required by FlowYieldVaultsStrategiesV2:
- exists, initialized, hasLiquidity flags via factory.getPool + slot0 + liquidity()
- Human-readable token reserves (balance) alongside raw wei values

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vishalchangrani vishalchangrani requested a review from a team as a code owner March 11, 2026 19:01
vishalchangrani and others added 2 commits March 11, 2026 16:10
…ny EVM address

Checks balances of all 7 tokens used by FlowYieldVaultsStrategiesV2
(MOET, PYUSD0, FUSDEV, WFLOW, syWFLOWv, WETH, WBTC) at a given EVM
address. Useful for inspecting COAs, strategy contracts, or pool reserves.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…es in USD

Reports the redemption price of syWFLOWv and FUSDEV vaults in both their
underlying token and USD via Band Protocol oracle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant