Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Refactor installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbennett committed Jun 11, 2020
1 parent 61aa7ad commit 043daf8
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env bash
set -e

CWD=`dirname $0`
CONTRACTS=$CWD/../packages/dai-plugin-governance/contracts
SOURCE=${1:-$CWD/../node_modules/@makerdao/testchain}
CONTRACTS=$GOVERNANCE/contracts

CHIEF=`jq ".MCD_ADM" "$SOURCE/out/addresses-mcd.json"`
jq ".CHIEF=$CHIEF" $CONTRACTS/addresses/testnet.json > testnet.tmp && mv testnet.tmp $CONTRACTS/addresses/testnet.json
Expand Down
11 changes: 2 additions & 9 deletions packages/dai-plugin-mcd/scripts/install-testchain-outputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ set -e

# TODO take the source directory as a parameter

CWD=`dirname $0`
CONTRACTS=$CWD/../packages/dai-plugin-mcd/contracts
SOURCE=${1:-$CWD/../node_modules/@makerdao/testchain}

function jq_inplace {
TMP=$(mktemp)
jq "$1" > $TMP && mv $TMP "$2"
}
CONTRACTS=$MCD/contracts

for file in $SOURCE/out/mcd/*.abi; do
cp $file $CONTRACTS/abis/$(basename $file .abi).json
Expand All @@ -21,7 +14,7 @@ cp $SOURCE/out/addresses-mcd.json $PACKAGE_ADDRESSES

# These contracts are no longer supported, but dummy addresses
# must still be set to prevent errors when fetching event history
DEPRECATED_CONTRACTS=$CWD/../packages/dai-plugin-mcd/test/deprecatedContracts.json
DEPRECATED_CONTRACTS=$MCD/test/contracts/deprecatedContracts.json
MIGRATION=$(cat $DEPRECATED_CONTRACTS | jq '.MIGRATION')
MCD_JOIN_SAI=$(cat $DEPRECATED_CONTRACTS | jq '.MCD_JOIN_SAI')
cat $PACKAGE_ADDRESSES | jq_inplace ".MIGRATION = $(echo $MIGRATION)" $PACKAGE_ADDRESSES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ set -e

# TODO take the source directory as a parameter

CWD=`dirname $0`
CONTRACTS=$CWD/../packages/dai-plugin-migrations/contracts
SOURCE=${1:-$CWD/../node_modules/@makerdao/testchain}
CONTRACTS=$MIGRATIONS/contracts

# Relevant contracts from SCD:
for CONTRACT in "SAI_TUB","SaiTub" "REDEEMER","Redeemer" "OLD_MKR","DSToken" "OLD_CHIEF","DSChief" "SAI_CAGEFREE","CageFree" "OLD_VOTE_PROXY_FACTORY","VoteProxyFactory"
Expand Down
9 changes: 1 addition & 8 deletions packages/dai-plugin-scd/scripts/install-testchain-outputs.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
#!/usr/bin/env bash
set -e

CWD=`dirname $0`
CONTRACTS=$CWD/../packages/dai-plugin-scd/contracts
SOURCE=${1:-$CWD/../node_modules/@makerdao/testchain}

function jq_inplace {
TMP=$(mktemp)
jq "$1" > $TMP && mv $TMP "$2"
}
CONTRACTS=$SCD/contracts

for file in $SOURCE/out/*.abi; do
cp $file $CONTRACTS/abis/$(basename $file .abi).json
Expand Down
9 changes: 1 addition & 8 deletions packages/dai/scripts/install-testchain-outputs.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
#!/usr/bin/env bash
set -e

CWD=`dirname $0`
CONTRACTS=$CWD/../packages/dai/contracts
SOURCE=${1:-$CWD/../node_modules/@makerdao/testchain}

function jq_inplace {
TMP=$(mktemp)
jq "$1" > $TMP && mv $TMP "$2"
}
CONTRACTS=$DAI/contracts

for file in $SOURCE/out/*.abi; do
cp $file $CONTRACTS/abis/$(basename $file .abi).json
Expand Down
22 changes: 17 additions & 5 deletions scripts/install-testchain-outputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@
set -e

CWD=`dirname $0`
SOURCE=${1:-$CWD/../node_modules/@makerdao/testchain}

. $CWD/../packages/dai-plugin-mcd/scripts/install-testchain-outputs.sh
. $CWD/../packages/dai-plugin-scd/scripts/install-testchain-outputs.sh
. $CWD/../packages/dai/scripts/install-testchain-outputs.sh
. $CWD/../packages/dai-plugin-migrations/scripts/install-testchain-outputs.sh
. $CWD/../packages/dai-plugin-governance/scripts/install-testchain-outputs.sh
function jq_inplace {
TMP=$(mktemp)
jq "$1" > $TMP && mv $TMP "$2"
}

DAI=$CWD/../packages/dai
MCD=$CWD/../packages/dai-plugin-mcd
SCD=$CWD/../packages/dai-plugin-scd
MIGRATIONS=$CWD/../packages/dai-plugin-migrations
GOVERNANCE=$CWD/../packages/dai-plugin-governance

. $MCD/scripts/install-testchain-outputs.sh
. $SCD/scripts/install-testchain-outputs.sh
. $DAI/scripts/install-testchain-outputs.sh
. $MIGRATIONS/scripts/install-testchain-outputs.sh
. $GOVERNANCE/scripts/install-testchain-outputs.sh

0 comments on commit 043daf8

Please sign in to comment.