Skip to main content

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:
Key properties:
  • 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

Critical: Only the portal contract that deployed a vault can call its functions.
Security guarantees:
  • Users cannot withdraw directly from vaults
  • Vaults cannot be drained by unauthorized contracts
  • Portal enforces all business logic and validation

Fund Management

Funding

Features:
  • 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

Safety features:
  • 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

Key difference from withdrawal:
  • 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

Authorization Model: The executor is deployed by the portal contract and only accepts calls from it. This prevents unauthorized execution of calls.

EOA Protection

One of the most important security features prevents calls to Externally Owned Accounts (EOAs) with calldata:
Why this matters:

Call Execution

Security features:
  • 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

Requirements:
  • Intent must be in Initial or Funded state
  • Claimant must be proven by the prover contract
  • Cannot withdraw after refund

Refund Validation

Refund conditions:
  • 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

Set Reasonable Deadlines: Too short and legitimate solvers may not have time to fulfill. Too long and your funds are locked unnecessarily.

For Solvers

Verify Proof Before Withdrawing: Always ensure your fulfillment was correctly proven before attempting withdrawal.

For Integrators

Token Approvals: Only approve the exact amount needed for each intent. Never give unlimited approvals.

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.
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.
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.
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.
The withdraw function uses min() to transfer available balance:
Solvers receive whatever is available, but may choose not to fulfill underfunded intents.

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