@@ -84,13 +84,12 @@ contract L1ERC20Bridge is IL1Bridge, IL1BridgeLegacy, AllowListed, ReentrancyGua
8484 address _governor ,
8585 uint256 _deployBridgeImplementationFee ,
8686 uint256 _deployBridgeProxyFee
87- ) external payable reentrancyGuardInitializer {
87+ ) external reentrancyGuardInitializer {
8888 require (_l2TokenBeacon != address (0 ), "nf " );
8989 require (_governor != address (0 ), "nh " );
9090 // We are expecting to see the exact three bytecodes that are needed to initialize the bridge
9191 require (_factoryDeps.length == 3 , "mk " );
9292 // The caller miscalculated deploy transactions fees
93- require (msg .value == _deployBridgeImplementationFee + _deployBridgeProxyFee, "fee " );
9493 l2TokenProxyBytecodeHash = L2ContractHelper.hashL2Bytecode (_factoryDeps[2 ]);
9594 l2TokenBeacon = _l2TokenBeacon;
9695
@@ -143,8 +142,8 @@ contract L1ERC20Bridge is IL1Bridge, IL1BridgeLegacy, AllowListed, ReentrancyGua
143142 uint256 _amount ,
144143 uint256 _l2TxGasLimit ,
145144 uint256 _l2TxGasPerPubdataByte
146- ) external payable returns (bytes32 l2TxHash ) {
147- l2TxHash = deposit (_l2Receiver, _l1Token, _amount, _l2TxGasLimit, _l2TxGasPerPubdataByte, address (0 ));
145+ ) external returns (bytes32 l2TxHash ) {
146+ l2TxHash = deposit (_l2Receiver, _l1Token, _amount, _l2TxGasLimit, _l2TxGasPerPubdataByte, address (0 ), 0 );
148147 }
149148
150149 /// @notice Initiates a deposit by locking funds on the contract and sending the request
@@ -155,6 +154,8 @@ contract L1ERC20Bridge is IL1Bridge, IL1BridgeLegacy, AllowListed, ReentrancyGua
155154 /// @param _l2TxGasLimit The L2 gas limit to be used in the corresponding L2 transaction
156155 /// @param _l2TxGasPerPubdataByte The gasPerPubdataByteLimit to be used in the corresponding L2 transaction
157156 /// @param _refundRecipient The address on L2 that will receive the refund for the transaction.
157+ /// @param _l1Amount The gas token amount to be transferred from L1 to L2, it should be enough to cover the gas cost of the L2 transaction
158+ /// it will also be the address to receive `_l2Value`. If zero, the refund will be sent to the sender of the transaction.
158159 /// @dev If the L2 deposit finalization transaction fails, the `_refundRecipient` will receive the `_l2Value`.
159160 /// Please note, the contract may change the refund recipient's address to eliminate sending funds to addresses out of control.
160161 /// - If `_refundRecipient` is a contract on L1, the refund will be sent to the aliased `_refundRecipient`.
@@ -171,8 +172,9 @@ contract L1ERC20Bridge is IL1Bridge, IL1BridgeLegacy, AllowListed, ReentrancyGua
171172 uint256 _amount ,
172173 uint256 _l2TxGasLimit ,
173174 uint256 _l2TxGasPerPubdataByte ,
174- address _refundRecipient
175- ) public payable nonReentrant senderCanCallFunction (allowList) returns (bytes32 l2TxHash ) {
175+ address _refundRecipient ,
176+ uint256 _l1Amount
177+ ) public nonReentrant senderCanCallFunction (allowList) returns (bytes32 l2TxHash ) {
176178 require (_amount != 0 , "2T " ); // empty deposit amount
177179 uint256 amount = _depositFunds (msg .sender , IERC20 (_l1Token), _amount);
178180 require (amount == _amount, "1T " ); // The token has non-standard transfer logic
@@ -187,12 +189,10 @@ contract L1ERC20Bridge is IL1Bridge, IL1BridgeLegacy, AllowListed, ReentrancyGua
187189 if (_refundRecipient == address (0 )) {
188190 refundRecipient = msg .sender != tx .origin ? AddressAliasHelper.applyL1ToL2Alias (msg .sender ) : msg .sender ;
189191 }
190- l2TxHash = zkSync.requestL2Transaction {value: msg . value } (
191- l2Bridge ,
192- 0 , // L2 msg.value
192+ l2TxHash = zkSync.requestL2Transaction (
193+ _l1Amount ,
194+ L2TransactionValue (l2Bridge, 0 , _l1Amount, _l2TxGasLimit, _l2TxGasPerPubdataByte) , // L2 msg.value
193195 l2TxCalldata,
194- _l2TxGasLimit,
195- _l2TxGasPerPubdataByte,
196196 new bytes [](0 ),
197197 refundRecipient
198198 );
0 commit comments