Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse the hardcoded addresses in forwarders instead of duplicating #22

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/testing/bridges/ArbitrumBridgeTesting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Vm } from "forge-std/Vm.sol";
import { Bridge } from "../Bridge.sol";
import { Domain, DomainHelpers } from "../Domain.sol";
import { RecordedLogs } from "../utils/RecordedLogs.sol";
import { ArbitrumForwarder } from "../../forwarders/ArbitrumForwarder.sol";

interface InboxLike {
function createRetryableTicket(
Expand Down Expand Up @@ -80,9 +81,9 @@ library ArbitrumBridgeTesting {

bytes32 name = keccak256(bytes(destinationChainAlias));
if (name == keccak256("arbitrum_one")) {
sourceCrossChainMessenger = 0x4Dbd4fc535Ac27206064B68FfCf827b0A60BAB3f;
sourceCrossChainMessenger = ArbitrumForwarder.L1_CROSS_DOMAIN_ARBITRUM_ONE;
} else if (name == keccak256("arbitrum_nova")) {
sourceCrossChainMessenger = 0xc4448b71118c9071Bcb9734A0EAc55D18A153949;
sourceCrossChainMessenger = ArbitrumForwarder.L1_CROSS_DOMAIN_ARBITRUM_NOVA;
} else {
revert("Unsupported destination chain");
}
Expand Down
13 changes: 7 additions & 6 deletions src/testing/bridges/CCTPBridgeTesting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Vm } from "forge-std/Vm.sol";
import { Bridge } from "../Bridge.sol";
import { Domain, DomainHelpers } from "../Domain.sol";
import { RecordedLogs } from "../utils/RecordedLogs.sol";
import { CCTPForwarder } from "../../forwarders/CCTPForwarder.sol";

interface IMessenger {
function receiveMessage(bytes calldata message, bytes calldata attestation) external returns (bool success);
Expand Down Expand Up @@ -35,17 +36,17 @@ library CCTPBridgeTesting {
function getCircleMessengerFromChainAlias(string memory chainAlias) internal pure returns (address) {
bytes32 name = keccak256(bytes(chainAlias));
if (name == keccak256("mainnet")) {
return 0x0a992d191DEeC32aFe36203Ad87D7d289a738F81;
return CCTPForwarder.MESSAGE_TRANSMITTER_CIRCLE_ETHEREUM;
} else if (name == keccak256("avalanche")) {
return 0x8186359aF5F57FbB40c6b14A588d2A59C0C29880;
return CCTPForwarder.MESSAGE_TRANSMITTER_CIRCLE_AVALANCHE;
} else if (name == keccak256("optimism")) {
return 0x4D41f22c5a0e5c74090899E5a8Fb597a8842b3e8;
return CCTPForwarder.MESSAGE_TRANSMITTER_CIRCLE_OPTIMISM;
} else if (name == keccak256("arbitrum_one")) {
return 0xC30362313FBBA5cf9163F0bb16a0e01f01A896ca;
return CCTPForwarder.MESSAGE_TRANSMITTER_CIRCLE_ARBITRUM_ONE;
} else if (name == keccak256("base")) {
return 0xAD09780d193884d503182aD4588450C416D6F9D4;
return CCTPForwarder.MESSAGE_TRANSMITTER_CIRCLE_BASE;
} else if (name == keccak256("polygon")) {
return 0xF3be9355363857F3e001be68856A2f96b4C39Ba9;
return CCTPForwarder.MESSAGE_TRANSMITTER_CIRCLE_POLYGON_POS;
} else {
revert("Unsupported chain");
}
Expand Down
5 changes: 3 additions & 2 deletions src/testing/bridges/OptimismBridgeTesting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Vm } from "forge-std/Vm.sol";
import { Bridge } from "../Bridge.sol";
import { Domain, DomainHelpers } from "../Domain.sol";
import { RecordedLogs } from "../utils/RecordedLogs.sol";
import { OptimismForwarder } from "../../forwarders/OptimismForwarder.sol";

interface IMessenger {
function sendMessage(
Expand Down Expand Up @@ -60,9 +61,9 @@ library OptimismBridgeTesting {

bytes32 name = keccak256(bytes(destinationChainAlias));
if (name == keccak256("optimism")) {
sourceCrossChainMessenger = 0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1;
sourceCrossChainMessenger = OptimismForwarder.L1_CROSS_DOMAIN_OPTIMISM;
} else if (name == keccak256("base")) {
sourceCrossChainMessenger = 0x866E82a600A1414e583f7F13623F1aC5d58b0Afa;
sourceCrossChainMessenger = OptimismForwarder.L1_CROSS_DOMAIN_BASE;
} else {
revert("Unsupported destination chain");
}
Expand Down
Loading