Msg.sender.transfer runs out of gas on a payable upgradeable proxy contract

:computer: Environment

Truffle v5.1.43
Solidity 0.5.7


Hello everyone! I am trying to withdraw weth on Kovan to get some Ether on my upgradeable proxy contract but the transaction runs out of gas every single time. It fails on the following line on the weth contract:


I am aware that sending some ether to a contract will run out of gas if there is no payable fallback function. So I added that function to my contract but no luck.

I have verified I can send Ether to my proxy instance from an EOA and that works. I must be missing something simple here but I can’t find the problem, any help would be great!

:1234: Code to reproduce

Here is a simple test proxy contract to reproduce my issue:

pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;

interface IWETH {
    function deposit()

    function withdraw(
        uint256 wad

contract WethTest {

    function() external payable { }

    function getWrappedEthInstance() public view returns (IWETH) {
      return IWETH(0x8a18c7034aCEfD1748199a58683Ee5F22e2d4e45);

    function unwrapEtherAndWithdraw(address payable _to, uint256 _withdrawalAmount)


And here is a tenderly link for a transaction that failed, you can clearly see the transaction failing after the eth is unwrapped but just when sending ether to the proxy instance:

1 Like

Hi @westerly,

The issue is due to the Istanbul repricing, see: OpenZeppelin upgradeable contracts affected by Istanbul hardfork

Unfortunately you will need to change how you get Ether to your upgradeable contract.

Ho right thanks much @abcoathup I missed this one!

1 Like

A post was split to a new topic: How to receive Ether to an upgradeable contract from a contract using msg.sender.transfer