首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么gnosis不接受设置的输入参数?

为什么gnosis不接受设置的输入参数?
EN

Ethereum用户
提问于 2023-04-20 17:01:34
回答 1查看 23关注 0票数 1

我正在设置一个保险箱,当我试图设置它时,我添加了一些看起来符合条件的输入,因为我用其他代码检查了它们,这些代码也在做同样的事情,但是我在参数上出现了一个错误。

代码语言:javascript
复制
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

}
代码语言:javascript
复制
     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)
EN

回答 1

Ethereum用户

回答已采纳

发布于 2023-04-20 20:49:50

Gnosis安全契约中的所有者添加过程存在问题,您只有一个所有者(daoMember1.address),阈值为1。

编辑:让我们尝试从交易收据中获取安全地址。

代码语言:javascript
复制
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
}
票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/149255

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档