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

1.4.1: Backport SafeToL2Setup contract #800

Merged
merged 2 commits into from
Jul 24, 2024

Commits on Jul 23, 2024

  1. Add Safe to L2 Setup Contract (#759)

    This PR introduces a setup contract that can be called from the `Safe`
    setup function in order to automatically promote a Safe at setup time if
    the code is executing on an L2. Namely, this allows the Safe Proxy
    factory to use a single singleton and initializer for all chains, but
    end up with different `singleton`s depending on the chain ID.
    
    The expected use of this contract is to use the standard proxy factory:
    
    ```solidity
    Safe l1Singleton;
    SafeL2 l2Singleton;
    SafeToL2Setup l2Setup;
    
    proxyFactory.createProxyWithNonce(
        address(l1Singleton),
        abi.encodeCall(
            l1Singleton.setup,
            (
                owners,
                threshold,
                address(l2Setup),
                abi.encodeCall(l2Setup.setupToL2, address(l2Singleton)),
                fallbackHandler,
                paymentToken,
                payment,
                paymentReceiver
            )
        ),
        saltNonce
    )
    ```
    
    On L1 (i.e. Ethereum Mainnet where `chainId == 1`), you would end up
    with a Safe where `safe.singleton == l1Singleton` and on any other
    chains, you would end up with `safe.singleton == l2Singleton`. This
    would happen _before_ the first transaction.
    
    ---------
    
    Co-authored-by: Mikhail <16622558+mmv08@users.noreply.github.com>
    nlordell and mmv08 committed Jul 23, 2024
    Configuration menu
    Copy the full SHA
    2c963e3 View commit details
    Browse the repository at this point in the history
  2. Adjust the tests for ethers v5

    mmv08 committed Jul 23, 2024
    Configuration menu
    Copy the full SHA
    6ec7e88 View commit details
    Browse the repository at this point in the history