Documentation Index
Fetch the complete documentation index at: https://eco.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
The Deposit Contract is the programmable address smart contract that receives tokens and executes the programmed action. Each contract is bound to a specific destination address and handles the conversion of deposits into Routes intents.
Purpose
Each programmable address contract serves a single destination:
- Token reception: Receives tokens from users
- Action execution: Converts deposits into cross-chain intents via Portal
- Refund handling: Returns funds for expired/unfulfilled intents
Functions
initialize
Called by the factory immediately after deployment.
function initialize(
bytes32 _destinationAddress,
address _depositor
) external
Parameters:
_destinationAddress: Destination wallet that will receive funds
_depositor: Address authorized to trigger refunds
createIntent
Creates a cross-chain intent for the specified amount.
function createIntent(uint256 amount)
external returns (bytes32 intentHash)
Parameters:
amount: Amount of tokens to include in the intent
Returns:
intentHash: Unique identifier for the created intent
refund
Triggers a refund for an expired intent.
function refund(
bytes32 routeHash,
Reward calldata reward
) external
Parameters:
routeHash: Hash of the route parameters
reward: Reward structure for the intent
View Functions
function destinationAddress() external view returns (bytes32)
function depositor() external view returns (address)
Reward Structure
The refund function requires a Reward struct:
struct Reward {
uint64 deadline;
address creator;
address prover;
uint256 nativeAmount;
TokenAmount[] tokens;
}
struct TokenAmount {
address token;
uint256 amount;
}
| Field | Type | Description |
|---|
deadline | uint64 | Intent expiry timestamp |
creator | address | Intent creator (this contract) |
prover | address | Prover contract address |
nativeAmount | uint256 | Native token amount |
tokens | TokenAmount[] | Token amounts in reward |
Events
IntentCreated
event IntentCreated(
bytes32 indexed intentHash,
uint256 amount,
address indexed caller
)
Emitted when a new intent is created from a deposit.
| Field | Type | Indexed | Description |
|---|
intentHash | bytes32 | Yes | Unique intent identifier |
amount | uint256 | No | Token amount in the intent |
caller | address | Yes | Address that triggered intent creation |
IntentRefunded
event IntentRefunded(
bytes32 indexed routeHash,
address indexed refundee
)
Emitted when funds are refunded for an expired intent.
| Field | Type | Indexed | Description |
|---|
routeHash | bytes32 | Yes | Route hash of the refunded intent |
refundee | address | Yes | Address receiving the refund |
Errors
AlreadyInitialized
error AlreadyInitialized()
Thrown when initialize() is called more than once.
NotInitialized
Thrown when calling functions before initialization.
OnlyFactory
Thrown when non-factory address calls initialize().
InvalidDepositor
Thrown when non-depositor attempts to trigger refund.
NoDepositorSet
Thrown when depositor address is zero during initialization.
InsufficientBalance
error InsufficientBalance(uint256 requested, uint256 available)
Thrown when intent amount exceeds contract’s token balance.
ZeroAmount
Thrown when attempting to create intent with zero amount.
ReentrancyGuardReentrantCall
error ReentrancyGuardReentrantCall()
Thrown on reentrancy attempt (security protection).