0

I have been using this code to create Gnosis safe programmatically:

const ethAdapter = new EthersAdapter({ethers, signerOrProvider: signerWallet}); //3
const safeFactory = await SafeFactory.create({ ethAdapter }); //4
const safeSdk: Safe = await safeFactory.deploySafe({ safeAccountConfig: { threshold: 2, owners: ['0x...', '0x...', '0x..'] }});

But today, in a few attempts to create Gnosis Safes on Goerli, I got this error:

cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted: Create2 call failed", method="estimateGas", transaction={"from":"0x12A244d6137dFE45B85F92185C524340D8CdD60f","to":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","data":"0x1688f0b90000000000000000000000003e5c63644e683549055b9be8653de26e0b4cd36e0000000000000000000000000000000000000000000000000000000000000060b1073742015cbcf5a3a4d9d1ae33ecf619439710b89475f92e2abd2117e90f900000000000000000000000000000000000000000000000000000000000000164b63e800d0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000f48f2b2d2a534e402487b3ee7c18c33aec0fe5e4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000012a244d6137dfe45b85f92185c524340d8cdd60f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","accessList":null}, error={"code":-32603,"message":"execution reverted: Create2 call failed","data":{"originalError":{"code":3,"data":"0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000013437265617465322063616c6c206661696c656400000000000000000000000000","message":"execution reverted: Create2 call failed"}},"docUrl":"https://docs.cloud.coinbase.com/wallet-sdk/docs/errors?version=3.7.0&code=-32603&method=eth_estimateGas&message=execution+reverted%3A+Create2+call+failed"}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)

I double checked to make sure there is fund in my wallet. Any pointer toward how I may solve/debug this issue will be much appreciated.

1 Answer 1

0

Same problem.

I solved it in this way.

  1. Create a new directory totally empty: /blabla/createsmartaccount_dir.

  2. Create these 2 files inside it.

/blabla/createsmartaccount_dir/index.js

/blabla/createsmartaccount_dir/package.json

  1. Run the commands

npm install

node ./index.js

#/blabla/createsmartaccount_dir/index.js

const { ethers } = require( 'ethers')
const { EthersAdapter } = require(  '@safe-global/protocol-kit')
const Safe = require(  '@safe-global/protocol-kit')
const { SafeFactory } = require(  '@safe-global/protocol-kit')
const { SafeAccountConfig } = require(  '@safe-global/protocol-kit')
const { ContractNetworksConfig } = require(  '@safe-global/protocol-kit')

const execute = async () => {
    const RPC_URL='https://rpc2.sepolia.org'
    const provider = new ethers.providers.JsonRpcProvider(RPC_URL)
    
    
    
    // Initialize signers
    //metamask wallet and privatekey
    //0x967c1CF5d91f3738c969c76EB4bDddA6da4183c1
    const signerWallet = 
new ethers.Wallet("ca46xxxxxxxxxxxxxxx", provider)

    const ethAdapter = new EthersAdapter({ethers, signerOrProvider: signerWallet})
    
    const chainId = await ethAdapter.getChainId()
    console.log(`ChainId: ${chainId}`)

    
  
    
    const safeVersion = '1.3.0'
    const isL1SafeMasterCopy = false
    const safeFactory = await SafeFactory.create({ ethAdapter: ethAdapter })



    const safeAccountConfig = {
        threshold: 1, // Have to be >= 1 && <= totalOwners
        owners: ["0x967xxxxxxxxxxxxxxxxxxxxxxxxxxxx"],
        eth_estimateGas:30000,
    }
    console.log("Start Deploying Safe");



    
    
    //This Safe is tied to owner 1 because the factory was initialized with an 
    //adapter that had owner 1 as the signer. 
  
    const safeSdkOwner1 = await safeFactory.deploySafe({ safeAccountConfig })

    const safeAddress = safeSdkOwner1.getAddress()

    console.log(`Safe deployed at: ${safeAddress}`)  
}
execute();

#/blabla/createsmartaccount_dir/package.json

{
  "dependencies": {
    "@safe-global/api-kit": "^1.0.1",
    "@safe-global/protocol-kit": "^0.1.1",
    "@safe-global/safe-core-sdk-types": "^1.10.1",
    "dotenv": "^16.0.3",
    "ethers": "5.7.2"
  }
}

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.