Fund with Trails
Trails seamlessly enables users to deposit funds into your chain, app, or protocol with optimized UX flows and native integrations with multiple liquidity sources to optimize routes for low-slippage. Users can fund from any token they hold across any supported chain, eliminating the need for manual bridging and swapping - embedded seamlessly in the experience. Traditional funding flows require users to:- Find an external bridge or fiat onramp provider supported by the chain / app
- Swap to the required deposit token
- Pay multiple gas fees across different networks
- Wait for bridge confirmations
- Navigate complex interfaces
Use Cases
Funding flows in Trails are modeled as exact input by default. For example, “I have exactly 10 USDC tokens I want to send out from the origin chain, and I’ll receive 9.99 USDC on the destination.” Funding can done through a variety of methods such as the user’s connected wallet, QR code deposit, or onramping from various fiat options. This is ideal for a variety of use cases and apps such as the following:- Transfer funds into a perpetual exchange deposit address.
- Bootstrap liquidity for lending protocols by transferring funds and executing a vault deposit.
- Add funds to your balance on an application with crypto support.
- Swap and deposit funds into staking contracts.
- Onboard users to new chains seamlessly from any origin chain.
- Top up a user’s account on a prediction market.
Examples
Depositing USDC into Base
This example shows how to use the Trails widget to enable a user to deposit into a chain with any token, in this case USDC on Base with a fixed amount:Depositing Fixed Amount into a DeFi Yield Vault
Trails is able to call any smart contract function on the destination chain. A common pattern is to fund a DeFi vault, for example depositing into an Aave pool on Base:Depositing variable amount into a DeFi Yield Vault
Additionally, Trails is easily integrated with virtually any ERC-4626 yield vault. For many use cases, you can simple encode the static calldata directly and pass it to Trails directly. However, for user-selected amounts where the amount is part of the calldata, you must encode it with a placeholder amount so the widget replaces it with the exact bridged/swapped output at execution time which we have a handy utility for to identify the data to replace. For example, a user can select any amount with any token to deposit into a USDC yearn vault on Katana:Next Steps
Explore more about configuring and customizing funding flows:- Fund Mode Configuration - Complete configuration options and parameters for fund mode
- SDK Configuration - Widget setup, callbacks, and event handling
- Widget Theming - Customize the appearance to match your brand
- Hooks Reference - Available hooks for programmatic control
- Tokens & Chains - Configure supported tokens and destination chains
- Customization Guide - Advanced customization options for funding flows