Overview
Eco Routes Protocol implements a comprehensive security model with multiple layers of protection:- Vault escrow system for isolated fund management
- Executor safety checks to prevent malicious calls
- Authorization controls limiting contract interactions
- Lifecycle-based state management preventing double-spends
Vault Security
Isolated Escrow
Each intent gets its own dedicated vault contract for fund isolation:- One vault per intent: Funds cannot be mixed between intents
- Deterministic addresses: Vault address computed from
intentHash - Minimal proxies: Gas-efficient clones of implementation contract
- Immutable portal: Each vault only accepts calls from its deployer
Portal Authorization
- Users cannot withdraw directly from vaults
- Vaults cannot be drained by unauthorized contracts
- Portal enforces all business logic and validation
Fund Management
Funding
- Partial funding support: Returns whether fully funded
- Multiple funding methods: Standard approvals and permit-based
- Safe transfers: Uses OpenZeppelin’s SafeERC20
- Balance checks: Verifies existing balance before transferring
Withdrawal
- Actual balance check: Uses
min()to prevent over-withdrawal - Graceful degradation: Transfers available amount even if underfunded
- Native ETH handling: Safely transfers ETH with success check
Refund
- Full balance: Transfers entire balance, not just reward amount
- Emergency recovery: Can recover funds even if partially funded
Executor Security
Purpose
The Executor contract safely executes arbitrary calls on behalf of intents:Portal-Only Execution
EOA Protection
One of the most important security features prevents calls to Externally Owned Accounts (EOAs) with calldata:Call Execution
- Batch execution: All calls in a batch must succeed or entire transaction reverts
- Return data: Captures and returns results from each call
- Detailed errors: Includes failed call details in revert messages
Lifecycle State Management
Intent Status
State Transitions
Validation Logic
Funding Validation
Partial Funding: Intents can be funded multiple times until fully funded, but cannot be funded after withdrawal or refund.
Withdrawal Validation
- Intent must be in
InitialorFundedstate - Claimant must be proven by the prover contract
- Cannot withdraw after refund
Refund Validation
- Deadline must have passed
- Intent must not have been proven on the correct destination
- OR intent has been withdrawn/refunded already
Best Practices
For Intent Creators
For Solvers
For Integrators
Attack Vectors & Mitigations
Double-Spend Prevention
Attack: Attempt to withdraw the same intent twice. Mitigation: State transitions prevent this:Vault Draining
Attack: Try to withdraw funds from vault directly. Mitigation:onlyPortal modifier:
Malicious Calls
Attack: Include malicious calldata targeting EOAs. Mitigation: EOA validation:Front-Running
Attack: See a profitable intent in mempool and try to fulfill it first. Mitigation: This is actually desirable behavior in the protocol! Solvers compete to fulfill intents quickly, benefiting users.Can someone steal my vault funds?
Can someone steal my vault funds?
No. Vaults are isolated and can only be accessed by the portal contract. The portal enforces all business logic including proof verification before allowing withdrawals.
What if my intent deadline passes?
What if my intent deadline passes?
You can call
refund() to recover your funds from the vault. The intent status will change to Refunded and you’ll receive all deposited tokens back.Can the executor call arbitrary contracts?
Can the executor call arbitrary contracts?
The executor can only be called by the portal, and it validates that calls don’t target EOAs with calldata. However, the intent creator defines what calls are made, so choose trusted routes.
What happens if a vault is underfunded?
What happens if a vault is underfunded?
The withdraw function uses Solvers receive whatever is available, but may choose not to fulfill underfunded intents.
min() to transfer available balance:Security Audits
Coming Soon: Professional security audits will be conducted before mainnet launch. Check the documentation for updates.
Next Steps
Deterministic Addresses
Learn how CREATE2 enables secure deterministic deployments
Deposit Addresses
See how security applies to deposit address system