forked from aragon/osx-plugin-template-hardhat
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/use-new-sdk-version
- Loading branch information
Showing
15 changed files
with
249 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Token Voting Plugin artifacts | ||
|
||
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.3.0 | ||
|
||
### Added | ||
|
||
- First NPM release of the Plugin's ABI (release 1, build 3) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Token Voting Plugin artifacts | ||
|
||
This package contains the ABI of the TokenVoting Plugin for OSx, as well as the address of its plugin repository on each supported network. Install it with: | ||
|
||
```sh | ||
yarn add @aragon/token-voting-plugin-artifacts | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
// ABI definitions | ||
import { | ||
IMajorityVotingABI, | ||
TokenVotingABI, | ||
TokenVotingSetupABI, | ||
TokenVotingSetupZkSyncABI, | ||
VotingPowerConditionABI, | ||
GovernanceERC20ABI, | ||
GovernanceWrappedERC20ABI, | ||
IGovernanceWrappedERC20ABI | ||
} from "@aragon/token-voting-plugin-artifacts"; | ||
|
||
// Plugin Repository addresses per-network | ||
import { addresses } from "@aragon/token-voting-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/token-voting/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/token-voting-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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "@aragon/token-voting-plugin-artifacts", | ||
"author": "Aragon X", | ||
"version": "1.3.0-alpha", | ||
"license": "AGPL-3.0-or-later", | ||
"description": "The Token Voting 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.5.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/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 (ignore mocks folder) | ||
for SRC_CONTRACT_FILE in $(find $CONTRACTS_FOLDER/src -type f -name "*.sol" ! -path "*/mocks/*") | ||
do | ||
SRC_FILE_NAME=$(basename $(echo $SRC_CONTRACT_FILE)) | ||
REL_PATH=$(echo $SRC_CONTRACT_FILE | sed "s|$CONTRACTS_FOLDER/||") | ||
SRC_FILE_PATH=$CONTRACTS_FOLDER/artifacts/$REL_PATH/${SRC_FILE_NAME%".sol"}.json | ||
|
||
ABI=$(node -e "console.log(JSON.stringify(JSON.parse(fs.readFileSync(\"$SRC_FILE_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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"pluginRepo": { | ||
"mainnet":"0xb7401cD221ceAFC54093168B814Cc3d42579287f", | ||
"sepolia":"0x424F4cA6FA9c24C03f2396DF0E96057eD11CF7dF", | ||
"holesky":"0xae05Dd0359377830105B0140b2FaFC35c068d565", | ||
"devSepolia":"0x6241ad0D3f162028d2e0000f1A878DBc4F5c4aD0", | ||
"polygon":"0xae67aea0B830ed4504B36670B5Fa70c5C386Bb58", | ||
"mumbai":"0xaCa70D8c462940B839DE386BcDD4CACf745632cA", | ||
"base":"0x2532570DcFb749A7F976136CC05648ef2a0f60b0", | ||
"baseSepolia":"0x424F4cA6FA9c24C03f2396DF0E96057eD11CF7dF", | ||
"arbitrum":"0x1AeD2BEb470aeFD65B43f905Bd5371b1E4749d18", | ||
"arbitrumSepolia":"0x424F4cA6FA9c24C03f2396DF0E96057eD11CF7dF", | ||
"linea":"0x9C08F499083963F69c1D51D5e3031afC111CD8f7", | ||
"lineaSepolia":"0x0aABaD9C02005de9135f7971443f7154F42e7404", | ||
"zksync":"0xE8F4C59f83CeE31A867E61c9959533A6e95ebCB3", | ||
"zksyncSepolia":"0x1f5f8f677164AA4D9b4465A99D22e1e01dC24160" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from "./abi"; | ||
|
||
import * as addresses from "./addresses.json"; | ||
export {addresses}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES6", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"outDir": "./dist", | ||
"resolveJsonModule": true | ||
}, | ||
"include": ["src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.5.4: | ||
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== |