@@ -10,18 +10,31 @@ import {
1010} from '../fee/types.js' ;
1111import { HookType } from '../hook/types.js' ;
1212import { IsmType } from '../ism/types.js' ;
13+ import { MultiProvider } from '../providers/MultiProvider.js' ;
14+ import { test1 , test2 } from '../consts/testChains.js' ;
1315import type { WarpCoreConfig } from '../warp/types.js' ;
1416
1517import { TokenType } from './config.js' ;
1618import {
1719 filterWarpCoreConfigMapByChains ,
1820 getChainsFromWarpCoreConfig ,
21+ normalizeWarpDeployConfigForCheck ,
1922 resolveTokenFeeAddress ,
2023 transformConfigToCheck ,
2124 warpCoreConfigMatchesChains ,
2225} from './configUtils.js' ;
2326import { TokenStandard } from './TokenStandard.js' ;
24- import { HypTokenConfig } from './types.js' ;
27+ import {
28+ HypTokenConfig ,
29+ WarpRouteDeployConfigMailboxRequired ,
30+ } from './types.js' ;
31+
32+ function buildMultiProvider ( ) : MultiProvider {
33+ return new MultiProvider ( {
34+ [ test1 . name ] : test1 ,
35+ [ test2 . name ] : test2 ,
36+ } ) ;
37+ }
2538
2639describe ( 'configUtils' , ( ) => {
2740 describe ( transformConfigToCheck . name , ( ) => {
@@ -556,13 +569,8 @@ describe('configUtils', () => {
556569 expect ( result . token ) . to . equal ( ROUTER_ADDRESS ) ;
557570 expect ( result . type ) . to . equal ( TokenFeeType . RoutingFee ) ;
558571
559- const routingResult = result as ResolvedRoutingFeeConfigInput ;
560- expect ( routingResult . feeContracts . ethereum . token ) . to . equal (
561- ROUTER_ADDRESS ,
562- ) ;
563- expect ( routingResult . feeContracts . arbitrum . token ) . to . equal (
564- ROUTER_ADDRESS ,
565- ) ;
572+ expect ( result . feeContracts . ethereum . token ) . to . equal ( ROUTER_ADDRESS ) ;
573+ expect ( result . feeContracts . arbitrum . token ) . to . equal ( ROUTER_ADDRESS ) ;
566574 } ) ;
567575
568576 it ( 'should handle RoutingFee with empty feeContracts' , ( ) => {
@@ -619,6 +627,106 @@ describe('configUtils', () => {
619627 } ) ;
620628 } ) ;
621629
630+ describe ( normalizeWarpDeployConfigForCheck . name , ( ) => {
631+ const ADDRESS = '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359' ;
632+ const OTHER_ADDRESS = '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' ;
633+
634+ it ( 'normalizes OFT configs to sentinel router state for checks' , ( ) => {
635+ const warpDeployConfig : WarpRouteDeployConfigMailboxRequired = {
636+ [ test1 . name ] : {
637+ decimals : 6 ,
638+ destinationGas : { [ test2 . name ] : '12345' } ,
639+ domainMappings : { [ test2 . name ] : 30110 } ,
640+ extraOptions : '0x' ,
641+ hook : OTHER_ADDRESS ,
642+ interchainSecurityModule : OTHER_ADDRESS ,
643+ mailbox : ADDRESS ,
644+ name : 'USDT' ,
645+ oft : OTHER_ADDRESS ,
646+ owner : ADDRESS ,
647+ remoteRouters : {
648+ [ test2 . name ] : {
649+ address : OTHER_ADDRESS ,
650+ } ,
651+ } ,
652+ symbol : 'USDT' ,
653+ token : ADDRESS ,
654+ type : TokenType . collateralOft ,
655+ } ,
656+ } ;
657+
658+ const normalized = normalizeWarpDeployConfigForCheck ( {
659+ multiProvider : buildMultiProvider ( ) ,
660+ warpDeployConfig,
661+ } ) ;
662+
663+ expect ( normalized [ test1 . name ] ) . to . deep . equal ( {
664+ decimals : 6 ,
665+ destinationGas : undefined ,
666+ domainMappings : { [ test2 . domainId ] : 30110 } ,
667+ extraOptions : undefined ,
668+ hook : constants . AddressZero ,
669+ interchainSecurityModule : constants . AddressZero ,
670+ mailbox : constants . AddressZero ,
671+ name : 'USDT' ,
672+ oft : OTHER_ADDRESS ,
673+ owner : ADDRESS ,
674+ remoteRouters : { } ,
675+ symbol : 'USDT' ,
676+ token : ADDRESS ,
677+ type : TokenType . collateralOft ,
678+ } ) ;
679+ } ) ;
680+
681+ it ( 'preserves non-empty OFT extraOptions' , ( ) => {
682+ const warpDeployConfig : WarpRouteDeployConfigMailboxRequired = {
683+ [ test1 . name ] : {
684+ decimals : 6 ,
685+ domainMappings : { [ test2 . name ] : 30110 } ,
686+ extraOptions : '0xdeadbeef' ,
687+ hook : OTHER_ADDRESS ,
688+ interchainSecurityModule : OTHER_ADDRESS ,
689+ mailbox : ADDRESS ,
690+ name : 'USDT' ,
691+ oft : OTHER_ADDRESS ,
692+ owner : ADDRESS ,
693+ symbol : 'USDT' ,
694+ token : ADDRESS ,
695+ type : TokenType . collateralOft ,
696+ } ,
697+ } ;
698+
699+ const normalized = normalizeWarpDeployConfigForCheck ( {
700+ multiProvider : buildMultiProvider ( ) ,
701+ warpDeployConfig,
702+ } ) ;
703+
704+ expect ( normalized [ test1 . name ] ) . to . deep . include ( {
705+ extraOptions : '0xdeadbeef' ,
706+ } ) ;
707+ } ) ;
708+
709+ it ( 'leaves non-OFT configs unchanged' , ( ) => {
710+ const warpDeployConfig : WarpRouteDeployConfigMailboxRequired = {
711+ [ test1 . name ] : {
712+ decimals : 18 ,
713+ mailbox : ADDRESS ,
714+ name : 'TOKEN' ,
715+ owner : ADDRESS ,
716+ symbol : 'TKN' ,
717+ type : TokenType . synthetic ,
718+ } ,
719+ } ;
720+
721+ const normalized = normalizeWarpDeployConfigForCheck ( {
722+ multiProvider : buildMultiProvider ( ) ,
723+ warpDeployConfig,
724+ } ) ;
725+
726+ expect ( normalized ) . to . deep . equal ( warpDeployConfig ) ;
727+ } ) ;
728+ } ) ;
729+
622730 const buildWarpCoreConfig = ( chainNames : string [ ] ) : WarpCoreConfig => ( {
623731 tokens : chainNames . map ( ( chainName , index ) => ( {
624732 chainName,
0 commit comments