Overview
TheReward struct defines the incentive structure and validation parameters for cross-chain intents. It specifies who can execute the intent, what rewards they receive upon successful execution, and the execution deadline.
Type Location: contracts/types/Intent.sol
Reward
Fields
Timestamp after which the intent can no longer be executed.Format: Unix timestamp (seconds since epoch)Purpose:Relationship with Route Deadline:Note: Using
- Prevents stale intents from being executed
- Protects users from unfavorable market conditions
- Allows intent creators to withdraw funds after expiration
- Must be greater than current
block.timestampwhen intent is created - Should be greater than
route.deadlineto allow time for proof submission and reward claiming - Typical range: 30 minutes to 48 hours from intent creation
uint64 is safe until the year 2262.Address that created the intent and has authority to modify or cancel it.Permissions:Use Cases:
- Can withdraw funds before intent is fulfilled
- Can refund the intent after deadline passes
- Has special authorization for intent state changes
- Receives any excess funds after reward distribution
- Must be the address that funded the intent vault
- Used for access control in vault operations
- Validated during intent creation and modification
- User wallets creating intents directly
- Smart contract wallets for automated strategies
- Protocol contracts for cross-chain operations
Address of the prover contract on the origin chain that must approve execution.Role:Security Consideration: The prover is critical for security. Using an untrusted or compromised prover could allow false proof submission and unauthorized reward claims.
- Validates that the intent was executed correctly on the destination chain
- Receives cross-chain proofs from destination chain provers
- Authorizes reward distribution only after proof verification
- Implements specific proof mechanism (native rollup proofs, message bridges, etc.)
- Must implement the
IProverinterface - Must be a trusted contract capable of verifying cross-chain execution
- Should have established communication with destination chain provers
- Native Provers: Use chain-native proof mechanisms (OP Stack, Arbitrum, etc.)
- Message Bridge Provers: Use arbitrary message bridges (Hyperlane, LayerZero, Wormhole)
- Oracle Provers: Use oracle networks for proof validation
- Local Provers: For same-chain testing and development
Amount of native tokens (in wei) offered as reward to the solver.Purpose:Example:Note: Use
- Incentivizes solvers to execute the intent on the destination chain
- Compensates for gas costs, capital risk, and execution effort
- Escrowed in the intent vault on the origin chain
- Must be provided as
msg.valuewhen callingopen()oropenFor() - Held in the intent’s vault contract until proven execution
- Released to the claimant (solver) after successful proof verification
0 if no native token reward is offered (only ERC20 rewards).Array of ERC20 tokens and amounts offered as additional rewards to the solver.Purpose:Funding:Important: Always use correct decimal precision for each token.See TokenAmount Type for more details.
- Provides multi-token reward structures
- Allows rewards in stablecoins, governance tokens, or protocol-specific tokens
- Enables complex incentive mechanisms
- Tokens must be transferred to the vault before or during intent creation
- Requires ERC20 approval for the vault contract
- Can use Permit for gasless approvals
Reward Hash Calculation
Rewards are hashed for intent identification and verification:- Used in intent hash calculation
- Transmitted to destination chain in
fill()originData - Verified during proof submission to ensure reward integrity
Usage Examples
Simple Native Token Reward
Multi-Token Reward
Protocol-Governed Reward
Reward Economics
Calculating Appropriate Rewards
Reward amounts should cover:-
Destination Gas Costs:
-
Origin Gas Costs:
-
Capital Risk:
-
Solver Profit:
-
Total Reward:
Dynamic Reward Adjustment
For competitive solver markets, consider:Reward Distribution Flow
-
Intent Creation:
- User specifies reward parameters
- Funds (native + tokens) transferred to vault
- Vault holds funds in escrow
-
Intent Execution:
- Solver executes route on destination chain
- Destination prover sends proof to origin prover
-
Proof Verification:
- Origin prover receives and validates proof
- Prover marks intent as proven
-
Reward Claim:
- Solver (claimant) calls vault to claim rewards
- Vault verifies proof status with prover
- Rewards transferred to claimant
-
Refund (if not executed):
- After
reward.deadline, creator can refund - Funds returned to creator’s address
- After
Security Considerations
Prover Trust
Critical: Theprover address has sole authority to mark intents as proven. Choose provers carefully:
- ✅ Trusted: Native rollup provers, established message bridges
- ⚠️ Caution: New or unaudited prover contracts
- ❌ Avoid: Unknown or unverified contracts
Deadline Management
Reward Funding
Token Approvals
Integration with ERC-7683
TheReward struct is used in ERC-7683 integration:
In OrderData
In ResolvedCrossChainOrder
Rewards are converted toOutput[] format for minReceived:
Related
- Intent Type - Complete intent structure including reward
- Route Type - Routing instructions paired with rewards
- TokenAmount Type - Token specification format
- OriginSettler - Handles reward funding and escrow
- Prover Contracts - Proof verification and reward authorization