@arcadia-finance/mcp-server 0.2.0 → 0.2.1

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 (34) hide show
  1. package/README.md +39 -47
  2. package/dist/clients/api.js +2 -2
  3. package/dist/index.js +1 -1
  4. package/dist/prompts/workflows.js +9 -9
  5. package/dist/tools/{write/sign-and-send.js → dev/send.js} +8 -7
  6. package/dist/tools/index.js +32 -32
  7. package/dist/tools/read/{accounts.js → account.js} +3 -3
  8. package/dist/tools/read/guides.js +1 -1
  9. package/dist/tools/read/pools.js +11 -1
  10. package/dist/tools/read/{protocol.js → strategy.js} +4 -4
  11. package/dist/tools/read/{balances.js → wallet.js} +68 -3
  12. package/dist/tools/{advanced → write/account}/add-liquidity.js +13 -13
  13. package/dist/tools/write/{borrow.js → account/borrow.js} +6 -6
  14. package/dist/tools/{advanced/close-position.js → write/account/close.js} +16 -17
  15. package/dist/tools/write/{create-account.js → account/create.js} +8 -8
  16. package/dist/tools/{advanced/repay-with-collateral.js → write/account/deleverage.js} +10 -7
  17. package/dist/tools/write/{deposit.js → account/deposit.js} +6 -6
  18. package/dist/tools/{advanced → write/account}/format-response.js +2 -2
  19. package/dist/tools/{advanced/account-metadata.js → write/account/metadata.js} +1 -1
  20. package/dist/tools/{advanced → write/account}/remove-liquidity.js +11 -12
  21. package/dist/tools/write/{repay.js → account/repay.js} +16 -5
  22. package/dist/tools/{advanced/position-actions.js → write/account/stake.js} +12 -13
  23. package/dist/tools/{advanced → write/account}/swap.js +5 -5
  24. package/dist/tools/write/{withdraw.js → account/withdraw.js} +7 -7
  25. package/dist/tools/write/{configure-asset-manager.js → asset-manager/configure.js} +7 -7
  26. package/dist/tools/write/{set-asset-manager.js → asset-manager/set.js} +6 -6
  27. package/dist/tools/write/{approve.js → wallet/approve.js} +5 -5
  28. package/package.json +2 -2
  29. package/server.json +2 -8
  30. package/skills/clamm-liquidity/SKILL.md +45 -45
  31. package/skills/clamm-liquidity/automation.md +7 -7
  32. package/skills/clamm-liquidity/selection.md +13 -13
  33. package/skills/clamm-liquidity/strategies.md +53 -53
  34. package/dist/tools/read/allowances.js +0 -72
@@ -10,17 +10,17 @@ Arcadia is a platform for managing concentrated liquidity positions — with bui
10
10
 
11
11
  ## Key Constraints
12
12
 
13
- - **All `write.*` and `advanced.*` tools return unsigned transactions** (`{ to, data, value, chainId }`) — you must sign and broadcast them. See "Transaction Signing" below.
13
+ - **All `write.*` tools return unsigned transactions** (`{ to, data, value, chainId }`) — you must sign and broadcast them. See "Transaction Signing" below.
14
14
  - **Automation strategy config** (tick range, rebalance thresholds) is not currently settable via MCP — this requires Arcadia platform access.
15
15
  - **Health factor** = `1 - (used_margin / liquidation_value)`. Higher is safer. `1` = no debt, `>0` = healthy, `0` = liquidation threshold, `<0` = past liquidation. Keep above 0.5 for leveraged positions; act immediately below 0.2.
16
- - **Minimum margin** — each lending pool enforces a fixed minimum margin denominated in the pool's numeraire (e.g. WETH for the WETH pool, USDC for the USDC pool), typically a few dollars in value. This gets **added to the debt** when computing `used_margin` (i.e. `used_margin = open_debt + minimum_margin`). It ensures liquidations remain profitable (covering gas costs) and prevents dust attacks. For small positions the fixed minimum margin dominates the used margin, pushing health factor lower than the leverage ratio alone would suggest (e.g. HF ~0.3 at 2× leverage). Increase position size for a healthier starting HF. `advanced.add_liquidity` also validates deposits against per-asset minimum amounts from strategy risk factors.
16
+ - **Minimum margin** — each lending pool enforces a fixed minimum margin denominated in the pool's numeraire (e.g. WETH for the WETH pool, USDC for the USDC pool), typically a few dollars in value. This gets **added to the debt** when computing `used_margin` (i.e. `used_margin = open_debt + minimum_margin`). It ensures liquidations remain profitable (covering gas costs) and prevents dust attacks. For small positions the fixed minimum margin dominates the used margin, pushing health factor lower than the leverage ratio alone would suggest (e.g. HF ~0.3 at 2× leverage). Increase position size for a healthier starting HF. `write.account.add_liquidity` also validates deposits against per-asset minimum amounts from strategy risk factors.
17
17
 
18
18
  ## Transaction Signing
19
19
 
20
- Write and advanced tools (`write.*` / `advanced.*`) return unsigned transaction calldata. This server does NOT sign or broadcast. After receiving a transaction object, you must:
20
+ Write tools (`write.*`) return unsigned transaction calldata. This server does NOT sign or broadcast. After receiving a transaction object, you must:
21
21
 
22
22
  1. **Sign** the transaction with the account owner's private key or wallet
23
- 2. **Broadcast** it to the appropriate chain (Base 8453, Optimism 10, or Unichain 130)
23
+ 2. **Broadcast** it to the appropriate chain (Base 8453 or Unichain 130)
24
24
  3. **Wait** for the transaction receipt to confirm success
25
25
 
26
26
  How you sign depends on your setup:
@@ -28,7 +28,7 @@ How you sign depends on your setup:
28
28
  - **MPC wallet** (Fireblocks, Dfns, Turnkey) — pass the unsigned tx to your provider's signing API
29
29
  - **Smart account** (Safe, Biconomy) — wrap the tx as a UserOperation or Safe transaction
30
30
  - **Embedded wallet** (Privy, Dynamic) — use the provider's `sendTransaction` method
31
- - **Direct private key** (development only) — use the built-in `dev.sign_and_send` tool (set `PK` in a `.env` file or MCP client config), or viem/ethers `sendTransaction` with a local signer
31
+ - **Direct private key** (development only) — use the built-in `dev.send` tool (set `PK` in a `.env` file or MCP client config), or viem/ethers `sendTransaction` with a local signer
32
32
 
33
33
  Example with viem:
34
34
 
@@ -43,57 +43,57 @@ Arcadia's flash-action tools can batch multiple DeFi operations into a single at
43
43
 
