The EVM implementation provides secure deposit functionality and flexible execution of arbitrary smart contract calls through allocator-signed requests. It leverages EIP-712 structured data signing for secure authorization and supports both native ETH and ERC20 token deposits.
Source Code: /packages/ethereum-vm
- Owner: Administrative control via Ownable pattern
- Allocator: Authorized signer for execution requests
- EIP-712: Structured data signing for secure authorization
- Call Execution: Arbitrary smart contract interaction capability
mapping(bytes32 => bool) public callRequests: Replay protection trackingaddress public allocator: Authorized signer address
constructor(owner, allocator): Initialize contract with owner and allocatorsetAllocator(address): Update allocator address (owner only)
depositNative(depositor, id): Deposit ETH with optional depositor overridedepositErc20(depositor, token, amount, id): Deposit specific ERC20 amountdepositErc20(depositor, token, id): Deposit full allowance amount
execute(request, signature): Execute allocator-signed call requests
CallRequest Structure:
struct CallRequest {
Call[] calls; // Array of calls to execute
uint256 nonce; // Unique identifier
uint256 expiration; // Unix timestamp expiration
}
struct Call {
address to; // Target contract address
bytes data; // Call data
uint256 value; // ETH value to send
bool allowFailure; // Whether call failure is acceptable
}Events:
RelayNativeDeposit:
event RelayNativeDeposit(address from, uint256 amount, bytes32 id);RelayErc20Deposit:
event RelayErc20Deposit(address from, address token, uint256 amount, bytes32 id);RelayCallExecuted:
event RelayCallExecuted(bytes32 id, Call call);