aragon / admin-plugin-old

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Aragon OSX Plugin Template Hardhat License: AGPL v3

Quickstart

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

Project

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

Formatting

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.

Linting

With

yarn lint

.sol, .js, and .ts files in the subfolders are analyzed with solhint and eslint, respectively.

Contracts

In packages/contracts, first run

yarn install

Building

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.

Testing

To test your contracts, run

yarn test

Linting

Lint the Solidity and TypeScript code all together with

yarn lint

or with separately with

yarn lint:sol

and

yarn lint:ts

Coverage

Generate the code coverage report:

yarn coverage

Gas Report

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.

Deployment

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.

Subgraph

TODO

JS Client

TODO

License

This project is licensed under AGPL-3.0-or-later.

About

License:GNU Affero General Public License v3.0


Languages

Language:TypeScript 94.9%Language:Solidity 3.0%Language:Shell 1.6%Language:JavaScript 0.4%