44
44
  **When to split:** In high-volatility markets or for low-liquidity pools, batched transactions may revert because on-chain state changes between when the backend computes calldata and when the transaction executes. If a batched tool fails, fall back to individual tools with tighter slippage. Always try batched first, split only on failure.
45
45
 
46
- **All advanced tools return time-sensitive calldata** — sign and broadcast promptly; calldata may expire after 30–60 seconds depending on market conditions. If a transaction reverts due to price movement, rebuild and retry at least once before falling back to individual tools.
46
+ **Batched write tools (`write.account.add_liquidity`, `write.account.close`, `write.account.deleverage`, `write.account.swap`, `write.account.remove_liquidity`, `write.account.stake`) return time-sensitive calldata** — sign and broadcast promptly; calldata may expire after 30–60 seconds depending on market conditions. If a transaction reverts due to price movement, rebuild and retry at least once before falling back to individual tools.
47
47
 
48
48
  ## MCP Tools (25 + 1 dev)
49
49
 
50
50
  ### Read Tools
51
51
 
52
- | Tool | When to use |
53
- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
- | `read.account_info` | Account overview + liquidation price. Pass `account_address` for detail (returns positions with `asset_address`/`asset_id`, collateral, debt) or `wallet_address` to list accounts. |
55
- | `read.account_history` | Historical account value over time. Optional `days` param (default 14). |
56
- | `read.account_pnl` | PnL and yield earned — use to check if a strategy is still profitable. |
57
- | `read.assets` | Supported collateral assets with prices. Pass `asset_addresses` (single or comma-separated) for price lookup. |
58
- | `read.wallet_balances` | On-chain ERC20 balances and native ETH for a wallet. Use to pre-check if the wallet has enough tokens before depositing or adding liquidity. |
59
- | `read.allowance` | Check ERC20 token allowances for a spender. Use before `write.approve` to avoid redundant approvals — skip if the current allowance is already sufficient. |
60
- | `read.lending_pools` | Pool TVL, APY, utilization, liquidity. Pass `pool_address` for detail + APY history (optional `days`, default 14). |
61
- | `read.strategies` | LP strategies with fee APY, underlyings, pool protocol. List view shows 7d avg APY for the strategy's default range (e.g. ±7.5% for volatile pairs). **Pass `strategy_id` to see APY per range width** (very_narrow → full_range) — narrower range = higher APY but more rebalancing cost/risk. Use `featured_only: true` for curated top strategies. |
62
- | `read.points` | Points for a wallet or leaderboard. No `chain_id` needed — points are cross-chain. |
63
- | `read.recommendation` | Rebalancing recommendation for an account. Uses 1d APY (not 7d like `read.strategies`), so numbers may differ. |
64
- | `read.guide` | Reference guides: `automation` (AM setup), `selection` (pool evaluation), `strategies` (step-by-step templates). |
52
+ | Tool | When to use |
53
+ | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+ | `read.account.info` | Account overview + liquidation price. Pass `account_address` for detail (returns positions with `asset_address`/`asset_id`, collateral, debt) or `wallet_address` to list accounts. |
55
+ | `read.account.history` | Historical account value over time. Optional `days` param (default 14). |
56
+ | `read.account.pnl` | PnL and yield earned — use to check if a strategy is still profitable. |
57
+ | `read.assets` | Supported collateral assets with prices. Pass `asset_addresses` (single or comma-separated) for price lookup. |
58
+ | `read.wallet.balances` | On-chain ERC20 balances and native ETH for a wallet. Use to pre-check if the wallet has enough tokens before depositing or adding liquidity. |
59
+ | `read.wallet.allowance` | Check ERC20 token allowances for a spender. Use before `write.wallet.approve` to avoid redundant approvals — skip if the current allowance is already sufficient. |
60
+ | `read.pools` | Pool TVL, APY, utilization, liquidity. Pass `pool_address` for detail + APY history (optional `days`, default 14). |
61
+ | `read.strategy.list` | LP strategies with fee APY, underlyings, pool protocol. List view shows 7d avg APY for the strategy's default range (e.g. ±7.5% for volatile pairs). **Pass `strategy_id` to see APY per range width** (very_narrow → full_range) — narrower range = higher APY but more rebalancing cost/risk. Use `featured_only: true` for curated top strategies. |
62
+ | `read.points` | Points for a wallet or leaderboard. No `chain_id` needed — points are cross-chain. |
63
+ | `read.strategy.recommendation` | Rebalancing recommendation for an account. Uses 1d APY (not 7d like `read.strategy.list`), so numbers may differ. |
64
+ | `read.guides` | Reference guides: `automation` (AM setup), `selection` (pool evaluation), `strategies` (step-by-step templates). |
65
65
 
66
66
  ### Preferred Write Tools (atomic/multi-step — use these first)
67
67
 
68
68
  These tools batch multiple operations into ONE atomic transaction. Always prefer these over individual tools.
69
69
 
70
- | Tool | Batches | When to use |
71
- | -------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
72
- | `advanced.add_liquidity` | deposit + swap + mint LP + optional borrow | Open LP position. Do NOT call `write.deposit` separately — this handles wallet transfer atomically. |
73
- | `advanced.close_position` | burn LP + swap + repay debt (up to 3 steps) | Close/exit a position. ALWAYS try this first. Tokens stay in account — follow up with `write.withdraw`. |
74
- | `advanced.repay_with_collateral` | swap collateral + repay debt | Repay debt using account collateral (no wallet tokens needed). Preferred for health factor fixes. |
75
- | `write.configure_asset_manager` | grant permission + set initiator/fees/strategy params | Enable AND configure an automation (rebalancer, compounder, yield claimer, merkl) in one transaction. |
70
+ | Tool | Batches | When to use |
71
+ | ------------------------------- | ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
72
+ | `write.account.add_liquidity` | deposit + swap + mint LP + optional borrow | Open LP position. Do NOT call `write.account.deposit` separately — this handles wallet transfer atomically. |
73
+ | `write.account.close` | burn LP + swap + repay debt (up to 3 steps) | Close/exit a position. ALWAYS try this first. Tokens stay in account — follow up with `write.account.withdraw`. |
74
+ | `write.account.deleverage` | swap collateral + repay debt | Repay debt using account collateral (no wallet tokens needed). Preferred for health factor fixes. |
75
+ | `write.asset_manager.configure` | grant permission + set initiator/fees/strategy params | Enable AND configure an automation (rebalancer, compounder, yield claimer, merkl) in one transaction. |
76
76
 
77
77
  ### Individual Write Tools (use when batched tools fail or for standalone operations)
78
78
 
