Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy safe fails to confirm on latest version with ethers v6 #623

Closed
froggiedev opened this issue Nov 29, 2023 · 8 comments
Closed

Deploy safe fails to confirm on latest version with ethers v6 #623

froggiedev opened this issue Nov 29, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@froggiedev
Copy link

froggiedev commented Nov 29, 2023

Expected behavior: Safe is deployed, then receipt is confirmed and returned
Current behavior: Safe is deployed, but the receipt fails to be confirmed with the following error:

TypeError: receipt.confirmations is not a function
    at ContractTransactionResponse.wait (provider.js:1066:1)
    at async ContractTransactionResponse.wait (wrappers.js:115:1)
    at async eval (SafeProxyFactoryEthersContract.js:27:1)
    at async SafeFactory.deploySafe (index.js:101:1)

Reproducing code:

"ethers": "^6.7.1"
"@safe-global/protocol-kit": "^2.0.0

import { ethers } from 'ethers';
import {
  SafeFactory,
  SafeAccountConfig,
  EthersAdapter,
} from '@safe-global/protocol-kit';

  const ethAdapter = new EthersAdapter({
      ethers,
      signerOrProvider: sdk.signer, // ethers v6 `Signer`
  });

  const safeAccountConfig: SafeAccountConfig = {
      owners: [sdk.signerAddress],
      threshold: 1,
    }

  async function deploySafe() {
    const safeFactory = await SafeFactory.create({ ethAdapter });

    const safeSDK = await safeFactory.deploySafe({
      safeAccountConfig,
      saltNonce: safeDeploymentConfig.saltNonce,
    });
    const safeAddress = await safeSDK.getAddress();

    console.log('Your Safe has been deployed:');
    console.log(`https://arbiscan.io/address/${safeAddress}`);
    console.log(`https://app.safe.global/arb1:${safeAddress}`);

    return safeSDK;
}
@dasanra
Copy link
Collaborator

dasanra commented Nov 29, 2023

@froggiedev thank you for your report. Could you also share which chain, Safe version and RPC provider you were using?

Thank you!

@dasanra dasanra added the bug Something isn't working label Nov 29, 2023
@froggiedev
Copy link
Author

froggiedev commented Nov 29, 2023

@froggiedev thank you for your report. Could you also share which chain, Safe version and RPC provider you were using?

Thank you!

Chain: Arbitrum
Safe Version: 1.4.1 (package version shared above)
RPC Provider: Quicknode (ethers v6 JsonRpcProvider)

@dasanra
Copy link
Collaborator

dasanra commented Nov 30, 2023

@froggiedev as far as I checked the issue is not coming from ethers v6 migration but because the Arbitrum contracts v1.4.1 are not yet on safe-deployments and we are not correctly handling this. You shouldn't find this issue if you try to deploy the contract v1.3.0. We will investigate further.

@froggiedev
Copy link
Author

@froggiedev as far as I checked the issue is not coming from ethers v6 migration but because the Arbitrum contracts v1.4.1 are not yet on safe-deployments and we are not correctly handling this. You shouldn't find this issue if you try to deploy the contract v1.3.0. We will investigate further.

Does contract v1.3.0 work with ethers v6?

@dasanra
Copy link
Collaborator

dasanra commented Dec 14, 2023

Yes, you can safely use ethers v6 in the safe-core-sdk and v1.3.0 version of the smart contracts

@froggiedev
Copy link
Author

Yes, you can safely use ethers v6 in the safe-core-sdk and v1.3.0 version of the smart contracts

Ah, but v1.3.0 does not support the Safe ERC-4337 module if I remember correctly.

@dasanra
Copy link
Collaborator

dasanra commented Mar 19, 2024

The issue should be now solved for Arbitrum, as the addresses are available at safe-deployments package.

Also this ticket relates better to the issue that causes this unexpected behavior.

@dasanra dasanra closed this as completed Mar 19, 2024
@nestorolivaresh
Copy link

nestorolivaresh commented May 20, 2024

@dasanra

This exact same error is happening to me while deploying a Safe using Sepolia.

"@safe-global/protocol-kit": "^3.1.1",
"ethers": "^6.12.1",

This is how I create the factory:

  const provider = await userWallet.getEthersProvider();
    const signer: unknown = provider.getSigner();

    const ethAdapter = new EthersAdapter({
      ethers,
      signerOrProvider: signer as ethers.Signer,
    });
    const factory = await SafeFactory.create({ ethAdapter });

This is how I deploy the safe:

      const safe = await safeFactory.deploySafe({
        safeAccountConfig,
        saltNonce: hexlify(ethers.randomBytes(32)),
      });

Here you can see the safe is succesfully being deployed: https://sepolia.etherscan.io/tx/0x2b8941304e26195213e2c47f3aac42bf68078573cb77aedab9a75664965af7c3

Here's the error:
TypeError: receipt.confirmations is not a function
at ContractTransactionResponse.wait (provider.js:751:31)
at async ContractTransactionResponse.wait (wrappers.js:102:25)
at async eval (SafeProxyFactoryEthersContract.js:30:31)
at async SafeFactory.deploySafe (index.js:110:29)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants