Skip to main content
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.
Parameters:
  • _destinationAddress: Destination wallet that will receive funds
  • _depositor: Address authorized to trigger refunds

createIntent

Creates a cross-chain intent for the specified amount.
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.
Parameters:
  • routeHash: Hash of the route parameters
  • reward: Reward structure for the intent

View Functions

Reward Structure

The refund function requires a Reward struct:

Events

IntentCreated

Emitted when a new intent is created from a deposit.

IntentRefunded

Emitted when funds are refunded for an expired intent.

Errors

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

Thrown when intent amount exceeds contract’s token balance.

ZeroAmount

Thrown when attempting to create intent with zero amount.

ReentrancyGuardReentrantCall

Thrown on reentrancy attempt (security protection).