Skip to content

Commit

Permalink
add artifact package
Browse files Browse the repository at this point in the history
  • Loading branch information
Rekard0 committed Feb 5, 2025
1 parent 81db7a2 commit d171496
Show file tree
Hide file tree
Showing 12 changed files with 860 additions and 5 deletions.
8 changes: 7 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,9 @@ artifacts-zk
cache-zk
deployments-zk
deployments

generated

# artifacts
temp_repo
packages/artifacts/src/abis/abis.ts
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 OSx Commons 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.4.0

## Added

- Add admin plugin's contracts artifacts of version 1.2.
31 changes: 31 additions & 0 deletions packages/artifacts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Artifacts Package for Admin Plugin

This package is responsible for generating and storing ABIs for smart contracts. It checks out the specified branch, compiles the contracts, and saves the ABIs in the `src/abis/` directory. The package can then be published to NPM for use in other projects.

## Installation

Run the following command to install dependencies:
```sh
yarn install
```

## Usage
### Generate ABIs
Run:
```sh
yarn generate
```
This will:
1. Check out the `packages/contracts`.
2. Install dependencies.
3. Compile contracts using Hardhat.
4. Generate ABIs using Wagmi.
5. Save the ABIs in `src/abis/`.

## Publishing

To publish the package to NPM, run:
```sh
yarn publish --access public
```
Ensure the package version is updated in `package.json` before publishing.
32 changes: 32 additions & 0 deletions packages/artifacts/generateAbis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -e # Exit on error

# Define directories
CONTRACTS_DIR="../contracts"
GENERATED_ABIS="../contracts/generated/abis.ts"
OUTPUT_ABIS_DIR="src/abis"

# Move into contracts package and install dependencies
cd $CONTRACTS_DIR

yarn install

yarn build

yarn wagmi:generate

# Move back to artifacts package
cd -

# Ensure the output directory exists
mkdir -p "$OUTPUT_ABIS_DIR"

# Copy the generated ABIs to the output directory
if [ -f "$GENERATED_ABIS" ]; then
cp "$GENERATED_ABIS" "$OUTPUT_ABIS_DIR/abis.ts"
else
echo "Warning: generated/abis.ts not found."
fi

echo "ABI generation complete. ABIs are stored in $OUTPUT_ABIS_DIR."
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.4.0",
"license": "AGPL-3.0-or-later",
"description": "The Aragon OSx Solidity contracts ABIs",
"typings": "dist/index.d.ts",
"main": "dist/index.js",
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"generate": "bash generateAbis.sh"
},
"devDependencies": {
"typescript": "^5.5.4"
}
}
10 changes: 10 additions & 0 deletions packages/artifacts/src/addresses/addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"network": {
"mainnet": {
"pluginRepo":""
},
"polygon": {
"pluginRepo":""
}
}
}
1 change: 1 addition & 0 deletions packages/artifacts/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './abis/abis';
9 changes: 9 additions & 0 deletions packages/artifacts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"declaration": true,
"outDir": "./dist"
},
"include": ["src"]
}
Loading

0 comments on commit d171496

Please sign in to comment.