4

I was trying to transfer an NFT using ERC721's safeTransferFrom method from my gnosis safe to another gnosis safe address but while executing the transaction I am getting -

Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"code":3,"message":"execution reverted: GS013","data":"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000054753303133000000000000000000000000000000000000000000000000000000"}, method="estimateGas", transaction={"from":"0x3c7c3487d6782266059193C2593D6a2f9aC43989","to":"0x01d0a2c2fE8d8B08B3Df890cA5dBE4aBCE1Fa642","data":"0x6a7612020000000000000000000000009296c6130f9899c1f7b5798bceaf5356134135440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000006442842e0e00000000000000000000000001d0a2c2fe8d8b08b3df890ca5dbe4abce1fa642000000000000000000000000b5f01e293a62b25e5e09c3c02e2e6fb2e2c4eca900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000410000000000000000000000003c7c3487d6782266059193c2593d6a2f9ac4398900000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.5.3)
{
  reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',
  code: 'UNPREDICTABLE_GAS_LIMIT',
  error: {
    code: 3,
    message: 'execution reverted: GS013',
    data: '0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000054753303133000000000000000000000000000000000000000000000000000000'
  },
  method: 'estimateGas',
  transaction: {
    from: '0x3c7c3487d6782266059193C2593D6a2f9aC43989',
    to: '0x01d0a2c2fE8d8B08B3Df890cA5dBE4aBCE1Fa642',
    data: '0x6a7612020000000000000000000000009296c6130f9899c1f7b5798bceaf5356134135440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000006442842e0e00000000000000000000000001d0a2c2fe8d8b08b3df890ca5dbe4abce1fa642000000000000000000000000b5f01e293a62b25e5e09c3c02e2e6fb2e2c4eca900000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000410000000000000000000000003c7c3487d6782266059193c2593d6a2f9ac4398900000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000',
    accessList: null
  }
}

On executing the same transaction with a different target address, i.e, my Metamask wallet address(EOA) it is working fine. Also when I tried transferring the NFT from my Metamask wallet to gnosis safe address via Opensea UI(Profile -> NFT -> Transfer) then also it is not working but working when the target address is my Metamask wallet address. So, I further checked and found Opensea UI also uses safeTransferFrom method to transfer NFTs.

Now, another thing I found is that transferring NFT to a safe address works fine with transferFrom method of ERC721.

So, not sure but I think the reason could be, as mentioned here:

If the target address is a contract, it must implement IERC721Receiver.onERC721Received, which is called upon a safe transfer, and return the magic value bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); otherwise, the transfer is reverted.

This is the decoded data of the transaction which was failing.

  • Why safeTransferFrom is not working when target address is gnosis safe?
  • Is it fine to use transferFrom method as safeTransferFrom is not working?

Edit: It is a bug in the gnosis SDK and an issue exist here for this. Once gnosis team fix this, I will mark this question as resolved.

2 Answers 2

0

A fallback handler that allows to handle NFTs is missing in the recipient Safe.

Fixed here how to add a fallback handler to a given Safe and adding a default fallback handler to newly deployed Safes: https://github.com/safe-global/safe-core-sdk/issues/262

1

I will refer to OpenZeppelin's ERC721 implementation throughout my answer.

Why safeTransferFrom is not working when target address is gnosis safe?

Because the Gnosis Safe contract does not implement the IERC721Receiver interface, which must be implemented by smart contract that receive NFTs if you want to use the safeTransferFrom function.

To quote the original spec of ERC721, "a wallet/broker/auction application MUST implement the wallet interface if it will accept safe transfers."

Is it fine to use transferFrom method as safeTransferFrom is not working?

Yes, because Gnosis Safe is a multi-signature wallet that can execute any function from any third-party smart contract.

The rationale in the original spec of ERC721 was to prevent accidental transfers to contracts that can no longer transfer the NFT.

That is not a risk with Gnosis Safe. If you get enough signatures, you can choose to transfer the NFT by calling the NFT contract.

2
  • Thank you for this Paul. Just to clarify, is there anything about safeMint or any form of "safe" transfer that prevents somebody from accidentally sending to an unused account (say due to a typo in the address entered in a text box) so long as that address is -not- an address of a published smart contract which fails to implement the IERC721Receiver? I presume not, but just wanted to confirm.
    – GGizmos
    Dec 21, 2022 at 6:51
  • The answer is "no" - the ERC-721 defines "safety" in terms of whether the recipient smart contracts implements IERC721Receiver. Any other edge cases (such as unused accounts, or incorrect recipients) are up to the app/ contract developer to handle. Dec 21, 2022 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.