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

Different proxy factory for Optimism Goerli #163

Closed
0xslipk opened this issue Dec 6, 2022 · 6 comments
Closed

Different proxy factory for Optimism Goerli #163

0xslipk opened this issue Dec 6, 2022 · 6 comments

Comments

@0xslipk
Copy link

0xslipk commented Dec 6, 2022

Hello guys,

I am trying to predict the safe address with create2 for a cross-chain Safe for goerli, mumbai, optimism-goerli, aurora-testnet, arbitrum-goerli, avalanche-fuji and binance-testnet. The problem is that I am using the proxy factory address as first parameter for getCreate2Address, but optimism-goerli on proxy_factory.json has different address that for example goerli. is this an error or correct?.

I am asking, because I can found the goerli address on optimism-goerli.

Thank you in advance.

@moisses89
Copy link
Member

It is not an error, they used different deterministic deployment proxy ( singleton-factory ) to create them. that's the reason for have two different addresses.

@moisses89
Copy link
Member

@0xslipk related your question safe-global/safe-smart-account#460
If no more concerns about this, the issue should be closed. 😅

@sunliang711
Copy link

If I want to use the same safe address on all networks, this can't be done, that's so bad ):

@0xslipk
Copy link
Author

0xslipk commented Feb 4, 2023

@0xslipk related your question safe-global/safe-smart-account#460

If no more concerns about this, the issue should be closed. 😅

Awesome thank you 🙏

@0xslipk 0xslipk closed this as completed Feb 4, 2023
@0xslipk
Copy link
Author

0xslipk commented Feb 4, 2023

If I want to use the same safe address on all networks, this can't be done, that's so bad ):

I actually did, so It can be done. 😬

@sunliang711
Copy link

sunliang711 commented Feb 6, 2023

If I want to use the same safe address on all networks, this can't be done, that's so bad ):

I actually did, so It can be done. 😬

How did you do that ? I have used the safe sdk to predict safe address with same owners same threshold and same salt, but the address of optimistic chain is different with others (ethereum polygon bsc arbitrum are the same).
This is my code:

export async function deploySafe(rpc: string, privateKey: string, owners: Array<string>, threshold: number, nonce: string, dryRun: boolean,isL1SafeMasterCopy: boolean) {
    // check owners duplicate
    if (new Set(owners).size != owners.length) {
        throw new Error("duplicate owners")
    }

    if (threshold > owners.length) {
        throw new Error("threshold greater than owners count")
    }

    owners.forEach(owner => {
        checkAddress(owner, `owner: ${owner} is not an valid address`)
    })

    const ethAdapter = createAdapter(rpc, privateKey)
    const sender = await ethAdapter.getSigner()?.getAddress()
    console.log("deployer:", sender)
    const safeFactory = await SafeFactory.create({ ethAdapter,isL1SafeMasterCopy })

    const saltNonce = nonce.length > 0 ? nonce : Date.now().toString()
    console.log("nonce:", saltNonce)

    const safeDeploymentConfig: SafeDeploymentConfig = {
        saltNonce
    }

    const safeAccountConfig: SafeAccountConfig = {
        owners,
        threshold
    }

    // predict deployed address
    console.log("predict deploy address..")
    const predictedDeployAddress = await safeFactory.predictSafeAddress({
        safeAccountConfig,
        safeDeploymentConfig
    })
    console.log('Predicted deployed address:', predictedDeployAddress)
    if (dryRun) {
        return
    }

    function callback(txHash: string) {
        console.log('Transaction hash:', txHash)
    }

    console.log("deploy..")
    const safe: Safe = await safeFactory.deploySafe({
        safeAccountConfig,
        safeDeploymentConfig,
        callback
    })
    const newSafeAddress = safe.getAddress()

    console.log('Deployed Safe:', newSafeAddress)
}

I found the proxy factory address on optimistic is different

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@0xslipk @moisses89 @sunliang711 and others