1

I'm setting up a safe and when trying to setting it up I'm adding some inputs that look eligible because i checked them with some other codes that were doing the same thing but I get an error on the arguments.

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')
  const safe = await ethers.getContractAt('GnosisSafe', masterCopy.address)

  // Set up Gnosis Safe contract with owners and threshold
  await safe.setup(
    [daoMember1.address],
    1,
    ethers.constants.AddressZero,
    '0x',
    ethers.constants.AddressZero,
    ethers.constants.AddressZero,
    0,
    ethers.constants.AddressZero
  )

  return safe

}
     Error: VM Exception while processing transaction: reverted with reason string 'GS200'
    at GnosisSafe.addOwnerWithThreshold (@gnosis.pm/safe-contracts/contracts/base/OwnerManager.sol:53)
    at GnosisSafe.setup (contracts/GnosisSafe.sol:86)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async HardhatNode._mineBlockWithPendingTxs (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:1819:23)
    at async HardhatNode.mineBlock (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:508:16)
    at async EthModule._sendTransactionAndReturnHash (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:1522:18)
    at async HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:123:18)
    at async EthersProviderWrapper.send (node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)

1 Answer 1

0

There's a problem with the owner addition process in the Gnosis Safe contract, you only have one owner (daoMember1.address) and a threshold of 1. Just replace this part of your code

edit: lets try to get the Safe address from the transaction receipt

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

  const masterCopyFactory = await ethers.getContractFactory('GnosisSafe')
  const masterCopy = await masterCopyFactory.deploy()

  const proxyFactoryFactory = await ethers.getContractFactory('GnosisSafeProxyFactory')
  const proxyFactory = await proxyFactoryFactory.deploy()

  const safeProxy = await proxyFactory.createProxy(masterCopy.address, '0x')

  const safeAddress = safeProxy.events[0].args.proxy
  const safe = await ethers.getContractAt('GnosisSafe', safeAddress)

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

  return safe
}
2
  • 1
    that is not possible safeProxy is a transaction receipt. I get this error when i do that :Argument of type 'ContractTransaction' is not assignable to parameter of type 'string'.ts(2769)
    – user120185
    Commented Apr 21, 2023 at 17:52
  • I modified my answer
    – Saxtheowl
    Commented Apr 21, 2023 at 20:18

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.