@@ -6,7 +6,7 @@ import {Role} from "../../../Role.sol";
66import {BeforeTransferCallbackERC721} from "../../../callback/BeforeTransferCallbackERC721.sol " ;
77import {IBridgeAndCall} from "@lxly-bridge-and-call/IBridgeAndCall.sol " ;
88
9- library BridgeAndCallStorage {
9+ library PolygonAgglayerCrossChainStorage {
1010
1111 /// @custom:storage-location erc7201:token.bridgeAndCall
1212 bytes32 public constant BRIDGE_AND_CALL_STORAGE_POSITION =
@@ -25,7 +25,7 @@ library BridgeAndCallStorage {
2525
2626}
2727
28- contract BridgeAndCallERC721 is ModularModule , BeforeTransferCallbackERC721 {
28+ contract PolygonAgglayerCrossChainERC721 is ModularModule , BeforeTransferCallbackERC721 {
2929
3030 /*//////////////////////////////////////////////////////////////
3131 ERRORS
@@ -45,7 +45,8 @@ contract BridgeAndCallERC721 is ModularModule, BeforeTransferCallbackERC721 {
4545 config.fallbackFunctions[0 ] = FallbackFunction ({selector: this .getBridgeModule.selector , permissionBits: 0 });
4646 config.fallbackFunctions[1 ] =
4747 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 });
4950
5051 config.requiredInterfaces = new bytes4 [](1 );
5152 config.requiredInterfaces[0 ] = 0x80ac58cd ; // ERC721.
@@ -56,7 +57,7 @@ contract BridgeAndCallERC721 is ModularModule, BeforeTransferCallbackERC721 {
5657 /// @dev Called by a Core into an Module during the installation of the Module.
5758 function onInstall (bytes calldata data ) external {
5859 address bridgeModule = abi.decode (data, (address ));
59- _bridgeAndCallStorage ().bridgeModule = bridgeModule;
60+ _polygonAgglayerStorage ().bridgeModule = bridgeModule;
6061 }
6162
6263 /// @dev Called by a Core into an Module during the uninstallation of the Module.
@@ -68,39 +69,46 @@ contract BridgeAndCallERC721 is ModularModule, BeforeTransferCallbackERC721 {
6869
6970 /// @notice Returns whether transfers is enabled for the token.
7071 function getBridgeModule () external view returns (address ) {
71- return _bridgeAndCallStorage ().bridgeModule;
72+ return _polygonAgglayerStorage ().bridgeModule;
7273 }
7374
7475 /// @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 ;
7778 }
7879
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
8788 ) external {
88- address bridgeModule = _bridgeAndCallStorage ().bridgeModule;
89+ address bridgeModule = _polygonAgglayerStorage ().bridgeModule;
8990 if (bridgeModule == address (0 )) {
9091 revert bridgeModuleNotSet ();
9192 }
93+ (address _fallbackAddress , bool _forceUpdateGlobalExitRoot ) = abi.decode (_extraArgs, (address , bool ));
9294
9395 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
95103 );
96104 }
97105
98106 /*//////////////////////////////////////////////////////////////
99107 INTERNAL FUNCTIONS
100108 //////////////////////////////////////////////////////////////*/
101109
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 ();
104112 }
105113
106114}
0 commit comments