Skip to content

Commit

Permalink
use source domain instead of target domain
Browse files Browse the repository at this point in the history
  • Loading branch information
derpy-duck committed Sep 27, 2023
1 parent c52590a commit a8a8be2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/CCTPBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ abstract contract CCTPBase is TokenBase {
USDC = _USDC;
}

function getCCTPDomain(uint16 targetChain) internal pure returns (uint32) {
if (targetChain == 2) {
function getCCTPDomain(uint16 chain) internal pure returns (uint32) {
if (chain == 2) {
return 0;
} else if (targetChain == 6) {
} else if (chain == 6) {
return 1;
} else if (targetChain == 23) {
} else if (chain == 23) {
return 3;
} else if (targetChain == 24) {
} else if (chain == 24) {
return 2;
} else {
revert("Wrong CCTP Domain");
Expand Down Expand Up @@ -95,7 +95,7 @@ abstract contract CCTPSender is CCTPBase {
addressToBytes32CCTP(targetAddress)
);
return MessageKey(
CCTPMessageLib.CCTP_KEY_TYPE, abi.encodePacked(getCCTPDomain(targetChain), nonce)
CCTPMessageLib.CCTP_KEY_TYPE, abi.encodePacked(getCCTPDomain(wormhole.chainId()), nonce)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/testing/helpers/MockOffchainRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ contract MockOffchainRelayer {
CCTPMessageLib.CCTPMessage memory cctpMessage
) internal pure returns (bool) {
(uint64 nonce,) = cctpMessage.message.asUint64(12);
(uint32 domain,) = cctpMessage.message.asUint32(8);
(uint32 domain,) = cctpMessage.message.asUint32(4);
return
nonce == cctpKey.nonce && domain == cctpKey.domain;
}
Expand Down

0 comments on commit a8a8be2

Please sign in to comment.