Skip to main content
Three commands cover treasury movement beyond simple transfers. swap routes through the Trails DEX API, including cross-chain swaps via --to-chain. deposit parks idle balances in Trails earn pools (Aave v3, Morpho, ERC-4626 vaults). withdraw exits those positions, with auto-discovery if you know only the asset and protocol. The CLI picks the highest-TVL pool by default; pass --protocol to constrain. All three are dry-run by default. Pass --broadcast to execute.

How it works

Treasury sweep flow
1OperatorCLIpolygon-agent swap —from USDT —to USDC …
2CLITrailsRoutes swap quote and gas across DEX aggregators
3Smart walletPolygonSwap executes; output token received
4OperatorCLIpolygon-agent deposit —asset USDC —amount 1000
5TrailsAave / MorphoDeposits into highest-TVL pool by default
--defi at wallet create time gives the smart wallet permission to interact with Aave v3, Morpho, and ERC-4626 vaults. Without --defi, deposit and withdraw fail with a session-rejection error before any funds move.

Commands

swap

DEX swap routed through Trails. Pass --to-chain to bridge during the swap.

deposit

Deposit into a Trails earn pool. With no --protocol, the CLI auto-selects the highest-TVL pool for the asset. --protocol aave or --protocol morpho constrains the choice.

withdraw

Withdraw from an Aave v3 aToken position or an ERC-4626 vault. Use --amount max for a full exit.

Worked example


Implementation

Setup and wallets

Pass --defi at wallet creation to enable swaps and yield.

Transfers

Plain token transfers; no DEX routing.

Trails

The underlying DEX and earn-pool router.