79
- | Tool | When to use |
80
- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
81
- | `write.approve` | Approve a token for spending. **Required before `write.deposit`** and before `advanced.add_liquidity` (when depositing from wallet). Call `read.allowance` first to check if already approved. |
82
- | `write.create_account` | Create a new Arcadia account (one-time setup). Use `account_version: 0` for the latest version (recommended). |
83
- | `write.deposit` | Deposit ERC20 tokens as collateral. NOT needed before `advanced.add_liquidity` — that tool handles deposits atomically. |
84
- | `write.withdraw` | Withdraw assets to account owner. Account version auto-detected on-chain. Params: `asset_addresses[]`, `asset_amounts[]` (exact amounts, no max_uint256), optional `asset_ids[]` (0 for ERC20). |
85
- | `write.borrow` | Borrow from a lending pool. NOT needed for leveraged LP — `advanced.add_liquidity` handles borrowing internally. |
86
- | `write.repay` | Repay debt from wallet (approve pool first). Use `amount: "max_uint256"` to repay in full. For repaying with account collateral, prefer `advanced.repay_with_collateral`. |
87
- | `advanced.swap` | Swap assets within account (backend handles routing). For closing positions, prefer `advanced.close_position`. |
88
- | `advanced.remove_liquidity` | PARTIAL liquidity decrease only (position stays open). For full LP removal/exit, use `advanced.close_position`. |
89
- | `advanced.position_action` | Stake, unstake, or claim rewards for an LP position. Direction auto-detected from `asset_address`. |
90
- | `write.set_asset_manager` | Grant/revoke AM permission only (no configuration). Use to revoke; for full setup prefer `write.configure_asset_manager`. |
79
+ | Tool | When to use |
80
+ | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
81
+ | `write.wallet.approve` | Approve a token for spending. **Required before `write.account.deposit`** and before `write.account.add_liquidity` (when depositing from wallet). Call `read.wallet.allowance` first to check if already approved. |
82
+ | `write.account.create` | Create a new Arcadia account (one-time setup). Use `account_version: 0` for the latest version (recommended). |
83
+ | `write.account.deposit` | Deposit ERC20 tokens as collateral. NOT needed before `write.account.add_liquidity` — that tool handles deposits atomically. |
84
+ | `write.account.withdraw` | Withdraw assets to account owner. Account version auto-detected on-chain. Params: `asset_addresses[]`, `asset_amounts[]` (exact amounts, no max_uint256), optional `asset_ids[]` (0 for ERC20). |
85
+ | `write.account.borrow` | Borrow from a lending pool. NOT needed for leveraged LP — `write.account.add_liquidity` handles borrowing internally. |
86
+ | `write.account.repay` | Repay debt from wallet (approve pool first). Use `amount: "max_uint256"` to repay in full. For repaying with account collateral, prefer `write.account.deleverage`. |
87
+ | `write.account.swap` | Swap assets within account (backend handles routing). For closing positions, prefer `write.account.close`. |
88
+ | `write.account.remove_liquidity` | PARTIAL liquidity decrease only (position stays open). For full LP removal/exit, use `write.account.close`. |
89
+ | `write.account.stake` | Stake, unstake, or claim rewards for an LP position. Direction auto-detected from `asset_address`. |
90
+ | `write.asset_manager.set` | Grant/revoke AM permission only (no configuration). Use to revoke; for full setup prefer `write.asset_manager.configure`. |
91
91
 
92
92
  ### Dev Tools (only available when `PK` env var is set)
93
93
 
94
- | Tool | When to use |
95
- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
96
- | `dev.sign_and_send` | Sign and broadcast an unsigned transaction using a local private key. Pass the `{ to, data, value, chainId }` from any `write.*` or `advanced.*` tool. **Not for production** — use a dedicated wallet MCP server (Fireblocks, Safe, Turnkey, etc.) instead. |
94
+ | Tool | When to use |
95
+ | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
96
+ | `dev.send` | Sign and broadcast an unsigned transaction using a local private key. Pass the `{ to, data, value, chainId }` from any `write.*` tool. **Not for production** — use a dedicated wallet MCP server (Fireblocks, Safe, Turnkey, etc.) instead. |
97
97
 
98
98
  ## Token Addresses (Base 8453)
99
99
 
@@ -118,7 +118,7 @@ These tools batch multiple operations into ONE atomic transaction. Always prefer
118
118
 
119
119
  ## Lending Pool Addresses (Base 8453)
120
120
 
121
- Use as `pool_address` in `write.borrow` / `write.repay`, as `creditor` in `write.create_account` / `advanced.repay_with_collateral`:
121
+ Use as `pool_address` in `write.account.borrow` / `write.account.repay`, as `creditor` in `write.account.create` / `write.account.deleverage`:
122
122
 
123
123
  | Asset | Pool Address |
124
124
  | ----- | -------------------------------------------- |
@@ -128,7 +128,7 @@ Use as `pool_address` in `write.borrow` / `write.repay`, as `creditor` in `write
128
128
 
129
129
  ## Asset Manager Addresses (Base 8453)
130
130
 
131
- Use with `write.configure_asset_manager` (enable + configure) or `write.set_asset_manager` (grant/revoke only). Both require V3/V4 accounts.
131
+ Use with `write.asset_manager.configure` (enable + configure) or `write.asset_manager.set` (grant/revoke only). Both require V3/V4 accounts.
132
132
 
133
133
  | Type | Protocol | Address |
134
134
  | -------------- | ------------- | -------------------------------------------- |
@@ -148,7 +148,7 @@ Use with `write.configure_asset_manager` (enable + configure) or `write.set_asse
148
148
  | CoW Swapper | All | `0xc928013A219EC9F18dE7B2dee6A50Ba626811854` |
149
149
  | Gas Relayer | All | `0xD938C8d04cF91094fecAF0A2018EAac483a40137` |
150
150
 
151
- **Slipstream V1 vs V2:** The pool determines the version — some pools are V1, some are V2. The API currently returns `protocol: "slipstream"` without V1/V2 distinction. To identify the version, check the position manager address from `read.account_info` against the known addresses (V1: `0x8279...`, V2: `0xa990...`). Alternatively, pass `pool_protocol` directly to `write.configure_asset_manager` to auto-resolve the correct AM address. Staked and wrapped staked positions use the same asset managers as their base protocol.
151
+ **Slipstream V1 vs V2:** The pool determines the version — some pools are V1, some are V2. The API currently returns `protocol: "slipstream"` without V1/V2 distinction. To identify the version, check the position manager address from `read.account.info` against the known addresses (V1: `0x8279...`, V2: `0xa990...`). Alternatively, pass `pool_protocol` directly to `write.asset_manager.configure` to auto-resolve the correct AM address. Staked and wrapped staked positions use the same asset managers as their base protocol.
152
152
 
