@hypurrquant/defi-cli 1.0.11 → 1.0.13

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.
Files changed (54) hide show
  1. package/README.md +9 -2
  2. package/config/chains.toml +6 -1
  3. package/config/protocols/dex/aerodrome_base.toml +2 -1
  4. package/config/protocols/dex/aerodrome_cl.toml +2 -1
  5. package/config/protocols/dex/apeswap_bnb.toml +1 -1
  6. package/config/protocols/dex/babydogeswap_bnb.toml +1 -1
  7. package/config/protocols/dex/bakeryswap_bnb.toml +2 -2
  8. package/config/protocols/dex/biswap_bnb.toml +1 -1
  9. package/config/protocols/dex/bscswap_bnb.toml +1 -1
  10. package/config/protocols/dex/curve_hyperevm.toml +1 -1
  11. package/config/protocols/dex/fstswap_bnb.toml +1 -1
  12. package/config/protocols/dex/hybra.toml +4 -2
  13. package/config/protocols/dex/hyperswap.toml +1 -1
  14. package/config/protocols/dex/kittenswap.toml +1 -1
  15. package/config/protocols/dex/merchantmoe_mantle.toml +2 -1
  16. package/config/protocols/dex/nest.toml +6 -5
  17. package/config/protocols/dex/pancakeswap_v2_bnb.toml +1 -1
  18. package/config/protocols/dex/pancakeswap_v3_bnb.toml +2 -1
  19. package/config/protocols/dex/project_x.toml +1 -1
  20. package/config/protocols/dex/ramses_cl.toml +1 -1
  21. package/config/protocols/dex/ramses_hl.toml +1 -1
  22. package/config/protocols/dex/thena_v1_bnb.toml +2 -1
  23. package/config/protocols/dex/traderjoe_monad.toml +2 -1
  24. package/config/protocols/dex/uniswap_v2_monad.toml +2 -1
  25. package/config/protocols/dex/uniswap_v3_base.toml +2 -1
  26. package/config/protocols/dex/uniswap_v3_bnb.toml +3 -1
  27. package/config/protocols/dex/uniswap_v3_mantle.toml +2 -1
  28. package/config/protocols/dex/uniswap_v3_monad.toml +2 -1
  29. package/config/protocols/lending/felix_morpho.toml +16 -0
  30. package/config/protocols/lending/hyperlend.toml +1 -1
  31. package/config/protocols/lending/hypurrfi.toml +1 -1
  32. package/config/protocols/lending/kinza_bnb.toml +1 -1
  33. package/config/protocols/lending/morpho_blue_monad.toml +17 -0
  34. package/config/protocols/lending/venus_flux_bnb.toml +5 -1
  35. package/dist/index.js +1590 -309
  36. package/dist/index.js.map +1 -1
  37. package/dist/main.js +1595 -314
  38. package/dist/main.js.map +1 -1
  39. package/dist/mcp-server.js +810 -196
  40. package/dist/mcp-server.js.map +1 -1
  41. package/package.json +1 -1
  42. package/skills/defi-cli/SKILL.md +54 -5
  43. package/skills/defi-cli/references/commands.md +41 -8
  44. package/skills/defi-cli/references/protocols.md +2 -2
  45. package/skills/defi-cli/scripts/bridge-quote.sh +34 -0
  46. package/skills/defi-cli/scripts/lending-supply-flow.sh +28 -0
  47. package/skills/defi-cli/scripts/lp-claim-all.sh +25 -0
  48. package/skills/defi-cli/scripts/lp-emission-discover.sh +20 -0
  49. package/skills/defi-cli/scripts/portfolio-snapshot.sh +0 -0
  50. package/skills/defi-cli/scripts/preflight.sh +0 -0
  51. package/skills/defi-cli/scripts/swap-quote.sh +37 -0
  52. package/skills/defi-cli/scripts/wallet-status.sh +30 -0
  53. package/skills/defi-cli/scripts/yield-scan.sh +0 -0
  54. package/skills/defi-cli/scripts/exploit-scan.sh +0 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypurrquant/defi-cli",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Multi-chain DeFi CLI \u2014 lending, DEX, LP, bridge, vault, staking from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -5,7 +5,7 @@ allowed-tools: "Bash(defi:*), Bash(npx defi-cli:*), Bash(npx -y defi-cli:*)"
5
5
  license: MIT
6
6
  metadata:
7
7
  author: hypurrquant
