ICMBridgeFactory manages Avalanche ICTT bridge routes and exposes a single bridge entrypoint for ERC20 transfers between Avalanche chains. Source: evm/src/ICMBridgeFactory.sol

Route model

Routes are keyed by:
mapping(address token => mapping(bytes32 destBlockchainId => BridgeRoute)) public s_routes;

BridgeRoute

FieldTypeDescription
tokenTransferreraddressLocal ERC20TokenHome or ERC20TokenRemote.
destTransferreraddressPaired transferrer on the destination chain.
requiredGasLimituint256Gas limit used by the ICM relayer.
activeboolWhether the route is enabled.

External functions

FunctionAccessDescription
pause()ownerPauses bridge operations.
unpause()ownerResumes bridge operations.
registerRoute(address,bytes32,address,address,uint256)ownerAdds a token and destination route.
updateRoute(address,bytes32,address,address,uint256)ownerUpdates an active route.
deregisterRoute(address,bytes32)ownerRemoves a route.
bridge(address,uint256,bytes32,address,address,uint256)publicPulls tokens and dispatches an ICTT transfer.
getRoute(address,bytes32)viewReturns route config.
isRouteActive(address,bytes32)viewReturns whether the route is active.

Fee handling

Fee modeInputs
No feeprimaryFeeToken = address(0), primaryRelayerFee = 0
Fee in bridge tokenprimaryFeeToken = token, primaryRelayerFee > 0
Fee in separate tokenprimaryFeeToken = feeToken, primaryRelayerFee > 0
For direct bridge() calls, the caller must approve the bridge token and any separate fee token. For AvalancheEscrowVault.claimHop, the vault only supports no fee or fee in the bridge token because it only holds the escrowed token.

Events

EventDescription
RouteRegistered(address,bytes32,address,address,uint256)Route added.
RouteUpdated(address,bytes32,address,address,uint256)Route changed.
RouteDeregistered(address,bytes32)Route removed.
BridgeSent(address,bytes32,address,address,uint256,uint256)Bridge transfer dispatched.

Errors

ErrorMeaning
ICMBridgeFactory__ZeroAddressRequired address is zero.
ICMBridgeFactory__ZeroAmountBridge amount is zero.
ICMBridgeFactory__RouteNotFoundRoute is missing or inactive.
ICMBridgeFactory__RouteAlreadyRegisteredActive route already exists.
ICMBridgeFactory__ZeroGasLimitGas limit is zero.
ICMBridgeFactory__InvalidBlockchainIdDestination blockchain ID is zero.
ICMBridgeFactory__InvalidFeeParametersNonzero fee was supplied with zero fee token.