153
153
  ## Account Versions
154
154
 
@@ -156,9 +156,9 @@ Spot vs margin is determined by whether a **creditor** (lending pool) is set at
156
156
 
157
157
  - `account_version: 3` — **margin account** (created with a `creditor`). Can borrow, leverage, and mint LP. Uses an onchain whitelist of allowed collateral tokens.
158
158
  - `account_version: 4` or `0` (latest) — **spot account** (no creditor, no borrowing). Can hold assets and mint LP with `leverage: 0`. Accepts any ERC20 (no onchain whitelist).
159
- - `account_version: 1` or `2` — legacy. Not supported by current MCP tools (`write.set_asset_manager` and `write.configure_asset_manager` require V3/V4).
159
+ - `account_version: 1` or `2` — legacy. Not supported by current MCP tools (`write.asset_manager.set` and `write.asset_manager.configure` require V3/V4).
160
160
  - For **leveraged LP strategies**, use `account_version: 3` with a creditor.
161
- - To check an existing account's version: call `read.account_info` — the response includes the account version.
161
+ - To check an existing account's version: call `read.account.info` — the response includes the account version.
162
162
 
163
163
  ## Reference Files
164
164
 
@@ -4,14 +4,14 @@ All automation on Arcadia uses one of two tools (both V3/V4 accounts only), then
4
4
 
5
5
  ## Which tool to use
6
6
 
7
- **To enable + configure (recommended):** Use `write.configure_asset_manager`. This grants permission AND sets strategy parameters (initiator, fee limits, trigger thresholds, fee recipient, etc.) in a single transaction.
7
+ **To enable + configure (recommended):** Use `write.asset_manager.configure`. This grants permission AND sets strategy parameters (initiator, fee limits, trigger thresholds, fee recipient, etc.) in a single transaction.
8
8
 
9
- **To grant/revoke only:** Use `write.set_asset_manager`. This only grants or revokes permission — no configuration. Use this to revoke an asset manager.
9
+ **To grant/revoke only:** Use `write.asset_manager.set`. This only grants or revokes permission — no configuration. Use this to revoke an asset manager.
10
10
 
11
11
  ## Configure + enable
12
12
 
13
13
  ```
14
- write.configure_asset_manager(
14
+ write.asset_manager.configure(
15
15
  account_address: <account>,
16
16
  asset_manager_address: <address from table below>,
17
17
  am_type: "rebalancer" | "compounder" | "yield_claimer" | "merkl_operator",
@@ -32,7 +32,7 @@ write.configure_asset_manager(
32
32
  ## Grant/revoke only
33
33
 
34
34
  ```
