@lidofinance/lsv-cli 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/abi/Dashboard.d.ts +291 -3
- package/dist/abi/Dashboard.js +10 -3
- package/dist/abi/Dashboard.js.map +1 -1
- package/dist/abi/LazyOracle.d.ts +364 -0
- package/dist/abi/LazyOracle.js +2 -0
- package/dist/abi/LazyOracle.js.map +1 -1
- package/dist/abi/OperatorGrid.d.ts +24 -0
- package/dist/abi/OperatorGrid.js +16 -0
- package/dist/abi/OperatorGrid.js.map +1 -1
- package/dist/abi/PredepositGuarantee.d.ts +357 -88
- package/dist/abi/PredepositGuarantee.js +31 -28
- package/dist/abi/PredepositGuarantee.js.map +1 -1
- package/dist/abi/ValidatorConsolidationRequests.d.ts +121 -0
- package/dist/abi/ValidatorConsolidationRequests.js +159 -0
- package/dist/abi/ValidatorConsolidationRequests.js.map +1 -0
- package/dist/abi/VaultFactory.d.ts +16 -0
- package/dist/abi/VaultViewer.d.ts +8 -14
- package/dist/abi/VaultViewer.js +10 -19
- package/dist/abi/VaultViewer.js.map +1 -1
- package/dist/abi/defi-wrapper/Distributor.d.ts +40 -2
- package/dist/abi/defi-wrapper/Distributor.js +52 -2
- package/dist/abi/defi-wrapper/Distributor.js.map +1 -1
- package/dist/abi/defi-wrapper/Factory.d.ts +973 -550
- package/dist/abi/defi-wrapper/Factory.js +720 -763
- package/dist/abi/defi-wrapper/Factory.js.map +1 -1
- package/dist/abi/defi-wrapper/StvPool.d.ts +121 -325
- package/dist/abi/defi-wrapper/StvPool.js +143 -413
- package/dist/abi/defi-wrapper/StvPool.js.map +1 -1
- package/dist/abi/defi-wrapper/StvStETHPool.d.ts +398 -381
- package/dist/abi/defi-wrapper/StvStETHPool.js +448 -433
- package/dist/abi/defi-wrapper/StvStETHPool.js.map +1 -1
- package/dist/abi/defi-wrapper/WithdrawalQueue.d.ts +309 -175
- package/dist/abi/defi-wrapper/WithdrawalQueue.js +381 -206
- package/dist/abi/defi-wrapper/WithdrawalQueue.js.map +1 -1
- package/dist/abi/defi-wrapper/index.d.ts +0 -1
- package/dist/abi/defi-wrapper/index.js +0 -1
- package/dist/abi/defi-wrapper/index.js.map +1 -1
- package/dist/abi/index.d.ts +1 -0
- package/dist/abi/index.js +1 -0
- package/dist/abi/index.js.map +1 -1
- package/dist/command/index.js +1 -0
- package/dist/command/index.js.map +1 -1
- package/dist/configs/constants.d.ts +44 -2
- package/dist/configs/constants.js +2 -2
- package/dist/configs/constants.js.map +1 -1
- package/dist/configs/deployed.d.ts +2 -2
- package/dist/configs/deployed.js +67 -6
- package/dist/configs/deployed.js.map +1 -1
- package/dist/configs/index.d.ts +4 -3
- package/dist/configs/index.js +4 -3
- package/dist/configs/index.js.map +1 -1
- package/dist/configs/utils.d.ts +1 -0
- package/dist/configs/utils.js +8 -0
- package/dist/configs/utils.js.map +1 -1
- package/dist/contracts/dashboard-impl.d.ts +2 -2
- package/dist/contracts/dashboard-impl.js +3 -2
- package/dist/contracts/dashboard-impl.js.map +1 -1
- package/dist/contracts/dashboard.d.ts +2 -2
- package/dist/contracts/dashboard.js +3 -2
- package/dist/contracts/dashboard.js.map +1 -1
- package/dist/contracts/defi-wrapper/distributor.d.ts +1 -1
- package/dist/contracts/defi-wrapper/distributor.js +3 -2
- package/dist/contracts/defi-wrapper/distributor.js.map +1 -1
- package/dist/contracts/defi-wrapper/factory.d.ts +1 -1
- package/dist/contracts/defi-wrapper/factory.js +3 -2
- package/dist/contracts/defi-wrapper/factory.js.map +1 -1
- package/dist/contracts/defi-wrapper/index.d.ts +0 -1
- package/dist/contracts/defi-wrapper/index.js +0 -1
- package/dist/contracts/defi-wrapper/index.js.map +1 -1
- package/dist/contracts/defi-wrapper/stv-pool.d.ts +2 -2
- package/dist/contracts/defi-wrapper/stv-pool.js +3 -2
- package/dist/contracts/defi-wrapper/stv-pool.js.map +1 -1
- package/dist/contracts/defi-wrapper/stv-steth-pool.d.ts +1 -1
- package/dist/contracts/defi-wrapper/stv-steth-pool.js +3 -2
- package/dist/contracts/defi-wrapper/stv-steth-pool.js.map +1 -1
- package/dist/contracts/defi-wrapper/withdrawal-queue.d.ts +1 -1
- package/dist/contracts/defi-wrapper/withdrawal-queue.js +3 -2
- package/dist/contracts/defi-wrapper/withdrawal-queue.js.map +1 -1
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/lazy-oracle.js +3 -2
- package/dist/contracts/lazy-oracle.js.map +1 -1
- package/dist/contracts/locator.d.ts +3 -9655
- package/dist/contracts/locator.js +4 -3
- package/dist/contracts/locator.js.map +1 -1
- package/dist/contracts/operator-grid.d.ts +1 -1
- package/dist/contracts/operator-grid.js +3 -2
- package/dist/contracts/operator-grid.js.map +1 -1
- package/dist/contracts/pdg.js +3 -2
- package/dist/contracts/pdg.js.map +1 -1
- package/dist/contracts/steth.d.ts +54 -54
- package/dist/contracts/steth.js +3 -2
- package/dist/contracts/steth.js.map +1 -1
- package/dist/contracts/validator-consolidation-requests.d.ts +5 -0
- package/dist/contracts/validator-consolidation-requests.js +13 -0
- package/dist/contracts/validator-consolidation-requests.js.map +1 -0
- package/dist/contracts/vault-factory.d.ts +3 -28346
- package/dist/contracts/vault-factory.js +4 -3
- package/dist/contracts/vault-factory.js.map +1 -1
- package/dist/contracts/vault-hub.js +3 -2
- package/dist/contracts/vault-hub.js.map +1 -1
- package/dist/contracts/vault-viewer.d.ts +3 -9661
- package/dist/contracts/vault-viewer.js +9 -7
- package/dist/contracts/vault-viewer.js.map +1 -1
- package/dist/contracts/vault.d.ts +2 -2
- package/dist/contracts/vault.js +3 -2
- package/dist/contracts/vault.js.map +1 -1
- package/dist/contracts/wsteth.d.ts +3 -24690
- package/dist/contracts/wsteth.js +4 -3
- package/dist/contracts/wsteth.js.map +1 -1
- package/dist/features/consolidation.d.ts +18 -0
- package/dist/features/consolidation.js +199 -0
- package/dist/features/consolidation.js.map +1 -0
- package/dist/features/defi-wrapper/create-vault.d.ts +17 -0
- package/dist/features/defi-wrapper/create-vault.js +137 -0
- package/dist/features/defi-wrapper/create-vault.js.map +1 -0
- package/dist/features/defi-wrapper/defi-wrapper-factory.d.ts +111 -0
- package/dist/features/defi-wrapper/defi-wrapper-factory.js +231 -0
- package/dist/features/defi-wrapper/defi-wrapper-factory.js.map +1 -0
- package/dist/features/defi-wrapper/index.d.ts +3 -0
- package/dist/features/defi-wrapper/index.js +4 -0
- package/dist/features/defi-wrapper/index.js.map +1 -0
- package/dist/features/defi-wrapper/pool-info.d.ts +35 -0
- package/dist/features/defi-wrapper/pool-info.js +97 -0
- package/dist/features/defi-wrapper/pool-info.js.map +1 -0
- package/dist/features/deposits/check-bls-deposits.js +2 -2
- package/dist/features/deposits/check-bls-deposits.js.map +1 -1
- package/dist/features/deposits/index.d.ts +2 -0
- package/dist/features/deposits/index.js +2 -0
- package/dist/features/deposits/index.js.map +1 -1
- package/dist/features/deposits/make-pdg-proof.js +1 -1
- package/dist/features/deposits/make-pdg-proof.js.map +1 -1
- package/dist/features/deposits/no-pdg.d.ts +1 -1
- package/dist/features/deposits/no-pdg.js +6 -3
- package/dist/features/deposits/no-pdg.js.map +1 -1
- package/dist/features/deposits/pdg.d.ts +2 -0
- package/dist/features/deposits/pdg.js +18 -0
- package/dist/features/deposits/pdg.js.map +1 -0
- package/dist/features/deposits/validators.d.ts +12 -0
- package/dist/features/deposits/validators.js +31 -0
- package/dist/features/deposits/validators.js.map +1 -0
- package/dist/features/dev-tools/impersonate.d.ts +14 -0
- package/dist/features/dev-tools/impersonate.js +64 -0
- package/dist/features/dev-tools/impersonate.js.map +1 -0
- package/dist/features/dev-tools/index.d.ts +1 -0
- package/dist/features/dev-tools/index.js +2 -0
- package/dist/features/dev-tools/index.js.map +1 -0
- package/dist/features/index.d.ts +5 -1
- package/dist/features/index.js +5 -1
- package/dist/features/index.js.map +1 -1
- package/dist/features/lazy-oracle.js +2 -2
- package/dist/features/lazy-oracle.js.map +1 -1
- package/dist/features/metrics.d.ts +4 -0
- package/dist/features/metrics.js +48 -0
- package/dist/features/metrics.js.map +1 -0
- package/dist/features/mint-burn/allowance.d.ts +7 -1
- package/dist/features/mint-burn/allowance.js +8 -9
- package/dist/features/mint-burn/allowance.js.map +1 -1
- package/dist/features/mint-burn/burn-shares.d.ts +2 -1
- package/dist/features/mint-burn/burn-shares.js +4 -3
- package/dist/features/mint-burn/burn-shares.js.map +1 -1
- package/dist/features/mint-burn/burn-steth.d.ts +2 -1
- package/dist/features/mint-burn/burn-steth.js +4 -3
- package/dist/features/mint-burn/burn-steth.js.map +1 -1
- package/dist/features/mint-burn/mint-shares.js +4 -6
- package/dist/features/mint-burn/mint-shares.js.map +1 -1
- package/dist/features/mint-burn/mint-steth.js +4 -6
- package/dist/features/mint-burn/mint-steth.js.map +1 -1
- package/dist/features/pdg.js +4 -0
- package/dist/features/pdg.js.map +1 -1
- package/dist/features/utils/connection.d.ts +2 -0
- package/dist/features/utils/connection.js +14 -0
- package/dist/features/utils/connection.js.map +1 -0
- package/dist/features/utils/get-boolean.d.ts +1 -0
- package/dist/features/utils/get-boolean.js +13 -0
- package/dist/features/utils/get-boolean.js.map +1 -0
- package/dist/features/utils/index.d.ts +2 -0
- package/dist/features/utils/index.js +2 -0
- package/dist/features/utils/index.js.map +1 -1
- package/dist/features/utils/liability-shares.js +2 -1
- package/dist/features/utils/liability-shares.js.map +1 -1
- package/dist/features/utils/quarantine.js +2 -0
- package/dist/features/utils/quarantine.js.map +1 -1
- package/dist/features/utils/report-fresh.d.ts +11 -1
- package/dist/features/utils/report-fresh.js +17 -15
- package/dist/features/utils/report-fresh.js.map +1 -1
- package/dist/features/vault-factory.d.ts +13 -14
- package/dist/features/vault-factory.js +32 -10
- package/dist/features/vault-factory.js.map +1 -1
- package/dist/features/vault-operations/connect-vault.d.ts +4 -0
- package/dist/features/vault-operations/connect-vault.js +21 -0
- package/dist/features/vault-operations/connect-vault.js.map +1 -0
- package/dist/features/vault-operations/create-vault.d.ts +4 -2
- package/dist/features/vault-operations/create-vault.js +17 -7
- package/dist/features/vault-operations/create-vault.js.map +1 -1
- package/dist/features/vault-operations/dashboard-by-vault.js +21 -8
- package/dist/features/vault-operations/dashboard-by-vault.js.map +1 -1
- package/dist/features/vault-operations/index.d.ts +2 -0
- package/dist/features/vault-operations/index.js +2 -0
- package/dist/features/vault-operations/index.js.map +1 -1
- package/dist/features/vault-operations/roles.d.ts +5 -0
- package/dist/features/vault-operations/roles.js +65 -0
- package/dist/features/vault-operations/roles.js.map +1 -0
- package/dist/features/vault-operations/vault-info.js +10 -4
- package/dist/features/vault-operations/vault-info.js.map +1 -1
- package/dist/features/vault-operations/vault-overview.js +6 -8
- package/dist/features/vault-operations/vault-overview.js.map +1 -1
- package/dist/features/vault-operations/vault-roles.js +4 -1
- package/dist/features/vault-operations/vault-roles.js.map +1 -1
- package/dist/features/vault-operations/vaults-by-role.js +29 -10
- package/dist/features/vault-operations/vaults-by-role.js.map +1 -1
- package/dist/features/vault.js +4 -2
- package/dist/features/vault.js.map +1 -1
- package/dist/features/with-report.d.ts +6 -0
- package/dist/features/with-report.js +18 -0
- package/dist/features/with-report.js.map +1 -0
- package/dist/index.js +38 -11
- package/dist/index.js.map +1 -1
- package/dist/programs/account/read.js +1 -1
- package/dist/programs/account/read.js.map +1 -1
- package/dist/programs/account/write.js +14 -0
- package/dist/programs/account/write.js.map +1 -1
- package/dist/programs/contracts/dashboard/read.js +7 -7
- package/dist/programs/contracts/dashboard/read.js.map +1 -1
- package/dist/programs/contracts/dashboard/write.js +80 -61
- package/dist/programs/contracts/dashboard/write.js.map +1 -1
- package/dist/programs/contracts/hub/config.js +0 -10
- package/dist/programs/contracts/hub/config.js.map +1 -1
- package/dist/programs/contracts/hub/read.js +63 -2
- package/dist/programs/contracts/hub/read.js.map +1 -1
- package/dist/programs/contracts/hub/write.js +6 -2
- package/dist/programs/contracts/hub/write.js.map +1 -1
- package/dist/programs/contracts/operator-grid/write.js +1 -1
- package/dist/programs/contracts/operator-grid/write.js.map +1 -1
- package/dist/programs/contracts/pdg/read.js +2 -1
- package/dist/programs/contracts/pdg/read.js.map +1 -1
- package/dist/programs/contracts/pdg/write.js +37 -3
- package/dist/programs/contracts/pdg/write.js.map +1 -1
- package/dist/programs/contracts/vault/write.js +16 -16
- package/dist/programs/contracts/vault/write.js.map +1 -1
- package/dist/programs/contracts/vault-factory/write.js +39 -25
- package/dist/programs/contracts/vault-factory/write.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/distributor/read.js +1 -1
- package/dist/programs/defi-wrapper/contracts/distributor/read.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/distributor/write.js +3 -3
- package/dist/programs/defi-wrapper/contracts/distributor/write.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/factory/read.js +2 -8
- package/dist/programs/defi-wrapper/contracts/factory/read.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/factory/write.js +91 -276
- package/dist/programs/defi-wrapper/contracts/factory/write.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/index.d.ts +0 -1
- package/dist/programs/defi-wrapper/contracts/index.js +0 -1
- package/dist/programs/defi-wrapper/contracts/index.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/stv-pool/config.js +22 -32
- package/dist/programs/defi-wrapper/contracts/stv-pool/config.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/stv-pool/read.js +17 -24
- package/dist/programs/defi-wrapper/contracts/stv-pool/read.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/stv-pool/write.js +25 -174
- package/dist/programs/defi-wrapper/contracts/stv-pool/write.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/stv-steth-pool/config.js +0 -90
- package/dist/programs/defi-wrapper/contracts/stv-steth-pool/config.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/stv-steth-pool/read.js +16 -23
- package/dist/programs/defi-wrapper/contracts/stv-steth-pool/read.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/stv-steth-pool/write.js +34 -231
- package/dist/programs/defi-wrapper/contracts/stv-steth-pool/write.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/withdrawal-queue/config.js +1 -91
- package/dist/programs/defi-wrapper/contracts/withdrawal-queue/config.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/withdrawal-queue/read.js +8 -27
- package/dist/programs/defi-wrapper/contracts/withdrawal-queue/read.js.map +1 -1
- package/dist/programs/defi-wrapper/contracts/withdrawal-queue/write.js +55 -24
- package/dist/programs/defi-wrapper/contracts/withdrawal-queue/write.js.map +1 -1
- package/dist/programs/defi-wrapper/index.d.ts +1 -0
- package/dist/programs/defi-wrapper/index.js +1 -0
- package/dist/programs/defi-wrapper/index.js.map +1 -1
- package/dist/programs/defi-wrapper/use-cases/health/index.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/health/main.d.ts +1 -0
- package/dist/programs/defi-wrapper/use-cases/health/main.js +6 -0
- package/dist/programs/defi-wrapper/use-cases/health/main.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/health/read.js +338 -0
- package/dist/programs/defi-wrapper/use-cases/health/read.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/health/utils.d.ts +56 -0
- package/dist/programs/defi-wrapper/use-cases/health/utils.js +389 -0
- package/dist/programs/defi-wrapper/use-cases/health/utils.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/health/write.js +254 -0
- package/dist/programs/defi-wrapper/use-cases/health/write.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/index.d.ts +3 -0
- package/dist/programs/defi-wrapper/use-cases/index.js +4 -0
- package/dist/programs/defi-wrapper/use-cases/index.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/main.d.ts +1 -0
- package/dist/programs/defi-wrapper/use-cases/main.js +6 -0
- package/dist/programs/defi-wrapper/use-cases/main.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/create-pool.d.ts +1 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/create-pool.js +180 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/create-pool.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/index.d.ts +3 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/index.js +5 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/index.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/main.d.ts +1 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/main.js +6 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/main.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/read.d.ts +1 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/read.js +130 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/read.js.map +1 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/write.d.ts +1 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/write.js +13 -0
- package/dist/programs/defi-wrapper/use-cases/wrapper-operations/write.js.map +1 -0
- package/dist/programs/dev-tools/anvil/index.d.ts +2 -0
- package/dist/programs/dev-tools/anvil/index.js +3 -0
- package/dist/programs/dev-tools/anvil/index.js.map +1 -0
- package/dist/programs/dev-tools/anvil/main.d.ts +1 -0
- package/dist/programs/dev-tools/anvil/main.js +5 -0
- package/dist/programs/dev-tools/anvil/main.js.map +1 -0
- package/dist/programs/dev-tools/anvil/write.d.ts +1 -0
- package/dist/programs/dev-tools/anvil/write.js +122 -0
- package/dist/programs/dev-tools/anvil/write.js.map +1 -0
- package/dist/programs/dev-tools/defi-wrapper/index.d.ts +2 -0
- package/dist/programs/dev-tools/defi-wrapper/index.js +3 -0
- package/dist/programs/dev-tools/defi-wrapper/index.js.map +1 -0
- package/dist/programs/dev-tools/defi-wrapper/main.d.ts +1 -0
- package/dist/programs/dev-tools/defi-wrapper/main.js +6 -0
- package/dist/programs/dev-tools/defi-wrapper/main.js.map +1 -0
- package/dist/programs/dev-tools/defi-wrapper/write.d.ts +1 -0
- package/dist/programs/dev-tools/defi-wrapper/write.js +77 -0
- package/dist/programs/dev-tools/defi-wrapper/write.js.map +1 -0
- package/dist/programs/dev-tools/index.d.ts +3 -0
- package/dist/programs/dev-tools/index.js +4 -0
- package/dist/programs/dev-tools/index.js.map +1 -0
- package/dist/programs/dev-tools/main.d.ts +1 -0
- package/dist/programs/dev-tools/main.js +6 -0
- package/dist/programs/dev-tools/main.js.map +1 -0
- package/dist/programs/index.d.ts +1 -0
- package/dist/programs/index.js +1 -0
- package/dist/programs/index.js.map +1 -1
- package/dist/programs/pdg-helpers.js +32 -24
- package/dist/programs/pdg-helpers.js.map +1 -1
- package/dist/programs/use-cases/consolidation/index.d.ts +2 -0
- package/dist/programs/use-cases/consolidation/index.js +3 -0
- package/dist/programs/use-cases/consolidation/index.js.map +1 -0
- package/dist/programs/use-cases/consolidation/main.d.ts +1 -0
- package/dist/programs/use-cases/consolidation/main.js +5 -0
- package/dist/programs/use-cases/consolidation/main.js.map +1 -0
- package/dist/programs/use-cases/consolidation/write.d.ts +1 -0
- package/dist/programs/use-cases/consolidation/write.js +78 -0
- package/dist/programs/use-cases/consolidation/write.js.map +1 -0
- package/dist/programs/use-cases/deposits/read.js +4 -0
- package/dist/programs/use-cases/deposits/read.js.map +1 -1
- package/dist/programs/use-cases/deposits/write.js +41 -11
- package/dist/programs/use-cases/deposits/write.js.map +1 -1
- package/dist/programs/use-cases/index.d.ts +1 -0
- package/dist/programs/use-cases/index.js +1 -0
- package/dist/programs/use-cases/index.js.map +1 -1
- package/dist/programs/use-cases/metrics/read.js +9 -20
- package/dist/programs/use-cases/metrics/read.js.map +1 -1
- package/dist/programs/use-cases/vault-operations/create-vault.js +65 -29
- package/dist/programs/use-cases/vault-operations/create-vault.js.map +1 -1
- package/dist/programs/use-cases/vault-operations/write.js +124 -26
- package/dist/programs/use-cases/vault-operations/write.js.map +1 -1
- package/dist/providers/wallet.d.ts +14539 -63
- package/dist/providers/wallet.js +14 -4
- package/dist/providers/wallet.js.map +1 -1
- package/dist/tests/integration/deposits.test.d.ts +1 -0
- package/dist/tests/integration/deposits.test.js +67 -0
- package/dist/tests/integration/deposits.test.js.map +1 -0
- package/dist/tests/integration/globalSetup.d.ts +1 -0
- package/dist/tests/integration/globalSetup.js +55 -0
- package/dist/tests/integration/globalSetup.js.map +1 -0
- package/dist/tests/integration/helpers/index.d.ts +3 -0
- package/dist/tests/integration/helpers/index.js +4 -0
- package/dist/tests/integration/helpers/index.js.map +1 -0
- package/dist/tests/integration/helpers/test-assertions.d.ts +32 -0
- package/dist/tests/integration/helpers/test-assertions.js +92 -0
- package/dist/tests/integration/helpers/test-assertions.js.map +1 -0
- package/dist/tests/integration/helpers/test-client.d.ts +14530 -0
- package/dist/tests/integration/helpers/test-client.js +73 -0
- package/dist/tests/integration/helpers/test-client.js.map +1 -0
- package/dist/tests/integration/helpers/test-config.d.ts +14 -0
- package/dist/tests/integration/helpers/test-config.js +62 -0
- package/dist/tests/integration/helpers/test-config.js.map +1 -0
- package/dist/tests/integration/helpers/test-setup.d.ts +12 -0
- package/dist/tests/integration/helpers/test-setup.js +40 -0
- package/dist/tests/integration/helpers/test-setup.js.map +1 -0
- package/dist/tests/integration/lazy-oracle.test.d.ts +1 -0
- package/dist/tests/integration/lazy-oracle.test.js +31 -0
- package/dist/tests/integration/lazy-oracle.test.js.map +1 -0
- package/dist/tests/integration/metrics.test.d.ts +1 -0
- package/dist/tests/integration/metrics.test.js +95 -0
- package/dist/tests/integration/metrics.test.js.map +1 -0
- package/dist/tests/integration/mint-burn.test.d.ts +1 -0
- package/dist/tests/integration/mint-burn.test.js +149 -0
- package/dist/tests/integration/mint-burn.test.js.map +1 -0
- package/dist/tests/integration/operator-grid.test.d.ts +1 -0
- package/dist/tests/integration/operator-grid.test.js +41 -0
- package/dist/tests/integration/operator-grid.test.js.map +1 -0
- package/dist/tests/integration/pdg.test.d.ts +1 -0
- package/dist/tests/integration/pdg.test.js +47 -0
- package/dist/tests/integration/pdg.test.js.map +1 -0
- package/dist/tests/integration/utils.test.d.ts +1 -0
- package/dist/tests/integration/utils.test.js +70 -0
- package/dist/tests/integration/utils.test.js.map +1 -0
- package/dist/tests/integration/vault-factory.test.d.ts +1 -0
- package/dist/tests/integration/vault-factory.test.js +29 -0
- package/dist/tests/integration/vault-factory.test.js.map +1 -0
- package/dist/tests/integration/vault-hub.test.d.ts +1 -0
- package/dist/tests/integration/vault-hub.test.js +71 -0
- package/dist/tests/integration/vault-hub.test.js.map +1 -0
- package/dist/tests/integration/vault-operations.test.d.ts +1 -0
- package/dist/tests/integration/vault-operations.test.js +151 -0
- package/dist/tests/integration/vault-operations.test.js.map +1 -0
- package/dist/tests/integration/vault-roles.test.d.ts +1 -0
- package/dist/tests/integration/vault-roles.test.js +44 -0
- package/dist/tests/integration/vault-roles.test.js.map +1 -0
- package/dist/tests/integration/vault.test.d.ts +1 -0
- package/dist/tests/integration/vault.test.js +44 -0
- package/dist/tests/integration/vault.test.js.map +1 -0
- package/dist/tests/utils/arguments.test.js +85 -4
- package/dist/tests/utils/arguments.test.js.map +1 -1
- package/dist/tests/utils/bigInt.test.d.ts +1 -0
- package/dist/tests/utils/bigInt.test.js +61 -0
- package/dist/tests/utils/bigInt.test.js.map +1 -0
- package/dist/tests/utils/calculate-health.test.d.ts +1 -0
- package/dist/tests/utils/calculate-health.test.js +140 -0
- package/dist/tests/utils/calculate-health.test.js.map +1 -0
- package/dist/tests/utils/calculate-overview-v2.test.d.ts +1 -0
- package/dist/tests/utils/calculate-overview-v2.test.js +181 -0
- package/dist/tests/utils/calculate-overview-v2.test.js.map +1 -0
- package/dist/tests/utils/calculate-overview.test.js +2 -1
- package/dist/tests/utils/calculate-overview.test.js.map +1 -1
- package/dist/tests/utils/csv-file.test.d.ts +1 -0
- package/dist/tests/utils/csv-file.test.js +111 -0
- package/dist/tests/utils/csv-file.test.js.map +1 -0
- package/dist/tests/utils/data-validators.test.js +1 -1
- package/dist/tests/utils/data-validators.test.js.map +1 -1
- package/dist/tests/utils/error-handler.test.js +7 -16
- package/dist/tests/utils/error-handler.test.js.map +1 -1
- package/dist/tests/utils/get-commands.test.js +1 -1
- package/dist/tests/utils/get-commands.test.js.map +1 -1
- package/dist/tests/utils/get-deposit-data-root.test.js +1 -2
- package/dist/tests/utils/get-deposit-data-root.test.js.map +1 -1
- package/dist/tests/utils/get-value.test.js +1 -1
- package/dist/tests/utils/get-value.test.js.map +1 -1
- package/dist/tests/utils/health.test.js +1 -1
- package/dist/tests/utils/health.test.js.map +1 -1
- package/dist/tests/utils/interrupt-handler.test.js +2 -5
- package/dist/tests/utils/interrupt-handler.test.js.map +1 -1
- package/dist/tests/utils/ipfs.test.js +37 -24
- package/dist/tests/utils/ipfs.test.js.map +1 -1
- package/dist/tests/utils/lido-apr.test.d.ts +1 -0
- package/dist/tests/utils/lido-apr.test.js +95 -0
- package/dist/tests/utils/lido-apr.test.js.map +1 -0
- package/dist/tests/utils/logging.test.js +135 -15
- package/dist/tests/utils/logging.test.js.map +1 -1
- package/dist/tests/utils/merkle-utils.test.d.ts +1 -0
- package/dist/tests/utils/merkle-utils.test.js +231 -0
- package/dist/tests/utils/merkle-utils.test.js.map +1 -0
- package/dist/tests/utils/rebase-rewards.test.d.ts +1 -0
- package/dist/tests/utils/rebase-rewards.test.js +114 -0
- package/dist/tests/utils/rebase-rewards.test.js.map +1 -0
- package/dist/tests/utils/resove-path.test.js +1 -1
- package/dist/tests/utils/resove-path.test.js.map +1 -1
- package/dist/tests/utils/sleep.test.js +5 -5
- package/dist/tests/utils/sleep.test.js.map +1 -1
- package/dist/tests/utils/snake-to-camel.test.d.ts +1 -0
- package/dist/tests/utils/snake-to-camel.test.js +37 -0
- package/dist/tests/utils/snake-to-camel.test.js.map +1 -0
- package/dist/tests/utils/timestamp.test.d.ts +1 -0
- package/dist/tests/utils/timestamp.test.js +51 -0
- package/dist/tests/utils/timestamp.test.js.map +1 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/utils/arguments.d.ts +6 -1
- package/dist/utils/arguments.js +46 -1
- package/dist/utils/arguments.js.map +1 -1
- package/dist/utils/bigInt.d.ts +2 -0
- package/dist/utils/bigInt.js +3 -0
- package/dist/utils/bigInt.js.map +1 -0
- package/dist/utils/bls.d.ts +2 -2
- package/dist/utils/bls.js +8 -7
- package/dist/utils/bls.js.map +1 -1
- package/dist/utils/cache.d.ts +30 -0
- package/dist/utils/cache.js +140 -3
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/calculate-overview-v2.d.ts +1 -2
- package/dist/utils/calculate-overview-v2.js +4 -8
- package/dist/utils/calculate-overview-v2.js.map +1 -1
- package/dist/utils/calculate-overview.d.ts +1 -0
- package/dist/utils/calculate-overview.js +2 -2
- package/dist/utils/calculate-overview.js.map +1 -1
- package/dist/utils/charts/blessed/charts-apr.js +8 -18
- package/dist/utils/charts/blessed/charts-apr.js.map +1 -1
- package/dist/utils/charts/blessed/charts-rewards.js +7 -17
- package/dist/utils/charts/blessed/charts-rewards.js.map +1 -1
- package/dist/utils/charts/blessed/datasets/prepare-metrics.d.ts +5 -5
- package/dist/utils/charts/blessed/datasets/prepare-metrics.js +11 -11
- package/dist/utils/charts/blessed/datasets/prepare-metrics.js.map +1 -1
- package/dist/utils/charts/simple/simple-charts.js +8 -18
- package/dist/utils/charts/simple/simple-charts.js.map +1 -1
- package/dist/utils/commands/confirmations.js +1 -1
- package/dist/utils/commands/confirmations.js.map +1 -1
- package/dist/utils/commands/report.d.ts +6 -1
- package/dist/utils/commands/report.js +6 -4
- package/dist/utils/commands/report.js.map +1 -1
- package/dist/utils/consolidation/checks.d.ts +7 -0
- package/dist/utils/consolidation/checks.js +40 -0
- package/dist/utils/consolidation/checks.js.map +1 -0
- package/dist/utils/consolidation/confirms.d.ts +4 -0
- package/dist/utils/consolidation/confirms.js +41 -0
- package/dist/utils/consolidation/confirms.js.map +1 -0
- package/dist/utils/consolidation/index.d.ts +6 -0
- package/dist/utils/consolidation/index.js +7 -0
- package/dist/utils/consolidation/index.js.map +1 -0
- package/dist/utils/consolidation/logs.d.ts +3 -0
- package/dist/utils/consolidation/logs.js +43 -0
- package/dist/utils/consolidation/logs.js.map +1 -0
- package/dist/utils/consolidation/pubkeys.d.ts +8 -0
- package/dist/utils/consolidation/pubkeys.js +42 -0
- package/dist/utils/consolidation/pubkeys.js.map +1 -0
- package/dist/utils/consolidation/types.d.ts +12 -0
- package/dist/utils/consolidation/types.js +2 -0
- package/dist/utils/consolidation/types.js.map +1 -0
- package/dist/utils/consolidation/validator-info.d.ts +4 -0
- package/dist/utils/consolidation/validator-info.js +36 -0
- package/dist/utils/consolidation/validator-info.js.map +1 -0
- package/dist/utils/consolidation/validators-checks.d.ts +10 -0
- package/dist/utils/consolidation/validators-checks.js +58 -0
- package/dist/utils/consolidation/validators-checks.js.map +1 -0
- package/dist/utils/error-handler.js +2 -9
- package/dist/utils/error-handler.js.map +1 -1
- package/dist/utils/fetchCL.d.ts +35 -14
- package/dist/utils/fetchCL.js +78 -5
- package/dist/utils/fetchCL.js.map +1 -1
- package/dist/utils/health/health-utils.d.ts +54 -54
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/interrupt-handler.js +8 -2
- package/dist/utils/interrupt-handler.js.map +1 -1
- package/dist/utils/logging/console.js +41 -3
- package/dist/utils/logging/console.js.map +1 -1
- package/dist/utils/prompts/mint-burn/confirm-mint.js +1 -0
- package/dist/utils/prompts/mint-burn/confirm-mint.js.map +1 -1
- package/dist/utils/prompts/operations.js +4 -1
- package/dist/utils/prompts/operations.js.map +1 -1
- package/dist/utils/proof/create-proof.d.ts +5 -0
- package/dist/utils/proof/create-proof.js +5 -0
- package/dist/utils/proof/create-proof.js.map +1 -1
- package/dist/utils/read-programs-by-abi.d.ts +1 -1
- package/dist/utils/read-programs-by-abi.js +4 -18
- package/dist/utils/read-programs-by-abi.js.map +1 -1
- package/dist/utils/report/report.js +1 -1
- package/dist/utils/report/report.js.map +1 -1
- package/dist/utils/report/statistic-data.js +3 -3
- package/dist/utils/report/statistic-data.js.map +1 -1
- package/dist/utils/statistic/report-statistic.d.ts +6 -5
- package/dist/utils/statistic/report-statistic.js +15 -16
- package/dist/utils/statistic/report-statistic.js.map +1 -1
- package/dist/utils/transactions/tx-private-key.d.ts +4 -0
- package/dist/utils/transactions/tx-private-key.js +65 -32
- package/dist/utils/transactions/tx-private-key.js.map +1 -1
- package/dist/utils/transactions/tx-wc.d.ts +6 -3
- package/dist/utils/transactions/tx-wc.js +28 -26
- package/dist/utils/transactions/tx-wc.js.map +1 -1
- package/dist/utils/transactions/types.d.ts +5 -2
- package/dist/utils/transactions/utils.d.ts +3 -0
- package/dist/utils/transactions/utils.js +33 -0
- package/dist/utils/transactions/utils.js.map +1 -0
- package/dist/utils/wallet-connect.js +6 -4
- package/dist/utils/wallet-connect.js.map +1 -1
- package/dist/version/index.js +1 -1
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +29 -0
- package/dist/vitest.config.js.map +1 -0
- package/dist/vitest.integration.config.d.ts +2 -0
- package/dist/vitest.integration.config.js +39 -0
- package/dist/vitest.integration.config.js.map +1 -0
- package/package.json +15 -10
- package/dist/abi/defi-wrapper/StvStrategyPool.d.ts +0 -1769
- package/dist/abi/defi-wrapper/StvStrategyPool.js +0 -2319
- package/dist/abi/defi-wrapper/StvStrategyPool.js.map +0 -1
- package/dist/contracts/defi-wrapper/stv-strategy-pool.d.ts +0 -4
- package/dist/contracts/defi-wrapper/stv-strategy-pool.js +0 -11
- package/dist/contracts/defi-wrapper/stv-strategy-pool.js.map +0 -1
- package/dist/features/defi-wrapper-factory.d.ts +0 -18
- package/dist/features/defi-wrapper-factory.js +0 -28
- package/dist/features/defi-wrapper-factory.js.map +0 -1
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/config.d.ts +0 -3
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/config.js +0 -214
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/config.js.map +0 -1
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/index.js.map +0 -1
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/main.d.ts +0 -1
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/main.js +0 -6
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/main.js.map +0 -1
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/read.js +0 -77
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/read.js.map +0 -1
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/write.js +0 -370
- package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/write.js.map +0 -1
- /package/dist/programs/defi-wrapper/{contracts/stv-strategy-pool → use-cases/health}/index.d.ts +0 -0
- /package/dist/programs/defi-wrapper/{contracts/stv-strategy-pool → use-cases/health}/index.js +0 -0
- /package/dist/programs/defi-wrapper/{contracts/stv-strategy-pool → use-cases/health}/read.d.ts +0 -0
- /package/dist/programs/defi-wrapper/{contracts/stv-strategy-pool → use-cases/health}/write.d.ts +0 -0
|
@@ -16,14 +16,14 @@ withdrawalQueueWrite
|
|
|
16
16
|
.description('pause withdrawal requests placement and finalization')
|
|
17
17
|
.argument('<address>', 'withdrawal queue address', stringToAddress)
|
|
18
18
|
.action(async (address) => {
|
|
19
|
-
const contract = getWithdrawalQueueContract(address);
|
|
19
|
+
const contract = await getWithdrawalQueueContract(address);
|
|
20
20
|
const confirmationMessage = `Are you sure you want to pause withdrawal requests placement and finalization for the withdrawal queue ${address}?`;
|
|
21
21
|
const confirm = await confirmOperation(confirmationMessage);
|
|
22
22
|
if (!confirm)
|
|
23
23
|
return;
|
|
24
24
|
await callWriteMethodWithReceipt({
|
|
25
25
|
contract,
|
|
26
|
-
methodName: '
|
|
26
|
+
methodName: 'pauseWithdrawals',
|
|
27
27
|
payload: [],
|
|
28
28
|
});
|
|
29
29
|
});
|
|
@@ -32,14 +32,46 @@ withdrawalQueueWrite
|
|
|
32
32
|
.description('resume withdrawal requests placement and finalization')
|
|
33
33
|
.argument('<address>', 'withdrawal queue address', stringToAddress)
|
|
34
34
|
.action(async (address) => {
|
|
35
|
-
const contract = getWithdrawalQueueContract(address);
|
|
35
|
+
const contract = await getWithdrawalQueueContract(address);
|
|
36
36
|
const confirmationMessage = `Are you sure you want to resume withdrawal requests placement and finalization for the withdrawal queue ${address}?`;
|
|
37
37
|
const confirm = await confirmOperation(confirmationMessage);
|
|
38
38
|
if (!confirm)
|
|
39
39
|
return;
|
|
40
40
|
await callWriteMethodWithReceipt({
|
|
41
41
|
contract,
|
|
42
|
-
methodName: '
|
|
42
|
+
methodName: 'resumeWithdrawals',
|
|
43
|
+
payload: [],
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
withdrawalQueueWrite
|
|
47
|
+
.command('pause-finalization')
|
|
48
|
+
.description('pause withdrawal requests finalization')
|
|
49
|
+
.argument('<address>', 'withdrawal queue address', stringToAddress)
|
|
50
|
+
.action(async (address) => {
|
|
51
|
+
const contract = await getWithdrawalQueueContract(address);
|
|
52
|
+
const confirmationMessage = `Are you sure you want to pause withdrawal requests finalization for the withdrawal queue ${address}?`;
|
|
53
|
+
const confirm = await confirmOperation(confirmationMessage);
|
|
54
|
+
if (!confirm)
|
|
55
|
+
return;
|
|
56
|
+
await callWriteMethodWithReceipt({
|
|
57
|
+
contract,
|
|
58
|
+
methodName: 'pauseFinalization',
|
|
59
|
+
payload: [],
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
withdrawalQueueWrite
|
|
63
|
+
.command('resume-finalization')
|
|
64
|
+
.description('resume withdrawal requests finalization')
|
|
65
|
+
.argument('<address>', 'withdrawal queue address', stringToAddress)
|
|
66
|
+
.action(async (address) => {
|
|
67
|
+
const contract = await getWithdrawalQueueContract(address);
|
|
68
|
+
const confirmationMessage = `Are you sure you want to resume withdrawal requests finalization for the withdrawal queue ${address}?`;
|
|
69
|
+
const confirm = await confirmOperation(confirmationMessage);
|
|
70
|
+
if (!confirm)
|
|
71
|
+
return;
|
|
72
|
+
await callWriteMethodWithReceipt({
|
|
73
|
+
contract,
|
|
74
|
+
methodName: 'resumeFinalization',
|
|
43
75
|
payload: [],
|
|
44
76
|
});
|
|
45
77
|
});
|
|
@@ -51,15 +83,15 @@ withdrawalQueueWrite
|
|
|
51
83
|
.argument('<steth>', 'array of amounts of stETH shares to rebalance', stringToBigIntArray)
|
|
52
84
|
.argument('<address>', 'address that will be able to claim the created request', stringToAddress)
|
|
53
85
|
.action(async (address, stvToWithdraw, stethSharesToRebalance, owner) => {
|
|
54
|
-
const contract = getWithdrawalQueueContract(address);
|
|
86
|
+
const contract = await getWithdrawalQueueContract(address);
|
|
55
87
|
const confirmationMessage = `Are you sure you want to request multiple withdrawals for ${owner} with ${stvToWithdraw.join(', ')} stv and ${stethSharesToRebalance.join(', ')} steth shares for the withdrawal queue ${address}?`;
|
|
56
88
|
const confirm = await confirmOperation(confirmationMessage);
|
|
57
89
|
if (!confirm)
|
|
58
90
|
return;
|
|
59
91
|
await callWriteMethodWithReceipt({
|
|
60
92
|
contract,
|
|
61
|
-
methodName: '
|
|
62
|
-
payload: [stvToWithdraw, stethSharesToRebalance
|
|
93
|
+
methodName: 'requestWithdrawalBatch',
|
|
94
|
+
payload: [owner, stvToWithdraw, stethSharesToRebalance],
|
|
63
95
|
});
|
|
64
96
|
});
|
|
65
97
|
withdrawalQueueWrite
|
|
@@ -70,7 +102,7 @@ withdrawalQueueWrite
|
|
|
70
102
|
.argument('<steth>', 'amount of steth shares to rebalance', stringToBigInt)
|
|
71
103
|
.argument('<address>', 'address that will be able to claim the created request', stringToAddress)
|
|
72
104
|
.action(async (address, stvToWithdraw, stethSharesToRebalance, owner) => {
|
|
73
|
-
const contract = getWithdrawalQueueContract(address);
|
|
105
|
+
const contract = await getWithdrawalQueueContract(address);
|
|
74
106
|
const confirmationMessage = `Are you sure you want to request a withdrawal for ${owner} with ${stvToWithdraw} stv and ${stethSharesToRebalance} steth shares for the withdrawal queue ${address}?`;
|
|
75
107
|
const confirm = await confirmOperation(confirmationMessage);
|
|
76
108
|
if (!confirm)
|
|
@@ -78,7 +110,7 @@ withdrawalQueueWrite
|
|
|
78
110
|
await callWriteMethodWithReceipt({
|
|
79
111
|
contract,
|
|
80
112
|
methodName: 'requestWithdrawal',
|
|
81
|
-
payload: [stvToWithdraw, stethSharesToRebalance
|
|
113
|
+
payload: [owner, stvToWithdraw, stethSharesToRebalance],
|
|
82
114
|
});
|
|
83
115
|
});
|
|
84
116
|
withdrawalQueueWrite
|
|
@@ -86,16 +118,17 @@ withdrawalQueueWrite
|
|
|
86
118
|
.description('finalize withdrawal requests')
|
|
87
119
|
.argument('<address>', 'withdrawal queue address', stringToAddress)
|
|
88
120
|
.argument('<maxRequests>', 'the maximum number of requests to finalize', stringToBigInt)
|
|
89
|
-
.
|
|
90
|
-
|
|
91
|
-
const
|
|
121
|
+
.argument('<gasCostCoverageRecipient>', 'address to receive gas cost coverage', stringToAddress)
|
|
122
|
+
.action(async (address, maxRequests, gasCostCoverageRecipient) => {
|
|
123
|
+
const contract = await getWithdrawalQueueContract(address);
|
|
124
|
+
const confirmationMessage = `Are you sure you want to finalize up to ${maxRequests} withdrawal requests for the withdrawal queue ${address} to ${gasCostCoverageRecipient}?`;
|
|
92
125
|
const confirm = await confirmOperation(confirmationMessage);
|
|
93
126
|
if (!confirm)
|
|
94
127
|
return;
|
|
95
128
|
await callWriteMethodWithReceipt({
|
|
96
129
|
contract,
|
|
97
130
|
methodName: 'finalize',
|
|
98
|
-
payload: [maxRequests],
|
|
131
|
+
payload: [maxRequests, gasCostCoverageRecipient],
|
|
99
132
|
});
|
|
100
133
|
});
|
|
101
134
|
withdrawalQueueWrite
|
|
@@ -103,18 +136,17 @@ withdrawalQueueWrite
|
|
|
103
136
|
.description('claim one `_requestId` request once finalized sending locked ether to the owner')
|
|
104
137
|
.argument('<address>', 'withdrawal queue address', stringToAddress)
|
|
105
138
|
.argument('<requestId>', 'request id to claim', stringToBigInt)
|
|
106
|
-
.argument('<requestor>', 'address of the request owner, should be equal to msg.sender on Wrapper side', stringToAddress)
|
|
107
139
|
.argument('<recipient>', 'address where claimed ether will be sent to', stringToAddress)
|
|
108
|
-
.action(async (address, requestId,
|
|
109
|
-
const contract = getWithdrawalQueueContract(address);
|
|
110
|
-
const confirmationMessage = `Are you sure you want to claim request ${requestId}
|
|
140
|
+
.action(async (address, requestId, recipient) => {
|
|
141
|
+
const contract = await getWithdrawalQueueContract(address);
|
|
142
|
+
const confirmationMessage = `Are you sure you want to claim request ${requestId} and send the claimed ether to ${recipient} for the withdrawal queue ${address}?`;
|
|
111
143
|
const confirm = await confirmOperation(confirmationMessage);
|
|
112
144
|
if (!confirm)
|
|
113
145
|
return;
|
|
114
146
|
await callWriteMethodWithReceipt({
|
|
115
147
|
contract,
|
|
116
148
|
methodName: 'claimWithdrawal',
|
|
117
|
-
payload: [
|
|
149
|
+
payload: [recipient, requestId],
|
|
118
150
|
});
|
|
119
151
|
});
|
|
120
152
|
withdrawalQueueWrite
|
|
@@ -123,18 +155,17 @@ withdrawalQueueWrite
|
|
|
123
155
|
.argument('<address>', 'withdrawal queue address', stringToAddress)
|
|
124
156
|
.argument('<requestIds>', 'array of request ids to claim', stringToBigIntArray)
|
|
125
157
|
.argument('<hints>', 'checkpoint hints. can be found with `findCheckpointHints(_requestIds, 1, getLastCheckpointIndex())`', stringToBigIntArray)
|
|
126
|
-
.argument('<requestor>', 'address of the request owner, should be equal to msg.sender on Wrapper side', stringToAddress)
|
|
127
158
|
.argument('<recipient>', 'address where claimed ether will be sent to', stringToAddress)
|
|
128
|
-
.action(async (address, requestIds, hints,
|
|
129
|
-
const contract = getWithdrawalQueueContract(address);
|
|
130
|
-
const confirmationMessage = `Are you sure you want to claim requests ${requestIds.join(', ')}
|
|
159
|
+
.action(async (address, requestIds, hints, recipient) => {
|
|
160
|
+
const contract = await getWithdrawalQueueContract(address);
|
|
161
|
+
const confirmationMessage = `Are you sure you want to claim requests ${requestIds.join(', ')} and send the claimed ether to ${recipient} for the withdrawal queue ${address}?`;
|
|
131
162
|
const confirm = await confirmOperation(confirmationMessage);
|
|
132
163
|
if (!confirm)
|
|
133
164
|
return;
|
|
134
165
|
await callWriteMethodWithReceipt({
|
|
135
166
|
contract,
|
|
136
|
-
methodName: '
|
|
137
|
-
payload: [requestIds, hints
|
|
167
|
+
methodName: 'claimWithdrawalBatch',
|
|
168
|
+
payload: [recipient, requestIds, hints],
|
|
138
169
|
});
|
|
139
170
|
});
|
|
140
171
|
//# sourceMappingURL=write.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../../../../programs/defi-wrapper/contracts/withdrawal-queue/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,cAAc,EACd,mBAAmB,GACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,MAAM,oBAAoB,GAAG,eAAe;KACzC,OAAO,CAAC,OAAO,CAAC;KAChB,KAAK,CAAC,GAAG,CAAC;KACV,WAAW,CAAC,iCAAiC,CAAC,CAAC;AAElD,oBAAoB,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;AACxD,oBAAoB,CAAC,EAAE,CAAC,kBAAkB,EAAE;IAC1C,OAAO,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,oBAAoB;KACjB,OAAO,CAAC,OAAO,CAAC;KAChB,WA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U,EAAE,iBAAiB;QAC7B,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;KAChC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,oBAAoB;KACjB,OAAO,CAAC,mBAAmB,CAAC;KAC5B,WAAW,CACV,iFAAiF,CAClF;KACA,QAAQ,CAAC,WAAW,EAAE,0BAA0B,EAAE,eAAe,CAAC;KAClE,QAAQ,CACP,cAAc,EACd,+BAA+B,EAC/B,mBAAmB,CACpB;KACA,QAAQ,CACP,SAAS,EACT,qGAAqG,EACrG,mBAAmB,CACpB;KACA,QAAQ,CACP,aAAa,EACb,6CAA6C,EAC7C,eAAe,CAChB;KACA,MAAM,CACL,KAAK,EACH,OAAgB,EAChB,UAAoB,EACpB,KAAe,EACf,SAAkB,EAClB,EAAE;IACF,MAAM,QAAQ,GAAG,MAAM,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAE3D,MAAM,mBAAmB,GAAG,2CAA2C,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,kCAAkC,SAAS,6BAA6B,OAAO,GAAG,CAAC;IAC/K,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,MAAM,0BAA0B,CAAC;QAC/B,QAAQ;QACR,UAAU,EAAE,sBAAsB;QAClC,OAAO,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC;KACxC,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../programs/defi-wrapper/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../programs/defi-wrapper/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../programs/defi-wrapper/use-cases/health/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const health: import("commander").Command;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../../programs/defi-wrapper/use-cases/health/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ;KAC3B,OAAO,CAAC,QAAQ,CAAC;KACjB,KAAK,CAAC,GAAG,CAAC;KACV,WAAW,CAAC,yDAAyD,CAAC,CAAC"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { formatEther, formatUnits } from 'viem';
|
|
2
|
+
import { health } from './main.js';
|
|
3
|
+
import { getStvStethPoolContract } from '../../../../contracts/defi-wrapper/index.js';
|
|
4
|
+
import { getStethContract } from '../../../../contracts/index.js';
|
|
5
|
+
import { stringToAddress, logTable, logInfo, callReadMethodSilent, stringToNumber, formatBP, } from '../../../../utils/index.js';
|
|
6
|
+
import { getPublicClient } from '../../../../providers/index.js';
|
|
7
|
+
import { isThresholdBreached, calculateEffectiveLTV, calculateThresholdExcess, calculateBalancesFromEvents, } from './utils.js';
|
|
8
|
+
const healthRead = health
|
|
9
|
+
.command('read')
|
|
10
|
+
.aliases(['r'])
|
|
11
|
+
.description('health read commands');
|
|
12
|
+
healthRead
|
|
13
|
+
.command('list-unhealthy')
|
|
14
|
+
.description('list all unhealthy positions in the pool')
|
|
15
|
+
.argument('<address>', 'stv-steth-pool address', stringToAddress)
|
|
16
|
+
.option('--from-block <number>', 'from block number', stringToNumber)
|
|
17
|
+
.option('--to-block <number>', 'to block number (default: latest)', stringToNumber)
|
|
18
|
+
.option('--batch-size <number>', 'max blocks per RPC call (default: 30000)', stringToNumber)
|
|
19
|
+
.option('--verbose', 'show verbose output', false)
|
|
20
|
+
.action(async (address, options) => {
|
|
21
|
+
const poolContract = await getStvStethPoolContract(address);
|
|
22
|
+
const stethContract = await getStethContract();
|
|
23
|
+
logInfo('Fetching pool configuration...');
|
|
24
|
+
// Get pool configuration
|
|
25
|
+
const [forcedRebalanceThresholdBP, name, symbol] = await Promise.all([
|
|
26
|
+
callReadMethodSilent(poolContract, 'forcedRebalanceThresholdBP'),
|
|
27
|
+
callReadMethodSilent(poolContract, 'name'),
|
|
28
|
+
callReadMethodSilent(poolContract, 'symbol'),
|
|
29
|
+
]);
|
|
30
|
+
logInfo(`Pool: ${name} (${symbol}) at ${address}\nForced Rebalance Threshold: ${formatBP(forcedRebalanceThresholdBP)}\n`);
|
|
31
|
+
// Check health for each account
|
|
32
|
+
const unhealthyPositions = [];
|
|
33
|
+
// Calculate balances from indexed events
|
|
34
|
+
logInfo('📊 Calculating balances from indexed events');
|
|
35
|
+
const balances = await calculateBalancesFromEvents({
|
|
36
|
+
poolAddress: address,
|
|
37
|
+
fromBlock: options.fromBlock,
|
|
38
|
+
toBlock: options.toBlock,
|
|
39
|
+
batchSize: options.batchSize,
|
|
40
|
+
});
|
|
41
|
+
logInfo(`Found ${balances.size} accounts with positions. Checking health...\n`);
|
|
42
|
+
for (const [account, balance] of balances) {
|
|
43
|
+
try {
|
|
44
|
+
const stvBalance = balance.stvBalance;
|
|
45
|
+
const debtShares = balance.debtShares;
|
|
46
|
+
// Still check contract's isHealthy for comparison
|
|
47
|
+
const isHealthy = await callReadMethodSilent(poolContract, 'isHealthyOf', [account]);
|
|
48
|
+
if (options.verbose) {
|
|
49
|
+
logInfo(`Account: ${account}
|
|
50
|
+
stvBalance: ${formatUnits(stvBalance, 27)} STV
|
|
51
|
+
debtShares: ${formatEther(debtShares)} shares
|
|
52
|
+
isHealthy (from contract): ${isHealthy}
|
|
53
|
+
`);
|
|
54
|
+
}
|
|
55
|
+
// Skip accounts with no position
|
|
56
|
+
if (stvBalance === 0n && debtShares === 0n) {
|
|
57
|
+
if (options.verbose) {
|
|
58
|
+
logInfo(` Skipping account ${account} - no position\n`);
|
|
59
|
+
}
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
// Calculate values in ETH
|
|
63
|
+
const stvInEth = stvBalance > 0n
|
|
64
|
+
? await callReadMethodSilent(poolContract, 'previewRedeem', [
|
|
65
|
+
stvBalance,
|
|
66
|
+
])
|
|
67
|
+
: 0n;
|
|
68
|
+
const debtInEth = debtShares > 0n
|
|
69
|
+
? await callReadMethodSilent(stethContract, 'getPooledEthBySharesRoundUp', [debtShares])
|
|
70
|
+
: 0n;
|
|
71
|
+
if (options.verbose) {
|
|
72
|
+
logInfo(` stvInEth: ${formatEther(stvInEth)} ETH`);
|
|
73
|
+
logInfo(` debtInEth: ${formatEther(debtInEth)} ETH`);
|
|
74
|
+
logInfo(` forcedRebalanceThresholdBP: ${formatBP(forcedRebalanceThresholdBP)}`);
|
|
75
|
+
}
|
|
76
|
+
// Use contract-accurate threshold check
|
|
77
|
+
const thresholdBreached = isThresholdBreached({
|
|
78
|
+
assets: stvInEth,
|
|
79
|
+
stethShares: debtShares,
|
|
80
|
+
debtInEth,
|
|
81
|
+
forcedRebalanceThresholdBP,
|
|
82
|
+
verbose: options.verbose,
|
|
83
|
+
});
|
|
84
|
+
// Calculate display metrics
|
|
85
|
+
const ltvRatio = calculateEffectiveLTV({
|
|
86
|
+
assets: stvInEth,
|
|
87
|
+
debtInEth,
|
|
88
|
+
});
|
|
89
|
+
const thresholdExcess = calculateThresholdExcess({
|
|
90
|
+
assets: stvInEth,
|
|
91
|
+
stethShares: debtShares,
|
|
92
|
+
debtInEth,
|
|
93
|
+
forcedRebalanceThresholdBP,
|
|
94
|
+
verbose: options.verbose,
|
|
95
|
+
});
|
|
96
|
+
if (options.verbose) {
|
|
97
|
+
logInfo(` thresholdBreached (our calc): ${thresholdBreached}
|
|
98
|
+
ltvRatio: ${ltvRatio / 100}%
|
|
99
|
+
thresholdExcess: ${thresholdExcess / 100}%
|
|
100
|
+
`);
|
|
101
|
+
}
|
|
102
|
+
// Sanity check: contract's isHealthy should be inverse of our thresholdBreached
|
|
103
|
+
// isHealthy = true means healthy, thresholdBreached = false means healthy
|
|
104
|
+
if (isHealthy === thresholdBreached) {
|
|
105
|
+
logInfo(` ⚠️ MISMATCH: Contract isHealthy=${isHealthy}, our thresholdBreached=${thresholdBreached}`);
|
|
106
|
+
logInfo(`⚠️ WARNING: Health check mismatch for ${account}! Contract isHealthy=${isHealthy}, but our thresholdBreached=${thresholdBreached}`);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
if (options.verbose) {
|
|
110
|
+
logInfo(' ✅ Health check matches contract');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (!isHealthy && stvBalance > 0n) {
|
|
114
|
+
unhealthyPositions.push({
|
|
115
|
+
account,
|
|
116
|
+
stvBalance,
|
|
117
|
+
stvInEth,
|
|
118
|
+
debtShares,
|
|
119
|
+
debtInEth,
|
|
120
|
+
ltvRatio,
|
|
121
|
+
isHealthy,
|
|
122
|
+
thresholdExcess,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
logInfo(`Error checking account ${account}: ${error}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Sort by threshold excess descending (most critical first)
|
|
131
|
+
unhealthyPositions.sort((a, b) => b.thresholdExcess - a.thresholdExcess);
|
|
132
|
+
if (unhealthyPositions.length === 0) {
|
|
133
|
+
logInfo('✅ No unhealthy positions found!');
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
logInfo('⚠️ Unhealthy Positions Report\n');
|
|
137
|
+
const tableData = unhealthyPositions.map((p) => [
|
|
138
|
+
p.account,
|
|
139
|
+
`${formatUnits(p.stvBalance, 27)} STV`,
|
|
140
|
+
`${formatEther(p.debtShares)} shares`,
|
|
141
|
+
`${formatEther(p.debtInEth)} ETH`,
|
|
142
|
+
`${(p.ltvRatio / 100).toFixed(2)}%`, // Display LTV
|
|
143
|
+
`+${(p.thresholdExcess / 100).toFixed(2)}%`, // How much over threshold
|
|
144
|
+
p.thresholdExcess > 1000 // > 10% over threshold
|
|
145
|
+
? '🚨 CRITICAL'
|
|
146
|
+
: '⚠️ UNHEALTHY',
|
|
147
|
+
]);
|
|
148
|
+
logTable({
|
|
149
|
+
params: {
|
|
150
|
+
head: [
|
|
151
|
+
'Account',
|
|
152
|
+
'STV Balance',
|
|
153
|
+
'Debt (shares)',
|
|
154
|
+
'Debt (ETH)',
|
|
155
|
+
'LTV Ratio',
|
|
156
|
+
'Over Threshold',
|
|
157
|
+
'Status',
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
data: tableData,
|
|
161
|
+
});
|
|
162
|
+
logInfo(`\nTotal Unhealthy Accounts: ${unhealthyPositions.length}`);
|
|
163
|
+
logInfo(`Threshold: ${(Number(forcedRebalanceThresholdBP) / 100).toFixed(2)}%`);
|
|
164
|
+
});
|
|
165
|
+
healthRead
|
|
166
|
+
.command('calculate-rebalance-need')
|
|
167
|
+
.description('calculate total ETH needed to rebalance all unhealthy positions')
|
|
168
|
+
.argument('<address>', 'stv-steth-pool address', stringToAddress)
|
|
169
|
+
.option('--from-block <number>', 'from block number', stringToNumber)
|
|
170
|
+
.option('--batch-size <number>', 'max blocks per RPC call (default: 30000)', stringToNumber)
|
|
171
|
+
.option('--verbose', 'show verbose output', false)
|
|
172
|
+
.action(async (address, options) => {
|
|
173
|
+
const poolContract = await getStvStethPoolContract(address);
|
|
174
|
+
const stethContract = await getStethContract();
|
|
175
|
+
logInfo('Calculating rebalance requirements...\n');
|
|
176
|
+
// Get pool info
|
|
177
|
+
const [name, symbol, totalExceedingMintedSteth, vaultAddress] = await Promise.all([
|
|
178
|
+
callReadMethodSilent(poolContract, 'name'),
|
|
179
|
+
callReadMethodSilent(poolContract, 'symbol'),
|
|
180
|
+
callReadMethodSilent(poolContract, 'totalExceedingMintedSteth'),
|
|
181
|
+
callReadMethodSilent(poolContract, 'VAULT'),
|
|
182
|
+
]);
|
|
183
|
+
logInfo(`Pool: ${name} (${symbol}) at ${address}\n`);
|
|
184
|
+
// Calculate balances from indexed events
|
|
185
|
+
const balances = await calculateBalancesFromEvents({
|
|
186
|
+
poolAddress: address,
|
|
187
|
+
fromBlock: options.fromBlock,
|
|
188
|
+
batchSize: options.batchSize,
|
|
189
|
+
});
|
|
190
|
+
const rebalanceRequirements = [];
|
|
191
|
+
let totalStethRequired = 0n;
|
|
192
|
+
for (const [account, balance] of balances) {
|
|
193
|
+
try {
|
|
194
|
+
// Skip accounts with no position
|
|
195
|
+
if (balance.stvBalance === 0n && balance.debtShares === 0n) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
const isHealthy = await callReadMethodSilent(poolContract, 'isHealthyOf', [account]);
|
|
199
|
+
if (!isHealthy) {
|
|
200
|
+
// Call previewForceRebalance
|
|
201
|
+
const [stethShares, stvToBurn, isUndercollateralized] = await callReadMethodSilent(poolContract, 'previewForceRebalance', [account]);
|
|
202
|
+
if (stvToBurn > 0n) {
|
|
203
|
+
// Convert stETH shares to ETH
|
|
204
|
+
const stethInEth = await callReadMethodSilent(stethContract, 'getPooledEthBySharesRoundUp', [stethShares]);
|
|
205
|
+
rebalanceRequirements.push({
|
|
206
|
+
account,
|
|
207
|
+
stvToBurn,
|
|
208
|
+
stethShares,
|
|
209
|
+
stethInEth,
|
|
210
|
+
isUndercollateralized,
|
|
211
|
+
});
|
|
212
|
+
totalStethRequired += stethInEth;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
logInfo(`Error processing account ${account}: ${error}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// Get vault balance
|
|
221
|
+
const publicClient = await getPublicClient();
|
|
222
|
+
const vaultEthBalance = await publicClient.getBalance({
|
|
223
|
+
address: vaultAddress,
|
|
224
|
+
});
|
|
225
|
+
// Calculate adjusted requirement after exceeding stETH
|
|
226
|
+
// "Exceeding minted stETH" is already available in the pool and can be used
|
|
227
|
+
// for rebalancing WITHOUT providing additional ETH.
|
|
228
|
+
// So we subtract it from total required to get the REAL ETH need.
|
|
229
|
+
const adjustedRequirement = totalStethRequired > totalExceedingMintedSteth
|
|
230
|
+
? totalStethRequired - totalExceedingMintedSteth
|
|
231
|
+
: 0n;
|
|
232
|
+
// Calculate ETH shortfall: how much MORE ETH is needed beyond vault balance
|
|
233
|
+
const ethShortfall = adjustedRequirement > vaultEthBalance
|
|
234
|
+
? adjustedRequirement - vaultEthBalance
|
|
235
|
+
: 0n;
|
|
236
|
+
// Output summary
|
|
237
|
+
logInfo('═'.repeat(70));
|
|
238
|
+
logInfo('REBALANCE REQUIREMENTS REPORT');
|
|
239
|
+
logInfo('═'.repeat(70) + '\n');
|
|
240
|
+
logTable({
|
|
241
|
+
data: [
|
|
242
|
+
['Pool', address],
|
|
243
|
+
['Pool Name', `${name} (${symbol})`],
|
|
244
|
+
['', ''],
|
|
245
|
+
['📊 Unhealthy Accounts', rebalanceRequirements.length.toString()],
|
|
246
|
+
['', ''],
|
|
247
|
+
['═══ REBALANCE NEEDS ═══', ''],
|
|
248
|
+
[
|
|
249
|
+
'1️⃣ Total stETH Required (raw)',
|
|
250
|
+
`${formatEther(totalStethRequired)} ETH`,
|
|
251
|
+
],
|
|
252
|
+
[
|
|
253
|
+
'2️⃣ Exceeding Minted stETH (available)',
|
|
254
|
+
totalExceedingMintedSteth > 0n
|
|
255
|
+
? `${formatEther(totalExceedingMintedSteth)} ETH ✅`
|
|
256
|
+
: `${formatEther(totalExceedingMintedSteth)} ETH`,
|
|
257
|
+
],
|
|
258
|
+
[
|
|
259
|
+
'3️⃣ After Exceeding Adjustment',
|
|
260
|
+
adjustedRequirement > 0n
|
|
261
|
+
? `${formatEther(adjustedRequirement)} ETH (real need)`
|
|
262
|
+
: `${formatEther(adjustedRequirement)} ETH ✅ (covered by exceeding)`,
|
|
263
|
+
],
|
|
264
|
+
['', ''],
|
|
265
|
+
['═══ VAULT RESOURCES ═══', ''],
|
|
266
|
+
['💰 Vault ETH Balance', `${formatEther(vaultEthBalance)} ETH`],
|
|
267
|
+
[
|
|
268
|
+
'🎯 ETH Shortfall',
|
|
269
|
+
ethShortfall > 0n
|
|
270
|
+
? `⚠️ ${formatEther(ethShortfall)} ETH (NEED MORE)`
|
|
271
|
+
: `✅ ${formatEther(ethShortfall)} ETH (SUFFICIENT)`,
|
|
272
|
+
],
|
|
273
|
+
],
|
|
274
|
+
});
|
|
275
|
+
if (options.verbose && rebalanceRequirements.length > 0) {
|
|
276
|
+
logInfo('\n' + '─'.repeat(70));
|
|
277
|
+
logInfo('DETAILED BREAKDOWN BY ACCOUNT');
|
|
278
|
+
logInfo('─'.repeat(70) + '\n');
|
|
279
|
+
const detailedData = rebalanceRequirements.map((r) => [
|
|
280
|
+
r.account,
|
|
281
|
+
formatUnits(r.stvToBurn, 27),
|
|
282
|
+
formatEther(r.stethShares),
|
|
283
|
+
formatEther(r.stethInEth),
|
|
284
|
+
r.isUndercollateralized ? '⚠️ Yes' : 'No',
|
|
285
|
+
]);
|
|
286
|
+
logTable({
|
|
287
|
+
params: {
|
|
288
|
+
head: [
|
|
289
|
+
'Account',
|
|
290
|
+
'STV to Burn',
|
|
291
|
+
'stETH Shares',
|
|
292
|
+
'stETH (ETH)',
|
|
293
|
+
'Undercollateralized',
|
|
294
|
+
],
|
|
295
|
+
},
|
|
296
|
+
data: detailedData,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
// Action items
|
|
300
|
+
logInfo('\n' + '═'.repeat(70));
|
|
301
|
+
logInfo('ACTION ITEMS');
|
|
302
|
+
logInfo('═'.repeat(70) + '\n');
|
|
303
|
+
if (rebalanceRequirements.length === 0) {
|
|
304
|
+
logInfo('✅ No rebalance needed - all positions are healthy!\n');
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
// Explain the rebalance strategy
|
|
308
|
+
if (totalExceedingMintedSteth > 0n) {
|
|
309
|
+
logInfo(`1. 🔄 Can rebalance using exceeding stETH: ${formatEther(totalExceedingMintedSteth)} ETH`);
|
|
310
|
+
logInfo(` This stETH is already in the pool and doesn't require external ETH`);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
logInfo(`1. 🔄 No exceeding stETH available - will need to provide ETH externally`);
|
|
314
|
+
}
|
|
315
|
+
if (ethShortfall > 0n) {
|
|
316
|
+
logInfo(`\n2. ⚠️ Need to provide ${formatEther(ethShortfall)} ETH from external source`);
|
|
317
|
+
logInfo(` Command: yarn start dw stv-steth w rebalance-unassigned-liability-with-ether \\`);
|
|
318
|
+
logInfo(` ${address} ${formatEther(ethShortfall)}`);
|
|
319
|
+
}
|
|
320
|
+
else if (adjustedRequirement > 0n) {
|
|
321
|
+
logInfo(`\n2. ✅ Vault has sufficient ETH balance (${formatEther(vaultEthBalance)} ETH available)`);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
logInfo('\n2. ✅ Exceeding stETH fully covers all rebalance needs - no ETH required!');
|
|
325
|
+
}
|
|
326
|
+
logInfo(`\n3. 🎯 Execute rebalances for each account:`);
|
|
327
|
+
logInfo(` Command: yarn start dw uc h force-rebalance ${address} <account-address>`);
|
|
328
|
+
const undercollateralizedCount = rebalanceRequirements.filter((r) => r.isUndercollateralized).length;
|
|
329
|
+
if (undercollateralizedCount > 0) {
|
|
330
|
+
logInfo(`\n⚠️ CRITICAL: ${undercollateralizedCount} of ${rebalanceRequirements.length} accounts are UNDERCOLLATERALIZED!`);
|
|
331
|
+
logInfo(' These positions have debt > collateral and will cause LOSSES.');
|
|
332
|
+
logInfo(' Requires: LOSS_SOCIALIZER_ROLE to execute');
|
|
333
|
+
logInfo(` Command: yarn start dw uc h force-rebalance-and-socialize-loss ${address} <account-address>`);
|
|
334
|
+
}
|
|
335
|
+
logInfo('');
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../../programs/defi-wrapper/use-cases/health/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,cAAc,EACd,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,YAAY,CAAC;AAEpB,MAAM,UAAU,GAAG,MAAM;KACtB,OAAO,CAAC,MAAM,CAAC;KACf,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;KACd,WAAW,CAAC,sBAAsB,CAAC,CAAC;AAavC,UAAU;KACP,OAAO,CAAC,gBAAgB,CAAC;KACzB,WAAW,CAAC,0CAA0C,CAAC;KACvD,QAAQ,CAAC,WAAW,EAAE,wBAAwB,EAAE,eAAe,CAAC;KAChE,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,EAAE,cAAc,CAAC;KACpE,MAAM,CACL,qBAAqB,EACrB,mCAAmC,EACnC,cAAc,CACf;KACA,MAAM,CACL,uBAAuB,EACvB,0CAA0C,EAC1C,cAAc,CACf;KACA,MAAM,CAAC,WAAW,EAAE,qBAAqB,EAAE,KAAK,CAAC;KACjD,MA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CACF,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Replicates the contract's _isThresholdBreached logic
|
|
4
|
+
* @param assets - STV assets value in ETH (from previewRedeem)
|
|
5
|
+
* @param stethShares - debt in stETH shares
|
|
6
|
+
* @param debtInEth - debt in ETH (from getPooledEthBySharesRoundUp)
|
|
7
|
+
* @param forcedRebalanceThresholdBP - threshold in basis points
|
|
8
|
+
* @returns true if threshold is breached (position is unhealthy)
|
|
9
|
+
*/
|
|
10
|
+
export declare const isThresholdBreached: ({ assets, stethShares, debtInEth, forcedRebalanceThresholdBP, verbose, }: {
|
|
11
|
+
assets: bigint;
|
|
12
|
+
stethShares: bigint;
|
|
13
|
+
debtInEth: bigint;
|
|
14
|
+
forcedRebalanceThresholdBP: bigint;
|
|
15
|
+
verbose?: boolean;
|
|
16
|
+
}) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Calculate the "effective LTV ratio" for display purposes
|
|
19
|
+
* This shows how close the position is to the threshold
|
|
20
|
+
* Returns basis points (10000 = 100%)
|
|
21
|
+
*/
|
|
22
|
+
export declare const calculateEffectiveLTV: ({ assets, debtInEth, }: {
|
|
23
|
+
assets: bigint;
|
|
24
|
+
debtInEth: bigint;
|
|
25
|
+
}) => number;
|
|
26
|
+
/**
|
|
27
|
+
* Calculate how much the position exceeds the threshold
|
|
28
|
+
* Returns basis points of how much over threshold (negative if healthy)
|
|
29
|
+
*/
|
|
30
|
+
export declare const calculateThresholdExcess: ({ assets, stethShares, debtInEth, forcedRebalanceThresholdBP, verbose, }: {
|
|
31
|
+
assets: bigint;
|
|
32
|
+
stethShares: bigint;
|
|
33
|
+
debtInEth: bigint;
|
|
34
|
+
forcedRebalanceThresholdBP: bigint;
|
|
35
|
+
verbose?: boolean;
|
|
36
|
+
}) => number;
|
|
37
|
+
export declare const indexAccountsFromEvents: ({ poolAddress, fromBlock, toBlock, batchSize, }: {
|
|
38
|
+
poolAddress: Address;
|
|
39
|
+
fromBlock?: number;
|
|
40
|
+
toBlock?: number;
|
|
41
|
+
batchSize?: number;
|
|
42
|
+
}) => Promise<Set<Address>>;
|
|
43
|
+
/**
|
|
44
|
+
* Calculate account balances from indexed events
|
|
45
|
+
*/
|
|
46
|
+
export declare const calculateBalancesFromEvents: ({ poolAddress, fromBlock, toBlock, batchSize, }: {
|
|
47
|
+
poolAddress: Address;
|
|
48
|
+
fromBlock?: number;
|
|
49
|
+
toBlock?: number;
|
|
50
|
+
batchSize?: number;
|
|
51
|
+
}) => Promise<Map<Address, {
|
|
52
|
+
stvBalance: bigint;
|
|
53
|
+
debtShares: bigint;
|
|
54
|
+
}>>;
|
|
55
|
+
export declare const grantLossSocializerRole: (address: Address, currentAccount: Address) => Promise<void>;
|
|
56
|
+
export declare const setMaxLossSocializationBP: (address: Address) => Promise<void>;
|