Commit 156a12d3 authored by Maurelian's avatar Maurelian Committed by GitHub

Add receive() to OVM_L1ETHGateway so you can send ETH to it (fixed) (#311)

* remove immutable

* add fallback function to deposit eth into l2

* Revert "remove immutable"

This reverts commit 6e8bf7b1871b56085ce96ee73b5acbd4bd04b96c.

* remove conflicting receive function
Co-authored-by: default avatarGeorge Hotz <geohot@gmail.com>
Co-authored-by: default avatarsmartcontracts <kelvinfichter@gmail.com>
parent 59ae29f4
...@@ -56,6 +56,13 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr ...@@ -56,6 +56,13 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr
* Depositing * * Depositing *
**************/ **************/
receive()
external
payable
{
_initiateDeposit(msg.sender, msg.sender);
}
/** /**
* @dev deposit an amount of the ERC20 to the caller's balance on L2 * @dev deposit an amount of the ERC20 to the caller's balance on L2
*/ */
...@@ -155,14 +162,4 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr ...@@ -155,14 +162,4 @@ contract OVM_L1ETHGateway is iOVM_L1ETHGateway, OVM_CrossDomainEnabled, Lib_Addr
(bool success, ) = _to.call{value: _value}(new bytes(0)); (bool success, ) = _to.call{value: _value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
} }
/**
* @dev Prevent users from sending ETH directly to this contract without calling deposit
*/
receive()
external
payable
{
revert("Deposits must be initiated via deposit() or depositTo()");
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment