@ -12,7 +12,7 @@ import { MultiProvider } from '../../providers/MultiProvider';
import { ProxiedRouterDeployer } from '../../router/ProxiedRouterDeployer' ;
import { RouterConfig } from '../../router/types' ;
import { ChainMap , ChainName } from '../../types' ;
import { objMap } from '../../utils/objects' ;
import { objFilter , obj Map } from '../../utils/objects' ;
import { LiquidityLayerFactories , liquidityLayerFactories } from './contracts' ;
@ -93,18 +93,32 @@ export class LiquidityLayerDeployer extends ProxiedRouterDeployer<
this . logger ( ` Enroll CircleBridgeAdapters with each other ` ) ;
// Hack to allow use of super.enrollRemoteRouters
await super . enrollRemoteRouters (
objMap ( contractsMap , ( _ , contracts ) = > ( {
objMap (
objFilter (
contractsMap ,
( _ , c ) : c is HyperlaneContracts < LiquidityLayerFactories > = >
! ! c . circleBridgeAdapter ,
) ,
( _ , contracts ) = > ( {
liquidityLayerRouter : contracts.circleBridgeAdapter ,
} ) ) as unknown as HyperlaneContractsMap < LiquidityLayerFactories > ,
} ) ,
) as unknown as HyperlaneContractsMap < LiquidityLayerFactories > ,
configMap ,
) ;
this . logger ( ` Enroll PortalAdapters with each other ` ) ;
// Hack to allow use of super.enrollRemoteRouters
await super . enrollRemoteRouters (
objMap ( contractsMap , ( _ , contracts ) = > ( {
objMap (
objFilter (
contractsMap ,
( _ , c ) : c is HyperlaneContracts < LiquidityLayerFactories > = >
! ! c . portalAdapter ,
) ,
( _ , contracts ) = > ( {
liquidityLayerRouter : contracts.portalAdapter ,
} ) ) as unknown as HyperlaneContractsMap < LiquidityLayerFactories > ,
} ) ,
) as unknown as HyperlaneContractsMap < LiquidityLayerFactories > ,
configMap ,
) ;
}
@ -115,6 +129,9 @@ export class LiquidityLayerDeployer extends ProxiedRouterDeployer<
chain : ChainName ,
config : LiquidityLayerConfig ,
) : Promise < HyperlaneContracts < LiquidityLayerFactories > > {
// This is just the temp owner for contracts, and HyperlaneRouterDeployer#transferOwnership actually sets the configured owner
const deployer = await this . multiProvider . getSignerAddress ( chain ) ;
const routerContracts = await super . deployContracts ( chain , config ) ;
const bridgeAdapters : Partial <
@ -125,7 +142,7 @@ export class LiquidityLayerDeployer extends ProxiedRouterDeployer<
bridgeAdapters . circleBridgeAdapter = await this . deployCircleBridgeAdapter (
chain ,
config . circle ,
config . own er,
deploy er,
routerContracts . liquidityLayerRouter ,
) ;
}
@ -133,7 +150,7 @@ export class LiquidityLayerDeployer extends ProxiedRouterDeployer<
bridgeAdapters . portalAdapter = await this . deployPortalAdapter (
chain ,
config . portal ,
config . own er,
deploy er,
routerContracts . liquidityLayerRouter ,
) ;
}
@ -173,9 +190,11 @@ export class LiquidityLayerDeployer extends ProxiedRouterDeployer<
this . logger (
` Set wormhole domain ${ wormholeDomain } for hyperlane domain ${ hyperlaneDomain } ` ,
) ;
await this . multiProvider . handleTx (
await this . runIfOwner ( chain , portalAdapter , ( ) = >
this . multiProvider . handleTx (
chain ,
portalAdapter . addDomain ( hyperlaneDomain , wormholeDomain ) ,
) ,
) ;
}
@ -186,12 +205,14 @@ export class LiquidityLayerDeployer extends ProxiedRouterDeployer<
)
) {
this . logger ( 'Set Portal as LiquidityLayerAdapter on Router' ) ;
await this . multiProvider . handleTx (
await this . runIfOwner ( chain , portalAdapter , ( ) = >
this . multiProvider . handleTx (
chain ,
router . setLiquidityLayerAdapter (
adapterConfig . type ,
portalAdapter . address ,
) ,
) ,
) ;
}
@ -223,9 +244,11 @@ export class LiquidityLayerDeployer extends ProxiedRouterDeployer<
)
) {
this . logger ( ` Set USDC token contract ` ) ;
await this . multiProvider . handleTx (
await this . runIfOwner ( chain , circleBridgeAdapter , ( ) = >
this . multiProvider . handleTx (
chain ,
circleBridgeAdapter . addToken ( adapterConfig . usdcAddress , 'USDC' ) ,
) ,
) ;
}
// Set domain mappings
@ -242,9 +265,11 @@ export class LiquidityLayerDeployer extends ProxiedRouterDeployer<
this . logger (
` Set circle domain ${ circleDomain } for hyperlane domain ${ hyperlaneDomain } ` ,
) ;
await this . multiProvider . handleTx (
await this . runIfOwner ( chain , circleBridgeAdapter , ( ) = >
this . multiProvider . handleTx (
chain ,
circleBridgeAdapter . addDomain ( hyperlaneDomain , circleDomain ) ,
) ,
) ;
}
@ -255,12 +280,14 @@ export class LiquidityLayerDeployer extends ProxiedRouterDeployer<
)
) {
this . logger ( 'Set Circle as LiquidityLayerAdapter on Router' ) ;
await this . multiProvider . handleTx (
await this . runIfOwner ( chain , circleBridgeAdapter , ( ) = >
this . multiProvider . handleTx (
chain ,
router . setLiquidityLayerAdapter (
adapterConfig . type ,
circleBridgeAdapter . address ,
) ,
) ,
) ;
}