Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-data-to-proposal-actions-json
Browse files Browse the repository at this point in the history
  • Loading branch information
clauBv23 committed Feb 18, 2025
2 parents d839904 + 6bd420b commit 19a3a44
Show file tree
Hide file tree
Showing 27 changed files with 442 additions and 163 deletions.
21 changes: 17 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# GENERAL

## The network used for testing purposes
NETWORK_NAME="sepolia" # ["mainnet", "sepolia", "polygon", "baseMainnet", "arbitrum"]
NETWORK_NAME="sepolia" # ["mainnet", "sepolia", "polygon"]

## To upload the metadata for deployed contracts
PUB_PINATA_JWT=

# CONTRACTS

Expand All @@ -21,12 +24,22 @@ POLYGONSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
BASESCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
ARBISCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"

# SUBGRAPH
## Deployment addresses
# Note that addresses will be also used for testing so ensure they are valid on the network you are running the forking tests on.

## The Graph credentials
GRAPH_KEY="zzzzzzzzzzzz"
# optional, address if not provided will get it from the latest deployment on the network or from the ens registrar
# defined in the framework if it supports it. In case it is not found will create a new one.
PLUGIN_REPO_ADDRESS=0x0000000000000000000000000000000000000000
# not optional, if not provided will not be able to deploy the plugin or run the forking tests.
PLUGIN_REPO_FACTORY_ADDRESS=0x0000000000000000000000000000000000000000
# optional, only needed when a latest versions of the plugin are going to be deploy on a new network.
PLACEHOLDER_SETUP=0x0000000000000000000000000000000000000000
# not optional, if not provided will not be able to transfer the ownership of the plugin when deploying
# the plugin or running the forking tests.
MANAGEMENT_DAO_ADDRESS=0x0000000000000000000000000000000000000000

## Subgraph
GRAPH_KEY="zzzzzzzzzzzz"
SUBGRAPH_NAME="osx"
SUBGRAPH_VERSION="v1.0.0"
SUBGRAPH_NETWORK_NAME="mainnet" # ["mainnet", "sepolia", "polygon", "base", "arbitrum"]
63 changes: 63 additions & 0 deletions .github/workflows/artifacts-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish Artifacts

on:
workflow_dispatch:

jobs:
publish-artifacts-to-npm:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'

- name: Configure NPM for Scoped Package
run: |
cd packages/artifacts
SCOPE=$(jq -r '.name' package.json | cut -d'/' -f1)
echo "$SCOPE:registry=https://registry.npmjs.org/" > ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Get Version from package.json
id: get_version
run: |
cd packages/artifacts
VERSION=$(jq -r '.version' package.json)
TAG_VERSION="v$VERSION"
echo "VERSION=$TAG_VERSION" >> $GITHUB_ENV
- name: Create Git Tag
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git tag $VERSION
git push origin $VERSION
- name: Install Dependencies
run: |
cd packages/artifacts
yarn install
- name: Build Package
env:
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
run: |
cd packages/artifacts
yarn build
- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd packages/artifacts
if [[ "$VERSION" == *"-alpha"* ]]; then
npm publish --tag alpha --access public
else
npm publish --tag latest --access public
fi
4 changes: 3 additions & 1 deletion .github/workflows/contracts-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
node-version: 18

- name: 'Install the dependencies'
run: 'yarn install --frozen-lockfile'
run: 'yarn install --frozen-lockfile --ignore-scripts'

- name: 'Build the contracts'
run: 'yarn build'
Expand All @@ -37,4 +37,6 @@ jobs:
run: 'yarn coverage'
env:
NETWORK_NAME: ${{ vars.NETWORK_NAME }}
PLUGIN_REPO_FACTORY_ADDRESS: ${{ vars.PLUGIN_REPO_FACTORY_ADDRESS }}
MANAGEMENT_DAO_ADDRESS: ${{ vars.MANAGEMENT_DAO_ADDRESS }}
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
2 changes: 1 addition & 1 deletion .github/workflows/formatting-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
node-version: 18

- name: 'Install the dependencies'
run: 'yarn install --frozen-lockfile'
run: 'yarn install --frozen-lockfile --ignore-scripts'

- name: 'Check code formatting'
run: 'yarn prettier:check'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/subgraph-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
node-version: 18

