Overview
CallProxy executes arbitrary smart contract calls on behalf of cross-chain messages. It provides context about the original sender and chain, enabling secure cross-chain interactions. Contract Location:contracts/periphery/CallProxy.sol
Key Features
- Execute contract calls with cross-chain context
- Support for both native ETH and ERC-20 token transfers
- Fallback handling for failed calls
- Reentrancy protection
- Multi-send support for batched operations
Context Variables
Chain ID where the cross-chain message originated
Original sender address on the source chain (encoded as bytes)
These context variables are available to the target contract during execution, allowing it to verify the cross-chain caller.
Main Functions
call
Executes a contract call with native ETH.Address to receive leftover funds if call fails
Target contract to call
Encoded function call data
Execution flags (revert behavior, sender proxying, etc.)
Original sender on source chain
Source chain ID
callERC20
Executes a contract call with ERC-20 tokens.Usage Example
Target contracts can access the cross-chain context:Accessing Context
Execution Flags
Flags control execution behavior:REVERT_IF_EXTERNAL_FAIL: Revert entire transaction if target call failsPROXY_WITH_SENDER: Provide native sender context to target contractSEND_HASHED_DATA: Send hashed data instead of full calldataSEND_EXTERNAL_CALL_GAS_LIMIT: Allow custom gas limits
Flag Examples
Flag Examples
Setting Flags
Multi-Send Support
CallProxy supports batched transactions:Batch Execution
Security Considerations
- Reentrancy protection via
lockmodifier - Only callable by DeBridgeGate
- Excess funds returned to reserve address
- Token approvals cleared after execution
Related Documentation
Cross-Chain Calls Guide
Learn how to implement cross-chain calls
ICallProxy Interface
Interface reference