@@ -786,8 +786,8 @@ describe('per-chain bridge configuration', () => {
786786 } ) ;
787787 } ) ;
788788
789- it ( 'should require externalBridges.lifi when executionType is inventory' , ( ) => {
790- const data = {
789+ it ( 'should accept externalBridges.layerzero for inventory execution ' , ( ) => {
790+ const data : RebalancerConfigFileInput = {
791791 warpRouteId : 'test-route' ,
792792 strategy : [
793793 {
@@ -796,20 +796,26 @@ describe('per-chain bridge configuration', () => {
796796 ethereum : {
797797 weighted : { weight : 100 , tolerance : 5 } ,
798798 executionType : ExecutionType . Inventory ,
799+ externalBridge : ExternalBridgeType . LayerZero ,
799800 } ,
800801 } ,
801802 } ,
802803 ] ,
803804 inventorySigners : {
804805 ethereum : '0x1234567890123456789012345678901234567890' ,
805806 } ,
807+ externalBridges : {
808+ layerzero : { } ,
809+ } ,
806810 } ;
807811
808812 writeYamlOrJson ( TEST_CONFIG_PATH_BRIDGE , data ) ;
813+ const config = RebalancerConfig . load ( TEST_CONFIG_PATH_BRIDGE ) ;
809814
810- expect ( ( ) => RebalancerConfig . load ( TEST_CONFIG_PATH_BRIDGE ) ) . to . throw (
811- / e x t e r n a l B r i d g e s \. l i f i . * r e q u i r e d / i ,
815+ expect ( config . strategyConfig [ 0 ] . chains . ethereum . externalBridge ) . to . equal (
816+ ExternalBridgeType . LayerZero ,
812817 ) ;
818+ expect ( config . externalBridges ?. layerzero ) . to . deep . equal ( { } ) ;
813819 } ) ;
814820
815821 it ( 'should require externalBridges.lifi when externalBridge is lifi' , ( ) => {
@@ -839,7 +845,7 @@ describe('per-chain bridge configuration', () => {
839845 ) ;
840846 } ) ;
841847
842- it ( 'should require externalBridge field when executionType is inventory ' , ( ) => {
848+ it ( 'should require externalBridges.layerzero when externalBridge is layerzero ' , ( ) => {
843849 const data = {
844850 warpRouteId : 'test-route' ,
845851 strategy : [
@@ -849,6 +855,43 @@ describe('per-chain bridge configuration', () => {
849855 ethereum : {
850856 weighted : { weight : 100 , tolerance : 5 } ,
851857 executionType : ExecutionType . Inventory ,
858+ externalBridge : ExternalBridgeType . LayerZero ,
859+ } ,
860+ } ,
861+ } ,
862+ ] ,
863+ inventorySigners : {
864+ ethereum : '0x1234567890123456789012345678901234567890' ,
865+ } ,
866+ } ;
867+
868+ writeYamlOrJson ( TEST_CONFIG_PATH_BRIDGE , data ) ;
869+
870+ expect ( ( ) => RebalancerConfig . load ( TEST_CONFIG_PATH_BRIDGE ) ) . to . throw (
871+ / e x t e r n a l B r i d g e s \. l a y e r z e r o .* r e q u i r e d | l a y e r z e r o .* n o t c o n f i g u r e d / i,
872+ ) ;
873+ } ) ;
874+
875+ it ( 'should accept override-only layerzero inventory config without lifi' , ( ) => {
876+ const data : RebalancerConfigFileInput = {
877+ warpRouteId : 'test-route' ,
878+ strategy : [
879+ {
880+ rebalanceStrategy : RebalancerStrategyOptions . Weighted ,
881+ chains : {
882+ ethereum : {
883+ weighted : { weight : 50 , tolerance : 5 } ,
884+ bridge : ethers . constants . AddressZero ,
885+ override : {
886+ arbitrum : {
887+ executionType : ExecutionType . Inventory ,
888+ externalBridge : ExternalBridgeType . LayerZero ,
889+ } ,
890+ } ,
891+ } ,
892+ arbitrum : {
893+ weighted : { weight : 50 , tolerance : 5 } ,
894+ bridge : ethers . constants . AddressZero ,
852895 } ,
853896 } ,
854897 } ,
@@ -857,9 +900,40 @@ describe('per-chain bridge configuration', () => {
857900 ethereum : '0x1234567890123456789012345678901234567890' ,
858901 } ,
859902 externalBridges : {
860- lifi : {
861- integrator : 'test-app' ,
903+ layerzero : { } ,
904+ } ,
905+ } ;
906+
907+ writeYamlOrJson ( TEST_CONFIG_PATH_BRIDGE , data ) ;
908+ const config = RebalancerConfig . load ( TEST_CONFIG_PATH_BRIDGE ) ;
909+
910+ expect (
911+ config . strategyConfig [ 0 ] . chains . ethereum . override ?. arbitrum
912+ ?. externalBridge ,
913+ ) . to . equal ( ExternalBridgeType . LayerZero ) ;
914+ expect ( config . externalBridges ?. lifi ) . to . equal ( undefined ) ;
915+ expect ( config . externalBridges ?. layerzero ) . to . deep . equal ( { } ) ;
916+ } ) ;
917+
918+ it ( 'should require externalBridge field when executionType is inventory' , ( ) => {
919+ const data = {
920+ warpRouteId : 'test-route' ,
921+ strategy : [
922+ {
923+ rebalanceStrategy : RebalancerStrategyOptions . Weighted ,
924+ chains : {
925+ ethereum : {
926+ weighted : { weight : 100 , tolerance : 5 } ,
927+ executionType : ExecutionType . Inventory ,
928+ } ,
929+ } ,
862930 } ,
931+ ] ,
932+ inventorySigners : {
933+ ethereum : '0x1234567890123456789012345678901234567890' ,
934+ } ,
935+ externalBridges : {
936+ layerzero : { } ,
863937 } ,
864938 } ;
865939
0 commit comments