After creating a new repository from this template, cloning, and opening it in your IDE, run
yarn install && cd packages/contracts && yarn install && yarn build && yarn typechain
You can now develop a plugin by changing the src/MyPlugin.sol
and src/MyPluginSetup.sol
files. You can directly import contracts from Aragon OSx as well as OpenZeppelin's openzeppelin-contracts and openzeppelin-contracts-upgradeable that are already set up for you.
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.17;
import {IDAO, PluginUUPSUpgradeable} from "@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol";
import {SafeCastUpgradeable} from '@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol';
contract MyPlugin is PluginUUPSUpgradeable {
//...
};
The initial MyPlugin
and MyPluginSetup
example comes with unit test, integration test, and test helpers in the package/contracts/test
folder that you can reuse.
To build and test your contracts, run
yarn clean && yarn build && yarn test
The root folder of the repo includes three subfolders:
.
├── packages/contracts
│ ├── src
│ ├── deploy
│ ├── test
│ ├── utils
│ ├── ...
│ └── package.json
│
├── packages/subgraph
│ ├── src
│ ├── scripts
│ ├── manifest
│ ├── tests
│ ├── utils
│ ├── ...
│ └── package.json
│
├── packages/js-client
│ ├── src
│ ├── test
│ ├── ...
│ └── package.json
│
├── ...
└── package.json
The root-level package.json
file contains global dev-dependencies
for formatting and linting. After installing them with
yarn install
you can run the associated scripts
. With
yarn prettier:check
all .sol
, .js
, .ts
, .json
, and .yml
files will be format-checked according to the specifications in .prettierrc
file.With
yarn prettier:write
the formatting is applied.
With
yarn lint
.sol
, .js
, and .ts
files in the subfolders are analyzed with solhint
and eslint
, respectively.
In packages/contracts
, first run
yarn install
First build the contracts and
yarn build
and generate the typechain TypeScript bindings with
yarn typechain
During development of your smart contracts, changes can result in altered typechain bindings. You can remove the outdated build- and typechain-related files with
yarn clean
which will execute yarn typechain
again. For convenience, use yarn clean && yarn build
.
To test your contracts, run
yarn test
Lint the Solidity and TypeScript code all together with
yarn lint
or with separately with
yarn lint:sol
and
yarn lint:ts
Generate the code coverage report:
yarn coverage
See the gas usage per test and average gas per method call:
REPORT_GAS=true yarn test
you can permanently enable the gas reporting by putting the REPORT_GAS=true
into the .env
file.
The deploy scripts provided in this repo should already be sufficient to deploy the first and upcoming versions of your plugin.
Deploy the contracts to the local Hardhat Network with
yarn deploy
Deploy the contracts to sepolia with
yarn deploy --network sepolia
This will also create a plugin repo for the first version (v1.1
) of your plugin.
If you want to deploy a new version of your plugin afterwards (e.g., 1.2
), simply change the VERSION
entry in the packages/contracts/plugin-settings.ts
file.
TODO
TODO
This project is licensed under AGPL-3.0-or-later.