Skip to content

Commit

Permalink
fix: fixed tests and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sendra committed Dec 4, 2023
1 parent 31c1b49 commit f8e9d95
Show file tree
Hide file tree
Showing 35 changed files with 225 additions and 48 deletions.
4 changes: 4 additions & 0 deletions scripts/Adapters/BaseAdapterScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import '../../src/contracts/adapters/IBaseAdapter.sol';
abstract contract BaseAdapterScript is BaseScript {
function REMOTE_NETWORKS() public view virtual returns (uint256[] memory);

function GET_BASE_GAS_LIMIT() public view virtual returns (uint256) {
return 0;
}

function _deployAdapter(
DeployerHelpers.Addresses memory addresses,
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
Expand Down
13 changes: 12 additions & 1 deletion scripts/Adapters/DeployArbAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ abstract contract BaseArbAdapter is BaseAdapterScript {
return false;
}

function GET_BASE_GAS_LIMIT() public view virtual override returns (uint256) {
return 150_000;
}

function _deployAdapter(
DeployerHelpers.Addresses memory addresses,
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
Expand All @@ -24,12 +28,19 @@ abstract contract BaseArbAdapter is BaseAdapterScript {
addresses.crossChainController,
INBOX(),
DESTINATION_CCC(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
} else {
addresses.arbAdapter = address(
new ArbAdapter(addresses.crossChainController, INBOX(), DESTINATION_CCC(), trustedRemotes)
new ArbAdapter(
addresses.crossChainController,
INBOX(),
DESTINATION_CCC(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand Down
14 changes: 12 additions & 2 deletions scripts/Adapters/DeployCBaseAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@ abstract contract BaseCBAdapter is BaseAdapterScript {
) internal override {
if (isTestnet()) {
addresses.baseAdapter = address(
new CBaseAdapterTestnet(addresses.crossChainController, OVM(), trustedRemotes)
new CBaseAdapterTestnet(
addresses.crossChainController,
OVM(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
} else {
addresses.baseAdapter = address(
new CBaseAdapter(addresses.crossChainController, OVM(), trustedRemotes)
new CBaseAdapter(
addresses.crossChainController,
OVM(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand Down
9 changes: 8 additions & 1 deletion scripts/Adapters/DeployCCIP.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ abstract contract BaseCCIPAdapter is BaseAdapterScript {
new CCIPAdapterTestnet(
addresses.crossChainController,
CCIP_ROUTER(),
GET_BASE_GAS_LIMIT(),
trustedRemotes,
LINK_TOKEN()
)
);
} else {
addresses.ccipAdapter = address(
new CCIPAdapter(addresses.crossChainController, CCIP_ROUTER(), trustedRemotes, LINK_TOKEN())
new CCIPAdapter(
addresses.crossChainController,
CCIP_ROUTER(),
GET_BASE_GAS_LIMIT(),
trustedRemotes,
LINK_TOKEN()
)
);
}
}
Expand Down
28 changes: 24 additions & 4 deletions scripts/Adapters/DeployGnosisChain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ contract Ethereum is BaseGnosisChainAdapter {
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
addresses.gnosisAdapter = address(
new GnosisChainAdapter(addresses.crossChainController, GNOSIS_AMB_BRIDGE(), trustedRemotes)
new GnosisChainAdapter(
addresses.crossChainController,
GNOSIS_AMB_BRIDGE(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand All @@ -57,7 +62,12 @@ contract Ethereum_testnet is BaseGnosisChainAdapter {
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
addresses.gnosisAdapter = address(
new GnosisChainAdapter(addresses.crossChainController, GNOSIS_AMB_BRIDGE(), trustedRemotes)
new GnosisChainAdapter(
addresses.crossChainController,
GNOSIS_AMB_BRIDGE(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand All @@ -82,7 +92,12 @@ contract Gnosis is BaseGnosisChainAdapter {
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
addresses.gnosisAdapter = address(
new GnosisChainAdapter(addresses.crossChainController, GNOSIS_AMB_BRIDGE(), trustedRemotes)
new GnosisChainAdapter(
addresses.crossChainController,
GNOSIS_AMB_BRIDGE(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand All @@ -108,7 +123,12 @@ contract Gnosis_testnet is BaseGnosisChainAdapter {
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
addresses.gnosisAdapter = address(
new GnosisChainAdapter(addresses.crossChainController, GNOSIS_AMB_BRIDGE(), trustedRemotes)
new GnosisChainAdapter(
addresses.crossChainController,
GNOSIS_AMB_BRIDGE(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
8 changes: 7 additions & 1 deletion scripts/Adapters/DeployHL.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ abstract contract BaseHLAdapter is BaseAdapterScript {
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
addresses.hlAdapter = address(
new HyperLaneAdapter(addresses.crossChainController, HL_MAIL_BOX(), HL_IGP(), trustedRemotes)
new HyperLaneAdapter(
addresses.crossChainController,
HL_MAIL_BOX(),
HL_IGP(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand Down
14 changes: 12 additions & 2 deletions scripts/Adapters/DeployLZ.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@ abstract contract BaseLZAdapter is BaseAdapterScript {
address lzAdapter;
if (isTestNet()) {
lzAdapter = address(
new LayerZeroAdapterTestnet(LZ_ENDPOINT(), addresses.crossChainController, trustedRemotes)
new LayerZeroAdapterTestnet(
LZ_ENDPOINT(),
addresses.crossChainController,
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
} else {
lzAdapter = address(
new LayerZeroAdapter(LZ_ENDPOINT(), addresses.crossChainController, trustedRemotes)
new LayerZeroAdapter(
LZ_ENDPOINT(),
addresses.crossChainController,
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
addresses.lzAdapter = lzAdapter;
Expand Down
18 changes: 16 additions & 2 deletions scripts/Adapters/DeployMetisAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,31 @@ abstract contract BaseMetisAdapter is BaseAdapterScript {
return false;
}

function GET_BASE_GAS_LIMIT() public view virtual override returns (uint256) {
return 150_000;
}

function _deployAdapter(
DeployerHelpers.Addresses memory addresses,
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
if (isTestnet()) {
addresses.metisAdapter = address(
new MetisAdapterTestnet(addresses.crossChainController, OVM(), trustedRemotes)
new MetisAdapterTestnet(
addresses.crossChainController,
OVM(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
} else {
addresses.metisAdapter = address(
new MetisAdapter(addresses.crossChainController, OVM(), trustedRemotes)
new MetisAdapter(
addresses.crossChainController,
OVM(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand Down
9 changes: 7 additions & 2 deletions scripts/Adapters/DeployOpAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ abstract contract BaseOpAdapter is BaseAdapterScript {
) internal override {
if (isTestnet()) {
addresses.opAdapter = address(
new OptimismAdapterTestnet(addresses.crossChainController, OVM(), trustedRemotes)
new OptimismAdapterTestnet(
addresses.crossChainController,
OVM(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
} else {
addresses.opAdapter = address(
new OpAdapter(addresses.crossChainController, OVM(), trustedRemotes)
new OpAdapter(addresses.crossChainController, OVM(), GET_BASE_GAS_LIMIT(), trustedRemotes)
);
}
}
Expand Down
28 changes: 24 additions & 4 deletions scripts/Adapters/DeployPolygon.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ contract Ethereum is BasePolygonAdapter {
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
addresses.polAdapter = address(
new PolygonAdapterEthereum(addresses.crossChainController, FX_TUNNEL(), trustedRemotes)
new PolygonAdapterEthereum(
addresses.crossChainController,
FX_TUNNEL(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand All @@ -58,7 +63,12 @@ contract Polygon is BasePolygonAdapter {
console2.log(addresses.crossChainController);

addresses.polAdapter = address(
new PolygonAdapterPolygon(addresses.crossChainController, FX_TUNNEL(), trustedRemotes)
new PolygonAdapterPolygon(
addresses.crossChainController,
FX_TUNNEL(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand All @@ -82,7 +92,12 @@ contract Ethereum_testnet is BasePolygonAdapter {
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
addresses.polAdapter = address(
new PolygonAdapterGoerli(addresses.crossChainController, FX_TUNNEL(), trustedRemotes)
new PolygonAdapterGoerli(
addresses.crossChainController,
FX_TUNNEL(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand All @@ -106,7 +121,12 @@ contract Polygon_testnet is BasePolygonAdapter {
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
addresses.polAdapter = address(
new PolygonAdapterMumbai(addresses.crossChainController, FX_TUNNEL(), trustedRemotes)
new PolygonAdapterMumbai(
addresses.crossChainController,
FX_TUNNEL(),
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
10 changes: 9 additions & 1 deletion scripts/Adapters/DeployZkEVMAdapter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ contract Ethereum is BaseAdapterScript {
new ZkEVMAdapterEthereum(
addresses.crossChainController,
ZK_EVM_BRIDGE_MAINNET,
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
Expand All @@ -54,6 +55,7 @@ contract Zkevm is BaseAdapterScript {
new ZkEVMAdapterPolygonZkEVM(
addresses.crossChainController,
ZK_EVM_BRIDGE_MAINNET,
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
Expand All @@ -76,7 +78,12 @@ contract Ethereum_testnet is BaseAdapterScript {
IBaseAdapter.TrustedRemotesConfig[] memory trustedRemotes
) internal override {
addresses.zkevmAdapter = address(
new ZkEVMAdapterGoerli(addresses.crossChainController, ZK_EVM_BRIDGE_TESTNET, trustedRemotes)
new ZkEVMAdapterGoerli(
addresses.crossChainController,
ZK_EVM_BRIDGE_TESTNET,
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
}
}
Expand All @@ -100,6 +107,7 @@ contract Zkevm_testnet is BaseAdapterScript {
new ZkEVMAdapterZkEVMGoerli(
addresses.crossChainController,
ZK_EVM_BRIDGE_TESTNET,
GET_BASE_GAS_LIMIT(),
trustedRemotes
)
);
Expand Down
3 changes: 2 additions & 1 deletion scripts/contract_extensions/ArbitrumAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ contract ArbitrumAdapterTestnet is ArbAdapter {
address crossChainController,
address inbox,
address destinationCCC,
uint256 baseGasLimit,
TrustedRemotesConfig[] memory trustedRemotes
) ArbAdapter(crossChainController, inbox, destinationCCC, trustedRemotes) {}
) ArbAdapter(crossChainController, inbox, destinationCCC, baseGasLimit, trustedRemotes) {}

/// @inheritdoc IArbAdapter
function isDestinationChainIdSupported(uint256 chainId) public pure override returns (bool) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/contract_extensions/CBAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ contract CBaseAdapterTestnet is CBaseAdapter {
constructor(
address crossChainController,
address ovmCrossDomainMessenger,
uint256 baseGasLimit,
TrustedRemotesConfig[] memory trustedRemotes
) CBaseAdapter(crossChainController, ovmCrossDomainMessenger, trustedRemotes) {}
) CBaseAdapter(crossChainController, ovmCrossDomainMessenger, baseGasLimit, trustedRemotes) {}

/// @inheritdoc IOpAdapter
function isDestinationChainIdSupported(uint256 chainId) public pure override returns (bool) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/contract_extensions/CCIPAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ contract CCIPAdapterTestnet is CCIPAdapter {
constructor(
address crossChainController,
address ccipRouter,
uint256 baseGasLimit,
TrustedRemotesConfig[] memory trustedRemotes,
address linkToken
) CCIPAdapter(crossChainController, ccipRouter, trustedRemotes, linkToken) {}
) CCIPAdapter(crossChainController, ccipRouter, baseGasLimit, trustedRemotes, linkToken) {}

/// @inheritdoc IBaseAdapter
function nativeToInfraChainId(uint256 nativeChainId) public pure override returns (uint256) {
Expand Down
5 changes: 4 additions & 1 deletion scripts/contract_extensions/GnosisChainAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ contract GnosisChainAdapterTestnet is GnosisChainAdapter {
constructor(
address crossChainController,
address arbitraryMessageBridge,
uint256 baseGasLimit,
TrustedRemotesConfig[] memory trustedRemotes
) GnosisChainAdapter(crossChainController, arbitraryMessageBridge, trustedRemotes) {}
)
GnosisChainAdapter(crossChainController, arbitraryMessageBridge, baseGasLimit, trustedRemotes)
{}

function isDestinationChainIdSupported(uint256 chainId) public pure override returns (bool) {
return chainId == TestNetChainIds.GNOSIS_CHIADO;
Expand Down
3 changes: 2 additions & 1 deletion scripts/contract_extensions/LayerZeroAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ contract LayerZeroAdapterTestnet is LayerZeroAdapter {
constructor(
address lzEndpoint,
address crossChainController,
uint256 baseGasLimit,
TrustedRemotesConfig[] memory originConfigs
) LayerZeroAdapter(lzEndpoint, crossChainController, originConfigs) {}
) LayerZeroAdapter(lzEndpoint, crossChainController, baseGasLimit, originConfigs) {}

/// @inheritdoc IBaseAdapter
function nativeToInfraChainId(uint256 nativeChainId) public pure override returns (uint256) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/contract_extensions/MetisAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ contract MetisAdapterTestnet is MetisAdapter {
constructor(
address crossChainController,
address ovmCrossDomainMessenger,
uint256 baseGasLimit,
TrustedRemotesConfig[] memory trustedRemotes
) MetisAdapter(crossChainController, ovmCrossDomainMessenger, trustedRemotes) {}
) MetisAdapter(crossChainController, ovmCrossDomainMessenger, baseGasLimit, trustedRemotes) {}

/// @inheritdoc IOpAdapter
function isDestinationChainIdSupported(uint256 chainId) public pure override returns (bool) {
Expand Down
Loading

0 comments on commit f8e9d95

Please sign in to comment.