I'm attempting to use a new smart contract as a proxy to another contract. The goal is that when this new contract receives Ether, it immediately sends that Ether to the other contract.

I keep getting the error

Error: Transaction reverted: contract call run out of gas and made the transaction revert

Here's the code I'm currently working with:

receive() external payable {
  require(msg.value >= .01 ether, "INSUFFICIENT_FUNDS"); 
  executeMint(msg.value / .01 ether); 

function executeMint(uint256 numberOfMints) internal {

Any insight as to why this might be failing?

NOTE: The other contract does have a receive() function and it works as expected when I send Ether to it directly from a wallet.

  • Without more info, these are guesses, but 1. Are you sure _nftContractAddy can receive ETH? If must have a payable fallback/receive function in order for this to work, 2. Are you sure you're sending enough ETH with your testing?
    – natewelch_
    Commented Sep 16, 2022 at 16:13
  • Would be more helpful if you could include an Etherscan link for the failing tx. Commented Sep 16, 2022 at 16:20
  • @natewelch_ Yes the other contract can receive ETH. It has a receive function and works as expected when sending ETH to it from a wallet. As for gas, I've tried sending the maximum allowable gas limit and the still get this error.
    – juju
    Commented Sep 16, 2022 at 16:20
  • @AhmedIhsanTawfeeq This is happening in local testing. Contract is not deployed yet.
    – juju
    Commented Sep 16, 2022 at 16:21
  • It's also worth noting that you have a couple of issues in the contract. Most notable one is that you're not using the defined numberOfMints input parameter in executeMint(uint256 numberOfMints), and instead you're using msg.value. Commented Sep 16, 2022 at 16:22

1 Answer 1


While sending eth from one contract to another, don't use .transfer or .transfer, use .call, since transfer and send forward a maximum of 2300 gas units. call forwards all the gas. This way, the other contract can do more operations without running out of gas.

Something like:

function executeMint(uint256 numberOfMints) internal {
  payable(_nftContractAddy).call{value: msg.value}(""); 

Docs: https://docs.soliditylang.org/en/v0.8.13/security-considerations.html?highlight=transfer#sending-and-receiving-ether

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.