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/MockHyperlaneEnvironment.sol

80 lines
2.8 KiB

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.13;
2 years ago
import "./MockMailbox.sol";
import "../middleware/InterchainQueryRouter.sol";
import "../test/TestInterchainGasPaymaster.sol";
import "../test/TestIsm.sol";
import {TypeCasts} from "../libs/TypeCasts.sol";
contract MockHyperlaneEnvironment {
uint32 originDomain;
uint32 destinationDomain;
2 years ago
mapping(uint32 => MockMailbox) public mailboxes;
mapping(uint32 => TestInterchainGasPaymaster) public igps;
mapping(uint32 => IInterchainSecurityModule) public isms;
mapping(uint32 => InterchainQueryRouter) public queryRouters;
constructor(uint32 _originDomain, uint32 _destinationDomain) {
originDomain = _originDomain;
destinationDomain = _destinationDomain;
2 years ago
MockMailbox originMailbox = new MockMailbox(_originDomain);
MockMailbox destinationMailbox = new MockMailbox(_destinationDomain);
originMailbox.addRemoteMailbox(_destinationDomain, destinationMailbox);
destinationMailbox.addRemoteMailbox(_originDomain, originMailbox);
On chain gas oracles in the IGP (#1765) * Rough implementations of all gas oracles, done with StaticGasOracle & tests * more tests, beef up StorageGasOracle * Tests cleaned up, moved to Foundry test for IGP * rm StaticGasOracle, fix all tests * cleaning up * comment * yarn gas, better comments * Fix sdk test * Fix e2e * Rm LZ stuff * fix router test * Rm MockInterchainGasPaymaster * pr comments * Move to setGasConfigs instead of setGasConfig * fix test * nit * yarn gas * IGP deploy & checker tooling, script to update on-chain StorageGasOracle data (#1794) * Add IGP gas oracle to checker * Checker works * Support different gas oracle contracts in IGP deploy tooling too * Export some types * Build out set-storage-gas-oracle-values * nit * nit * rm comment * Add pricing data * nits * nearly there * haven't tested e2e yet, but added new proxy upgrade logic to set gas oracles in IGP in upgradeAndCall * pr comments * lots * Move away from upgradeAndCall for IGP upgrade, trying to debug annoying dependency issue * Got working, cleaned a little * Add test to ensure a new implementation is deployed * yarn hyperlane * nits * cleaning * Map in description * Dedupe submission type logic * yarn gas * Separate beneficiary in IGP (#1801) * Add IGP gas oracle to checker * Checker works * Support different gas oracle contracts in IGP deploy tooling too * Export some types * Build out set-storage-gas-oracle-values * nit * nit * Add separate beneficiary to IGP * Checker / govern / deploy tooling * nits * Add compare-storage-gas-oracle * successful test upgrade, minor changes * Nits * Fix tests * Performed testne3 upgrade. Need to clean up code, but should probably use this for the mainnet upgrade * nit * update prices * Update gas prices and token exchange rates for mainnet * mainnet upgrade. needs lots of cleaning, but here it is in all its glory * Starting to clean up * more cleanup * Use updated submodules * yarn gas * nit * PR comments * yarn hyperlane * yarn gas
2 years ago
igps[originDomain] = new TestInterchainGasPaymaster(address(this));
igps[destinationDomain] = new TestInterchainGasPaymaster(address(this));
isms[originDomain] = new TestIsm();
isms[destinationDomain] = new TestIsm();
originMailbox.setDefaultIsm(isms[originDomain]);
destinationMailbox.setDefaultIsm(isms[destinationDomain]);
2 years ago
mailboxes[_originDomain] = originMailbox;
mailboxes[_destinationDomain] = destinationMailbox;
InterchainQueryRouter originQueryRouter = new InterchainQueryRouter();
InterchainQueryRouter destinationQueryRouter = new InterchainQueryRouter();
address owner = address(this);
originQueryRouter.initialize(
2 years ago
address(originMailbox),
address(igps[originDomain]),
address(isms[originDomain]),
owner
);
destinationQueryRouter.initialize(
2 years ago
address(destinationMailbox),
address(igps[destinationDomain]),
address(isms[destinationDomain]),
owner
);
originQueryRouter.enrollRemoteRouter(
_destinationDomain,
TypeCasts.addressToBytes32(address(destinationQueryRouter))
);
destinationQueryRouter.enrollRemoteRouter(
_originDomain,
TypeCasts.addressToBytes32(address(originQueryRouter))
);
queryRouters[_originDomain] = originQueryRouter;
queryRouters[_destinationDomain] = destinationQueryRouter;
}
function processNextPendingMessage() public {
2 years ago
mailboxes[destinationDomain].processNextInboundMessage();
}
function processNextPendingMessageFromDestination() public {
2 years ago
mailboxes[originDomain].processNextInboundMessage();
}
}