- name: 'Install root dependencies'
run: 'yarn install --frozen-lockfile'
run: 'yarn install --frozen-lockfile --ignore-scripts'
working-directory: .

- name: 'Install dependencies for contracts'
run: 'yarn install --frozen-lockfile'
run: 'yarn install --frozen-lockfile --ignore-scripts'
working-directory: packages/contracts

- name: 'Install the dependencies for subgraph'
run: 'yarn install --frozen-lockfile'
run: 'yarn install --frozen-lockfile --ignore-scripts'
working-directory: packages/subgraph

- name: 'Build the subgraph'
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.coverage_artifacts
.coverage_cache
.coverage_contracts
artifacts
packages/contracts/artifacts
build
cache
coverage
Expand Down Expand Up @@ -37,3 +37,8 @@ artifacts-zk
cache-zk
deployments-zk
deployments

generated

#artifacts
packages/artifacts/src/abi.ts
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
[license]: https://opensource.org/licenses/AGPL-v3
[license-badge]: https://img.shields.io/badge/License-AGPL_v3-blue.svg

## Audit

### v1.2.0

**Halborn**: [audit report](https://github.com/aragon/osx/tree/main/audits/Halborn_AragonOSx_v1_4_Smart_Contract_Security_Assessment_Report_2025_01_03.pdf)

- Commit ID: [546cfa243a5d0726d75158db646573ca2237f570](https://github.com/aragon/admin-plugin/commit/546cfa243a5d0726d75158db646573ca2237f570)
- Started: 2024-11-18
- Finished: 2025-02-13

## Project

The root folder of the repo includes two subfolders:
Expand Down Expand Up @@ -35,7 +45,7 @@ The root folder of the repo includes two subfolders:
The root-level `package.json` file contains global `dev-dependencies` for formatting and linting. After installing the dependencies with

```sh
yarn install
yarn --ignore-scripts
```

you can run the associated [formatting](#formatting) and [linting](#linting) commands.
Expand Down Expand Up @@ -81,7 +91,7 @@ This package is located in `packages/contracts`.
### Install Dependencies

```sh
yarn install
yarn --ignore-scripts
```

### Building
Expand Down Expand Up @@ -237,7 +247,7 @@ yarn deploy:zksync --network zksyncMainnet --tags ...
In `packages/subgraph`, first run

```sh
yarn install
yarn --ignore-scripts
```

which will also run
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@aragon/admin-plugin",
"description": "A template to fork from when developing an Aragon OSx plugin",
"version": "0.0.1-alpha.1",
"license": "AGPL-3.0-or-later",
"author": {
"name": "Aragon",
Expand Down
12 changes: 12 additions & 0 deletions packages/artifacts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Aragon Admin plugin Artifacts

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.2.0

### Added

- First NPM release of the Plugin's ABI (release 1, build 2)
57 changes: 57 additions & 0 deletions packages/artifacts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Admin Plugin artifacts

This package contains the ABIs of the OSx Admin plugin, as well as the address of the plugin repository on each supported network.

## Installation

```sh
yarn add @aragon/admin-plugin-artifacts
```

## Usage

```typescript
import {
AdminSetupABI,
AdminABI
} from "@aragon/admin-plugin-artifacts";

import { addresses } from "@aragon/admin-plugin-artifacts";
```

You can also open [addresses.json](./src/addresses.json) directly.


## Development

### Building the package

Install the dependencies and generate the local ABI definitions.

```sh
yarn --ignore-scripts
yarn build
```

The `build` script will:
1. Move to `packages/contracts`.
2. Install its dependencies.
3. Compile the contracts using Hardhat.
4. Generate their ABI.
5. Extract their ABI and embed it into on `src/abi.ts`.

## Documentation

You can find all documentation regarding how to use this plugin in [Aragon's documentation here](https://docs.aragon.org/admin/1.x/index.html).

## Contributing

If you like what we're doing and would love to support, please review our `CONTRIBUTING_GUIDE.md` [here](https://github.com/aragon/admin-plugin/blob/main/CONTRIBUTIONS.md). We'd love to build with you.

## Security

If you believe you've found a security issue, we encourage you to notify us. We welcome working with you to resolve the issue promptly.

Security Contact Email: [email protected]

Please do not use the issue tracker for security issues.
22 changes: 22 additions & 0 deletions packages/artifacts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@aragon/admin-plugin-artifacts",
"author": "Aragon X",
"version": "1.2.0-alpha",
"license": "AGPL-3.0-or-later",
"description": "The Admin Plugin ABI definition",
"typings": "dist/index.d.ts",
"main": "dist/index.js",
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "yarn prepare-abi && rm -Rf dist && tsc -p tsconfig.json",
"prepare-abi": "bash prepare-abi.sh"
},
"devDependencies": {
"typescript": "^5.7.3"
}
}
38 changes: 38 additions & 0 deletions packages/artifacts/prepare-abi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# Exit on error
set -e

# Constants
CONTRACTS_FOLDER="../contracts"
TARGET_ABI_FILE="./src/abi.ts"

# Move into contracts package and install dependencies
cd $CONTRACTS_FOLDER

yarn --ignore-scripts && yarn build

# Move back to artifacts package
cd - > /dev/null

# Wipe the destination file
echo "// NOTE: Do not edit this file. It is generated automatically." > $TARGET_ABI_FILE

# Extract the abi field and create a TS file
find $CONTRACTS_FOLDER/src -type f -name "*.sol" ! -path "*/mocks/*" | while read -r SRC_CONTRACT_FILE
do
SRC_FILE_NAME=$(basename "$SRC_CONTRACT_FILE")
RELATIVE_PATH=${SRC_CONTRACT_FILE#"$CONTRACTS_FOLDER/src/"}

# Adjusting the artifact path to match the directory structure
ARTIFACT_PATH="$CONTRACTS_FOLDER/artifacts/src/${RELATIVE_PATH%".sol"}.sol/${SRC_FILE_NAME%".sol"}.json"

ABI=$(node -e "console.log(JSON.stringify(JSON.parse(fs.readFileSync(\"$ARTIFACT_PATH\").toString()).abi))")
CONTRACT_NAME=${SRC_FILE_NAME%".sol"}

echo "const ${CONTRACT_NAME}ABI = $ABI as const;" >> $TARGET_ABI_FILE
echo "export {${CONTRACT_NAME}ABI};" >> $TARGET_ABI_FILE
echo "" >> $TARGET_ABI_FILE
done

echo "ABI prepared: $TARGET_ABI_FILE"
18 changes: 18 additions & 0 deletions packages/artifacts/src/addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"pluginRepo": {
"mainnet": "0xA4371a239D08bfBA6E8894eccf8466C6323A52C3",
"sepolia": "0x152c9E28995E418870b85cbbc0AEE4e53020edb2",
"holesky": "0xC56B719Fc71D9056AbC559a0E3e6CE98Abc44a67",
"devSepolia": "0xEdA3074437375DC71007AFC9D421644656d72287",
"polygon": "0x7fF570473d0876db16A59e8F04EE7F17Ab117309",
"mumbai": "0x0DF9b15550fF39149e491dDD154b28f587e0cD16",
"base": "0x212eF339C77B3390599caB4D46222D79fAabcb5c",
"baseSepolia": "0x152c9E28995E418870b85cbbc0AEE4e53020edb2",
"arbitrum": "0x326A2aee6A8eE78D79E7E956DE60C6E452f76a8e",
"arbitrumSepolia": "0x152c9E28995E418870b85cbbc0AEE4e53020edb2",
"linea": "0x7d56667664ADf9e5aAb436629e6a789162Ad83eA",
"lineaSepolia": "0xf79F733e0D5d5e0e3037b221E8B3fd12Fb564101",
"zksync": "",
"zksyncSepolia": ""
}
}
3 changes: 3 additions & 0 deletions packages/artifacts/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './abi';
import * as addresses from "./addresses.json";
export {addresses};
11 changes: 11 additions & 0 deletions packages/artifacts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"declaration": true,
"resolveJsonModule": true,
"outDir": "./dist",
},
"include": ["src"]
}

8 changes: 8 additions & 0 deletions packages/artifacts/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


typescript@^5.7.3:
version "5.7.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e"
integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==
Loading

0 comments on commit 19a3a44

Please sign in to comment.