Skip to content

Commit

Permalink
chore: merge develop into main (#38)
Browse files Browse the repository at this point in the history
* feat: copied files from the simple-storage-example-plugin repo into package/contracts

* set monorepo package.json

* fix: CI/CD

* init subgraph

* fix: CI/CD

* feat: CI/CD improvements

* feat: cleaned devDependencies

* feat: improve CI step description

* subgraph bare bone (WIP)

* feat: add subpackages and cleaned dependencies

* feat: temporary readme

* feat: move packages

* fix: wrong path

* add post install

* plugin repo only

* switch to osx-ethers

* fix missing dir issue

* make it build

* build 1

* chore: cleaning

* feat: deleted contracts-versions

* feat: refactoring

* feat: refactoring

* feat: improvements

* feat: refactoring

* fix: linting and prettier

* feat: print more infos, remove unused function

* fix: print more info

* More infos

* Renaming

* More info

* fix: test failing because of wrong default test network

* feature: add subgraph workflow

* fix: rename flows

* fix: adapt triggers

* fix: install packages first

* fix: triggers

* feat: one .env file

* fix: .env paths

* fix: remove redundant checkout

* debug: print info

* debug: attempt fix

* fix: missing env variable

* fix: triggers

* Removed summaries

* WIP

* improvements

* fix: path

* fix: empty json handling

* fix: lint warnings

* add psp and pluginRepos related mapping WIP

* refactor PSP handlers (WIP)

* refactor PSP handlers (WIP)

* refactor PSP handlers (WIP)

* refactor PSP handlers (WIP)

* clean up

* create common id functions

* clean up

* Feature: Add js client (#2)

* add dummy js-client

* update yarn.lock

* update package.json

* fix formatting

* fix comments and add js-client github actions

* update js-client test workflow

* fix test workflow

* fix lint

* update workflow

* wip

* fix comments and add implementation

* update yarn lock and remove docs workflow

* Update packages/contracts-ethers/package.json

Co-authored-by: Jør∂¡ <4456749+brickpop@users.noreply.github.com>

* Update packages/js-client/src/context.ts

Co-authored-by: Jør∂¡ <4456749+brickpop@users.noreply.github.com>

* Update packages/js-client/test/unit/context.test.ts

Co-authored-by: Jør∂¡ <4456749+brickpop@users.noreply.github.com>

* add tests

* fix comments

* fix comments

* update client-common version

* fix lint command

* Update packages/js-client/src/internal/modules/methods.ts

Co-authored-by: Jør∂¡ <4456749+brickpop@users.noreply.github.com>

* update size limit

* update gh actions

* update gh actions

* fix gh actions

* add build command

* update gh actions

* fix gh action

* fix lint

* fix lint

* ignore js-client tests

* minor fixes

---------

Co-authored-by: Jør∂¡ <4456749+brickpop@users.noreply.github.com>

* fix subgraph build

* fix lint

* map 1 event

* chore: bump package versions

* feat: added event, tests, and improved signer, renamed plugin

* fix: linting and formatting errors

* feature: support base goerli network

* Add missing migration import for setup processing

* feat: added sepolia and base support and fix IPFS returning empty strings (#10)

* feat: added sepolia and base support

* fix: replaced outdated IPFS server url

* fix: empty return value

* OS-593: refactors repo for linting and linting during workflows (#11)

* chore(OS-593): Removes .editorconfig from project root

Prettier uses its .prettierrc as a first priority to configure the
formatter

* chore(OS-593): Updates node to v18 in gitpod

* chore(OS-593): same network for subgraph and contracts

Use the same network for subgraph and contracts in the .env.example file

* chore(OS-593): configure vscode editor correctly

configures vscode to use fixed a tabsize of 4 and adds commitizen
extentions into recommendations

* chore(OS-593): reconfigures linting system to start from the root

all linting commands have to be run from the root, then eslint merges
the configs per package and lints those

* build(OS-593): refactors package.json and dependency handling

moves all linting commands to the root of the repo for proper config
merging

* chore(OS-593): adds solidity visual developer as recommmended

we recommend to use the solidity visual auditor extension for
development

* style(OS-593): fixes linting issues

fixes some linting issues in contracts and js-client

* ci(OS-593): refactor workflows and include linting

refactors workflows to be easier and includes formatting and linting in
all workflows

* style(OS-593): apply prettier formatting

* ci(OS-593): lint all packages indiviually

lints the packages individually and adds step summaries for important
steps

* ci(OS-593): remove prettier output from summary

prettiers output isn't really working with step summary

* ci(OS-593): uses now node 18 in workflows

* chore(OS-593): fix typo in formatting-linting.yml

* docs: added readme (#13)

* docs: added readme

* docs: fix typos

* Os 782 remove the contracts ethers and do rollup in mini sdk (#12)

* refactor(OS-782): removes contracts-ethers package

Removes a now unecessary contracts-ethers package. js-client creates its
own typechain now

BREAKING CHANGE: Removal of contracts-ethers

* refactor(OS-782): js-client generates typescript

js-client doesn't depend on contracts-ethers anymore and creates the
typechain typings during its own build

* test(OS-782): ganache replacment, optimizations, use native jest

replaces depricated ganache setup with hardhat for testing, removes
contract interactions where they aren't necessary, upgrades jest by not
using tsdx for testing

* ci(OS-782): fixes js-client publish and tests workflows

corrects reusable worfklow in js-client publishing workflow, adapts
js-client-tests to use the new typechain integration properly

* build(OS-782): removes contracts-ethers linting command

* chore(OS-782): applies prettier formatting

* refactor: renamed and refactored files

* refactor: skip repo creation if ENS name is already taken

* docs: added usage guide and improved comments

* ci: fix workflow by removing outdated lint

* ci: formatting & linting on every push

* docs: improve migration file comment

* ci: fix linting workflow

* build: use the same typescript version everywhere

* docs: improve usage guide

* docs: improved usage guide

* OS-754 : re-organize entity relations & add testing (#15)

* re organize entity relations

* add testing for OSx & Plugin

* remove extra files

* Update Satsuma deploy node url

* Clean up

* fix lint

* fix subgraph scripts

* fix subgraph test flow

* ci: fixed linting work flow

* add comment

* OSx: Remove redundant code

* flow: build contracts for subgraph testing

* flow: build root for subgraph testing

* flow: remove comments

* subgraph: update test constants and comments

* subgraph: refactor & add comments

* ci: skip js-client linting

* docs: fix typo

---------

Co-authored-by: Michael Heuer <20623991+Michael-A-Heuer@users.noreply.github.com>

* fix(js-client): exclude dist from tsconfig.json (#20)

* fix(js-client): exclude dist from tsconfig.json

not excluding dist would result in an error trying to run tests after
the client has been built

* ci(js-client): fix missing env in build

* chore: added arbitrum and arbitrumGoerli (#18)

* chore: added arbitrum and arbitrumGoerli

* ci: fix ci pipeline by adding typescript dev dependency

* ci: fix pipeline by removing leftover contracts-ethers lint

* ci: do a global lint on every push

* fix: etherscan arbitrum name

* ci: skip js-client linting

* build: add cross-env to fix subgraph ci

* refactor: add event explicitly

* build(js-client): replaces tsdx with dts-cli (#21)

* build(js-client): replace tsdx with dts-cli
deps(js-client): update to typescript 5.2.2
deps(root): update eslint packages

* lint(js-client): fixes linting errors

* test(js-client): fixes jest-environment import

* style: apply prettier changes

* chore: bump OZ dependency (#22)

* docs: add readme and usage guide

* OS-888 fix: Import Repo address from plugin-info (#26)

* fix: Import repo address from plugin-info

* fix: fix typo

* update plugin-info.json location

* update script

* update gitignore

* update osx-ethers to version 1.3.0

* Update .gitignore

Co-authored-by: Michael Heuer <20623991+Michael-A-Heuer@users.noreply.github.com>

* fix import

* remove alias import

---------

Co-authored-by: Jose Manuel Mariñas Bascoy <josemarinasbascoy@gmail.com>
Co-authored-by: josemarinas <36479864+josemarinas@users.noreply.github.com>
Co-authored-by: Michael Heuer <20623991+Michael-A-Heuer@users.noreply.github.com>

* build: clean-up of dependecy and commands  (#19)

* build: remove docker-related commands

* build: remove local subgraphs commands

* chore: bump dependencies

* build: bump OZ version and fix unmet dependencies

* Feature: Add Subgraph step-by-step guide (#25)

* add step-by-step guide

* fiux lintint

* fix comments

* fix lint

* fix: Remove individual usage

* fix: update .env.example to include Sepolia

* docs: Improve usage guide

* fix: replace arbitrumGoerli and baseGoerli with the sepolia replacements

* fix: improve usage format

* Apply suggestions from code review

Co-authored-by: Michael Heuer <20623991+Michael-A-Heuer@users.noreply.github.com>

* feat: improve usage guide file structure & address comments

* fix: remove redundant titles

* fix: link dependencies in the usage guide

* fix: fix typo

* Apply suggestions from code review

Co-authored-by: Michael Heuer <20623991+Michael-A-Heuer@users.noreply.github.com>

---------

Co-authored-by: Rekard0 <5880388+Rekard0@users.noreply.github.com>
Co-authored-by: Michael Heuer <20623991+Michael-A-Heuer@users.noreply.github.com>

* feat: use `osx-commons-contracts` and `osx-commons-configs` (#28)

* build: use ts 5.2.2

* refactor: use osx-commons

* refactor: use osx-commons

* build: use osx-commons-sdk

* build: use osx-commons-sdk

* refactor: contract improvements

* build: print coverage report

* chore: bump osx-commons-sdk version

* feat: use the latest osx-commons-contracts

* refactor: use osx-commons-configs and deploy script refactor

* build: subgraph fix

* docs: improve .env example

* style: fix prettier

* build: use osx-commons

* chore: bump subgraph osx-ethers dependency

* chore: remove todo

* test: remove redundant expect

* fix: use unknown instead of any

* fix: imports

* fix: wrong type

* fix: import

* fix: import

* feat: use typechain binding

* refactor: deploy script simplification

* refactor: findPluginRepo and domain

* refactor: improve code, comments, and tests

* refactor: improved helpers

* style: fix linting issues

* chore: remove todos

* revert: deletion of hashHelpers

* feat: catch errors properly

* refactor: folder structure

* refactor: help gh to track files

* refactor: help gh to track files

* refactor: improve folder structure (#30)

* build: remove js client (#31)

* ci: clean GH flows and remove gitpod (#32)

* ci: improve flows

* style: remove unused commitizen config file

* build: update yarn.lock

* docs: update README.md (#33)

* docs: update README.md

* doc: improve README and USAGE_GUIDE

* doc: minor improvement

* feat: use commons subgraph (#29)

* use commons subgraph

* update events folder structure

* fix comments

* fix tests

* build: update yarn.lock

---------

Co-authored-by: Michael Heuer <michael.heuer@rwth-aachen.de>

* build: improve  package.json files (#34)

* feat: improvements surfaced from the admin plugin (#36)

* feat: various improvements that surfaced from the admin plugin

* build: remove duplicated dependency

* ci: use network name env var

* style: throw errors for unsupported networks or missing deployments

---------

Co-authored-by: Rekard0 <5880388+Rekard0@users.noreply.github.com>
Co-authored-by: josemarinas <36479864+josemarinas@users.noreply.github.com>
Co-authored-by: Jør∂¡ <4456749+brickpop@users.noreply.github.com>
Co-authored-by: Jør∂¡ <itsbrickpop@gmail.com>
Co-authored-by: Mathias Scherer <mathias@aragon.org>
Co-authored-by: Aaron Abu Usama <50079365+pythonpete32@users.noreply.github.com>
Co-authored-by: Jose Manuel Mariñas Bascoy <josemarinasbascoy@gmail.com>
  • Loading branch information
8 people committed Feb 28, 2024
1 parent 5f69964 commit 1b4ff11
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 113 deletions.
1 change: 1 addition & 0 deletions .github/workflows/contracts-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ jobs:
- name: 'Test the contracts and generate the coverage report'
run: 'yarn coverage'
env:
NETWORK_NAME: ${{ vars.NETWORK_NAME }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aragon/osx-plugin-template",
"description": "A template to fork from when developing an Aragon OSx plugin",
"version": "0.0.1-alpha.0",
"version": "0.0.1-alpha.1",
"license": "AGPL-3.0-or-later",
"author": {
"name": "Aragon",
Expand Down
6 changes: 5 additions & 1 deletion packages/contracts/deploy/00_info/01_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
isLocal,
} from '../../utils/helpers';
import {getNetworkByNameOrAlias} from '@aragon/osx-commons-configs';
import {UnsupportedNetworkError} from '@aragon/osx-commons-sdk';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import path from 'path';
Expand All @@ -26,7 +27,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

// Fork the network provided in the `.env` file
const networkConfig = getNetworkByNameOrAlias(productionNetworkName)!;
const networkConfig = getNetworkByNameOrAlias(productionNetworkName);
if (networkConfig === null) {
throw new UnsupportedNetworkError(productionNetworkName);
}
await hre.network.provider.request({
method: 'hardhat_reset',
params: [
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/deploy/10_create_repo/11_create_repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

console.log(
`'${pluginEnsDomain(hre)}' PluginRepo deployed at: ${pluginRepo.address}.`
`PluginRepo '${pluginEnsDomain(hre)}' deployed at '${pluginRepo.address}'.`
);

hre.aragonToVerifyContracts.push({
Expand Down
6 changes: 5 additions & 1 deletion packages/contracts/deploy/20_new_version/21_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deploy} = deployments;
const {deployer} = await getNamedAccounts();

await deploy(PLUGIN_SETUP_CONTRACT_NAME, {
const res = await deploy(PLUGIN_SETUP_CONTRACT_NAME, {
from: deployer,
args: [],
log: true,
});

console.log(
`Deployed '${PLUGIN_SETUP_CONTRACT_NAME}' contract at '${res.address}'`
);
};

export default func;
Expand Down
31 changes: 24 additions & 7 deletions packages/contracts/deploy/30_upgrade_repo/31_upgrade_repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import {
getLatestNetworkDeployment,
getNetworkNameByAlias,
} from '@aragon/osx-commons-configs';
import {PLUGIN_REPO_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {
PLUGIN_REPO_PERMISSIONS,
UnsupportedNetworkError,
} from '@aragon/osx-commons-sdk';
import {PluginRepo__factory} from '@aragon/osx-ethers';
import {BytesLike} from 'ethers';
import {DeployFunction} from 'hardhat-deploy/types';
Expand All @@ -15,6 +18,14 @@ type SemVer = [number, number, number];
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const [deployer] = await hre.ethers.getSigners();
const productionNetworkName: string = getProductionNetworkName(hre);
const network = getNetworkNameByAlias(productionNetworkName);
if (network === null) {
throw new UnsupportedNetworkError(productionNetworkName);
}
const networkDeployments = getLatestNetworkDeployment(network);
if (networkDeployments === null) {
throw `Deployments are not available on network ${network}.`;
}

// Get PluginRepo
const {pluginRepo, ensDomain} = await findPluginRepo(hre);
Expand All @@ -28,8 +39,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// Get the latest `PluginRepo` implementation as the upgrade target
const latestPluginRepoImplementation = PluginRepo__factory.connect(
getLatestNetworkDeployment(getNetworkNameByAlias(productionNetworkName)!)!
.PluginRepoBase.address,
networkDeployments.PluginRepoBase.address,
deployer
);

Expand All @@ -53,11 +63,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// Re-initialization will happen through a call to `function initializeFrom(uint8[3] calldata _previousProtocolVersion, bytes calldata _initData)`
// that Aragon might add to the `PluginRepo` contract once it's required.
/*
// Define the `initData` arguments that
// Define the `_initData` arguments
const initData: BytesLike[] = [];
// Encode the call to `function initializeFrom(uint8[3] calldata _previousProtocolVersion, bytes calldata _initData)` with `initData`
const initializeFromCalldata =
newPluginRepoImplementation.interface.encodeFunctionData('initializeFrom', [
latestPluginRepoImplementation.interface.encodeFunctionData('initializeFrom', [
current,
initData,
]);
Expand Down Expand Up @@ -102,11 +112,18 @@ func.skip = async (hre: HardhatRuntimeEnvironment) => {

const [deployer] = await hre.ethers.getSigners();
const productionNetworkName: string = getProductionNetworkName(hre);
const network = getNetworkNameByAlias(productionNetworkName);
if (network === null) {
throw new UnsupportedNetworkError(productionNetworkName);
}
const networkDeployments = getLatestNetworkDeployment(network);
if (networkDeployments === null) {
throw `Deployments are not available on network ${network}.`;
}

// Get the latest `PluginRepo` implementation as the upgrade target
const latestPluginRepoImplementation = PluginRepo__factory.connect(
getLatestNetworkDeployment(getNetworkNameByAlias(productionNetworkName)!)!
.PluginRepoBase.address,
networkDeployments.PluginRepoBase.address,
deployer
);

Expand Down
53 changes: 35 additions & 18 deletions packages/contracts/test/10_unit-testing/12_plugin-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type FixtureResult = {
alice: SignerWithAddress;
bob: SignerWithAddress;
pluginSetup: MyPluginSetup;
prepareInstallationInputs: string;
prepareUninstallationInputs: string;
daoMock: DAOMock;
};

Expand All @@ -32,24 +34,36 @@ async function fixture(): Promise<FixtureResult> {
const daoMock = await new DAOMock__factory(deployer).deploy();
const pluginSetup = await new MyPluginSetup__factory(deployer).deploy();

return {deployer, alice, bob, pluginSetup, daoMock};
const prepareInstallationInputs = ethers.utils.defaultAbiCoder.encode(
getNamedTypesFromMetadata(
buildMetadata.pluginSetup.prepareInstallation.inputs
),
[defaultInitData.number]
);

const prepareUninstallationInputs = ethers.utils.defaultAbiCoder.encode(
getNamedTypesFromMetadata(
buildMetadata.pluginSetup.prepareUninstallation.inputs
),
[]
);

return {
deployer,
alice,
bob,
pluginSetup,
prepareInstallationInputs,
prepareUninstallationInputs,
daoMock,
};
}

describe(PLUGIN_SETUP_CONTRACT_NAME, function () {
describe('prepareInstallation', async () => {
let initData: string;

before(async () => {
initData = ethers.utils.defaultAbiCoder.encode(
getNamedTypesFromMetadata(
buildMetadata.pluginSetup.prepareInstallation.inputs
),
[defaultInitData.number]
);
});

it('returns the plugin, helpers, and permissions', async () => {
const {deployer, pluginSetup, daoMock} = await loadFixture(fixture);
const {deployer, pluginSetup, prepareInstallationInputs, daoMock} =
await loadFixture(fixture);

const nonce = await ethers.provider.getTransactionCount(
pluginSetup.address
Expand All @@ -64,7 +78,7 @@ describe(PLUGIN_SETUP_CONTRACT_NAME, function () {
preparedSetupData: {helpers, permissions},
} = await pluginSetup.callStatic.prepareInstallation(
daoMock.address,
initData
prepareInstallationInputs
);

expect(plugin).to.be.equal(anticipatedPluginAddress);
Expand All @@ -80,7 +94,10 @@ describe(PLUGIN_SETUP_CONTRACT_NAME, function () {
],
]);

await pluginSetup.prepareInstallation(daoMock.address, initData);
await pluginSetup.prepareInstallation(
daoMock.address,
prepareInstallationInputs
);
const myPlugin = new MyPlugin__factory(deployer).attach(plugin);

// initialization is correct
Expand All @@ -91,17 +108,17 @@ describe(PLUGIN_SETUP_CONTRACT_NAME, function () {

describe('prepareUninstallation', async () => {
it('returns the permissions', async () => {
const {pluginSetup, daoMock} = await loadFixture(fixture);
const {pluginSetup, daoMock, prepareUninstallationInputs} =
await loadFixture(fixture);

const dummyAddr = ADDRESS.ZERO;
const emptyData = '0x';

const permissions = await pluginSetup.callStatic.prepareUninstallation(
daoMock.address,
{
plugin: dummyAddr,
currentHelpers: [],
data: emptyData,
data: prepareUninstallationInputs,
}
);

Expand Down
34 changes: 22 additions & 12 deletions packages/contracts/test/20_integration-testing/21_deployment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {METADATA} from '../../plugin-settings';
import {METADATA, VERSION} from '../../plugin-settings';
import {getProductionNetworkName, findPluginRepo} from '../../utils/helpers';
import {
getLatestNetworkDeployment,
Expand All @@ -8,6 +8,7 @@ import {
DAO_PERMISSIONS,
PERMISSION_MANAGER_FLAGS,
PLUGIN_REPO_PERMISSIONS,
UnsupportedNetworkError,
toHex,
uploadToIPFS,
} from '@aragon/osx-commons-sdk';
Expand Down Expand Up @@ -66,13 +67,13 @@ describe(`Deployment on network '${productionNetworkName}'`, function () {
const {pluginRepo} = await loadFixture(fixture);

await pluginRepo['getVersion((uint8,uint16))']({
release: 1,
build: 1,
release: VERSION.release,
build: VERSION.build,
});

const results = await pluginRepo['getVersion((uint8,uint16))']({
release: 1,
build: 1,
release: VERSION.release,
build: VERSION.build,
});

const buildMetadataURI = `ipfs://${await uploadToIPFS(
Expand All @@ -97,17 +98,26 @@ async function fixture(): Promise<FixtureResult> {

const [deployer] = await ethers.getSigners();

// Plugin repo registry
const pluginRepoRegistry = PluginRepoRegistry__factory.connect(
getLatestNetworkDeployment(getNetworkNameByAlias(productionNetworkName)!)!
.PluginRepoRegistryProxy.address,
deployer
);

// Plugin Repo
const {pluginRepo, ensDomain} = await findPluginRepo(env);
if (pluginRepo === null) {
throw `PluginRepo '${ensDomain}' does not exist yet.`;
}

const network = getNetworkNameByAlias(productionNetworkName);
if (network === null) {
throw new UnsupportedNetworkError(productionNetworkName);
}
const networkDeployments = getLatestNetworkDeployment(network);
if (networkDeployments === null) {
throw `Deployments are not available on network ${network}.`;
}

// Plugin repo registry
const pluginRepoRegistry = PluginRepoRegistry__factory.connect(
networkDeployments.PluginRepoRegistryProxy.address,
deployer
);

return {deployer, pluginRepo, pluginRepoRegistry};
}
Loading

0 comments on commit 1b4ff11

Please sign in to comment.