1

I'm trying to transfer eth from a contract to multiple wallets + a gnosis safe and I'm using EIP2930, but the transaction is still failing due to out of gas.

If we use type: 2

export const withdrawFromContract = async () => {
  try {
    const provider = await detectEthereumProvider();
    const accessPassContract = getAccessPassContract(provider);
    const withdraw = await accessPassContract.withdraw({
      gasLimit: 500000,
      type: 2,
      accessList: [
        {
          address: '0xFBfeD54D426217BF75d2ce86622c1e5fAf16b0a6',
          storageKeys: ['0x0000000000000000000000000000000000000000000000000000000000000000'],
        },
        {
          address: '0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552', //Master address we got from https://safe-transaction.mainnet.gnosis.io/api/v1/safes/0xFBfeD54D426217BF75d2ce86622c1e5fAf16b0a6/
          storageKeys: [],
        },
      ],
    });
    console.log(withdraw);
  } catch (error) {
    console.log(error);
  }
};

transaction fails due to out of gas.

On the contract we are doing a transfer to the Gnosis-Safe

    function withdraw() external onlyOwner {
      uint pointOnePercent = address(this).balance / 1000; 
      address payable Moderation = payable(0xFBfeD54D426217BF75d2ce86622c1e5fAf16b0a6);
      Moderation.transfer(pointOnePercent*50); //5%
      //Rest are normal addresses that transfer without any issues, I don't think I need to add them to the accesslist
    }

We are in a weird position and would love any help we can get pointing us in the right direction

3
  • 1
    Could you share the transaction hash? the access list looks good, it could be the 500000 gas limit that you set
    – mikheevm
    Apr 16, 2022 at 9:12
  • 1
    I found it and I could simulate the transaction with your access list and it was successfully executed. You can try to change the transaction type to 1
    – mikheevm
    Apr 16, 2022 at 9:14
  • 1
    I think my problem was we are using metamask to send the transaction as the owner has ledger and we could not create a code wallet for his ledger wallet. We are thinking about transferring ownership to a regular wallet and create a code wallet from mnemonic. We are trying to think of the downsides of such an approach.
    – Efesus
    Apr 16, 2022 at 15:13

2 Answers 2

4

Solved it.

https://etherscan.io/tx/0xfbf20efe99271206c0f5b497a92bee2e66f8bf9991e07648935194f17610b36e

What no one tells you is that metamask does not add accesslist to your requests. If you have this problem and cannot solve it, feel free to contact me anywhere so I can help you.

Efe Acikgoz

5
  • Did you solve without Metamask or you found a workaround using Metamask?
    – 70ny
    Jul 22, 2023 at 15:09
  • We had to solve it without using Metamask, but since our contract was uploaded using a hardware wallet, we needed to change contract ownership to a software wallet and used that wallet hardcoded on our admin panel webpage
    – Efesus
    Jul 27, 2023 at 13:29
  • which software wallet did you use?
    – 70ny
    Jul 29, 2023 at 13:58
  • We hardcoded mnemonic seed phrase of the wallet directly to the local admin page we created. I'd recommend not to host this page anywhere, local only
    – Efesus
    Jul 30, 2023 at 12:45
  • 1
    so you didn't use a software wallet, but simply loaded the mnemonic seed via EthersJS, right?
    – 70ny
    Jul 31, 2023 at 20:50
0

for anyone coming here for the same reason - heres the gnosis article for support on this

https://help.gnosis-safe.io/en/articles/5249851-why-can-t-i-transfer-eth-from-a-contract-into-a-safe

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.