8
- version: "1.0.0"
8
+ version: "1.0.11"
9
9
  ---
10
10
 
11
11
  # defi-cli Agent Guide
@@ -54,17 +54,40 @@ export DEFI_PRIVATE_KEY=0xYourPrivateKey # only needed for broadcasting
54
54
  | `hyperevm` | HyperEVM | 999 | 🟢 production |
55
55
  | `mantle` | Mantle | 5000 | 🟢 production |
56
56
  | `base` | Base | 8453 | 🟢 production |
57
- | `bnb` | BNB Chain | 56 | 🟡 staged |
57
+ | `bnb` | BNB Chain | 56 | 🟢 production |
58
58
  | `monad` | Monad | 143 | 🟡 staged |
59
59
 
60
60
  🟢 = mainnet broadcast verified | 🟡 = configs verified, awaiting funded broadcast
61
61
 
62
+ ## References
63
+
64
+ - **`references/protocols.md`** — full protocol slug catalog per chain (39 protocols across 5 chains)
65
+ - **`references/commands.md`** — every CLI command with flags, dry-run shape, and JSON envelope notes
66
+
67
+ ## Scripts (`scripts/`)
68
+
69
+ Copy-paste runnable usage recipes. Each script honours `DEFI_CMD` (override the binary name, e.g. `DEFI_CMD="npx -y -p @hypurrquant/defi-cli@latest defi"`) and emits JSON on stdout, status on stderr.
70
+
71
+ | Script | What it does | Invocation |
72
+ |---|---|---|
73
+ | `preflight.sh` | Verify install + wallet env | `bash preflight.sh` |
74
+ | `yield-scan.sh` | Best supply APY across all chains | `ASSET=USDC bash yield-scan.sh` |
75
+ | `lp-emission-discover.sh` | Active emission pools sorted by APR | `bash lp-emission-discover.sh mantle merchantmoe-mantle` |
76
+ | `swap-quote.sh` | Compare every supported aggregator (dry-run) | `CHAIN=base FROM=WETH TO=USDC AMOUNT=10000000000000000 bash swap-quote.sh` |
77
+ | `bridge-quote.sh` | Compare LI.FI / deBridge / CCTP (dry-run) | `FROM_CHAIN=base TO_CHAIN=arbitrum TOKEN=USDC AMOUNT=100000000 bash bridge-quote.sh` |
78
+ | `lending-supply-flow.sh` | yield → rates → position → dry-run supply | `CHAIN=hyperevm PROTOCOL=hyperlend ASSET=USDC AMOUNT=1000000 bash lending-supply-flow.sh` |
79
+ | `lp-claim-all.sh` | List all LP positions + claim CLI hints | `WALLET=0xABC… bash lp-claim-all.sh mantle` |
80
+ | `portfolio-snapshot.sh` | Snapshot + PnL for a wallet | `WALLET=0xABC… bash portfolio-snapshot.sh hyperevm` |
81
+ | `wallet-status.sh` | Resolved wallet + native balance per chain | `bash wallet-status.sh` |
82
+
83
+ All `*-quote.sh` and `lending-supply-flow.sh` scripts are **dry-run only** — they never touch `--broadcast`. Add `--broadcast` to the printed CLI yourself after user confirmation.
84
+
62
85
  ## Protocol Slugs by Chain
63
86
 
64
87
  For full protocol list see `references/protocols.md`. High-level summary:
65
88
 
66
- ### HyperEVM (11)
67
- **Lending**: `hyperlend`, `hypurrfi`, `felix-morpho` · **DEX**: `project-x`, `hyperswap`, `curve-hyperevm`, `ramses-cl`, `ramses-hl`, `kittenswap`, `hybra`, `nest`
89
+ ### HyperEVM (10)
90
+ **Lending**: `hyperlend`, `hypurrfi`, `felix-morpho` · **DEX**: `project-x`, `hyperswap-v3`, `curve-hyperevm`, `ramses-cl`, `ramses-hl`, `kittenswap`, `hybra`
68
91
 
69
92
  ### Mantle (3)
70
93
  **Lending**: `aave-v3-mantle` · **DEX**: `uniswap-v3-mantle`, `merchantmoe-mantle` (LB + MOE emission)
@@ -139,7 +162,9 @@ For full protocol list see `references/protocols.md`. High-level summary:
139
162
 
140
163
  ## Core Workflow: Cross-chain Bridge
141
164
 
