Openzeppelin safeMint erc721 to a gnosis safe

I have deployed a pretty standard ERC721 contract from openzeppelin.

I can safemint without problems to a normal wallet/address but when i try to safemint using a gnosis safe as a destination it doesnt seem to work.

Can anyone shed some light as to why this is happening?

I have tried sending existing NFT's to/from the gnosis safe and that works fine.

Also permissions seem to be all fine.

On defender i just get the following:

Hey @altc,

I moved this into the #support:defender category since it seems to be the correct one. However, can you provide the code you're using for the ERC721?

We can move it back to #support:contracts if this ends up being a question about OpenZeppelin contracts.


If the mint destination is a smart-contract account (in opposed to an externally-owned account), then that smart contract must implement the ERC721Receiver interface, as you can see in the ERC721 contract's internal function _safeMint:

    _checkOnERC721Received(address(0), to, tokenId, data),
    "ERC721: transfer to non ERC721Receiver implementer"

You can scroll further down that contract (which I have linked above), and see exactly how function _checkOnERC721Received is implemented.

And since the gnosis safe contract does not implement the ERC721Receiver interface, your attempt to mint to that contract reverts.

That appears to be it, i had to change it to mint rather than safemint... its a gnosis safe that i created through openzeppelin defender itself...

Once i changed from safemint to mint it works fine

Well, safeMint is probably designated for your own protection, allowing you to safely assume that the contract which you're minting for is designated to receive those tokens and "handle them appropriately" (i.e., based on the intentional implementation of that contract).