Skip to main content

Overview

The Reward 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

Defines the reward and validation parameters for cross-chain execution.

Fields

uint64
Timestamp after which the intent can no longer be executed.Format: Unix timestamp (seconds since epoch)Purpose:
  • Prevents stale intents from being executed
  • Protects users from unfavorable market conditions
  • Allows intent creators to withdraw funds after expiration
Validation:
  • Must be greater than current block.timestamp when intent is created
  • Should be greater than route.deadline to allow time for proof submission and reward claiming
  • Typical range: 30 minutes to 48 hours from intent creation
Example:
Relationship with Route Deadline:
Note: Using uint64 is safe until the year 2262.
address
Address that created the intent and has authority to modify or cancel it.Permissions:
  • 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
Security:
  • Must be the address that funded the intent vault
  • Used for access control in vault operations
  • Validated during intent creation and modification
Example:
Use Cases:
  • User wallets creating intents directly
  • Smart contract wallets for automated strategies
  • Protocol contracts for cross-chain operations
address
Address of the prover contract on the origin chain that must approve execution.Role:
  • 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.)
Requirements:
  • Must implement the IProver interface
  • Must be a trusted contract capable of verifying cross-chain execution
  • Should have established communication with destination chain provers
Prover Types:
  • 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
Example:
Security Consideration: The prover is critical for security. Using an untrusted or compromised prover could allow false proof submission and unauthorized reward claims.
uint256
Amount of native tokens (in wei) offered as reward to the solver.Purpose:
  • 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
Funding:
  • Must be provided as msg.value when calling open() or openFor()
  • Held in the intent’s vault contract until proven execution
  • Released to the claimant (solver) after successful proof verification
Calculation:
Example:
Note: Use 0 if no native token reward is offered (only ERC20 rewards).
TokenAmount[]
Array of ERC20 tokens and amounts offered as additional rewards to the solver.Purpose:
  • Provides multi-token reward structures
  • Allows rewards in stablecoins, governance tokens, or protocol-specific tokens
  • Enables complex incentive mechanisms
Structure:
Funding:
  • 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
Example:
Important: Always use correct decimal precision for each token.See TokenAmount Type for more details.

Reward Hash Calculation

Rewards are hashed for intent identification and verification:
This hash is:
  1. Used in intent hash calculation
  2. Transmitted to destination chain in fill() originData
  3. Verified during proof submission to ensure reward integrity
Full Intent Hash:

Usage Examples

Simple Native Token Reward

Multi-Token Reward

Protocol-Governed Reward


Reward Economics

Calculating Appropriate Rewards

Reward amounts should cover:
  1. Destination Gas Costs:
  2. Origin Gas Costs:
  3. Capital Risk:
  4. Solver Profit:
  5. Total Reward:

Dynamic Reward Adjustment

For competitive solver markets, consider:

Reward Distribution Flow

  1. Intent Creation:
    • User specifies reward parameters
    • Funds (native + tokens) transferred to vault
    • Vault holds funds in escrow
  2. Intent Execution:
    • Solver executes route on destination chain
    • Destination prover sends proof to origin prover
  3. Proof Verification:
    • Origin prover receives and validates proof
    • Prover marks intent as proven
  4. Reward Claim:
    • Solver (claimant) calls vault to claim rewards
    • Vault verifies proof status with prover
    • Rewards transferred to claimant
  5. Refund (if not executed):
    • After reward.deadline, creator can refund
    • Funds returned to creator’s address

Security Considerations

Prover Trust

Critical: The prover 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

The Reward struct is used in ERC-7683 integration:

In OrderData

In ResolvedCrossChainOrder

Rewards are converted to Output[] format for minReceived: