0

I am trying to run a function that sends ETH to a Multisig safe.

function withdrawAll() external onlyOwner {
   uint256 _balance = address(this).balance;
   require(payable(safeAddress).send(_balance));
}

I get the following error.

[43097] Withdraw::run()
    ├─ [0] VM::startBroadcast()
    │   └─ ← ()
    ├─ [16200] FrogeNFT::withdrawAll()
    │   ├─ [2183] GnosisSafeProxy::fallback{value: 650000000000000000}()
    │   │   └─ ← EvmError: OutOfGas
    │   └─ ← EvmError: Revert
    └─ ← EvmError: Revert

I have created a Tenderly simulation to help https://www.tdly.co/shared/simulation/65338102-6844-4e15-826b-11ebea0dba31

2 Answers 2

0

This might be because of the gas limit on transfer and send functions, which is 2300. And the fallback of the receiver contract might be using more gas.

Use call instead. payable(safeAddress).call{value:balance}("");

1
0

I had to use the address of the safe along with the first slot and the singleton.

You can find the singleton with the contract view method getStorageAt(0, 1) the safe gets the singleton in the fallback so check that for where your singleton is stored at

let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)

Here is the example of the accessList

[
  [
    "0x4d1e64484f31b91b22627f7888ac9587e6d86072",
    [
      "0x0000000000000000000000000000000000000000000000000000000000000000"
    ]
  ],
  [
    "0xd9db270c1b5e3bd161e8c8503c55ceabee709552",
    []
  ]
]

My simulated transaction https://dashboard.tenderly.co/explorer/fork/dcc2efab-150f-4f71-a549-479f15255a9f/simulation/05662d72-30bf-45a2-a978-ab4cc5485c39

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.