write_account_add_liquidity
Multi-step flash-action: atomically combines [deposit from wallet] + [use account collateral] + [swap to optimal ratio] + [mint LP] + [borrow if leveraged] in ONE transaction. Do NOT call write_account_deposit separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (read_wallet_allowances), then approve if needed (write_wallet_approve). Supports depositing multiple tokens and minting multiple LP positions in one tx. Works with both margin accounts (can leverage) and spot accounts (no leverage). For workflows, call read_guides('strategies'). The returned calldata is time-sensitive: sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up), passing only the accept_price_checks the user already confirmed. Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation. expected_value_change is in raw units of the account's numeraire token (6 decimals for USDC, 18 for WETH). Negative = cost to open, positive = value gained. Compare before.total_account_value and after.total_account_value for the full picture. If a pool's price is off market or one of its tokens has no price, the tool returns the price warnings, an accept_price_checks list and NO transaction. Show the warnings to the user and call again with that accept_price_checks list only after the user explicitly confirms they accept them. If a later call returns new warnings, even on a rebuild, show them and get a new confirmation before passing their list. The acknowledgement never bypasses a backend refusal.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain_id | No | Chain ID: 8453 (Base), 130 (Unichain), 10 (Optimism), or 4663 (Robinhood) | |
| deposits | No | Wallet tokens to deposit. Approve each token first (write_wallet_approve). Omit to use only account collateral. | |
| leverage | No | 0 = no borrow, 2 = 2x leverage. Margin accounts only. | |
| slippage | No | Basis points, 100 = 1% | |
| positions | Yes | LP positions to mint. For a single position, pass one entry. | |
| wallet_address | Yes | Wallet address of the account owner | |
| account_address | Yes | Arcadia account address | |
| use_account_assets | No | If true, use ALL existing account collateral for LP minting. Fetched automatically. | |
| accept_price_checks | No | The accept_price_checks list returned with the price warnings of a previous call, passed unchanged and only after the user has explicitly confirmed those warnings. Never set it on the first call. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| after | No | ||
| before | No | ||
| description | No | ||
| transaction | Yes | ||
| price_checks | No | ||
| tenderly_sim_url | No | ||
| tenderly_sim_status | No | ||
| expected_value_change | No | ||
| expected_value_change_unavailable | No |