@@ -122,21 +122,19 @@ contract Bridge is Initializable {
122122 }
123123
124124 /// @notice Sends ERC20 tokens to the sender's address on the other chain.
125- /// @param _localToken Address of the ERC20 on this chain.
126- /// @param _remoteToken Address of the corresponding token on the remote chain.
127- /// @param _to Solana pubkey to send tokens to
128- /// @param _amount Amount of local tokens to deposit.
129- /// @param _extraData Extra data to be sent with the transaction. Note that the recipient will
125+ /// @param localToken Address of the ERC20 on this chain.
126+ /// @param remoteToken Address of the corresponding token on the remote chain.
127+ /// @param to Solana pubkey to send tokens to
128+ /// @param amount Amount of local tokens to deposit.
129+ /// @param extraData Extra data to be sent with the transaction. Note that the recipient will
130130 /// not be triggered with this data, but it will be emitted and can be used
131131 /// to identify the transaction.
132- function bridgeToken (
133- address _localToken ,
134- bytes32 _remoteToken ,
135- bytes32 _to ,
136- uint64 _amount ,
137- bytes calldata _extraData
138- ) public virtual onlyEOA {
139- _initiateBridgeERC20 (_localToken, _remoteToken, msg .sender , _to, _amount, _extraData);
132+ function bridgeToken (address localToken , bytes32 remoteToken , bytes32 to , uint64 amount , bytes calldata extraData )
133+ public
134+ virtual
135+ onlyEOA
136+ {
137+ _initiateBridgeERC20 (localToken, remoteToken, msg .sender , to, amount, extraData);
140138 }
141139
142140 /// @notice Finalizes a token bridge on this chain. Can only be triggered by the Bridge contract on the remote
@@ -186,49 +184,49 @@ contract Bridge is Initializable {
186184 //////////////////////////////////////////////////////////////
187185
188186 /// @notice Sends ERC20 tokens to a receiver's address on the other chain.
189- /// @param _localToken Address of the ERC20 on this chain.
190- /// @param _remoteToken Address of the corresponding token on the remote chain.
191- /// @param _to Address of the receiver.
192- /// @param _amount Amount of local tokens to deposit.
193- /// @param _extraData Extra data to be sent with the transaction. Note that the recipient will
187+ /// @param localToken Address of the ERC20 on this chain.
188+ /// @param remoteToken Address of the corresponding token on the remote chain.
189+ /// @param to Address of the receiver.
190+ /// @param amount Amount of local tokens to deposit.
191+ /// @param extraData Extra data to be sent with the transaction. Note that the recipient will
194192 /// not be triggered with this data, but it will be emitted and can be used
195193 /// to identify the transaction.
196194 function _initiateBridgeERC20 (
197- address _localToken ,
198- bytes32 _remoteToken ,
199- address _from ,
200- bytes32 _to ,
201- uint64 _amount ,
202- bytes memory _extraData
195+ address localToken ,
196+ bytes32 remoteToken ,
197+ address from ,
198+ bytes32 to ,
199+ uint64 amount ,
200+ bytes memory extraData
203201 ) internal {
204202 require (msg .value == 0 , "StandardBridge: cannot send value " );
205203
206- if (_isCrossChainERC20 (_localToken )) {
204+ if (_isCrossChainERC20 (localToken )) {
207205 require (
208- _isCorrectTokenPair (CrossChainERC20 (_localToken ), _remoteToken ),
206+ _isCorrectTokenPair (CrossChainERC20 (localToken ), remoteToken ),
209207 "StandardBridge: wrong remote token for Optimism Mintable ERC20 local token "
210208 );
211209
212- CrossChainERC20 (_localToken ).burn (_from, _amount );
210+ CrossChainERC20 (localToken ).burn (from, amount );
213211 } else {
214- SafeTransferLib.safeTransferFrom ({token: _localToken , from: _from , to: address (this ), amount: _amount });
215- deposits[_localToken][_remoteToken ] = deposits[_localToken][_remoteToken ] + _amount ;
212+ SafeTransferLib.safeTransferFrom ({token: localToken , from: from , to: address (this ), amount: amount });
213+ deposits[localToken][remoteToken ] = deposits[localToken][remoteToken ] + amount ;
216214 }
217215
218- emit ERC20BridgeInitiated (_localToken, _remoteToken, _from, _to, _amount, _extraData );
216+ emit ERC20BridgeInitiated (localToken, remoteToken, from, to, amount, extraData );
219217
220218 MessagePasser.Instruction[] memory messageIxs = new MessagePasser.Instruction [](1 );
221219 messageIxs[0 ] = MessagePasser.Instruction ({
222220 programId: remoteBridge,
223221 accounts: new MessagePasser.AccountMeta [](0 ),
224222 data: Encoder.encodeBridgePayload (
225223 BridgePayload ({
226- localToken: _remoteToken ,
227- remoteToken: _localToken ,
228- from: _from ,
229- to: _to ,
230- amount: _amount ,
231- extraData: _extraData
224+ localToken: remoteToken ,
225+ remoteToken: localToken ,
226+ from: from ,
227+ to: to ,
228+ amount: amount ,
229+ extraData: extraData
232230 })
233231 )
234232 });
0 commit comments