Gnosis Safe – Approve Hash Function Not Transferring ERC20 Token: Fixes and Solutions

address.transferethereum-classicethers.jsgnosisgnosis-safe

I am using the gnosis-safe core SDK here to create transactions to transfer Eth out of a deployed safe proxy. Doc: https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-core-sdk#deploysafe

I deployed the proxy on Rinkeby via:

        const { ethereum } = window;
        const provider = new ethers.providers.Web3Provider(ethereum)
        const safeOwner = provider.getSigner(0)
        const ethAdapter = new EthersAdapter({ ethers, signer: safeOwner });

        const txServiceUrl = 'https://safe-transaction.gnosis.io';
        const safeService = new SafeServiceClient({ txServiceUrl, ethAdapter });
        const is_dev = true;
        let ethAdapter = this.ethAdapter;
        const safeFactory = await SafeFactory.create({ ethAdapter, isL1SafeMasterCopy: !is_dev });

        const safeAccountConfig = {
          owners: ['0x...D9'],
          threshold: 1,
        }        

        const safeSdk = await safeFactory.deploySafe({ safeAccountConfig });        

So it is a safe with just one authorizer. I then deposit some ETH into this safe proxy, and try to send it out of the safe with:

        let safeAddress = '0x...c';
        const safeSdk = await Safe.create({ ethAdapter, safeAddress, isL1SafeMasterCopy: false })
        const num_ethers = ethers.utils.parseUnits("0.1", 'ether').toHexString();
        const transaction = {
          to: '0x...1', 
          data: '0x',
          value:num_ethers,
        }
        const safeTransaction = await safeSdk.createTransaction(transaction)        
        console.log('safeTransaction: ', safeTransaction)
        const hash = await safeSdk.getTransactionHash(safeTransaction);
        const txResponse = await safeSdk.approveTransactionHash(hash);
        const reshash = await txResponse.transactionResponse?.wait();       

What ends up happening is that the authorizer is charged for the ApproveHash transaction, but the Eth does not transfer. Is there something I'm missing here conceptually? The data field should be 0x for transferring eth on Rinkeby network as well right? Tx log here: https://rinkeby.etherscan.io/address/0x99Ae62C23728EAa970F5064DcD3F869ae80FC89c

Best Answer

approveTransactionHash only approves the transaction without executing it. Please refer to the core SDK documentation to learn how to execute a transaction https://github.com/safe-global/safe-core-sdk/blob/main/packages/guides/integrating-the-safe-core-sdk.md#8-execute-the-transaction

Related Topic