Skip to content

Reading Elysium

Mine

export-abis.sh

17 lines · sha256 f09ecf51c3f094903d43b13be716d56bc9473158b675ba12a4ae2a0396cbf490 · Raw

1#!/usr/bin/env bash
2# Exports the ABI (only) of the 8 KIBBLE contracts to contracts/abi/<Name>.json.
3# Usage: ./script/export-abis.sh (runs forge build first)
4set -euo pipefail
5cd "$(dirname "$0")/.."
6forge build >/dev/null
7mkdir -p abi
8for name in KibbleToken Miner Emission Genesis Zapper Burner Oracle LpLocker; do
9 if command -v jq >/dev/null 2>&1; then
10 jq '.abi' "out/${name}.sol/${name}.json" > "abi/${name}.json"
11 else
12 node -e 'const fs=require("fs");const a=JSON.parse(fs.readFileSync(process.argv[1])).abi;fs.writeFileSync(process.argv[2],JSON.stringify(a,null,2)+"\n")' \
13 "out/${name}.sol/${name}.json" "abi/${name}.json"
14 fi
15 echo "abi/${name}.json"
16done
17