diff --git a/default.nix b/default.nix index 131f136..aa5f11b 100644 --- a/default.nix +++ b/default.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation rec { name = "mcd-${version}"; - version = "0.2.10-rc.1"; + version = "0.2.11-rc.1"; src = ./.; nativeBuildInputs = [makeWrapper]; diff --git a/libexec/mcd/conf/kovan.json b/libexec/mcd/conf/kovan.json index 8201174..b9a3108 100644 --- a/libexec/mcd/conf/kovan.json +++ b/libexec/mcd/conf/kovan.json @@ -1,76 +1,76 @@ { "DEPLOYER": "0x61de44946D6b809a30D8e6A236157966659f9640", - "MULTICALL": "0x36b468a9cf4a7a00188731257582dfe5c2141896", + "MULTICALL": "0x34b5bd422b27a8c8eaf3f80b940367d975c8f6e1", "FAUCET": "0x94598157fcf0715c3bc9b4a35450cce82ac57b20", - "MCD_DEPLOY": "0x8600f5b33aebc97202ccec04eb36a5a233dabe18", + "MCD_DEPLOY": "0x6146433a8ec1ac6cf100acf2ab09a81912393ed2", "MCD_GOV": "0xaaf64bfcc32d0f15873a02163e7e500671a4ffcd", - "MCD_GOV_GUARD": "0x1d2f30363fb30c6ba3a26f5c0ab9f3e77197aefc", - "MCD_IOU": "0x52d54e192d1d2eff3319427bbfede0b79855e2aa", - "MCD_ADM": "0x03358a3959247ae8de50a52c7919b88ab5989b85", - "VOTE_PROXY_FACTORY": "0xe743525d0653bdf291f835a19e493bb3d1026ab9", - "MCD_VAT": "0x5ce1e3c8ba1363c7a87f5e9118aac0db4b0f0691", - "MCD_JUG": "0x1ff7cb4126d7690daaa1c0f1ba58bab06d53d4b8", - "MCD_CAT": "0xfd5db7bd95c6a53f805dc2c631e62803e17de609", - "MCD_VOW": "0x43d3fa1c52933c4ff13628e43279f17d97cbbe9a", - "MCD_JOIN_DAI": "0xe70a5307f5132ee3a6a056c5efb7d5a53f3cdbd7", - "MCD_FLAP": "0xec9f745bfd0835dbea3c0c61a0cc6a15f68c5a31", - "MCD_FLOP": "0xeedcbe2ecec652617f5757688a73745a3905cc14", - "MCD_PAUSE": "0x8fe4f004ed32c0d11d00de9f7aa65a37815211ae", - "MCD_PAUSE_PROXY": "0xd8439f40a308964666800c03fb746e32901eb0e8", - "MCD_GOV_ACTIONS": "0x7e6c691559395329149aefd4bfaed2689130bb3b", - "MCD_DAI": "0x5944413037920674d39049ec4844117a031eaa74", - "MCD_SPOT": "0xcf68a9dc1e17a0d56ffedfb7e96ed6bf7e84458a", - "MCD_POT": "0x570d432df425937d0b83077dafe16a728c1c3438", - "MCD_END": "0xc6cd35939523d258d5c28febf6017635a4ea858d", - "MCD_ESM": "0xb4a9e253cb9b13109ac89fea50f2b33f6eafe825", - "PROXY_ACTIONS": "0xc8c1351cadc005390fd1afa1eaf25c679d8b599c", - "CDP_MANAGER": "0x772ff99b5aae3d51512d73c04f763c73adc7a86a", - "GET_CDPS": "0xda50a754d77e5a4432acc01b55625d58a3821fb9", - "PROXY_FACTORY": "0xff8f45417d818dc4e070389ad2b876f132605a2f", - "PROXY_REGISTRY": "0x1935399ecbeefbfe23b58213c5acddfbcb2ed4d9", + "MCD_GUARD": "0x0de879766490e497025738ae29bb8cc533eb355d", + "MCD_ADM": "0x3d434d7625721aa31ddbf9f98825aca6ba4b685f", + "MCD_IOU": "0xc52362382417f56e85e7e030b786972a1a2edd0b", + "VOTE_PROXY_FACTORY": "0x984c18e3f8a8582cedaa5b96e2c7399f0a2b022b", + "MCD_VAT": "0x04c67ea772ebb467383772cb1b64c7a9b1e02bca", + "MCD_JUG": "0xeffb135cf2e4911de9e478679d358c9df246424a", + "MCD_CAT": "0x505795bd482f24da52bba25c072a833696d8c6ee", + "MCD_VOW": "0x5fd6598a1f6a3b5fe78627fa72107d4a9fadf348", + "MCD_JOIN_DAI": "0xcf20652c7e9ff777fcb3772b594e852d1154174d", + "MCD_FLAP": "0x43920251323f05139c76bd75771fd3ab8e5a6dad", + "MCD_FLOP": "0xd5f64f76ce8047e8978707a00fa4c143405e9e37", + "MCD_PAUSE": "0xb5bb144eb951a8060d6ac186aee694187e2d037d", + "MCD_PAUSE_PROXY": "0xd16ba625e0b981c73fba249db64b523eade884a4", + "MCD_GOV_ACTIONS": "0xed0150fc2eb6f280af552fbdf3cbd5f66d3c7d1f", + "MCD_DAI": "0xdb6a55a94e0dd324292f3d05cf504c751b31cee2", + "MCD_SPOT": "0x2403ddca8715427fdb04f9e70d8989cddab06b67", + "MCD_POT": "0xe019a058adcd42e34a456f3b86466ddd103027e4", + "MCD_END": "0xdf72153215205ae87b4cf388866064ce234b35a5", + "MCD_ESM": "0xce1db78a9d5ff7520430421f8fa5f7744021dd3e", + "PROXY_ACTIONS": "0x4e8fa882ce2127b50e508d3abfa6be12911b0c05", + "CDP_MANAGER": "0x7a4991c6bd1053c31f1678955ce839999d9841b1", + "GET_CDPS": "0xcc1ba3ee9cd1e06765ae41a195723bbe97de4ed1", + "PROXY_FACTORY": "0xe11e3b391f7e8bc47247866af32af67dd58dc800", + "PROXY_REGISTRY": "0x64a436ae831c1672ae81f674cab8b6775df3475c", "ETH": "0xd0a1e359811322d97991e03f863a0c30c2cf029c", "VAL_ETH": "0x75dd74e8afe8110c8320ed397cccff3b8134d981", "PIP_ETH": "0x75dd74e8afe8110c8320ed397cccff3b8134d981", - "MCD_JOIN_ETH_A": "0xca512f193650db9a55aba9e61a7ec0b0b5aea0b7", - "MCD_FLIP_ETH_A": "0x9d18e462b23ffc45ce6136a76dff82c4c55702be", - "MCD_JOIN_ETH_B": "0x9f5611179d416f977fe85896ce15816fd3d152ee", - "MCD_FLIP_ETH_B": "0xdcdf9f7504727aa2b7299c3f0d9fb661a2febfcd", - "MCD_JOIN_ETH_C": "0xc7a0aa2565a2081636697e4e40f300e74e77c3a0", - "MCD_FLIP_ETH_C": "0xc387636fe80a031f48839be73727d52985bf3f41", + "MCD_JOIN_ETH_A": "0x004ddbf22b90cc5ce715be6096ac2fd89b514bf6", + "MCD_FLIP_ETH_A": "0xe8b1439bbcc5a4da4a8e938257aea3a8d18f78ad", + "MCD_JOIN_ETH_B": "0xb3acc117e70e9f2cb8afa66c80ed5ffc09df9c70", + "MCD_FLIP_ETH_B": "0xd4b18bbc581fa6f7a019c7c8f2245430f865c14e", + "MCD_JOIN_ETH_C": "0xade09cccddbacfdd69741c97a45d742460e9ec23", + "MCD_FLIP_ETH_C": "0x965875bddaa6011a8af54cb952798473bc0f086b", "REP": "0xc7aa227823789e363f29679f23f7e8f6d9904a9b", "VAL_REP": "0x5debc8c4124db0c1d3bad99e69287a576c7b2ccc", "PIP_REP": "0x5debc8c4124db0c1d3bad99e69287a576c7b2ccc", - "MCD_JOIN_REP_A": "0x7d9d701e87920a1a7396438769b571fb55b6ffdc", - "MCD_FLIP_REP_A": "0x7558ae09e94e27424f2a02d1fa46ea8284d0c8eb", + "MCD_JOIN_REP_A": "0x91f4e07be74445a3897b6d4e70393b5ad7b8e4b0", + "MCD_FLIP_REP_A": "0x01d7735e4a4cadadb1f1ec5e7fe08f676ec17ed2", "ZRX": "0x18392097549390502069c17700d21403ea3c721a", "VAL_ZRX": "0xc010f1bbde279a5bb05c93f5fc902293d5a9f7a9", "PIP_ZRX": "0xc010f1bbde279a5bb05c93f5fc902293d5a9f7a9", - "MCD_JOIN_ZRX_A": "0x6d10ff4eb87484c55d9fc2907a11ae26fa6c859f", - "MCD_FLIP_ZRX_A": "0x976b340267b77f02b443d9a5ea34681f31796ed6", + "MCD_JOIN_ZRX_A": "0x4a48d3e3ee832575f70efb980c9a62ddce5c263a", + "MCD_FLIP_ZRX_A": "0x5ce206c55d6c13fe9293a947b43a0dcd3e6ef137", "OMG": "0x441b1a74c69ee6e631834b626b29801d42076d38", "VAL_OMG": "0x1e9740f61e80650a60ba70f2d0b477fb85db2b03", "PIP_OMG": "0x1e9740f61e80650a60ba70f2d0b477fb85db2b03", - "MCD_JOIN_OMG_A": "0x46024f1bace6b2e93b622cffc12a4cd43a23aa76", - "MCD_FLIP_OMG_A": "0xcd03d1147d14e06fa31ed5b85eca1e95ccdc6de6", + "MCD_JOIN_OMG_A": "0x606fcf8eb5bbe1dd17d52d853c7d346c594109fe", + "MCD_FLIP_OMG_A": "0xc967ff09e407ec029cb98f42f8e628116407085b", "BAT": "0x9f8cfb61d3b2af62864408dd703f9c3beb55dff7", "VAL_BAT": "0x5c40c9eb35c76069fa4c3a00ea59fac6ffa9c113", "PIP_BAT": "0x5c40c9eb35c76069fa4c3a00ea59fac6ffa9c113", - "MCD_JOIN_BAT_A": "0x277cd249711a5895353d48ae5254271c1004cb0d", - "MCD_FLIP_BAT_A": "0x6a8f77412029523a21cfb35960ebe062418b91b8", + "MCD_JOIN_BAT_A": "0x635716849a7f6ae57211bb2f9564b10551a8f166", + "MCD_FLIP_BAT_A": "0x5bc5be4775eb6c61bff9717e1f35d887fb54142c", "DGD": "0x62aeec5fb140bb233b1c5612a8747ca1dc56dc1b", "VAL_DGD": "0x112bf99e873317643fbfcc22d197e3e01b825cb0", "PIP_DGD": "0x112bf99e873317643fbfcc22d197e3e01b825cb0", - "MCD_JOIN_DGD_A": "0x3689d9885a998ea4615f82000f8491bf773b2642", - "MCD_FLIP_DGD_A": "0xc39447dda044cd02d1a8c2f935e14376ff6276ea", + "MCD_JOIN_DGD_A": "0xf07b0cbe6fad45bb3576de92e063639ad951987f", + "MCD_FLIP_DGD_A": "0x034f2c3e4e8db8f8469493bb38d8885e06f8ab54", "GNT": "0xc81ba844f451d4452a01bbb2104c1c4f89252907", "VAL_GNT": "0xf46e96a6f23fdcb5870f0ac0dbe9d2c605485ddc", "PIP_GNT": "0xf46e96a6f23fdcb5870f0ac0dbe9d2c605485ddc", - "MCD_JOIN_GNT_A": "0x64d1f7e7702f914b0fc13ce56d7a022b2a8449b0", - "MCD_FLIP_GNT_A": "0x3d8b0106e5f28e6611cdfd3940a973e7b7fc6ff7", - "PROXY_PAUSE_ACTIONS": "0xcd958d3cb7d6b394dbdc38259952d79dc2b55cf8", - "PROXY_DEPLOYER": "0x7c3b871d79d3de3c7e80c5e8393bb6477bec3004", - "GOV_POLL_GEN": "0x08acfcb03118b31fd945f9d5bd8cb61581c06b42", + "MCD_JOIN_GNT_A": "0x4e22282bb7304c6c07aa4404b3a9a2f7afe1958a", + "MCD_FLIP_GNT_A": "0xa1a4cc927091a3c9f10e55a161869b3cad58ef1b", + "PROXY_PAUSE_ACTIONS": "0x640457c680d75dae73450a642c41cd178d34ac65", + "PROXY_DEPLOYER": "0x818a81dd914e89a4698869ee54c8e2c056bfda03", + "GOV_POLL_GEN": "0xd247195403963d7b81ff0028d1036d7ed0ed61a3", "POLL_ID": "0", - "VOTE_YES": "0x4a04b03901feccec8f4d795e2387e54d1a6b6d8d", - "VOTE_NO": "0x0d0a1ddc1103c4c891917a7a6320bc7632cf7724" + "VOTE_YES": "0x6e1c3b0334ef4231dd739d1e0e2f9cf2ec0fdb4a", + "VOTE_NO": "0x80ba5974a57033ccb1a4e6982ae32a255cd24f5f" } diff --git a/libexec/mcd/mcd---version b/libexec/mcd/mcd---version index 76fb93f..c31c424 100755 --- a/libexec/mcd/mcd---version +++ b/libexec/mcd/mcd---version @@ -1,6 +1,6 @@ #!/usr/bin/env bash cat <<. -mcd 0.2.10-rc.1 +mcd 0.2.11-rc.1 Copyright (C) 2018, 2019 dc diff --git a/libexec/mcd/mcd-cdp b/libexec/mcd/mcd-cdp index 44d8bde..9486382 100755 --- a/libexec/mcd/mcd-cdp +++ b/libexec/mcd/mcd-cdp @@ -2,42 +2,45 @@ ### mcd-cdp -- CDP managerment ### Usage: mcd cdp [] [] ### -### Commands: ls [] List Cdps -### count [] Cdp count -### open Open a new Cdp -### urn Cdp state -### lock Join & lock collateral -### free Free & exit collateral -### draw Draw & exit dai -### wipe Join & wipe dai -### give
Give a Cdp to another owner -### quit
Convert a Cdp to native Urn +### Commands: ls [] List Cdps +### count [] Cdp count +### open Open a new Cdp +### urn Cdp state +### lock Join & lock standard gem collateral +### safe-lock Join & safely lock standard gem collateral (checks it is your CDP) +### free Free & exit standard gem collateral +### draw Draw & exit dai +### wipe Join & wipe dai +### safe-wipe Join & wipe dai +### give
Give a Cdp to another owner +### quit
Convert a Cdp to native Urn set -e shopt -s extglob -export MCD_PROXY=$(mcd --proxy-address) +MCD_PROXY=$(mcd --proxy-address) +export MCD_PROXY case $1 in ls) { sig="getCdpsDesc(address,address)" - data=$(seth call ${GET_CDPS?} $sig ${CDP_MANAGER?} $MCD_PROXY) + data=$(seth call "${GET_CDPS?}" "$sig" "${CDP_MANAGER?}" "$MCD_PROXY") data=${data:194:${#data}} size=$(( ${#data} / 3)) cdps=${data::$size}; - urns=${data:$size:$(( $size * 2 ))}; + urns=${data:$size:$(( "$size" * 2 ))}; ilks=${data:(-$size)} - for i in `seq 64 64 $(( ${#cdps} - 64 ))`; do + for i in $(seq 64 64 $(( ${#cdps} - 64 ))); do id=$(( 16#${cdps:$i:64} )) echo "cdp $id" - echo "urn 0x${urns:$(( $i+24)):40}" - echo "ilk $(mcd --to-ascii ${ilks:$i:64})" + echo "urn 0x${urns:$(( "$i"+24)):40}" + echo "ilk $(mcd --to-ascii "${ilks:$i:64}")" echo done };; count) { sig="count(address)" - hex=$(seth call ${CDP_MANAGER?} $sig ${2:-MCD_PROXY}) - seth --to-dec $hex + hex=$(seth call "${CDP_MANAGER?}" $sig "${2:-MCD_PROXY}") + seth --to-dec "$hex" };; open) { mcd cdp-open "${@:2}"; diff --git a/libexec/mcd/mcd-cdp-cmd b/libexec/mcd/mcd-cdp-cmd index 09328e7..4dd9830 100755 --- a/libexec/mcd/mcd-cdp-cmd +++ b/libexec/mcd/mcd-cdp-cmd @@ -2,87 +2,106 @@ set -e cdp=$1; shift -hex=0x$(seth --to-word $(seth --to-hex $cdp)) -ilk=$(seth call ${CDP_MANAGER?} 'ilks(uint)(bytes32)' $hex) +hex=0x$(seth --to-word "$(seth --to-hex "$cdp")") +ilk=$(seth call "${CDP_MANAGER?}" 'ilks(uint)(bytes32)' "$hex") act=$1; shift; -export MCD_ILK=$(mcd --to-ascii $ilk) -export ETH_GAS=${ETH_GAS:-270000} +MCD_ILK=$(mcd --to-ascii "$ilk") +export MCD_ILK +export ETH_GAS=${ETH_GAS:-500000} require-wad() { [ -n "$1" ] || mcd --fail "mcd-cdp: Please specify an amount to $act" - wad=$(seth --to-uint256 $(seth --to-wei $1 eth)) + wad=$(seth --to-uint256 "$(seth --to-wei "$1" eth)") } case $act in lock) { - require-wad $1 - mcd --gem-approve $MCD_PROXY $1 - sig="lockGem(address,address,uint,uint)" - mcd --proxy-exec $sig ${CDP_MANAGER?} $(mcd gem adapter) $hex $wad + require-wad "$1" + mcd --gem-approve "$MCD_PROXY" "$1" + sig="lockGem(address,address,uint,uint,bool)" + mcd --proxy-exec $sig "${CDP_MANAGER?}" "$(mcd gem adapter)" "$hex" "$wad" 1 - [[ $SETH_ASYNC != yes ]] && mcd cdp $cdp urn + [[ $SETH_ASYNC != yes ]] && mcd cdp "$cdp" urn + };; + safe-lock) { + require-wad "$1" + mcd --gem-approve "$MCD_PROXY" "$1" + sig="safeLockGem(address,address,uint,uint,bool)" + mcd --proxy-exec $sig "${CDP_MANAGER?}" "$(mcd gem adapter)" "$hex" "$wad" 1 + + [[ $SETH_ASYNC != yes ]] && mcd cdp "$cdp" urn };; free) { - require-wad $1 + require-wad "$1" sig="freeGem(address,address,uint,uint)" - mcd --proxy-exec $sig ${CDP_MANAGER?} $(mcd gem adapter) $hex $wad + mcd --proxy-exec $sig "${CDP_MANAGER?}" "$(mcd gem adapter)" "$hex" "$wad" - [[ $SETH_ASYNC != yes ]] && mcd cdp $cdp urn + [[ $SETH_ASYNC != yes ]] && mcd cdp "$cdp" urn };; draw) { - require-wad $1 - sig="draw(address,address,uint,uint)" - mcd --proxy-exec $sig ${CDP_MANAGER?} $MCD_JOIN_DAI $hex $wad + require-wad "$1" + sig="draw(address,address,address,uint,uint)" + mcd --proxy-exec $sig "${CDP_MANAGER?}" "$MCD_JUG" "$MCD_JOIN_DAI" "$hex" "$wad" - [[ $SETH_ASYNC != yes ]] && mcd cdp $cdp urn + [[ $SETH_ASYNC != yes ]] && mcd cdp "$cdp" urn };; wipe) { - require-wad $1 + require-wad "$1" export MCD_TOKEN=$MCD_DAI - mcd --dai-approve $MCD_PROXY + mcd --dai-approve "$MCD_PROXY" sig="wipe(address,address,uint,uint)" - mcd --proxy-exec $sig ${CDP_MANAGER?} $MCD_JOIN_DAI $hex $wad + mcd --proxy-exec $sig "${CDP_MANAGER?}" "$MCD_JOIN_DAI" "$hex" "$wad" + + [[ $SETH_ASYNC != yes ]] && mcd cdp "$cdp" urn + };; + safe-wipe) { + require-wad "$1" + export MCD_TOKEN=$MCD_DAI + mcd --dai-approve "$MCD_PROXY" + sig="safeWipe(address,address,uint,uint)" + mcd --proxy-exec $sig "${CDP_MANAGER?}" "$MCD_JOIN_DAI" "$hex" "$wad" - [[ $SETH_ASYNC != yes ]] && mcd cdp $cdp urn + [[ $SETH_ASYNC != yes ]] && mcd cdp "$cdp" urn };; give) { - lad=$(seth --to-address $1) - echo "from: $(mcd cdp $cdp lad) to: $lad" + lad=$(seth --to-address "$1") + echo "from: $(mcd cdp "$cdp" lad) to: $lad" echo "Warning: only give to a proxy that you control!" read -r -p "Continue? [Y/n]: " response case $response in [yY]) { sig="give(address,uint,address)" - mcd --proxy-exec $sig ${CDP_MANAGER?} $hex $lad + mcd --proxy-exec $sig "${CDP_MANAGER?}" "$hex" "$lad" };; *) { exit 1; };; esac };; quit) { - dst=$(seth --to-address $1) - urn=$(seth call ${CDP_MANAGER?} 'urns(uint)(address)' $hex) + dst=$(seth --to-address "$1") + urn=$(seth call "${CDP_MANAGER?}" 'urns(uint)(address)' "$hex") sig="can(address,address)(uint)" - can=$(seth call $MCD_VAT $sig $urn $dst) - if [[ $(seth --to-dec $can) -eq 1 ]]; then - mcd --proxy-exec 'quit(uint,address)' $hex $dst + can=$(seth call "$MCD_VAT" "$sig" "$urn" "$dst") + if [[ $(seth --to-dec "$can") -eq 1 ]]; then + mcd --proxy-exec 'quit(uint,address)' "$hex" "$dst" else echo >&2 "Error: destination urn must be trusted" fi };; lad) { sig="lads(uint)(address)" - echo 0x$(seth call ${CDP_MANAGER?} $sig $hex) + echo "0x$(seth call "${CDP_MANAGER?}" "$sig" "$hex")" };; owner) { - lad=$(mcd cdp $cdp lad) - owner="$(seth call $lad 'owner()(address)')" + lad=$(mcd cdp "$cdp" lad) + owner="$(seth call "$lad" 'owner()(address)')" [[ ${#owner} -ne 40 ]] && owner=$lad - echo $owner + echo "$owner" };; urn) { sig="urns(uint)(address)" - export MCD_URN=$(seth call ${CDP_MANAGER?} $sig $hex) + MCD_URN=$(seth call "${CDP_MANAGER?}" $sig "$hex") + export MCD_URN mcd urn };; gem) {