How it works
TRAILS_ROUTER_PLACEHOLDER_AMOUNT stands in for the arrived amount in your calldata. Trails substitutes the real figure at execution time, so slippage and bridge variance are absorbed automatically.
Encoding a composable action
PassdestinationCalldata with the encoded function call for whatever action you want executed on arrival. The example below deposits into an ERC-4626 yield vault, but the same pattern works for any protocol:
What you can compose
Any protocol interaction that takes a token amount as input works with this pattern:| Action | ABI function | Notes |
|---|---|---|
| Yield vault deposit | deposit(uint256 assets, address receiver) | ERC-4626 standard |
| Liquidity provision | addLiquidity(...) | AMM-specific ABI |
| Staking | stake(uint256 amount) | Protocol-specific |
| Lending supply | supply(address asset, uint256 amount, ...) | Aave-style |
| Custom contract call | Any payable function | Encode via encodeFunctionData |
Widget integration
For drop-in UI, passtoCalldata to the Trails Widget. The widget handles the full funding and action flow:
Example: yield accounts
One common use of composable actions is offering savings accounts in a fintech or neobank app. Users deposit USDC into a yield vault. The entire flow (bridge, swap, deposit) happens in a single tap, with no gas, no wallet management, and no protocol knowledge required from the user.Offer yield accounts to your users
Step-by-step guide: wallet setup, Morpho vault deposit, permit signing, and withdraw flow.
Next steps
Fund from Anywhere
Let users fund your protocol from any token, chain, credit card, or bank account.
Smart Sessions
Automate recurring actions without per-transaction prompts.
Trails API reference
Full endpoint reference for QuoteIntent, CommitIntent, and ExecuteIntent.