-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
47 lines (31 loc) · 929 Bytes
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
get-contracts gcpath="../pandasia":
#!/bin/zsh
echo $gcpath
echo {{gcpath}}
CURRENT=$PWD
CONTRACTS=("Pandasia")
cd {{gcpath}}
if [[ ! -d "node_modules" ]]; then
yarn
fi
forge build
cd $CURRENT
rm -rf src/contracts
mkdir -p src/contracts
for contract in "${CONTRACTS[@]}"; do
CONTRACT_PATH={{gcpath}}/artifacts-forge/contracts/$contract.sol/$contract.json
echo $CONTRACT_PATH
CURRENT_CONTRACT="src/contracts/$contract.ts"
cp $CONTRACT_PATH src/contracts
mv src/contracts/$contract.json src/contracts/$contract.ts
sed -i '' '1,2d' $CURRENT_CONTRACT
sed -i '' "1i\
const $contract = [" $CURRENT_CONTRACT
sed -i '' '/"bytecode":/,$d' $CURRENT_CONTRACT
sed -i '' '$d' $CURRENT_CONTRACT
sed -i '' '$a\
] as const
' $CURRENT_CONTRACT
echo "" >> $CURRENT_CONTRACT
echo "export default $contract" >> $CURRENT_CONTRACT
done