@@ -42,11 +42,14 @@ contract PolygonAgglayerCrossChain is Module, CrossChain {
42
42
FallbackFunction ({selector: this .setRouter.selector , permissionBits: Role._MANAGER_ROLE});
43
43
config.fallbackFunctions[2 ] =
44
44
FallbackFunction ({selector: this .sendCrossChainTransaction.selector , permissionBits: 0 });
45
+
46
+ config.registerInstallationCallback = true ;
45
47
}
46
48
47
49
/// @dev Called by a Core into an Module during the installation of the Module.
48
50
function onInstall (bytes calldata data ) external {
49
51
address router = abi.decode (data, (address ));
52
+ console.log ("router in onInstall: " , router);
50
53
_polygonAgglayerStorage ().router = router;
51
54
}
52
55
@@ -83,19 +86,23 @@ contract PolygonAgglayerCrossChain is Module, CrossChain {
83
86
bytes calldata _payload ,
84
87
bytes calldata _extraArgs
85
88
) 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 ));
89
96
console.log ("token address " , _token);
90
97
console.log ("amount " , _amount);
91
98
console.log ("destinationChain " , _destinationChain);
92
99
console.log ("callAddress " , _callAddress);
93
- console.log ("fallbackAddress " , _fallbackAddress);
94
- console.log ("forceUpdateGlobalExitRoot " , _forceUpdateGlobalExitRoot);
95
100
96
- IBridgeAndCall (router).bridgeAndCall (
101
+ // IBridgeAndCall(_polygonAgglayerStorage().router).bridgeAndCall(
102
+ _bridgeAndCall (
97
103
_token,
98
104
_amount,
105
+ permitData,
99
106
uint32 (_destinationChain),
100
107
_callAddress,
101
108
_fallbackAddress,
@@ -107,6 +114,21 @@ contract PolygonAgglayerCrossChain is Module, CrossChain {
107
114
onCrossChainTransactionSent (_destinationChain, _callAddress, _payload, _extraArgs);
108
115
}
109
116
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
+
110
132
/*//////////////////////////////////////////////////////////////
111
133
INTERNAL FUNCTIONS
112
134
//////////////////////////////////////////////////////////////*/
0 commit comments