0

I'd like to forward the gas fee of this tx to my gnosis safe:

  function withdraw() external onlyOwner {
    payable(vault).transfer(address(this).balance);
  }

Note: vault is the Gnosis Safe address.

Is this possible ?

2
  • What do you mean forward? Make the gnosis safe pay for the tx fee?
    – Meet
    Commented Mar 13, 2022 at 19:01
  • Yes. But also it seems like my problem is related to eip-2929: help.gnosis-safe.io/en/articles/…
    – eightyfive
    Commented Mar 13, 2022 at 21:32

3 Answers 3

1

use vault.call{value: address(this).balance}('') to forward the call with the full gas. Otherwise, it can be specified via vault.call{value: address(this).balance, gas: 50000}('') for example.

0

I'm pretty sure the only way to "forward" gas costs is to delete a bunch of stored data. (gas rebate tokens)

0

Update

IGNORE my answer. It’s not correct, I got confused, see comments.

Original

So you can make an address pay for the Tx gas fee by using payable().

payable(vault).transfer(address(this).balance);

Here the vault (Gnosis safe address) will pay for the Tx gas fee.

This requires setting up a Spending limit for the smart contract sending the funds.

Be careful though !

EIP-2929 broke contract to contract transfer for Gnosis safes. And you have to use EIP-2930 accessList to go around the new limitation.

More details about that here.

3
  • Be careful, payable by itself doesn't pay transaction fees. The whole thing payable(vault).transfer(address(this).balance) transfers any existing balance to the vault contract. It doesn't pay any transaction fee.
    – Ismael
    Commented Mar 17, 2022 at 5:00
  • Ok thanks. I got confused in the stress of the moment then. So you confirm that the Tx fee is paid by the account calling the smart contract method (in that case owner) ?
    – eightyfive
    Commented Mar 17, 2022 at 8:39
  • 1
    The transaction fees are always paid by the transaction's signer account.
    – Ismael
    Commented Mar 17, 2022 at 14:19

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.