The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
hyperlane-monorepo/solidity/contracts/mock/MockInterchainAccountRouter...

48 lines
1.4 KiB

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.13;
import {InterchainAccountRouter} from "../middleware/InterchainAccountRouter.sol";
import {OwnableMulticall, Call} from "../OwnableMulticall.sol";
/*
* @title The Hello World App
* @dev You can use this simple app as a starting point for your own application.
*/
contract MockInterchainAccountRouter is InterchainAccountRouter {
struct PendingCall {
uint32 originDomain;
bytes senderAndCalls;
}
uint32 public originDomain;
mapping(uint256 => PendingCall) pendingCalls;
uint256 totalCalls = 0;
uint256 callsProcessed = 0;
constructor(uint32 _originDomain) InterchainAccountRouter() {
originDomain = _originDomain;
}
function _dispatch(uint32, bytes memory _messageBody)
internal
override
returns (bytes32)
{
pendingCalls[totalCalls] = PendingCall(originDomain, _messageBody);
totalCalls += 1;
return keccak256(abi.encodePacked(totalCalls));
}
function processNextPendingCall() public {
PendingCall memory pendingCall = pendingCalls[callsProcessed];
(address sender, Call[] memory calls) = abi.decode(
pendingCall.senderAndCalls,
(address, Call[])
);
getDeployedInterchainAccount(originDomain, sender).proxyCalls(calls);
callsProcessed += 1;
}
}