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/optics-core/contracts/test/TestGovernanceRouter.sol

39 lines
1.2 KiB

// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
import "../governance/GovernanceRouter.sol";
import {TypeCasts} from "../XAppConnectionManager.sol";
contract TestGovernanceRouter is GovernanceRouter {
using TypedMemView for bytes;
using TypedMemView for bytes29;
using GovernanceMessage for bytes29;
constructor(uint32 _localDomain, uint256 _recoveryTimelock)
GovernanceRouter(_localDomain, 50)
{} // solhint-disable-line no-empty-blocks
function testSetRouter(uint32 _domain, bytes32 _router) external {
_setRouter(_domain, _router); // set the router locally
bytes memory _setRouterMessage = GovernanceMessage.formatSetRouter(
_domain,
_router
);
_sendToAllRemoteRouters(_setRouterMessage);
}
function setRouterAddress(uint32 _domain, address _router) external {
_setRouter(_domain, TypeCasts.addressToBytes32(_router));
}
function containsDomain(uint32 _domain) external view returns (bool) {
for (uint256 i = 0; i < domains.length; i++) {
if (domains[i] == _domain) return true;
}
return false;
}
}