@@ -42,11 +42,14 @@ contract PolygonAgglayerCrossChain is Module, CrossChain {
4242 FallbackFunction ({selector: this .setRouter.selector , permissionBits: Role._MANAGER_ROLE});
4343 config.fallbackFunctions[2 ] =
4444 FallbackFunction ({selector: this .sendCrossChainTransaction.selector , permissionBits: 0 });
45+
46+ config.registerInstallationCallback = true ;
4547 }
4648
4749 /// @dev Called by a Core into an Module during the installation of the Module.
4850 function onInstall (bytes calldata data ) external {
4951 address router = abi.decode (data, (address ));
52+ console.log ("router in onInstall: " , router);
5053 _polygonAgglayerStorage ().router = router;
5154 }
5255
@@ -83,19 +86,23 @@ contract PolygonAgglayerCrossChain is Module, CrossChain {
8386 bytes calldata _payload ,
8487 bytes calldata _extraArgs
8588 ) external payable override {
86- address router = _polygonAgglayerStorage ().router;
87- (address _fallbackAddress , bool _forceUpdateGlobalExitRoot , address _token , uint256 _amount ) =
88- abi.decode (_extraArgs, (address , bool , address , uint256 ));
89+ (
90+ address _fallbackAddress ,
91+ bool _forceUpdateGlobalExitRoot ,
92+ address _token ,
93+ uint256 _amount ,
94+ bytes memory permitData
95+ ) = abi.decode (_extraArgs, (address , bool , address , uint256 , bytes ));
8996 console.log ("token address " , _token);
9097 console.log ("amount " , _amount);
9198 console.log ("destinationChain " , _destinationChain);
9299 console.log ("callAddress " , _callAddress);
93- console.log ("fallbackAddress " , _fallbackAddress);
94- console.log ("forceUpdateGlobalExitRoot " , _forceUpdateGlobalExitRoot);
95100
96- IBridgeAndCall (router).bridgeAndCall (
101+ // IBridgeAndCall(_polygonAgglayerStorage().router).bridgeAndCall(
102+ _bridgeAndCall (
97103 _token,
98104 _amount,
105+ permitData,
99106 uint32 (_destinationChain),
100107 _callAddress,
101108 _fallbackAddress,
@@ -107,6 +114,21 @@ contract PolygonAgglayerCrossChain is Module, CrossChain {
107114 onCrossChainTransactionSent (_destinationChain, _callAddress, _payload, _extraArgs);
108115 }
109116
117+ function _bridgeAndCall (address _token , uint256 _amount , bytes memory permitData , uint32 _destinationChain , address _callAddress , address _fallbackAddress , bytes memory _payload , bool _forceUpdateGlobalExitRoot ) internal {
118+ console.log ("router: " , _polygonAgglayerStorage ().router);
119+ IBridgeAndCall (_polygonAgglayerStorage ().router).bridgeAndCall (
120+ _token,
121+ _amount,
122+ permitData,
123+ _destinationChain,
124+ _callAddress,
125+ _fallbackAddress,
126+ _payload,
127+ _forceUpdateGlobalExitRoot
128+ );
129+ }
130+
131+
110132 /*//////////////////////////////////////////////////////////////
111133 INTERNAL FUNCTIONS
112134 //////////////////////////////////////////////////////////////*/
0 commit comments