What is an Intent?
An intent represents a user’s desired outcome on a destination chain. It contains:- Route: The calls to execute on the destination chain, including required tokens
- Reward: The compensation offered to solvers who execute the intent
- Destination: The target chain ID where execution should occur
Intent Structure
Eco Routes uses three core data structures defined incontracts/types/Intent.sol:
Intent
Intent.sol
Route
Intent.sol
Reward
Intent.sol
Creating Your First Intent
Here’s a complete example of creating an intent for a cross-chain token transfer.1
Define the Intent Parameters
First, define what you want to happen on the destination chain:
2
Create Token Transfer Calls
Define the calls to execute on the destination chain:
3
Specify Required Tokens
Declare which tokens the solver must provide:
4
Define the Route
Combine the execution parameters:
5
Define the Reward
Specify compensation for the solver:
6
Create the Complete Intent
Assemble the full intent:
Publishing and Funding Intents
Once you’ve created an intent, you need to publish and fund it. TheIntentSource contract provides several methods.
Function Signatures
Fromcontracts/IntentSource.sol:
IntentSource.sol
Publish and Fund in One Transaction
- ERC20 Rewards
- Native Token Rewards
- Mixed Rewards
For intents with ERC20 token rewards:
Separate Publish and Fund
You can also publish an intent first and fund it later:Anyone can fund an intent once it’s published. The reward tokens are held in a deterministic vault contract until the intent is fulfilled.
Real-World Examples
Example 1: Cross-Chain Swap
Swap USDC on Ethereum for USDT on Arbitrum:Example 2: Cross-Chain DeFi Interaction
Deposit funds into a lending protocol on another chain:Example 3: Native Token Transfer
Transfer ETH to another chain:Checking Intent Status
You can check if an intent has been funded usingcontracts/IntentSource.sol:
IntentSource.sol
Important Considerations
Deterministic Vaults: Reward tokens are stored in deterministic vault contracts created via CREATE2. The vault address is the same across all chains for the same intent hash.
Next Steps
Fulfilling Intents
Learn how solvers execute intents on destination chains
Proving Intents
Understand how fulfillment is proven cross-chain
ERC-7683 Integration
Use the standardized ERC-7683 interface