35
- write.set_asset_manager(
35
+ write.asset_manager.set(
36
36
  account_address: <account>,
37
37
  asset_manager_address: <address from table below>,
38
38
  enabled: true, // false to revoke
@@ -40,7 +40,7 @@ write.set_asset_manager(
40
40
  )
41
41
  ```
42
42
 
43
- To revoke any AM: `write.set_asset_manager(..., enabled: false)` or `write.configure_asset_manager` is not used for revocation — use `write.set_asset_manager` with `enabled: false`.
43
+ To revoke any AM: `write.asset_manager.set(..., enabled: false)` or `write.asset_manager.configure` is not used for revocation — use `write.asset_manager.set` with `enabled: false`.
44
44
 
45
45
  ---
46
46
 
@@ -109,7 +109,7 @@ Quota is also bypassed automatically when: gas cost < pending fees ÷ 2, or posi
109
109
  | Uniswap V3 | `0x75Ed28EA8601Ce9F5FbcAB1c2428f04A57aFaA16` | All |
110
110
  | Uniswap V4 | `0xD8aa21AB7f9B8601CB7d7A776D3AFA1602d5D8D4` | All |
111
111
 
112
- **Recipient config:** Set `fee_recipient` in `write.configure_asset_manager` (V3/V4 accounts). Pass your wallet address or any destination address.
112
+ **Recipient config:** Set `fee_recipient` in `write.asset_manager.configure` (V3/V4 accounts). Pass your wallet address or any destination address.
113
113
 
114
114
  ---
115
115
 
@@ -117,7 +117,7 @@ Quota is also bypassed automatically when: gas cost < pending fees ÷ 2, or posi
117
117
 
118
118
  **What it does:** Bot claims external Merkl protocol incentive rewards into the account. These are additional rewards paid by token teams on top of regular LP fees — completely separate from trading fee yield.
119
119
 
120
- **When to enable:** When the pool you LP into has active Merkl campaigns. Check by looking at the pool APY breakdown in `read.strategies` — if there's a "Merkl" or "external rewards" component, enable this.
120
+ **When to enable:** When the pool you LP into has active Merkl campaigns. Check by looking at the pool APY breakdown in `read.strategy.list` — if there's a "Merkl" or "external rewards" component, enable this.
121
121
 
122
122
  **Address (all chains):** `0x969F0251360b9Cf11c68f6Ce9587924c1B8b42C6`
123
123
 
@@ -7,8 +7,8 @@ Use this guide to evaluate whether a strategy makes sense and how to configure i
7
7
  ## 1. Pool / Strategy Selection
8
8
 
9
9
  ```
10
- read.strategies(chain_id: 8453) // browse all LP strategies + fee APY
11
- read.lending_pools(chain_id: 8453) // check borrow cost for leveraged strategies
10
+ read.strategy.list(chain_id: 8453) // browse all LP strategies + fee APY
11
+ read.pools(chain_id: 8453) // check borrow cost for leveraged strategies
12
12
  ```
13
13
 
14
14
  **Viability check (leveraged):**
@@ -32,12 +32,12 @@ Must be positive to justify the leverage cost. Higher leverage amplifies both si
32
32
 
33
33
  - Fee tier: higher fee tier (0.3%, 1%) = more fee per trade, better for volatile pairs
34
34
  - Volume + TVL: high volume/TVL ratio = fees are being earned actively
35
- - Active Merkl rewards: extra yield on top, check `read.strategies` APY breakdown
35
+ - Active Merkl rewards: extra yield on top, check `read.strategy.list` APY breakdown
36
36
 
37
37
  **`numeraire` — context-dependent meaning:**
38
38
 
39
- - **`advanced.add_liquidity`**: `numeraire` = account base currency (typically the stable side, e.g. USDC for a WETH/USDC position). The backend uses it to denominate calculations and determine the optimal swap ratio. For WETH/USDC: `numeraire = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` (USDC).
40
- - **`advanced.repay_with_collateral`**: `numeraire` = the debt token you're repaying (e.g. WETH address when repaying WETH debt). This differs from the add liquidity usage.
39
+ - **`write.account.add_liquidity`**: `numeraire` = account base currency (typically the stable side, e.g. USDC for a WETH/USDC position). The backend uses it to denominate calculations and determine the optimal swap ratio. For WETH/USDC: `numeraire = 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` (USDC).
40
+ - **`write.account.deleverage`**: `numeraire` = the debt token you're repaying (e.g. WETH address when repaying WETH debt). This differs from the add liquidity usage.
41
41
 
42
42
  ---
43
43
 
@@ -45,7 +45,7 @@ Must be positive to justify the leverage cost. Higher leverage amplifies both si
45
45
 
46
46
  Range width is the central tradeoff in any LP strategy. It is set in the Arcadia platform after enabling the rebalancer. Understanding the full tradeoff is essential for choosing parameters — a simple fee APY comparison is not enough.
47
47
 
48
- **Core principle:** The `strategy_apy` from `read.strategies` (list view) is the 7-day average APY computed for that strategy's **default range width** (configured per strategy — e.g. very narrow for stables, ±7.5% / balanced for most volatile pairs). It is sampled every ~3 hours and averaged over 7d. It already reflects a concentrated range — NOT a full-range / pool-level number. Choosing a different range width changes your actual yield: narrower = higher fee capture but more rebalancing cost/risk, wider = lower fees but fewer rebalances. Call `read.strategies(strategy_id: <id>)` to see APY broken down by range width (very_narrow, narrow, balanced, wide, very_wide, full_range). The net return after rebalancing costs, IL, and gas determines the optimal width — see the model below.
48
+ **Core principle:** The `strategy_apy` from `read.strategy.list` (list view) is the 7-day average APY computed for that strategy's **default range width** (configured per strategy — e.g. very narrow for stables, ±7.5% / balanced for most volatile pairs). It is sampled every ~3 hours and averaged over 7d. It already reflects a concentrated range — NOT a full-range / pool-level number. Choosing a different range width changes your actual yield: narrower = higher fee capture but more rebalancing cost/risk, wider = lower fees but fewer rebalances. Call `read.strategy.list(strategy_id: <id>)` to see APY broken down by range width (very_narrow, narrow, balanced, wide, very_wide, full_range). The net return after rebalancing costs, IL, and gas determines the optimal width — see the model below.
49
49
 
50
50
  ### The full tradeoff
51
51
 
@@ -76,7 +76,7 @@ expected_net_return =
76
76
 
77
77
  Inputs to estimate from market data:
78
78
 
79
- - **time_in_range_fraction**: given the pool's historical volatility, how often does price stay within ±X% of the current price? Use `read.strategies` APY + historical vol data.
79
+ - **time_in_range_fraction**: given the pool's historical volatility, how often does price stay within ±X% of the current price? Use `read.strategy.list` APY + historical vol data.
80
80
  - **rebalance_frequency**: how many rebalances per day does the chosen range width require? Wider range = fewer rebalances.
81
81
  - **gas_cost_per_rebalance**: check current chain gas price × ~4M units per rebalance.
82
82
  - **IL_rate**: IL as a function of how far price moved before the rebalance; wider ranges accumulate less IL per rebalance.
@@ -137,7 +137,7 @@ Target collateral ratio ≥ 1.5 at entry (≈ health factor ~0.5+). Never open b
137
137
  - Borrow APY rising (utilization climbing in lending pool)
138
138
  - Market showing high volatility (gap risk)
139
139
  - Position already near support/resistance — a breakout would spike debt fast
140
- - Health factor dropping toward 0.5 (check with `read.account_info`)
140
+ - Health factor dropping toward 0.5 (check with `read.account.info`)
141
141
 
142
142
  ---
143
143
 
@@ -155,7 +155,7 @@ Target collateral ratio ≥ 1.5 at entry (≈ health factor ~0.5+). Never open b
155
155
 
156
156
  ## 5. Exit Signals
157
157
 
158
- Monitor periodically with `read.account_info` and `read.account_pnl`. Exit or adjust when:
158
+ Monitor periodically with `read.account.info` and `read.account.pnl`. Exit or adjust when:
159
159
 
160
160
  | Signal | Threshold | Action |
161
161
  | -------------------------------- | ------------------------ | ------------------------------------- |
@@ -163,17 +163,17 @@ Monitor periodically with `read.account_info` and `read.account_pnl`. Exit or ad
163
163
  | Health factor falling | < 0.5 | Add collateral or reduce debt |
164
164
  | Health factor critical | < 0.2 | Immediate action required |
165
165
  | Position out-of-range repeatedly | Bot can't keep up | Widen range or reduce leverage |
166
- | Net PnL negative over time | Check `read.account_pnl` | Evaluate whether IL is outpacing fees |
166
+ | Net PnL negative over time | Check `read.account.pnl` | Evaluate whether IL is outpacing fees |
167
167
 
168
- **Closing in volatile conditions:** Atomic close (`advanced.close_position`) may revert during high volatility or for low-liquidity pools because on-chain state diverges from when the backend computed the calldata. If atomic close fails, fall back to individual tools with tighter slippage — see strategies.md closing section for the full fallback sequence.
168
+ **Closing in volatile conditions:** Atomic close (`write.account.close`) may revert during high volatility or for low-liquidity pools because on-chain state diverges from when the backend computed the calldata. If atomic close fails, fall back to individual tools with tighter slippage — see strategies.md closing section for the full fallback sequence.
169
169
 
170
170
  ---
171
171
 
172
172
  ## 6. Quick Checklist Before Opening a Position
173
173
 
174
174
  ```
175
- [ ] read.strategies → fee_APY noted (7d avg for default range; call with strategy_id for per-range APY)
176
- [ ] read.lending_pools → borrow_APY noted (if leveraged)
175
+ [ ] read.strategy.list → fee_APY noted (7d avg for default range; call with strategy_id for per-range APY)
176
+ [ ] read.pools → borrow_APY noted (if leveraged)
177
177
  [ ] net_APY = fee_APY - (leverage-1) × borrow_APY > 0
178
178
  [ ] Pair type matches strategy (volatile/stable for delta neutral)
179
179
  [ ] Range width: modeled or estimated for pair volatility + stAAA quota
@@ -4,17 +4,17 @@ These are templates and examples — not the only valid approaches. Adapt parame
4
4
 
5
5
  ## Key Parameter Notes
6
6
 
7
- - **`advanced.add_liquidity`** capital sources: `deposits` array (wallet tokens), `use_account_assets=true` (existing account collateral), or both. Supports depositing multiple tokens and minting multiple LP positions in one tx. The backend swaps everything to the optimal ratio for the LP. You do NOT need to `write.deposit` first — `advanced.add_liquidity` handles the wallet transfer atomically. Check allowances first (`read.allowance`), then approve if needed (`write.approve`).
7
+ - **`write.account.add_liquidity`** capital sources: `deposits` array (wallet tokens), `use_account_assets=true` (existing account collateral), or both. Supports depositing multiple tokens and minting multiple LP positions in one tx. The backend swaps everything to the optimal ratio for the LP. You do NOT need to `write.account.deposit` first — `write.account.add_liquidity` handles the wallet transfer atomically. Check allowances first (`read.wallet.allowance`), then approve if needed (`write.wallet.approve`).
8
8
  - **V4 spot accounts CAN mint LP** but cannot leverage (set `leverage: 0`). V3 margin accounts (created with a `creditor`) can both mint LP and leverage. If the user wants leveraged LP, create a V3 margin account with a creditor (`account_version: 3`).
9
- - **`numeraire`** in `advanced.repay_with_collateral`: the debt token you're repaying (e.g. WETH when repaying WETH debt). `advanced.add_liquidity` auto-detects numeraire — no param needed.
10
- - **`leverage`**: `0` = no leverage. `2` = 2x. Do NOT use `1` for no leverage — use `0`. When `leverage > 0`, borrowing is handled internally by `advanced.add_liquidity` — do NOT call `write.borrow` separately.
11
- - **LP NFT details**: after `advanced.add_liquidity`, call `read.account_info` to find `asset_address` (the position manager contract) and `asset_id` (NFT token ID) in the positions list — needed for unstake/remove/claim actions.
12
- - **`amount: "max_uint256"`** in `write.repay` repays all debt in full.
9
+ - **`numeraire`** in `write.account.deleverage`: the debt token you're repaying (e.g. WETH when repaying WETH debt). `write.account.add_liquidity` auto-detects numeraire — no param needed.
10
+ - **`leverage`**: `0` = no leverage. `2` = 2x. Do NOT use `1` for no leverage — use `0`. When `leverage > 0`, borrowing is handled internally by `write.account.add_liquidity` — do NOT call `write.account.borrow` separately.
11
+ - **LP NFT details**: after `write.account.add_liquidity`, call `read.account.info` to find `asset_address` (the position manager contract) and `asset_id` (NFT token ID) in the positions list — needed for unstake/remove/claim actions.
12
+ - **`amount: "max_uint256"`** in `write.account.repay` repays all debt in full.
13
13
  - **`slippage`** is in basis points: 100 = 1%, 50 = 0.5%.
14
- - **`salt`** in `write.create_account` is a random uint32 used for deterministic address derivation. Use any random 32-bit integer (e.g. `Math.floor(Math.random() * 2**32)`).
15
- - **`creditor`** = the lending pool address you want to borrow from. Set at account creation via `write.create_account`. Determines which asset the account can borrow. **Required for leveraged LP strategies.** Omit for spot-only accounts (no borrowing, but LP minting still works with `leverage: 0`).
16
- - **`write.withdraw`**: pass exact amounts from `read.account_info`. Does NOT support `"max_uint256"` — will error.
17
- - **Getting the account address after creation:** The address is deterministic from the salt. It's visible in the tx receipt events. Or call `read.account_info(wallet_address: ...)` after creation to list all accounts.
14
+ - **`salt`** in `write.account.create` is a random uint32 used for deterministic address derivation. Use any random 32-bit integer (e.g. `Math.floor(Math.random() * 2**32)`).
15
+ - **`creditor`** = the lending pool address you want to borrow from. Set at account creation via `write.account.create`. Determines which asset the account can borrow. **Required for leveraged LP strategies.** Omit for spot-only accounts (no borrowing, but LP minting still works with `leverage: 0`).
16
+ - **`write.account.withdraw`**: pass exact amounts from `read.account.info`. Does NOT support `"max_uint256"` — will error.
17
+ - **Getting the account address after creation:** The address is deterministic from the salt. It's visible in the tx receipt events. Or call `read.account.info(wallet_address: ...)` after creation to list all accounts.
18
18
 
19
19
  ---
20
20
 
@@ -22,14 +22,14 @@ These are templates and examples — not the only valid approaches. Adapt parame
22
22
 
23
23
  ```
24
24
  Open: check allowances → approve tokens if needed → create account → add liquidity (atomic: deposit + swap + mint + borrow) → enable automation
25
- Monitor: read.account_info (health), read.account_pnl (profitability)
25
+ Monitor: read.account.info (health), read.account.pnl (profitability)
26
26
  Adjust: add collateral or repay debt if health drops; remove + re-add liquidity to manually rebalance range
27
27
  Close: disable rebalancer → unstake → atomic close (burn LP + swap + repay) → withdraw
28
28
  ```
29
29
 
30
30
  ### Batching vs splitting
31
31
 
32
- **Default: always use atomic tools.** `advanced.add_liquidity` batches opening, `advanced.close_position` batches closing, `advanced.repay_with_collateral` batches debt repayment from collateral. These reduce transaction count and eliminate exposure to price movement between steps.
32
+ **Default: always use atomic tools.** `write.account.add_liquidity` batches opening, `write.account.close` batches closing, `write.account.deleverage` batches debt repayment from collateral. These reduce transaction count and eliminate exposure to price movement between steps.
33
33
 
34
34
  **When to split:** In high-volatility markets or for low-liquidity pools, atomic transactions may revert because on-chain state diverges from when the backend computed the calldata. If an atomic tool fails, fall back to individual tools with tighter slippage. Always try atomic first — split only on failure.
35
35
 
@@ -52,38 +52,38 @@ Close: disable rebalancer → unstake → atomic close (burn LP + swap + repay
52
52
 
53
53
  ### Step-by-step
54
54
 
55
- > Addresses below are Base mainnet examples. Always verify current addresses via `read.lending_pools` and `read.assets` before executing.
55
+ > Addresses below are Base mainnet examples. Always verify current addresses via `read.pools` and `read.assets` before executing.
56
56
 
57
57
  ```
58
58
  // 1. FIND A POOL
59
- read.strategies(chain_id: 8453)
59
+ read.strategy.list(chain_id: 8453)
60
60
  → Filter for volatile/stable pair (WETH/USDC, cbBTC/USDC, etc.)
61
61
  → Note: strategy_id (integer), pool_protocol (Slipstream V1/V2, UniV3, UniV4), fee_APY
62
62
 
63
63
  // 2. CHECK BORROW COST
64
- read.lending_pools(chain_id: 8453)
64
+ read.pools(chain_id: 8453)
65
65
  → Find the WETH lending pool (address: 0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2)
66
66
  → If borrow_apy > fee_apy → stop, strategy not profitable
67
67
 
68
68
  // 3. CREATE MARGIN ACCOUNT (V3 + creditor = can borrow/leverage)
69
- write.create_account(
69
+ write.account.create(
70
70
  salt: <random uint32, e.g. 3141592653>,
71
71
  account_version: 3, // V3 margin — required for leverage
72
72
  creditor: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", // WETH lending pool — enables borrow
73
73
  chain_id: 8453
74
74
  )
75
75
  → Submit tx, note deployed account address from tx receipt
76
- → Or call read.account_info(wallet_address: ...) to find the new account address
76
+ → Or call read.account.info(wallet_address: ...) to find the new account address
77
77
 
78
78
  // 4. CHECK ALLOWANCE + APPROVE (skip approve if already sufficient)
79
- read.allowance(
79
+ read.wallet.allowance(
80
80
  owner_address: <owner_wallet>,
81
81
  spender_address: <account_address>,
82
82
  token_addresses: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"], // USDC
83
83
  chain_id: 8453
84
84
  )
85
85
  // → If allowance is insufficient or zero:
86
- write.approve(
86
+ write.wallet.approve(
87
87
  token_address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC
88
88
  spender_address: <account_address>,
89
89
  amount: "max_uint256",
@@ -91,8 +91,8 @@ write.approve(
91
91
  )
92
92
 
93
93
  // 5. OPEN LEVERAGED LP (atomic: pull USDC from wallet + borrow WETH + swap to ratio + mint LP)
94
- // No separate write.deposit needed — advanced.add_liquidity handles the wallet transfer atomically.
95
- advanced.add_liquidity(
94
+ // No separate write.account.deposit needed — write.account.add_liquidity handles the wallet transfer atomically.
95
+ write.account.add_liquidity(
96
96
  account_address: <account_address>,
97
97
  wallet_address: <owner_wallet>,
98
98
  positions: [{ strategy_id: <integer from step 1> }],
@@ -103,7 +103,7 @@ advanced.add_liquidity(
103
103
  )
104
104
 
105
105
  // 6. ENABLE AND CONFIGURE REBALANCER (match address to LP protocol from step 1)
106
- write.configure_asset_manager(
106
+ write.asset_manager.configure(
107
107
  account_address: <account_address>,
108
108
  asset_manager_address: "0x953Ff365d0b562ceC658dc46B394E9282338d9Ea", // Slipstream V2
109
109
  am_type: "rebalancer",
@@ -116,7 +116,7 @@ write.configure_asset_manager(
116
116
  // → Range width and reposition mode must be configured in the Arcadia platform
117
117
 
118
118
  // 7. ENABLE MERKL (if pool has Merkl incentives — check fee APY breakdown in step 1)
119
- write.configure_asset_manager(
119
+ write.asset_manager.configure(
120
120
  account_address: <account_address>,
121
121
  asset_manager_address: "0x969F0251360b9Cf11c68f6Ce9587924c1B8b42C6",
122
122
  am_type: "merkl_operator",
@@ -129,7 +129,7 @@ write.configure_asset_manager(
129
129
 
130
130
  ```
131
131
  // Run periodically (daily or on request)
132
- read.account_info(account_address: <account_address>, chain_id: 8453)
132
+ read.account.info(account_address: <account_address>, chain_id: 8453)
133
133
  → health_factor = 1 - (used_margin / liquidation_value). Higher = safer.
134
134
  1 → no debt (safest)
135
135
  > 0.5 → healthy
@@ -144,10 +144,10 @@ typically a few dollars in value) to the debt when computing used_margin
144
144
  dominates, pushing HF lower than the leverage ratio suggests — e.g. HF ~0.3 at 2×
145
145
  instead of ~0.5–0.7. Increase position size for a healthier starting HF.
146
146
 
147
- read.account_pnl(account_address: <account_address>, chain_id: 8453)
147
+ read.account.pnl(account_address: <account_address>, chain_id: 8453)
148
148
  → If net yield is consistently negative → evaluate exit
149
149
 
150
- read.lending_pools(chain_id: 8453)
150
+ read.pools(chain_id: 8453)
151
151
  → If borrow_APY risen above fee_APY → exit signal
152
152
  ```
153
153
 
@@ -156,15 +156,15 @@ read.lending_pools(chain_id: 8453)
156
156
  ```
157
157
  // Option A: Add collateral (raises health factor, cheapest)
158
158
  // Check allowance first — skip approve if already sufficient
159
- read.allowance(owner_address: <wallet>, spender_address: <account>, token_addresses: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"], chain_id: 8453)
160
- write.approve(token_address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", spender_address: <account>, amount: "max_uint256", chain_id: 8453)
161
- write.deposit(account_address: <account>, asset_addresses: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"], asset_amounts: ["<amount>"], chain_id: 8453)
159
+ read.wallet.allowance(owner_address: <wallet>, spender_address: <account>, token_addresses: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"], chain_id: 8453)
160
+ write.wallet.approve(token_address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", spender_address: <account>, amount: "max_uint256", chain_id: 8453)
161
+ write.account.deposit(account_address: <account>, asset_addresses: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"], asset_amounts: ["<amount>"], chain_id: 8453)
162
162
 
163
163
  // Option B: Repay some WETH debt (reduces leverage)
164
164
  // NOTE: you must approve the WETH pool to spend WETH from your wallet first — check allowance, then approve if needed
165
- read.allowance(owner_address: <wallet>, spender_address: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", token_addresses: ["0x4200000000000000000000000000000000000006"], chain_id: 8453)
166
- write.approve(token_address: "0x4200000000000000000000000000000000000006", spender_address: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", amount: "max_uint256", chain_id: 8453)
167
- write.repay(
165
+ read.wallet.allowance(owner_address: <wallet>, spender_address: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", token_addresses: ["0x4200000000000000000000000000000000000006"], chain_id: 8453)
166
+ write.wallet.approve(token_address: "0x4200000000000000000000000000000000000006", spender_address: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", amount: "max_uint256", chain_id: 8453)
167
+ write.account.repay(
168
168
  pool_address: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", // WETH pool
169
169
  account_address: <account>,
170
170
  amount: "<raw_weth_amount_in_wei>", // e.g. "100000000000000000" = 0.1 WETH
@@ -172,7 +172,7 @@ write.repay(
172
172
  )
173
173
 
174
174
  // Option C: Atomic sell USDC collateral → repay WETH debt (one flash tx, no wallet WETH needed)
175
- advanced.repay_with_collateral(
175
+ write.account.deleverage(
176
176
  account_address: <account>,
177
177
  asset_from: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // sell USDC from account
178
178
  amount_in: "<usdc_amount_to_sell>", // collateral amount to sell (input side, NOT debt amount)
@@ -191,7 +191,7 @@ advanced.repay_with_collateral(
191
191
 
192
192
  ```
193
193
  // 0. Disable automation first (prevents rebalancer from acting during close)
194
- write.set_asset_manager(
194
+ write.asset_manager.set(
195
195
  account_address: <account>,
196
196
  asset_manager_address: "0x953Ff365d0b562ceC658dc46B394E9282338d9Ea",
197
197
  enabled: false,
@@ -199,13 +199,13 @@ write.set_asset_manager(
199
199
  )
200
200
 
201
201
  // 1. Get account state — need asset list for the close call
202
- read.account_info(account_address: <account>, chain_id: 8453)
202
+ read.account.info(account_address: <account>, chain_id: 8453)
203
203
 
204
204
  // 2. Unstake if staked (required before close)
205
- advanced.position_action(action: "unstake", asset_address: <staked_pm_address>, asset_id: <nft_id>, account_address: <account>, chain_id: 8453)
205
+ write.account.stake(action: "unstake", asset_address: <staked_pm_address>, asset_id: <nft_id>, account_address: <account>, chain_id: 8453)
206
206
 
207
207
  // 3. Atomic close: burns LP + swaps all tokens to USDC + repays debt — ONE transaction
208
- advanced.close_position(
208
+ write.account.close(
209
209
  account_address: <account>,
210
210
  assets: [
211
211
  { asset_address: "<position_manager>", asset_id: <nft_id>, amount: "1", decimals: 1 }
@@ -216,7 +216,7 @@ advanced.close_position(
216
216
  )
217
217
 
218
218
  // 4. Withdraw remaining assets to wallet
219
- write.withdraw(
219
+ write.account.withdraw(
220
220
  account_address: <account>,
221
221
  asset_addresses: ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"],
222
222
  asset_amounts: ["<balance>"],
@@ -228,19 +228,19 @@ write.withdraw(
228
228
 
229
229
  If the full atomic close fails, split into two steps:
230
230
 
231
- 1. `advanced.close_position(close_lp_only=true)` — burns LP only, tokens stay in account
232
- 2. Then use individual tools: `advanced.repay_with_collateral` → `write.withdraw`
231
+ 1. `write.account.close(close_lp_only=true)` — burns LP only, tokens stay in account
232
+ 2. Then use individual tools: `write.account.deleverage` → `write.account.withdraw`
233
233
 
234
234
  #### Last resort: Manual step-by-step
235
235
 
236
236
  Only if both atomic approaches fail:
237
237
 
238
238
  ```
239
- advanced.position_action(action: "claim", ...) // claim fees
240
- advanced.remove_liquidity(adjustment: <amount>) // partial decrease
241
- advanced.repay_with_collateral(...) // swap collateral → repay debt
242
- write.repay(amount: "max_uint256") // repay remaining from wallet
243
- write.withdraw(...) // withdraw all to wallet
239
+ write.account.stake(action: "claim", ...) // claim fees
240
+ write.account.remove_liquidity(adjustment: <amount>) // partial decrease
241
+ write.account.deleverage(...) // swap collateral → repay debt
242
+ write.account.repay(amount: "max_uint256") // repay remaining from wallet
243
+ write.account.withdraw(...) // withdraw all to wallet
244
244
  ```
245
245
 
246
246
  **Key risks:**
@@ -283,23 +283,23 @@ The `protocol_owned_liquidity` strategy type uses a dynamic range algorithm (k1/
283
283
  // Same tools, different intent — no leverage, wider slippage tolerance
284
284
 
285
285
  // 1. Check allowance + approve treasury tokens (skip approve if already sufficient)
286
- read.allowance(owner_address: <treasury_wallet>, spender_address: <account>, token_addresses: [<token>], chain_id: 8453)
287
- write.approve(token_address: <token>, spender_address: <account>, amount: "max_uint256", chain_id: 8453)
286
+ read.wallet.allowance(owner_address: <treasury_wallet>, spender_address: <account>, token_addresses: [<token>], chain_id: 8453)
287
+ write.wallet.approve(token_address: <token>, spender_address: <account>, amount: "max_uint256", chain_id: 8453)
288
288
 
289
289
  // 2. Create account (separate from retail positions)
290
290
  // For POL without leverage, a spot account (V4) works fine.
291
291
  // Use V3 + creditor only if you want the option to leverage later.
292
- write.create_account(
292
+ write.account.create(
293
293
  salt: <random uint32>,
294
294
  account_version: 0, // V4 spot — no leverage needed for POL
295
295
  chain_id: 8453
296
296
  )
297
297
 
298
298
  // 3. Deposit treasury tokens
299
- write.deposit(account_address: <account>, ...)
299
+ write.account.deposit(account_address: <account>, ...)
300
300
 
301
301
  // 4. Open LP (no leverage — deposits are pulled from wallet)
302
- advanced.add_liquidity(
302
+ write.account.add_liquidity(
303
303
  account_address: <account>,
304
304
  wallet_address: <treasury_wallet>,
305
305
  positions: [{ strategy_id: <from step 1> }],
@@ -310,7 +310,7 @@ advanced.add_liquidity(
310
310
  )
311
311
 
312
312
  // 5. Enable rebalancer with POL strategy hook
313
- write.configure_asset_manager(
313
+ write.asset_manager.configure(
314
314
  account_address: <account>,
315
315
  asset_manager_address: <rebalancer matching LP protocol>,
316
316
  am_type: "rebalancer",
@@ -329,11 +329,11 @@ write.configure_asset_manager(
329
329
  ### Monitoring for POL
330
330
 
331
331
  ```
332
- read.account_info → verify position is in range (primary check — no liquidation risk since no leverage)
333
- read.account_pnl → track IL vs. fee income
332
+ read.account.info → verify position is in range (primary check — no liquidation risk since no leverage)
333
+ read.account.pnl → track IL vs. fee income
334
334
  Note: net negative IL is EXPECTED and ACCEPTABLE for POL
335
335
  The treasury is "paying" for market liquidity
336
- read.recommendation → check if rebalancing is needed
336
+ read.strategy.recommendation → check if rebalancing is needed
337
337
  ```
338
338
 
339
339
  **POL monitoring goal:** Ensure sufficient liquidity is deployed and treasury capital is not eroding excessively — not maximizing return.