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.
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;
}
FieldTypeDescription
deadlineuint64Intent expiry timestamp
creatoraddressIntent creator (this contract)
proveraddressProver contract address
nativeAmountuint256Native token amount
tokensTokenAmount[]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.
FieldTypeIndexedDescription
intentHashbytes32YesUnique intent identifier
amountuint256NoToken amount in the intent
calleraddressYesAddress that triggered intent creation

IntentRefunded

event IntentRefunded(
    bytes32 indexed routeHash,
    address indexed refundee
)
Emitted when funds are refunded for an expired intent.
FieldTypeIndexedDescription
routeHashbytes32YesRoute hash of the refunded intent
refundeeaddressYesAddress receiving the refund

Errors

AlreadyInitialized

error AlreadyInitialized()
Thrown when initialize() is called more than once.

NotInitialized

error NotInitialized()
Thrown when calling functions before initialization.

OnlyFactory

error OnlyFactory()
Thrown when non-factory address calls initialize().

InvalidDepositor

error InvalidDepositor()
Thrown when non-depositor attempts to trigger refund.

NoDepositorSet

error 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

error ZeroAmount()
Thrown when attempting to create intent with zero amount.

ReentrancyGuardReentrantCall

error ReentrancyGuardReentrantCall()
Thrown on reentrancy attempt (security protection).