Overview
IntentSource is an abstract contract containing all core intent functionality for EVM chains. It manages the lifecycle of cross-chain intents and their associated rewards on the source chain. Contract Location:contracts/IntentSource.sol
Inherits: OriginSettler, IIntentSource
State Variables
Status Enum
View Functions
getRewardStatus
bytes32
Hash of the intent to query
Status
Current status of the intent (Initial, Funded, Withdrawn, or Refunded)
getIntentHash (Intent)
Intent
The intent to hash
bytes32
Combined hash of route and reward
bytes32
Hash of the route component
bytes32
Hash of the reward component
getIntentHash (Destination, Route, Reward)
uint64
Destination chain ID for the intent
bytes
Encoded route data for the intent as bytes for cross-VM compatibility
Reward
Reward structure containing distribution details
bytes32
Combined hash of route and reward
bytes32
Hash of the route component
bytes32
Hash of the reward component
getIntentHash (Route Hash)
uint64
Destination chain ID for the intent
bytes32
Pre-computed hash of the route component
Reward
Reward structure containing distribution details
bytes32
Combined hash of route and reward
bytes32
Hash of the route component (passed through)
bytes32
Hash of the reward component
intentVaultAddress (Intent)
Intent
Intent to calculate vault address for
address
Address of the intent vault
intentVaultAddress (Destination, Route, Reward)
uint64
Destination chain ID for the intent
bytes
Encoded route data for the intent as bytes
Reward
The reward structure containing distribution details
address
Address of the intent vault
isIntentFunded (Intent)
Intent
Intent to validate
bool
True if intent is completely funded, false otherwise
isIntentFunded (Destination, Route, Reward)
uint64
Destination chain ID for the intent
bytes
Encoded route data for the intent as bytes
Reward
The reward structure containing distribution details
bool
True if intent is completely funded, false otherwise
State-Changing Functions
publish (Intent)
Intent
The complete intent struct to be published
bytes32
Hash of the created intent
address
Address of the created vault
publish (Destination, Route, Reward)
uint64
Destination chain ID for the intent
bytes
Encoded route data for the intent as bytes
Reward
The reward structure containing distribution details
bytes32
Hash of the created intent
address
Address of the created vault
publishAndFund (Intent)
Intent
The complete intent struct to be published and funded
bool
Whether to allow partial funding
bytes32
Hash of the created and funded intent
address
Address of the created vault
This function is payable to accept native token (ETH) for funding.
publishAndFund (Destination, Route, Reward)
uint64
Destination chain ID for the intent
bytes
Encoded route data for the intent as bytes
Reward
The reward structure containing distribution details
bool
Whether to allow partial funding
bytes32
Hash of the created and funded intent
address
Address of the created vault
fund
uint64
Destination chain ID for the intent
bytes32
Hash of the route component
Reward
Reward structure containing distribution details
bool
Whether to allow partial funding
bytes32
Hash of the funded intent
Prevents funding of intents that are already withdrawn or refunded. Allows funding of Initial or Funded status intents for partial funding.
fundFor
uint64
Destination chain ID for the intent
bytes32
Hash of the route component
Reward
Reward structure containing distribution details
bool
Whether to allow partial funding
address
Address to fund the intent from
address
Address of the permitContract instance
bytes32
Hash of the funded intent
publishAndFundFor (Intent)
Intent
The complete intent struct
bool
Whether to allow partial funding
address
Address to fund the intent from
address
Address of the permitContract instance
bytes32
Hash of the created and funded intent
address
Address of the created vault
publishAndFundFor (Destination, Route, Reward)
uint64
Destination chain ID for the intent
bytes
Encoded route data for the intent as bytes
Reward
The reward structure containing distribution details
bool
Whether to accept partial funding
address
The address providing the funding
address
The permit contract for token approvals
bytes32
Hash of the created and funded intent
address
Address of the created vault
withdraw
uint64
Destination chain ID for the intent
bytes32
Hash of the intent’s route
Reward
Reward structure of the intent
If the intent has been proven on a different chain, this function will challenge the proof instead of withdrawing.
batchWithdraw
uint64[]
Array of destination chain IDs for the intents
bytes32[]
Array of route hashes for the intents
Reward[]
Array of reward structures for the intents
All arrays must have the same length, or the function will revert with ArrayLengthMismatch.
refund
uint64
Destination chain ID for the intent
bytes32
Hash of the intent’s route
Reward
Reward structure of the intent
Can only be called after the reward deadline has passed, and only if the intent has not been proven/claimed.
refundTo
uint64
Destination chain ID for the intent
bytes32
Hash of the intent’s route
Reward
Reward structure of the intent
address
Address to receive the refunded rewards
Only the reward creator (reward.creator) can call this function.
recoverToken
uint64
Destination chain ID for the intent
bytes32
Hash of the intent’s route
Reward
Reward structure of the intent
address
Token address for handling incorrect vault transfers
The token must not be among the intent’s reward tokens. This function is for recovering tokens sent to the vault by mistake.