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 ?
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 ?
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.
I'm pretty sure the only way to "forward" gas costs is to delete a bunch of stored data. (gas rebate tokens)
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.
payable(vault).transfer(address(this).balance)
transfers any existing balance to the vault contract. It doesn't pay any transaction fee.