write.account.add_liquidity
Add liquidity to Arcadia Finance accounts by depositing tokens, using collateral, swapping to optimal ratios, and minting LP positions in a single atomic transaction.
Instructions
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). 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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_address | Yes | Arcadia account address | |
| wallet_address | Yes | Wallet address of the account owner | |
| positions | Yes | LP positions to mint. For a single position, pass one entry. | |
| deposits | No | Wallet tokens to deposit. Approve each token first (write.wallet.approve). Omit to use only account collateral. | |
| use_account_assets | No | If true, use ALL existing account collateral for LP minting. Fetched automatically. | |
| leverage | No | 0 = no borrow, 2 = 2x leverage. Margin accounts only. | |
| slippage | No | Basis points, 100 = 1% | |
| chain_id | No | Chain ID: 8453 (Base) or 130 (Unichain) |