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.
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.
A DAO or Gnosis Safe on the origin domain wants to call restrictedFunction()
on the destination domain:
- 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 ofrestrictedFunction()
,_operation
: the type of operation
- The DAO or Gnosis Safe calls
xcall
on the Connext contract on the origin domain, passing in the above_calldata
and thetarget
Connext Module. See the Connext Quickstart for more info. - Connext's protocol posts your payload to the Connext Module on the destination domain, which in turn calls
restrictedFunction()
.
To add this module to your Gnosis Safe:
- Deploy the module (see instructions below), passing in the relevant
_origin
and_originAddress
that you expect messages to come from. - In the Gnosis Safe app, navigate to the "apps" tab and select the Zodiac Safe App.
- 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
!
To see available commands run yarn hardhat
.
Some helpful commands:
yarn install # install dependencies
yarn build # compiles contracts
yarn test # runs the tests
yarn deploy # deploys the contracts add the `--network` param to select a network
This project is set up to support both a "normal deployment" where the module is deployed directly, along with deployment via the Mastercopy / Minimal Proxy pattern (using our ModuleProxyFactory).
Currently, it is set up to deploy via the Mastercopy / Minimal Proxy pattern on Rinkeby and as a "normal deployment" on other networks. You can easily modify this behavior for your own module.
yarn deploy # "normal deployment"
yarn deploy --network rinkeby # deploys a mastercopy and a minimal proxy for the module
The "normal deployment" can be useful for easily deploying and testing your module locally (for instance, the Hardhat Network).
The "normal deployment" deploys the MyModule contract and the test contracts (contracts/test/Button.sol
and contracts/test/TestAvatar.sol
), then sets the TestAvatar as the Button owner, and enables MyModule on the TestAvatar.
The Mastercopy / Minimal Proxy deployment deploys the MyModule mastercopy, a MyModule proxy, and the test contracts (contracts/test/Button.sol and contracts/test/TestAvatar.sol), then sets the TestAvatar as the Button owner and enables the MyModule proxy on the TestAvatar.
When deploying modules that are going to be used for multiple avatars, it can make sense to use our Mastercopy/Proxy pattern. This deployment uses the Singleton Factory contract (EIP-2470). See a list of supported networks here. For adding support to other chains, check out the documentation here and here.