I have an Ethereum dApp that can support users connecting from EOA or smart contract wallets. In the case of smart contracts the contract they connect with must implement isValidSingature (EIP 1271) which the dApp calls, passing a signature generated from the EOA that the user initiated the transaction with, to determine if the transaction can proceed. I would like a user to be able to connect to the dApp specifying a Gnosis safe contract as their wallet. So assuming I have a Solidity implementation of isValidSignature (and perhaps other methods to add and remove permitted EOAs) is there a way I can have this implemented by the Gnosis safe contract? I could extend the Gnosis contract, but I gather this won't work because the Safe singleton must be used, not some new contract I have deployed. Do modules provide a way for this to be done? If so are there any examples or tutorials to look at? Thanks.

  • Hard to understand the question. Safe already supports EIP-1271: github.com/safe-global/safe-contracts/blob/…
    – eth
    Aug 12, 2023 at 2:30
  • The linked code supports having a signer which implements isValidSignature. In that scenario the Safe contract calls the isValidSignature function which is implemented by the signer contract. My scenario is that my dApp on-boards a user who is using a Safe as their wallet and the dApp validates their signature by calling an implementation of isValidSignature on the Safe contract. I don't know if that's possible, but it would require extending a Safe (perhaps by writing a module?) to implement isValidSignature. Aug 14, 2023 at 14:40
  • Thanks, I understand now. I think they do allow isValidSignature to be implemented github.com/safe-global/safe-contracts/blob/… I think you also have to watch out for github.com/safe-global/safe-contracts/blob/… If you find more in their docs and figure these out, please post an answer :)
    – eth
    Aug 16, 2023 at 6:19
  • Related? ethereum.stackexchange.com/questions/124444/…
    – eth
    Aug 16, 2023 at 6:23
  • Thanks for the help. I also came across this: ethereum.stackexchange.com/questions/122635/… However it looks like the CompatibilityFallbackHandler implementation of isValidSignature requires the msg.sender to be another Safe. I think I'm probably going about this the hard way and should instead switch to having my own contract implement isValidSignature and my contract be owned by a Safe. Should work for my case at least, and keeps my signature validation stuff cleanly separated from the Safe. Aug 16, 2023 at 15:39


Your Answer

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

Browse other questions tagged or ask your own question.