This project shows the usage of Safe{Core} protocol
The project contains contracts, tests and scripts to build a Plugin.
- Contracts
- Imports.sol - Import that are only used for testing and by scripts
- Base.sol - Types and base Plugin contracts that can be extended (i.e. to manage Plugin metadata)
- Plugins.sol - A collection of example Plugins
- Tests
- RelayPlugin.spec.ts - Tests for the Relay example Plugin.
- Scripts
- Deployment - Deployment scripts for the example Plugins
- Tasks - Tasks to register plugins
- Utils - Utility method to interfact with Plugins
The metadata of a Plugin is used to provide information to users when enabling the Plugin. Currently the information required is:
name
- Name of the Plugin that should be displayedversion
- Version of the Plugin that is shown to the userrequiresRootAccess
- Indicates if the Plugin require root access (i.e. performdelegatecall
or change the account config).iconUrl
- Icon that should be displayedappUrl
- App to configure and use the Plugin
Note: The format and type of metadata currently required by Plugins is just for this demo. This will change in the future and a proper format will be proposed in the specificiations
The base contracts include two base contracts:
BasePluginWithStoredMetadata
- A plugin that stores the metadata onchainBasePluginWithEventMetadata
- A plugin that stores the metadata in an event
Both allow that the web app can retrieve this metadata to display it to the user.
It is also possible to provide other storage means (i.e. ipfs
or url
). For this it is necessary to extend the BasePlugin
contract and add the require utility script.
The following example are included int his repository:
RelayPlugin
- A plugin that allows to relay Safe transactions and pay a fee for it which is capped by the user.
yarn
yarn build
yarn test
yarn deploy <network>
The Registry used in this demo is a open test Registry (so no verification of Plugins or any other listing requirements).
- Register the Sample Plugin on the Registry
yarn register-plugin <network>
- List all Plugins in the Registry
yarn list-plugins <network>