Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Adapt new dapptools + fix some shellcheck issues + export a json file…
Browse files Browse the repository at this point in the history
… with addresses
  • Loading branch information
gbalabasquer committed Jul 15, 2019
1 parent 94c891d commit 4c8ac97
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/out
load-env*
load-fab*
addresses.json
94 changes: 64 additions & 30 deletions bin/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,52 @@ export SOLC_FLAGS=${SOLC_FLAGS:-"--optimize"}
export ETH_GAS=${ETH_GAS:-"4500000"}
export ETH_FROM=${ETH_FROM:-$(seth rpc eth_coinbase)}

dapp --use solc:0.4.25 build
dapp --use solc:0.4.25 build --extract

(test -z $GEM_FAB || test -z $VOX_FAB || test -z $TUB_FAB || test -z $TAP_FAB || test -z $TOP_FAB || test -z $MOM_FAB || test -z $DAD_FAB) && exit 1
# shellcheck disable=SC2153
{ test -z "$GEM_FAB" || test -z "$VOX_FAB" || test -z "$TUB_FAB" || \
test -z "$TAP_FAB" || test -z "$TOP_FAB" || test -z "$MOM_FAB" || \
test -z "$DAD_FAB"; } && \
exit 1

export SETH_ASYNC=yes
test -z $SAI_GEM && GEMtx=$(dapp create DSToken $(seth --to-bytes32 $(seth --from-ascii 'ETH')))
test -z $SAI_GOV && GOVtx=$(dapp create DSToken $(seth --to-bytes32 $(seth --from-ascii 'GOV')))
test -z $SAI_PIP && PIPtx=$(dapp create DSValue)
test -z $SAI_PEP && PEPtx=$(dapp create DSValue)
test -z "$SAI_GEM" && GEMtx=$(dapp create DSToken "$(seth --to-bytes32 "$(seth --from-ascii 'ETH')")")
test -z "$SAI_GOV" && GOVtx=$(dapp create DSToken "$(seth --to-bytes32 "$(seth --from-ascii 'GOV')")")
test -z "$SAI_PIP" && PIPtx=$(dapp create DSValue)
test -z "$SAI_PEP" && PEPtx=$(dapp create DSValue)
export SETH_ASYNC=no
test -z $SAI_GEM && SAI_GEM=$(seth receipt $GEMtx contractAddress)
test -z $SAI_GOV && SAI_GOV=$(seth receipt $GOVtx contractAddress)
test -z $SAI_PIP && SAI_PIP=$(seth receipt $PIPtx contractAddress)
test -z $SAI_PEP && SAI_PEP=$(seth receipt $PEPtx contractAddress)
test -z $SAI_PIT && SAI_PIT="0x0000000000000000000000000000000000000123"
test -z "$SAI_GEM" && SAI_GEM=$(seth receipt "$GEMtx" contractAddress)
test -z "$SAI_GOV" && SAI_GOV=$(seth receipt "$GOVtx" contractAddress)
test -z "$SAI_PIP" && SAI_PIP=$(seth receipt "$PIPtx" contractAddress)
test -z "$SAI_PEP" && SAI_PEP=$(seth receipt "$PEPtx" contractAddress)
test -z "$SAI_PIT" && SAI_PIT="0x0000000000000000000000000000000000000123"

DAI_FAB=$(dapp create DaiFab $GEM_FAB $VOX_FAB $TUB_FAB $TAP_FAB $TOP_FAB $MOM_FAB $DAD_FAB)
DAI_FAB=$(dapp create DaiFab "$GEM_FAB" "$VOX_FAB" "$TUB_FAB" "$TAP_FAB" "$TOP_FAB" "$MOM_FAB" "$DAD_FAB")

if [ -z $SAI_ADM ]
if [ -z "$SAI_ADM" ]
then
SAI_ADM=$(dapp create DSRoles)
seth send $SAI_ADM 'setRootUser(address,bool)' $ETH_FROM true
seth send "$SAI_ADM" 'setRootUser(address,bool)' "$ETH_FROM" true
fi

