Skip to main content

Overview

Eco Routes Protocol uses CREATE2 for deterministic address generation across two critical components:
  1. Intent Vaults: Escrow contracts holding rewards
  2. Deposit Addresses: User-specific deposit endpoints
Deterministic addresses enable powerful features like sending funds before deployment and predicting contract locations across chains.

CREATE2 Basics

Standard EVM Formula

Parameters:
  • 0xff: CREATE2 prefix (standard for EVM)
  • deployer_address: Address of the contract deploying
  • salt: Unique 32-byte value
  • init_code: Contract creation bytecode

TRON Exception

TRON Networks: Use prefix 0x41 instead of 0xff for historical reasons.

Clones Library

The protocol uses minimal proxy clones for gas-efficient deployments:
Benefits:
  • Gas efficient: Minimal proxy pattern (~200 gas overhead per call)
  • Deterministic: Same salt always produces same address
  • Flexible: Change implementation without redeploying all proxies

Intent Vault Addresses

Deterministic Vault Calculation

Each intent gets a unique vault based on its intentHash:

Intent Hash Calculation

Intent hash components:

Example Vault Address

Lazy Deployment

Optimization: Vaults are only deployed when needed (funding, withdrawal, or refund), saving gas for simple view operations.

Deposit Address Calculation

Factory-Based Deployment

Deposit addresses are created by factory contracts:

Salt Composition

Why include depositor?
  • Different refund addresses need different deposit contracts
  • Same destination + different depositor = different address
  • Prevents address collisions between users

Deployment Check

Usage pattern:

Practical Examples

Example 1: Pre-Funding a Vault

Example 2: Deposit Address for CEX Withdrawal

Example 3: Cross-Chain Vault Address

Different Chains = Different Addresses: Even with the same salt, CREATE2 produces different addresses on different chains because the deployer address changes.

Security Implications

Address Squatting Prevention

Concern: Can someone deploy to an address before the legitimate user? Answer: No, because:

Salt Collision

Concern: Can two intents have the same vault? Answer: Extremely unlikely:
For a collision to occur:
  • Same destination chain
  • Same route (recipient, calls, etc.)
  • Same reward (creator, deadline, amounts)
  • Probability: ~2^-256 (astronomically low)

Pre-Deployment Vulnerabilities

Be Careful: Sending funds to predicted addresses before deployment requires trust in the deployment process.

Gas Optimization

View Functions Don’t Deploy

Minimal Proxy Gas Costs

Lazy Deployment Savings

Yes! You can compute CREATE2 addresses using the same formula:
If you send funds to a deposit address with wrong parameters:
  • The address won’t match any intent creation
  • Backend won’t detect it (monitors specific addresses)
  • Funds will sit there until manually recovered
Solution: Always verify the address with the factory before sending.
No! Once a contract is deployed to an address, it cannot be redeployed (even after selfdestruct in some cases). This is a security feature preventing address reuse attacks.For deposit addresses: Each user gets a unique address based on destination + depositor, so reuse isn’t an issue.For vaults: Each intent gets a unique vault based on intentHash, ensuring isolation.

Next Steps

Deposit Addresses

See CREATE2 in action with deposit addresses

Security Model

Learn how deterministic addresses enhance security