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
Hash of the intent to query
Current status of the intent (Initial, Funded, Withdrawn, or Refunded)
getIntentHash (Intent)
The intent to hash
Combined hash of route and reward
Hash of the route component
Hash of the reward component
getIntentHash (Destination, Route, Reward)
Destination chain ID for the intent
Encoded route data for the intent as bytes for cross-VM compatibility
Reward structure containing distribution details
Combined hash of route and reward
Hash of the route component
Hash of the reward component
getIntentHash (Route Hash)
Destination chain ID for the intent
Pre-computed hash of the route component
Reward structure containing distribution details
Combined hash of route and reward
Hash of the route component (passed through)
Hash of the reward component
intentVaultAddress (Intent)
Intent to calculate vault address for
Address of the intent vault
intentVaultAddress (Destination, Route, Reward)
Destination chain ID for the intent
Encoded route data for the intent as bytes
The reward structure containing distribution details
Address of the intent vault
isIntentFunded (Intent)
Intent to validate
True if intent is completely funded, false otherwise
isIntentFunded (Destination, Route, Reward)
Destination chain ID for the intent
Encoded route data for the intent as bytes
The reward structure containing distribution details
True if intent is completely funded, false otherwise
State-Changing Functions
publish (Intent)
The complete intent struct to be published
Hash of the created intent
Address of the created vault
publish (Destination, Route, Reward)
Destination chain ID for the intent
Encoded route data for the intent as bytes
The reward structure containing distribution details
Hash of the created intent
Address of the created vault
publishAndFund (Intent)
The complete intent struct to be published and funded
Whether to allow partial funding
Hash of the created and funded intent
Address of the created vault
This function is payable to accept native token (ETH) for funding.
publishAndFund (Destination, Route, Reward)
Destination chain ID for the intent
Encoded route data for the intent as bytes
The reward structure containing distribution details
Whether to allow partial funding
Hash of the created and funded intent
Address of the created vault
fund
Destination chain ID for the intent
Hash of the route component
Reward structure containing distribution details
Whether to allow partial funding
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
Destination chain ID for the intent
Hash of the route component
Reward structure containing distribution details
Whether to allow partial funding
Address to fund the intent from
Address of the permitContract instance
Hash of the funded intent
publishAndFundFor (Intent)
The complete intent struct
Whether to allow partial funding
Address to fund the intent from
Address of the permitContract instance
Hash of the created and funded intent
Address of the created vault
publishAndFundFor (Destination, Route, Reward)
Destination chain ID for the intent
Encoded route data for the intent as bytes
The reward structure containing distribution details
Whether to accept partial funding
The address providing the funding
The permit contract for token approvals
Hash of the created and funded intent
Address of the created vault
withdraw
Destination chain ID for the intent
Hash of the intent’s route
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
Array of destination chain IDs for the intents
Array of route hashes for the intents
Array of reward structures for the intents
All arrays must have the same length, or the function will revert with ArrayLengthMismatch.
refund
Destination chain ID for the intent
Hash of the intent’s route
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
Destination chain ID for the intent
Hash of the intent’s route
Reward structure of the intent
Address to receive the refunded rewards
Only the reward creator (reward.creator) can call this function.
recoverToken
Destination chain ID for the intent
Hash of the intent’s route
Reward structure of the intent
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.