Overview
CompactArbiter serves as the core integration layer with TheCompact’s resource locking system, enabling arbiters to unlock tokens and assets that were previously locked on origin chains.TheCompact is a protocol for cross-chain resource management where users can lock resources on one chain and later unlock them on another chain through cryptographic proofs and signatures.
Key Capabilities
- Multichain claims: Unlocking resources when the current chain is the notarized chain
- Exogenous claims: Unlocking resources when operating on a non-notarized chain
- Batch operations: Efficient processing of multiple token unlocks in single transaction
- Signature validation: EIP-712 compliant mandate verification for secure unlocking
- Cross-chain coordination: Managing state transitions across multiple blockchain networks
Architecture
The contract abstracts away the complexity of TheCompact’s claim operations while providing standardized interfaces for settlement-specific arbiters to leverage resource unlocking.Constructor
address
required
The address of TheCompact claims contract that manages resource locks and unlocks. Must be a valid ITheCompactClaims implementation for the target network.
The compact address cannot be changed after deployment. Ensure you provide the correct address during contract initialization.
State Variables
CLAIM
STRING_MANDATE_STRIPPED
This is the witness typestring used by TheCompact for validating cross-chain mandates. The string defines the structure of the mandate data that gets hashed and signed. The “stripped” version excludes the leading “Mandate mandate)” portion as required by TheCompact.
Claim Functions
Notarized Chain Unlock
Handles the case where resources were locked on the chain where the order was notarized, and now need to be unlocked for cross-chain settlement. Uses batchMultichainClaim for standard cross-chain resource unlocking.
Parameters
Types.Order
required
The order containing token inputs and settlement details.
bytes32[]
required
Additional chain elements for multi-chain validation.
bytes
required
The signature from the origin chain authorizing the unlock.
bytes
required
The allocator-specific data for resource allocation.
address
required
The address that will receive the unlocked tokens.
bytes32
required
The mandate hash for TheCompact validation.
Returns
bytes32
The claim hash returned by TheCompact, used for tracking and validation.
Implementation
The function handles both single and batch token unlocking:- Single Token
- Batch Tokens
For orders with a single token input, uses
multichainClaim for gas efficiency:Exogenous Chain Unlock
Handles the case where resources were locked on a different chain than where the order was notarized. Uses exogenousBatchClaim for cross-chain resource unlocking where the current chain is not the notarized chain.
Parameters
Types.Order
required
The order containing token inputs and settlement details.
bytes
required
The signature from the origin chain authorizing the unlock.
uint256
required
The chain ID where the order was originally notarized.
uint256
required
The index of the current chain in the cross-chain element array.
bytes32[]
required
Additional chain elements for multi-chain validation.
bytes
required
The allocator-specific data for resource allocation.
address
required
The address that will receive the unlocked tokens.
bytes32
required
The mandate hash for TheCompact validation.
Returns
bytes32
The claim hash returned by TheCompact, used for tracking and validation.
Implementation
Similar to notarized chain unlocking, handles both single and batch tokens:- Single Token
- Batch Tokens
Modifiers
requireOtherChain
Ensures the order doesn’t have target operations (which would indicate same-chain execution) and that the notarized chain ID differs from the current chain.
Errors
ClaimFailed
InvalidOrderData
- Target operations are present in a cross-chain order
- Notarized chain ID equals current chain ID for exogenous claims
- Sponsor address is the arbiter contract itself
Events
ProcessedClaim
address
The address that sponsored the original order.
uint256
The unique identifier of the processed order.
bytes32
The hash returned by TheCompact claim operations.
Gas Optimization
Source Code Reference
Location:/src/base/arbiter/CompactArbiter/CompactArbiter.sol:46