seth send $DAI_FAB 'makeTokens()'
seth send $DAI_FAB 'makeVoxTub(address,address,address,address,address)' $SAI_GEM $SAI_GOV $SAI_PIP $SAI_PEP $SAI_PIT
seth send $DAI_FAB 'makeTapTop()'
seth send $DAI_FAB 'configParams()'
seth send $DAI_FAB 'verifyParams()'
seth send $DAI_FAB 'configAuth(address)' $SAI_ADM
seth send "$DAI_FAB" 'makeTokens()'
seth send "$DAI_FAB" 'makeVoxTub(address,address,address,address,address)' "$SAI_GEM" "$SAI_GOV" "$SAI_PIP" "$SAI_PEP" "$SAI_PIT"
seth send "$DAI_FAB" 'makeTapTop()'
seth send "$DAI_FAB" 'configParams()'
seth send "$DAI_FAB" 'verifyParams()'
seth send "$DAI_FAB" 'configAuth(address)' "$SAI_ADM"

cat > load-env-$(seth chain) << EOF
SAI_SAI=0x$(seth call "$DAI_FAB" 'sai()(address)')
SAI_SIN=0x$(seth call "$DAI_FAB" 'sin()(address)')
SAI_SKR=0x$(seth call "$DAI_FAB" 'skr()(address)')
SAI_DAD=0x$(seth call "$DAI_FAB" 'dad()(address)')
SAI_MOM=0x$(seth call "$DAI_FAB" 'mom()(address)')
SAI_VOX=0x$(seth call "$DAI_FAB" 'vox()(address)')
SAI_TUB=0x$(seth call "$DAI_FAB" 'tub()(address)')
SAI_TAP=0x$(seth call "$DAI_FAB" 'tap()(address)')
SAI_TOP=0x$(seth call "$DAI_FAB" 'top()(address)')

cat > "load-env-$(seth chain)" << EOF
#!/bin/bash
# sai deployment on $(seth chain) from $(git rev-parse HEAD)
Expand All @@ -48,13 +62,33 @@ export SAI_PIP=$SAI_PIP
export SAI_PEP=$SAI_PEP
export SAI_PIT=$SAI_PIT
export SAI_ADM=$SAI_ADM
export SAI_SAI=0x$(seth call $DAI_FAB 'sai()(address)')
export SAI_SIN=0x$(seth call $DAI_FAB 'sin()(address)')
export SAI_SKR=0x$(seth call $DAI_FAB 'skr()(address)')
export SAI_DAD=0x$(seth call $DAI_FAB 'dad()(address)')
export SAI_MOM=0x$(seth call $DAI_FAB 'mom()(address)')
export SAI_VOX=0x$(seth call $DAI_FAB 'vox()(address)')
export SAI_TUB=0x$(seth call $DAI_FAB 'tub()(address)')
export SAI_TAP=0x$(seth call $DAI_FAB 'tap()(address)')
export SAI_TOP=0x$(seth call $DAI_FAB 'top()(address)')
export SAI_SAI=$SAI_SAI
export SAI_SIN=$SAI_SIN
export SAI_SKR=$SAI_SKR
export SAI_DAD=$SAI_DAD
export SAI_MOM=$SAI_MOM
export SAI_VOX=$SAI_VOX
export SAI_TUB=$SAI_TUB
export SAI_TAP=$SAI_TAP
export SAI_TOP=$SAI_TOP
EOF

cat > addresses.json << EOF
{
"SAI_GEM": "$SAI_GEM",
"SAI_GOV": "$SAI_GOV",
"SAI_PIP": "$SAI_PIP",
"SAI_PEP": "$SAI_PEP",
"SAI_PIT": "$SAI_PIT",
"SAI_ADM": "$SAI_ADM",
"SAI_SAI": "$SAI_SAI",
"SAI_SIN": "$SAI_SIN",
"SAI_SKR": "$SAI_SKR",
"SAI_DAD": "$SAI_DAD",
"SAI_MOM": "$SAI_MOM",
"SAI_VOX": "$SAI_VOX",
"SAI_TUB": "$SAI_TUB",
"SAI_TAP": "$SAI_TAP",
"SAI_TOP": "$SAI_TOP"
}
EOF
18 changes: 9 additions & 9 deletions bin/deploy-fab
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export SOLC_FLAGS=${SOLC_FLAGS:-"--optimize"}
export ETH_GAS=${ETH_GAS:-"3500000"}
export ETH_FROM=${ETH_FROM:-$(seth rpc eth_coinbase)}