142
- Bridge **source** must be a supported chain (hyperevm/mantle/base/bnb/monad). Bridge **destination** can be any chain LI.FI/deBridge route to, or any CCTP V2 chain (ethereum, arbitrum, optimism, polygon, avalanche, base).
165
+ Bridge **source** must be a supported chain (hyperevm/mantle/base/bnb/monad). Bridge **destination** can be any chain LI.FI / Relay / deBridge route to, or any CCTP V2 chain (ethereum, arbitrum, optimism, polygon, avalanche, base).
166
+
167
+ Providers: `lifi` (default, broad coverage), `relay` (fast native-token routes, ~3s settle), `debridge` (DLN intent), `cctp` (Circle native USDC).
143
168
 
144
169
  ```
145
170
  1. defi --json --chain base bridge --token USDC --amount 100000000 --to-chain arbitrum --provider lifi # dry-run
@@ -147,6 +172,13 @@ Bridge **source** must be a supported chain (hyperevm/mantle/base/bnb/monad). Br
147
172
  3. defi --json --chain base bridge --token USDC --amount 100000000 --to-chain arbitrum --provider lifi --broadcast
148
173
  ```
149
174
 
175
+ Relay native-token example (USDC/USDT often blocked by Relay's currency registry — use native sentinel `0x0…0`):
176
+
177
+ ```
178
+ defi --json --chain base bridge --token 0x0000000000000000000000000000000000000000 \
179
+ --amount 1000000000000000 --to-chain bnb --provider relay --broadcast
180
+ ```
181
+
150
182
  ## Core Workflow: Yield Comparison
151
183
 
152
184
  ```
@@ -163,9 +195,26 @@ Bridge **source** must be a supported chain (hyperevm/mantle/base/bnb/monad). Br
163
195
  | `Protocol not found: X` | run `defi --json status` to list valid slugs for the chain |
164
196
  | `KyberSwap: unsupported chain` | use openocean, lifi, or relay |
165
197
  | `AMOUNT_TOO_LOW` (Relay) | increase amount or switch provider |
198
+ | `INVALID_INPUT_CURRENCY` (Relay bridge) | source token not in Relay's registry; use native sentinel `0x0…0` or switch provider |
166
199
  | `No fees to compound` | V3 position has no accumulated fees yet — wait for swaps to cross range |
167
200
  | `No pools found` | protocol may be inactive on this chain or discover branch missing config |
168
201
  | `DEFI_WALLET_ADDRESS not set` | set env var or pass `--address` |
202
+ | `tokenId X has zero liquidity` | NFT position already removed; verify with `lp positions` |
203
+ | `failed_probes[]` in yield output | RPC transport failure (not "asset unsupported"); set `<CHAIN>_RPC_URL` and retry |
204
+ | `WARNING: no wallet configured` on stderr | dry-run preview using placeholder `0x000…001`; do **NOT** pass `--broadcast` until wallet is set |
205
+
206
+ ## Recent Behaviour Notes (v1.0.5 → v1.0.11 + post-release fixes)
207
+
208
+ - **`lp remove` (V3 / Slipstream / Hybra / Algebra)** — pass only `--token-id`; `--token-a/--token-b/--liquidity` are optional. Liquidity is read from `NPM.positions(tokenId)` automatically.
209
+ - **`schema <action>`** accepts hyphenated names (`schema lending-supply` ≡ `schema lending.supply`).
210
+ - **`yield optimize` / `yield compare`** distinguishes "no opportunities" from "RPC failed" — failure surfaces a `failed_probes[]` envelope with per-protocol reason and a hint to set `<CHAIN>_RPC_URL`.
211
+ - **`portfolio show` / `snapshot`** prices each asset via its own oracle (ERC20s no longer mispriced at the native rate) and includes the native gas-token balance in `total_value_usd`.
212
+ - **`wallet address`** with no wallet returns `{ "address": null, "source": "none" }` (machine-parseable; the legacy `"(not set)"` sentinel is gone).
213
+ - **`bridge --provider cctp`** below the protocol min-fee returns a structured error envelope with `minimum_amount_wei` / `minimum_amount_usdc` (no broadcast attempt).
214
+ - **`bridge --provider relay`** wires the Executor when `--broadcast` is set (native tokens skip approve; ERC20 paths add a single approval to the relay-returned `to`). Relay's currency registry rejects some ERC20 inputs — e.g. BNB USDC/USDT return `INVALID_INPUT_CURRENCY`; switch to native sentinel `0x0…0` or another provider. Tiny amounts may surface `AMOUNT_TOO_LOW` (Relay's fee floor). Verified live both directions on Base ↔ BNB native (~3s settle).
215
+ - **`bridge --provider lifi` / `--provider debridge`** are now Executor-wired too (previously quote-only). LI.FI uses `quote.estimate.approvalAddress` as the ERC20 spender; deBridge uses the create-tx `to` address. Verified live Base ETH → BNB native: LI.FI tx `0xc2d2…1a80`, deBridge tx `0x2bd8…2827`.
216
+ - **`bridge --provider cctp --auto-receive`** polls Circle's Iris API after the burn confirms (`https://iris-api.circle.com/v2/messages/{srcDomain}?transactionHash=…`), then submits `MessageTransmitter.receiveMessage(message, attestation)` on the destination chain (V2 contract `0x81D40F21F12A8F0E3252Bccb954D722d4c464B64`, same address on every EVM V2 chain). Destination chains in `DEST_CHAIN_META` (ethereum, arbitrum, optimism, polygon, avalanche, linea, zksync) resolve their RPC from `<UPPER>_RPC_URL` env vars first, then fall back to public drpc/merkle endpoints. Auto-receive **requires destination-chain native gas** for the receive tx — a separate funding prerequisite. Without `--auto-receive` only the burn fires; the user must manually finalize on the destination later.
217
+ - **`setup`** masks API keys when displaying RPC URLs and suppresses key-echo when prompting for a private key; only `http://`/`https://` URLs are accepted.
169
218
 
170
219
  ## Examples
171
220
 
@@ -11,6 +11,8 @@ All amounts are in **wei** unless noted. USDC/USDT/USDT0 use 6 decimals; native
11
11
  defi --json status # current chain protocols
12
12
  defi --json --chain mantle status # Mantle protocols + addresses
13
13
  defi --json schema # full CLI schema as JSON
14
+ defi --json schema lending.supply # one action's params + cli example
15
+ defi --json schema lending-supply # hyphenated form also works (post-v1.0.11)
14
16
  ```
15
17
 
16
18
  ## Yield (read-only, safe)
@@ -21,6 +23,11 @@ defi --json --chain mantle yield compare --asset USDT
21
23
  defi --json yield optimize --asset USDC --amount 100000000 # diversification plan
22
24
  ```
23
25
 
26
+ **Failure shape (post-v1.0.11)**: when every RPC probe fails, the command no longer pretends "no opportunities found" — it returns:
27
+ ```json
28
+ { "error": "...", "failed_probes": [{ "protocol": "aave-v3-mantle", "type": "lending", "reason": "..." }], "hint": "Set MANTLE_RPC_URL=..." }
29
+ ```
30
+
24
31
  ## Price (read-only, safe)
25
32
 
26
33
  ```bash
@@ -110,8 +117,8 @@ defi --json --chain hyperevm lp claim --protocol kittenswap --pool <addr> --toke
110
117
  # Merchant Moe LB (auto-detects user's actual bins)
111
118
  defi --json --chain mantle lp claim --protocol merchantmoe-mantle --pool <addr>
112
119
 
113
- # Off-chain Nest ticket
114
- defi --json --chain hyperevm lp claim --protocol nest --address <wallet>
120
+ # Nest is inactive (is_active = false in config); CLI rejects "--protocol nest".
121
+ # Off-chain claim via the Nest UI at blaze.nest.aegas.it.
115
122
  ```
116
123
 
117
124
  ### Compound (V3 fee auto-compound)
@@ -125,19 +132,21 @@ Collects accrued fees and re-adds them as liquidity in one tx. V3 fee-only proto
125
132
  ### Remove Liquidity
126
133
 
127
134
  ```bash
128
- # V3 / Slipstream (NFT-based)
129
- defi --json --chain <chain> lp remove --protocol <slug> \
130
- --token-a <token> --token-b <token> --liquidity <amount> --token-id <id> [--gauge <addr>]
135
+ # V3 / Slipstream / Algebra / Hybra (NFT-based) — only --token-id required
136
+ # Liquidity is read live from NPM.positions(tokenId); --liquidity overrides if passed
137
+ defi --json --chain <chain> lp remove --protocol <slug> --token-id <id> [--gauge <addr>]
131
138
 
132
139
  # Solidly V2 (LP-token-based)
133
140
  defi --json --chain <chain> lp remove --protocol <slug> \
134
141
  --token-a <token> --token-b <token> --liquidity <wei> --gauge <addr>
135
142
 
136
- # Liquidity Book (Merchant Moe / TraderJoe)
143
+ # Liquidity Book (Merchant Moe / TraderJoe) — pair flags + bins required
137
144
  defi --json --chain <chain> lp remove --protocol <slug> \
138
145
  --token-a <token> --token-b <token> --pool <addr> --bins <bin1>,<bin2>,...
139
146
  ```
140
147
 
148
+ If a V3/CL `--token-id` resolves to zero on-chain liquidity, the command surfaces `tokenId X has zero liquidity (already removed?)` instead of producing a no-op `decreaseLiquidity(0) + collect`.
149
+
141
150
  ### LP Positions
142
151
 
143
152
  ```bash
@@ -180,6 +189,8 @@ defi --json --chain <chain> portfolio snapshot [--address <addr>]
180
189
  defi --json --chain <chain> portfolio pnl [--address <addr>]
181
190
  ```
182
191
 
192
+ **Pricing (post-v1.0.11)**: each ERC20 is priced via its own oracle (no longer the native asset's price). Native gas-token balance is fetched via `eth_getBalance` and included as `native_balance` / `native_value_usd` in the total. Tokens whose oracle returns 0 are omitted from the total instead of being mispriced. `snapshot` matches `show` to the cent.
193
+
183
194
  ## Token
184
195
 
185
196
  ```bash
@@ -195,10 +206,27 @@ defi --json --chain <chain> token transfer --token <token> --to <addr> --amount
195
206
  ## Wallet
196
207
 
197
208
  ```bash
198
- defi --json wallet address
199
- defi --json --chain <chain> wallet balance [--address <addr>]
209
+ defi --json wallet address # { "address": "0x…", "source": "ows|private_key|env|none" }
210
+ defi --json --chain <chain> wallet balance [--address <addr>] # native balance via eth_getBalance
200
211
  ```
201
212
 
213
+ `wallet address` returns `{ "address": null, "source": "none" }` when no wallet is configured (the legacy `"(not set)"` string sentinel is gone). Resolution precedence: `--address` flag → OWS vault (`DEFI_WALLET_ADDRESS=ows:<name>`) → `DEFI_PRIVATE_KEY` derived → plain `DEFI_WALLET_ADDRESS`.
214
+
215
+ ### Wallet placeholder warning
216
+
217
+ For dry-run paths (`swap`, `bridge`, `lending supply`, etc.), if no wallet is configured the CLI emits a one-shot stderr warning and substitutes the placeholder `0x000…001` so calldata can still be previewed. **Never pass `--broadcast` when the placeholder is in use** — the warning will tell you so explicitly.
218
+
219
+ ## Setup (interactive wizard)
220
+
221
+ ```bash
222
+ defi setup # prompts for chain RPCs + wallet
223
+ ```
224
+
225
+ Stored in `~/.defi/config.toml`. The wizard:
226
+ - Suppresses keypress echo when prompting for a private key.
227
+ - Accepts only `http://` and `https://` RPC URLs (rejects `ws://`, `wss://`, plain hosts).
228
+ - Masks the URL path when displaying current configuration (`https://eth.example.com/***`) so embedded API keys do not leak in transcripts.
229
+
202
230
  ## Bridge (cross-chain)
203
231
 
204
232
  Source chain (`--chain`) must be a supported chain: `hyperevm`, `mantle`, `base`, `bnb`, `monad`. Destination (`--to-chain`) can be any chain LI.FI/deBridge route to, plus all CCTP V2 chains.
@@ -213,3 +241,8 @@ defi --json --chain base bridge --token USDC --amount 100000000 --to-chain arbit
213
241
  # Circle CCTP V2 destinations: ethereum, avalanche, optimism, arbitrum, base, polygon
214
242
  defi --json --chain base bridge --token USDC --amount 100000000 --to-chain arbitrum --provider cctp
215
243
  ```
244
+
245
+ **CCTP min-fee guard (post-v1.0.7)**: when the burn amount cannot cover the protocol fee, the command short-circuits with a structured envelope (no broadcast attempt):
246
+ ```json
247
+ { "error": "amount_below_min_fee", "minimum_amount_wei": "...", "minimum_amount_usdc": "..." }
248
+ ```
@@ -13,13 +13,13 @@
13
13
  | Slug | Name | Interface | Notes |
14
14
  |------|------|-----------|-------|
15
15
  | `project-x` | Project X | uniswap_v3 | V3 fee-only |
16
- | `hyperswap` | HyperSwap | uniswap_v3 | V3 fee-only |
16
+ | `hyperswap-v3` | HyperSwap V3 | uniswap_v3 | V3 fee-only |
17
17
  | `curve-hyperevm` | Curve | curve_stableswap | StableswapNG factory |
18
18
  | `ramses-cl` | Ramses CL | uniswap_v3 + cl_style="ramses" | x(3,3) auto-stake, NPM.getPeriodReward |
19
19
  | `ramses-hl` | Ramses HL | solidly_v2 | ve(3,3) gauge, RAM emission |
20
20
  | `kittenswap` | KittenSwap | algebra_v3 + farming_center | KITTEN/WHYPE eternal farming |
21
21
  | `hybra` | Hybra V4 | hybra | CL gauge + GaugeManager + 2-year veHYBR lock (default) |
22
- | `nest` | NEST | algebra_v3 | Off-chain ticket NEST claim |
22
+ | `nest-v1` | NEST V1 | algebra_v3 | Claim path verified live 2026-05-07 (off-chain ticket via `blaze.nest.aegas.it` / `usenest.xyz/api/blaze`). LP/farm read-paths still return zero (`gauge.rewardRate = 0`); only `lp claim` is functional. |
23
23
 
24
24
  ---
25
25
 
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # bridge-quote.sh — dry-run a cross-chain bridge across LI.FI / deBridge / CCTP
3
+ # Source must be one of: hyperevm, mantle, base, bnb, monad
4
+ # Usage: FROM_CHAIN=base TO_CHAIN=arbitrum TOKEN=USDC AMOUNT=100000000 bash bridge-quote.sh
5
+ set -euo pipefail
6
+
7
+ DEFI="${DEFI_CMD:-defi}"
8
+ FROM_CHAIN="${FROM_CHAIN:-base}"
9
+ TO_CHAIN="${TO_CHAIN:-arbitrum}"
10
+ TOKEN="${TOKEN:-USDC}"
11
+ AMOUNT="${AMOUNT:-100000000}"
12
+
13
+ # CCTP V2 only routes USDC and only between these chains
14
+ CCTP_CHAINS="ethereum avalanche optimism arbitrum base polygon"
15
+ PROVIDERS=(lifi debridge)
16
+ if [[ "$TOKEN" == "USDC" ]] && [[ " $CCTP_CHAINS " == *" $TO_CHAIN "* ]] && [[ " $CCTP_CHAINS " == *" $FROM_CHAIN "* ]]; then
17
+ PROVIDERS+=(cctp)
18
+ fi
19
+
20
+ echo "[bridge-quote] $AMOUNT $TOKEN: $FROM_CHAIN -> $TO_CHAIN" >&2
21
+ echo "[bridge-quote] providers: ${PROVIDERS[*]}" >&2
22
+
23
+ OUT="["
24
+ SEP=""
25
+ for P in "${PROVIDERS[@]}"; do
26
+ echo "[bridge-quote] probing $P..." >&2
27
+ RES=$("$DEFI" --json --chain "$FROM_CHAIN" bridge \
28
+ --token "$TOKEN" --amount "$AMOUNT" --to-chain "$TO_CHAIN" --provider "$P" 2>/dev/null \
29
+ || echo "{\"provider\":\"$P\",\"error\":\"probe_failed\"}")
30
+ OUT="${OUT}${SEP}{\"provider\":\"$P\",\"result\":${RES}}"
31
+ SEP=","
32
+ done
33
+ OUT="${OUT}]"
34
+ echo "$OUT"
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env bash
2
+ # lending-supply-flow.sh — full lending-supply preview without broadcasting
3
+ # Walks: yield scan -> rates on chosen protocol -> existing position -> dry-run supply tx
4
+ # Usage: CHAIN=hyperevm PROTOCOL=hyperlend ASSET=USDC AMOUNT=1000000 bash lending-supply-flow.sh
5
+ set -euo pipefail
6
+
7
+ DEFI="${DEFI_CMD:-defi}"
8
+ CHAIN="${CHAIN:-hyperevm}"
9
+ PROTOCOL="${PROTOCOL:-hyperlend}"
10
+ ASSET="${ASSET:-USDC}"
11
+ AMOUNT="${AMOUNT:-1000000}"
12
+
13
+ echo "[1/4 lending-supply-flow] best $ASSET supply rates across all chains" >&2
14
+ "$DEFI" --json yield scan --asset "$ASSET" --fields chain,protocol,supply_apy 2>/dev/null || true
15
+
16
+ echo "[2/4 lending-supply-flow] rates for $PROTOCOL/$ASSET on $CHAIN" >&2
17
+ "$DEFI" --json --chain "$CHAIN" lending rates --protocol "$PROTOCOL" --asset "$ASSET"
18
+
19
+ echo "[3/4 lending-supply-flow] existing position on $PROTOCOL" >&2
20
+ "$DEFI" --json --chain "$CHAIN" lending position --protocol "$PROTOCOL" 2>/dev/null \
21
+ || echo '{"position":null,"note":"no wallet configured or no position yet"}'
22
+
23
+ echo "[4/4 lending-supply-flow] DRY-RUN supply tx ($AMOUNT $ASSET) — review before --broadcast" >&2
24
+ "$DEFI" --json --chain "$CHAIN" lending supply \
25
+ --protocol "$PROTOCOL" --asset "$ASSET" --amount "$AMOUNT"
26
+
27
+ echo "" >&2
28
+ echo "[lending-supply-flow] To execute: re-run step 4 with --broadcast" >&2
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ # lp-claim-all.sh — list every LP position on a chain that has pending rewards,
3
+ # then print the claim CLI command for each (DRY-RUN guidance only — does not broadcast).
4
+ # Usage: WALLET=0xABC... bash lp-claim-all.sh <chain>
5
+ set -euo pipefail
6
+
7
+ DEFI="${DEFI_CMD:-defi}"
8
+ CHAIN="${1:-mantle}"
9
+ WALLET="${DEFI_WALLET_ADDRESS:-${WALLET:-}}"
10
+
11
+ if [[ -z "$WALLET" ]]; then
12
+ echo '{"error":"Set DEFI_WALLET_ADDRESS or WALLET env var to scan positions"}' >&2
13
+ exit 1
14
+ fi
15
+
16
+ echo "[lp-claim-all] $CHAIN: scanning all LP positions for $WALLET" >&2
17
+ "$DEFI" --json --chain "$CHAIN" lp positions --address "$WALLET"
18
+
19
+ echo "" >&2
20
+ echo "[lp-claim-all] To claim a specific position, use one of:" >&2
21
+ echo " V3 fees: defi --json --chain $CHAIN lp claim --protocol <slug> --token-id <id> --broadcast" >&2
22
+ echo " Solidly gauge: defi --json --chain $CHAIN lp claim --protocol <slug> --gauge <addr> --broadcast" >&2
23
+ echo " Slipstream NFT: defi --json --chain $CHAIN lp claim --protocol <slug> --gauge <addr> --token-id <id> --broadcast" >&2
24
+ echo " Merchant Moe: defi --json --chain $CHAIN lp claim --protocol merchantmoe-mantle --pool <addr> --broadcast" >&2
25
+ echo " KittenSwap: defi --json --chain $CHAIN lp claim --protocol kittenswap --pool <addr> --token-id <id> --broadcast" >&2
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bash
2
+ # lp-emission-discover.sh — list active-emission LP pools on a chain, sorted by APR
3
+ # Usage: bash lp-emission-discover.sh <chain> [protocol]
4
+ # Examples:
5
+ # bash lp-emission-discover.sh mantle merchantmoe-mantle
6
+ # bash lp-emission-discover.sh base aerodrome-cl
7
+ # bash lp-emission-discover.sh hyperevm kittenswap
8
+ set -euo pipefail
9
+
10
+ DEFI="${DEFI_CMD:-defi}"
11
+ CHAIN="${1:-mantle}"
12
+ PROTOCOL="${2:-}"
13
+
14
+ if [[ -n "$PROTOCOL" ]]; then
15
+ echo "[lp-emission-discover] $CHAIN/$PROTOCOL — emission-only, APR-sorted desc" >&2
16
+ "$DEFI" --json --chain "$CHAIN" lp discover --protocol "$PROTOCOL" --emission-only
17
+ else
18
+ echo "[lp-emission-discover] $CHAIN (all protocols) — emission-only, APR-sorted desc" >&2
19
+ "$DEFI" --json --chain "$CHAIN" lp discover --emission-only
20
+ fi
File without changes
File without changes
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+ # swap-quote.sh — dry-run a swap across every aggregator that supports the chain
3
+ # Picks the best amount_out and prints a side-by-side comparison.
4
+ # Usage: CHAIN=base FROM=WETH TO=USDC AMOUNT=1000000000000000000 bash swap-quote.sh
5
+ set -euo pipefail
6
+
7
+ DEFI="${DEFI_CMD:-defi}"
8
+ CHAIN="${CHAIN:-hyperevm}"
9
+ FROM="${FROM:-WHYPE}"
10
+ TO="${TO:-USDC}"
11
+ AMOUNT="${AMOUNT:-1000000000000000000}"
12
+ SLIPPAGE="${SLIPPAGE:-50}"
13
+
14
+ case "$CHAIN" in
15
+ hyperevm) PROVIDERS=(kyber openocean liquid lifi relay) ;;
16
+ mantle) PROVIDERS=(openocean lifi relay) ;;
17
+ base) PROVIDERS=(kyber openocean lifi relay) ;;
18
+ bnb) PROVIDERS=(kyber openocean lifi relay) ;;
19
+ monad) PROVIDERS=(lifi relay) ;;
20
+ *) echo "{\"error\":\"unknown chain: $CHAIN (expected hyperevm|mantle|base|bnb|monad)\"}" >&2; exit 1 ;;
21
+ esac
22
+
23
+ echo "[swap-quote] $CHAIN: $AMOUNT $FROM -> $TO @ ${SLIPPAGE}bps slippage" >&2
24
+ echo "[swap-quote] providers: ${PROVIDERS[*]}" >&2
25
+
26
+ OUT="["
27
+ SEP=""
28
+ for P in "${PROVIDERS[@]}"; do
29
+ echo "[swap-quote] probing $P..." >&2
30
+ RES=$("$DEFI" --json --chain "$CHAIN" swap --provider "$P" \
31
+ --from "$FROM" --to "$TO" --amount "$AMOUNT" --slippage "$SLIPPAGE" 2>/dev/null \
32
+ || echo "{\"provider\":\"$P\",\"error\":\"probe_failed\"}")
33
+ OUT="${OUT}${SEP}{\"provider\":\"$P\",\"result\":${RES}}"
34
+ SEP=","
35
+ done
36
+ OUT="${OUT}]"
37
+ echo "$OUT"
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+ # wallet-status.sh — print configured wallet + native balance on every supported chain
3
+ # Usage: bash wallet-status.sh
4
+ set -euo pipefail
5
+
6
+ DEFI="${DEFI_CMD:-defi}"
7
+ CHAINS=(hyperevm mantle base bnb monad)
8
+
9
+ echo "[wallet-status] resolving configured wallet..." >&2
10
+ ADDR_JSON=$("$DEFI" --json wallet address)
11
+ echo "$ADDR_JSON"
12
+
13
+ # Extract null check without jq dependency: address field is "null" when unset.
14
+ if echo "$ADDR_JSON" | grep -q '"address":null'; then
15
+ echo "[wallet-status] no wallet configured — skipping per-chain balances" >&2
16
+ echo "[wallet-status] To configure: export DEFI_WALLET_ADDRESS=0x... or run 'defi setup'" >&2
17
+ exit 0
18
+ fi
19
+
20
+ OUT="["
21
+ SEP=""
22
+ for C in "${CHAINS[@]}"; do
23
+ echo "[wallet-status] probing native balance on $C..." >&2
24
+ RES=$("$DEFI" --json --chain "$C" wallet balance 2>/dev/null \
25
+ || echo "{\"chain\":\"$C\",\"error\":\"rpc_unreachable\"}")
26
+ OUT="${OUT}${SEP}${RES}"
27
+ SEP=","
28
+ done
29
+ OUT="${OUT}]"
30
+ echo "$OUT"
File without changes
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env bash
2
- # exploit-scan.sh — run a one-shot exploit detection scan across all chains
3
- # Usage: bash exploit-scan.sh [chain]
4
- set -euo pipefail
5
-
6
- DEFI="${DEFI_CMD:-defi}"
7
- CHAIN="${1:-hyperevm}"
8
-
9
- echo "[exploit-scan] Scanning $CHAIN for oracle divergence, stablecoin depeg, exchange rate anomalies..." >&2
10
- "$DEFI" --json --chain "$CHAIN" scan --once --patterns oracle,stable,exchange_rate