0

I'm using nodejs and deploying the createSafe function as so:

async function createSafe(ethAdapter) {
    try {
        const safeFactory = await SafeFactory.create({ ethAdapter });
        const ownerAddress = await ethAdapter.getSignerAddress();
        const safeAccountConfig = {
            owners: [ownerAddress, "0xBD95F8B5242f440354e4E1ac8D2DCf30070cF97F"],
            threshold: 2,
        };
        const safe = await safeFactory.deploySafe({ safeAccountConfig, options: { gasLimit: 3000000 } });
        return safe;
    } catch (error) {
        console.error(error);
    }
}

I'm setting up my wallet and provider using ethers and alchemy like this

async function getProvider(network) {
    if (networks[network] === undefined) {
        throw new Error("Invalid network");
    }
    return new providers.AlchemyProvider(network, process.env.ALCHEMY_KEY);
}

async function getEthersAdapter(wallet) {
    try {
        const ethersAdapter = new EthersAdapter({ ethers, signerOrProvider: wallet });
        return ethersAdapter;
    } catch (error) {
        console.error(error);
    }
}
async function loadWallet(privateKey, provider) {
    wallet = new ethers.Wallet(privateKey, provider);
    return wallet;
}

And my test is like so

describe("Gnosis Safe", () => {
    describe("#createSafe", async () => {
        const network = "arbitrum-goerli";
        const provider = await getProvider(network);
        const pKey = process.env.PRIVATE_KEY;
        const wallet = await loadWallet(pKey, provider);
        console.log(wallet);
        const ethAdapter = await getEthersAdapter(wallet);
        console.log(ethAdapter);
        const safe = await createSafe(ethAdapter);

See transaction hash for the Create2 call failed error here: https://goerli-optimism.etherscan.io/tx/0xd6646dc55302f1be61140667e7f5c8bc0077faa6423954084699f2bd588d25a6

Any idea why I'm getting a Create2 call error? Any thoughts on how to debug this? I'm new to using nodejs, ethers, and gnosis safe contracts. Thanks.

1 Answer 1

0

Please see this StackExchange question regarding why a create2 call might revert: https://stackoverflow.com/questions/74160798/why-would-create2-revert

In your case, the reason is number 2) since all the deployment parameters are static, and I can see a previously successful deployment transaction on the account you linked.

https://goerli-optimism.etherscan.io/tx/0x4394be4a0cae9e971856431e4970c66b2d0970411e735c109f97f4ffcdc7eede

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.