dapp --use solc:0.4.25 build
dapp --use solc:0.4.25 build --extract

export SETH_ASYNC=yes

Expand All @@ -19,15 +19,15 @@ DAD_FABtx=$(dapp create DadFab)

export SETH_ASYNC=no

GEM_FAB=$(seth receipt $GEM_FABtx contractAddress)
VOX_FAB=$(seth receipt $VOX_FABtx contractAddress)
TUB_FAB=$(seth receipt $TUB_FABtx contractAddress)
TAP_FAB=$(seth receipt $TAP_FABtx contractAddress)
TOP_FAB=$(seth receipt $TOP_FABtx contractAddress)
MOM_FAB=$(seth receipt $MOM_FABtx contractAddress)
DAD_FAB=$(seth receipt $DAD_FABtx contractAddress)
GEM_FAB=$(seth receipt "$GEM_FABtx" contractAddress)
VOX_FAB=$(seth receipt "$VOX_FABtx" contractAddress)
TUB_FAB=$(seth receipt "$TUB_FABtx" contractAddress)
TAP_FAB=$(seth receipt "$TAP_FABtx" contractAddress)
TOP_FAB=$(seth receipt "$TOP_FABtx" contractAddress)
MOM_FAB=$(seth receipt "$MOM_FABtx" contractAddress)
DAD_FAB=$(seth receipt "$DAD_FABtx" contractAddress)

cat > load-fab-$(seth chain) << EOF
cat > "load-fab-$(seth chain)" << EOF
#!/bin/bash
# fab deployment on $(seth chain) from $(git rev-parse HEAD)
Expand Down
19 changes: 11 additions & 8 deletions bin/deploy-pre
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export SOLC_FLAGS=${SOLC_FLAGS:-"--optimize"}
export ETH_GAS=${ETH_GAS:-"3500000"}
export ETH_FROM=${ETH_FROM:-$(seth rpc eth_coinbase)}

dapp --use solc:0.4.25 build
dapp --use solc:0.4.25 build --extract

# ETHUSD feed
export SAI_PIP='0x729D19f657BD0614b4985Cf1D82531c67569197B'
Expand All @@ -17,19 +17,22 @@ export SAI_PEP='0x99041F808D598B782D5a3e498681C2452A31da08'
export SAI_GEM='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'

# Token burner
export SAI_PIT=$(dapp create GemPit)
SAI_PIT=$(dapp create GemPit)
export SAI_PIT

# MKR address
export SAI_GOV='0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2'

# Chief
## Voting IOU
export SAI_IOU=$(dapp create DSToken $(seth --to-bytes32 $(seth --from-ascii 'IOU')))
export SAI_ADM=$(dapp create DSChief $SAI_GOV $SAI_IOU 5)
seth send $SAI_IOU 'setOwner(address)' $SAI_ADM

cat > load-pre-$(seth chain) << EOF
test -z $SAI_GEM && GEMtx=$(dapp create DSToken $(seth --to-bytes32 $(seth --from-ascii 'ETH')))
SAI_IOU=$(dapp create DSToken "$(seth --to-bytes32 "$(seth --from-ascii 'IOU')")")
SAI_ADM=$(dapp create DSChief "$SAI_GOV" "$SAI_IOU" 5)
export SAI_IOU
export SAI_ADM
seth send "$SAI_IOU" 'setOwner(address)' "$SAI_ADM"

cat > "load-pre-$(seth chain)" << EOF
test -z $SAI_GEM && GEMtx=$(dapp create DSToken "$(seth --to-bytes32 "$(seth --from-ascii 'ETH')")")
#!/bin/bash
# pre-sai deployment on $(seth chain) from $(git rev-parse HEAD)
Expand Down

0 comments on commit 4c8ac97

Please sign in to comment.