@@ -6,7 +6,7 @@ import {Role} from "../../../Role.sol";
6
6
import {BeforeTransferCallbackERC721} from "../../../callback/BeforeTransferCallbackERC721.sol " ;
7
7
import {IBridgeAndCall} from "@lxly-bridge-and-call/IBridgeAndCall.sol " ;
8
8
9
- library BridgeAndCallStorage {
9
+ library PolygonAgglayerCrossChainStorage {
10
10
11
11
/// @custom:storage-location erc7201:token.bridgeAndCall
12
12
bytes32 public constant BRIDGE_AND_CALL_STORAGE_POSITION =
@@ -25,7 +25,7 @@ library BridgeAndCallStorage {
25
25
26
26
}
27
27
28
- contract BridgeAndCallERC721 is ModularModule , BeforeTransferCallbackERC721 {
28
+ contract PolygonAgglayerCrossChainERC721 is ModularModule , BeforeTransferCallbackERC721 {
29
29
30
30
/*//////////////////////////////////////////////////////////////
31
31
ERRORS
@@ -45,7 +45,8 @@ contract BridgeAndCallERC721 is ModularModule, BeforeTransferCallbackERC721 {
45
45
config.fallbackFunctions[0 ] = FallbackFunction ({selector: this .getBridgeModule.selector , permissionBits: 0 });
46
46
config.fallbackFunctions[1 ] =
47
47
FallbackFunction ({selector: this .setBridgeModule.selector , permissionBits: Role._MANAGER_ROLE});
48
- config.fallbackFunctions[2 ] = FallbackFunction ({selector: this .bridgeAndCall.selector , permissionBits: 0 });
48
+ config.fallbackFunctions[2 ] =
49
+ FallbackFunction ({selector: this .sendCrossChainTransaction.selector , permissionBits: 0 });
49
50
50
51
config.requiredInterfaces = new bytes4 [](1 );
51
52
config.requiredInterfaces[0 ] = 0x80ac58cd ; // ERC721.
@@ -56,7 +57,7 @@ contract BridgeAndCallERC721 is ModularModule, BeforeTransferCallbackERC721 {
56
57
/// @dev Called by a Core into an Module during the installation of the Module.
57
58
function onInstall (bytes calldata data ) external {
58
59
address bridgeModule = abi.decode (data, (address ));
59
- _bridgeAndCallStorage ().bridgeModule = bridgeModule;
60
+ _polygonAgglayerStorage ().bridgeModule = bridgeModule;
60
61
}
61
62
62
63
/// @dev Called by a Core into an Module during the uninstallation of the Module.
@@ -68,39 +69,46 @@ contract BridgeAndCallERC721 is ModularModule, BeforeTransferCallbackERC721 {
68
69
69
70
/// @notice Returns whether transfers is enabled for the token.
70
71
function getBridgeModule () external view returns (address ) {
71
- return _bridgeAndCallStorage ().bridgeModule;
72
+ return _polygonAgglayerStorage ().bridgeModule;
72
73
}
73
74
74
75
/// @notice Set transferability for a token.
75
- function setBridgeModule (address enableTransfer ) external {
76
- _bridgeAndCallStorage ().bridgeModule = enableTransfer ;
76
+ function setBridgeModule (address bridgeModule ) external {
77
+ _polygonAgglayerStorage ().bridgeModule = bridgeModule ;
77
78
}
78
79
79
- /// @notice Set transferability for a token.
80
- function bridgeAndCall (
81
- uint256 amount ,
82
- uint32 destinationNetwork ,
83
- address callAddress ,
84
- address fallbackAddress ,
85
- bytes calldata callData ,
86
- bool forceUpdateGlobalExitRoot
80
+ function sendCrossChainTransaction (
81
+ uint64 _destinationChain ,
82
+ address _callAddress ,
83
+ address _recipient ,
84
+ address _token ,
85
+ uint256 _amount ,
86
+ bytes calldata _data ,
87
+ bytes calldata _extraArgs
87
88
) external {
88
- address bridgeModule = _bridgeAndCallStorage ().bridgeModule;
89
+ address bridgeModule = _polygonAgglayerStorage ().bridgeModule;
89
90
if (bridgeModule == address (0 )) {
90
91
revert bridgeModuleNotSet ();
91
92
}
93
+ (address _fallbackAddress , bool _forceUpdateGlobalExitRoot ) = abi.decode (_extraArgs, (address , bool ));
92
94
93
95
IBridgeAndCall (bridgeModule).bridgeAndCall (
94
- address (this ), amount, destinationNetwork, callAddress, fallbackAddress, callData, forceUpdateGlobalExitRoot
96
+ address (this ),
97
+ _amount,
98
+ uint32 (_destinationChain),
99
+ _callAddress,
100
+ _fallbackAddress,
101
+ _data,
102
+ _forceUpdateGlobalExitRoot
95
103
);
96
104
}
97
105
98
106
/*//////////////////////////////////////////////////////////////
99
107
INTERNAL FUNCTIONS
100
108
//////////////////////////////////////////////////////////////*/
101
109
102
- function _bridgeAndCallStorage () internal pure returns (BridgeAndCallStorage .Data storage ) {
103
- return BridgeAndCallStorage .data ();
110
+ function _polygonAgglayerStorage () internal pure returns (PolygonAgglayerCrossChainStorage .Data storage ) {
111
+ return PolygonAgglayerCrossChainStorage .data ();
104
112
}
105
113
106
114
}
0 commit comments