0

I have a safe contract and I'm trying to sign message with it and verify it,

export async function createSafe() {
  const { daoMember1, daoMember2, daoMember3, daoMember4 } = await getAccounts()

  // Deploy Gnosis Safe master copy contract
  const masterCopyFactory = await ethers.getContractFactory('GnosisSafe')
  const masterCopy = await masterCopyFactory.deploy()

  // Deploy Gnosis Safe proxy factory contract
  const proxyFactoryFactory = await ethers.getContractFactory('GnosisSafeProxyFactory')
  const proxyFactory = await proxyFactoryFactory.deploy()

  // Create Gnosis Safe contract

  const safeProxy = await proxyFactory.createProxy(masterCopy.address, '0x')
  // console.log(safeProxy)
  const transactionReceipt = await safeProxy.wait()
  const proxyAddress = transactionReceipt.events[0].args.proxy
  const safe = await ethers.getContractAt('GnosisSafe', proxyAddress)

  await safe.setup(
    [daoMember1.address, daoMember2.address, daoMember3.address],
    2,
    ethers.constants.AddressZero,
    '0x',
    ethers.constants.AddressZero,
    ethers.constants.AddressZero,
    0,
    ethers.constants.AddressZero
  )

  return safe
}

and here i sign a message and try to verify it:

      const makerMessageHashBinary = ethers.utils.arrayify(makermessageHash)

      //makers signatur(Gnosis safe)
      const sig1 = safe.connect(daoMember1).approveHash(makerMessageHashBinary)

      const isValidSignature = await safe.isValidSignature(makerMessageHashBinary, sig1)

but the problem is :

Property 'isValidSignature' does not exist on type 'GnosisSafe'.

1 Answer 1

0

I think the function you are looking for is checkNSignatures() from what I could tell, the Safe contract does not implement the isValidSignature() function but rather it is defined in an interface which is used to call back to a contract to verify a signature.

Here is the code snippet which might be able to help you out

https://github.com/safe-global/safe-contracts/blob/main/contracts/Safe.sol#L274

Here is the documentation as well on pre approved hashs https://docs.safe.global/learn/safe-core/safe-core-protocol/signatures#pre-validated-signatures

Your Answer

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

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