/zodiac-module-connext

Primary LanguageTypeScriptGNU Lesser General Public License v3.0LGPL-3.0

Zodiac Connext Module

Build Status Coverage Status Contributor Covenant

The Connext Module belongs to the Zodiac collection of tools, which can be accessed through the Zodiac App available on Gnosis Safe.

If you have any questions about Zodiac, join the Gnosis Guild Discord. Follow @GnosisGuild on Twitter for updates.

About the Connext Module

This module allows an Avatar to be the target of any arbitrary function call originiating from a Gnosis Safe on another domain (chain or rollup) using Connext.

Connext is a modular protocol for cross-domain communication. It piggybacks on the most secure Arbitrary Messaging Bridge available for a given ecosystem (e.g. the Optimism rollup bridge, or the Gnosischain AMB) to relay data and funds asynchronously between contracts on different chains.

The module implements Connext's IXReceiver interface, which receives an encoded payload from across domains and uses it to call a target contract specified as part of the payload. The module restricts the cross-domain call to originate only from a prespecified _origin (domain identifier of the origin domain) _originAddress (address of the source Safe or other contract initiating the cross-domain call). Both _origin and _originAddress may be updated by the module owner.

Flow

A DAO or Gnosis Safe on the origin domain wants to call restrictedFunction() on the destination domain:

  1. The DAO or Gnosis Safe prepares the calldata for restrictedFunction(), by ABI encoding:
    • _to: target contract address,
    • _value: native assets to be passed into the function,
    • _data: the function signature of restrictedFunction(),
    • _operation: the type of operation
  2. The DAO or Gnosis Safe calls xcall on the Connext contract on the origin domain, passing in the above _calldata and the target Connext Module. See the Connext Quickstart for more info.
  3. Connext's protocol posts your payload to the Connext Module on the destination domain, which in turn calls restrictedFunction().

Attaching your module to a Gnosis Safe

To add this module to your Gnosis Safe:

  1. Deploy the module (see instructions below), passing in the relevant _origin and _originAddress that you expect messages to come from.
  2. In the Gnosis Safe app, navigate to the "apps" tab and select the Zodiac Safe App.
  3. Select "custom module", enter the address of your newly deployed module, and hit "Add Module".

It will then show up under Modules and Modifiers in the Gnosis Safe's Zodiac app. You can now interact with this Safe from _originAddress on _origin!

Commands

To see available commands run yarn hardhat.

Some helpful commands:

yarn install # install dependencies
yarn build # compiles contracts
yarn test # runs the tests
yarn deployMasterCopy # deploys the mastercopy of the Connext Module. Add the `--network` param to select a network.
yarn setup # deploys a instance of this module.

License

Created under the LGPL-3.0+ license.

Audits

An audit has been performed by the G0 group.

All issues and notes of the audit have been addressed in commit 531e086d1064525a7921caba310a5a0b2b4aa412.

The audit results are available as a pdf in this repo.

Security and Liability

All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.