Skip to content

Commit

Permalink
refactor/minor: bridgeAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
fluffywaffles committed Jun 7, 2024
1 parent 421f2c5 commit 9087095
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/builder/BridgeRoutes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ library BridgeRoutes {

struct Bridge {
uint256 chainId;
address outgoingAddress;
address bridgeAddress;
BridgeType bridgeType;
}

Expand All @@ -41,7 +41,7 @@ library BridgeRoutes {
if (CCTP.canBridge(srcChainId, assetSymbol)) {
bridge = Bridge({
chainId: srcChainId,
outgoingAddress: CCTP.knownOutgoingAddress(srcChainId),
bridgeAddress: CCTP.knownbridgeAddress(srcChainId),
bridgeType: BridgeType.CCTP
});
}
Expand All @@ -50,11 +50,11 @@ library BridgeRoutes {

// NOTE: this library would be generated by a network crawler script.
library CCTP {
// IDEA: input this into codegen, get out knownDomainId and knownOutgoingAddress functions?
// IDEA: input this into codegen, get out knownDomainId and knownbridgeAddress functions?
struct Roots {
uint256 chainId;
uint256 domainId;
address outgoingAddress;
address bridgeAddress;
}

error NoKnownBridge(string bridgeType, uint256 chainId);
Expand All @@ -70,7 +70,7 @@ library CCTP {
}
}

function knownOutgoingAddress(uint256 chainId) internal pure returns (address) {
function knownbridgeAddress(uint256 chainId) internal pure returns (address) {
if (chainId == 1) {
return 0xBd3fa81B58Ba92a82136038B25aDec7066af3155;
} else if (chainId == 8453) {
Expand All @@ -82,7 +82,7 @@ library CCTP {

function canBridge(uint256 chainId, string memory assetSymbol) internal pure returns (bool) {
return Strings.stringEqIgnoreCase(assetSymbol, "USDC")
&& knownOutgoingAddress(chainId) != address(0);
&& knownbridgeAddress(chainId) != address(0);
}

function encodeBridgeUSDC(
Expand All @@ -94,7 +94,7 @@ library CCTP {
) internal pure returns (bytes memory) {
return abi.encodeCall(
CCTPBridgeActions.bridgeUSDC,
(knownOutgoingAddress(originChainId), amount, knownDomainId(destChainId), bytes32(uint256(uint160(recipient))), usdc)
(knownbridgeAddress(originChainId), amount, knownDomainId(destChainId), bytes32(uint256(uint160(recipient))), usdc)
);
}
}

0 comments on commit 9087095

Please sign in to comment.