Skip to content

Commit

Permalink
Merge branch 'feat/create-artifact-package' of github.com:aragon/admi…
Browse files Browse the repository at this point in the history
…n-plugin into feat/create-artifact-package
  • Loading branch information
brickpop committed Feb 11, 2025
2 parents 75de270 + eecd147 commit f334aa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/artifacts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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
## v1.2.0

### Added

Expand Down
11 changes: 7 additions & 4 deletions packages/artifacts/prepare-abi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ cd - > /dev/null
echo "// NOTE: Do not edit this file. It is generated automatically and it will be eventually wiped." > $TARGET_ABI_FILE

# Extract the abi field and create a TS file
for SRC_CONTRACT_FILE in $(ls $CONTRACTS_FOLDER/src/*.sol )
find $CONTRACTS_FOLDER/src -type f -name "*.sol" ! -path "*/mocks/*" | while read -r SRC_CONTRACT_FILE
do
SRC_FILE_NAME=$(basename $(echo $SRC_CONTRACT_FILE))
SRC_FILE_PATH=$CONTRACTS_FOLDER/artifacts/src/$SRC_FILE_NAME/${SRC_FILE_NAME%".sol"}.json
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(\"$SRC_FILE_PATH\").toString()).abi))")
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
Expand Down

0 comments on commit f334aa9

Please sign in to comment.