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

Commit

Permalink
Use ilk-registry, add name, upd to 1.0.9 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmcmichael authored Jul 28, 2020
1 parent ea28b63 commit 996fe7f
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 37 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ $ mcd --ilk=ETH-A ilk spot
Gems are collateral tokens. Collateral is added and removed from the via adapters, which abstract away the differences between various token behaviours. Use `gem [<subcommand>]` to manage collateral balances for any given Ilk.

```sh
gem --ilk=<id> name Gem name e.g. Wrapped Ether
gem --ilk=<id> symbol Gem symbol e.g. WETH
gem --ilk=<id> decimals Number of decimals on gem e.g. 18
gem --ilk=<id> balance Print balances for a given urn (default: ETH_FROM)
Expand Down
6 changes: 0 additions & 6 deletions libexec/mcd/conf/ilks

This file was deleted.

41 changes: 27 additions & 14 deletions libexec/mcd/conf/kovan.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"MCD_CAT": "0x0511674A67192FE51e86fE55Ed660eB4f995BDd6",
"MCD_VOW": "0x0F4Cbe6CBA918b7488C26E29d9ECd7368F38EA3b",
"MCD_JOIN_DAI": "0x5AA71a3ae1C0bd6ac27A1f28e1415fFFB6F15B8c",
"MCD_FLAP": "0x064cd5f762851b1af81Fd8fcA837227cb3eC84b4",
"MCD_FLOP": "0x145B00b1AC4F01E84594EFa2972Fce1f5Beb5CED",
"MCD_FLAP": "0xc6d3C83A080e2Ef16E4d7d4450A869d0891024F5",
"MCD_FLOP": "0x52482a3100F79FC568eb2f38C4a45ba457FBf5fA",
"MCD_PAUSE": "0x8754E6ecb4fe68DaA5132c2886aB39297a5c7189",
"MCD_PAUSE_PROXY": "0x0e4725db88Bb038bBa4C4723e91Ba183BE11eDf3",
"MCD_GOV_ACTIONS": "0x0Ca17E81073669741714354f16D800af64e95C75",
Expand All @@ -25,34 +25,47 @@
"PROXY_ACTIONS_END": "0x7c3f28f174F2b0539C202a5307Ff48efa61De982",
"PROXY_ACTIONS_DSR": "0xc5CC1Dfb64A62B9C7Bb6Cbf53C2A579E2856bf92",
"CDP_MANAGER": "0x1476483dD8C35F25e568113C5f70249D3976ba21",
"DSR_MANAGER": "0x7f5d60432DE4840a3E7AE7218f7D6b7A2412683a",
"GET_CDPS": "0x592301a23d37c591C5856f28726AF820AF8e7014",
"ILK_REGISTRY": "0x6618BD7bBaBFacC518Fdec43542E4a73629B0819",
"OSM_MOM": "0x5dA9D1C3d4f1197E5c52Ff963916Fe84D2F5d8f3",
"FLIPPER_MOM": "0xf3828caDb05E5F22844f6f9314D99516D68a0C84",
"PROXY_FACTORY": "0xe11E3b391F7E8bC47247866aF32AF67Dd58Dc800",
"PROXY_REGISTRY": "0x64A436ae831C1672AE81F674CAb8B6775df3475C",
"ETH": "0xd0A1E359811322d97991E03f863a0C30C2cF029C",
"PIP_ETH": "0x75dD74e8afE8110C8320eD397CcCff3B8134d981",
"MCD_JOIN_ETH_A": "0x775787933e92b709f2a3C70aa87999696e74A9F8",
"MCD_FLIP_ETH_A": "0xB40139Ea36D35d0C9F6a2e62601B616F1FfbBD1b",
"MCD_FLIP_ETH_A": "0xc78EdADA7e8bEa29aCc3a31bBA1D516339deD350",
"BAT": "0x9f8cFB61D3B2aF62864408DD703F9C3BEB55dff7",
"PIP_BAT": "0x5C40C9Eb35c76069fA4C3A00EA59fAc6fFA9c113",
"MCD_JOIN_BAT_A": "0x2a4C485B1B8dFb46acCfbeCaF75b6188A59dBd0a",
"MCD_FLIP_BAT_A": "0xC94014A032cA5fCc01271F4519Add7E87a16b94C",
"MCD_FLIP_BAT_A": "0xc0126c3383777bDc175E659A51020E56307dDe21",
"USDC": "0xBD84be3C303f6821ab297b840a99Bd0d4c4da6b5",
"PIP_USDC": "0x4c51c2584309b7BF328F89609FDd03B3b95fC677",
"MCD_JOIN_USDC_A": "0x4c514656E7dB7B859E994322D2b511d99105C1Eb",
"MCD_FLIP_USDC_A": "0x45d5b4A304f554262539cfd167dd05e331Da686E",
"MCD_FLIP_USDC_A": "0xc29Ad1913C3B415497fdA1eA15c132502B8fa372",
"MCD_JOIN_USDC_B": "0xaca10483e7248453BB6C5afc3e403e8b7EeDF314",
"MCD_FLIP_USDC_B": "0x3c9eF711B68882d9732F60758e7891AcEae2Aa7c",
"WBTC": "0x7419f744bBF35956020C1687fF68911cD777f865",
"PIP_WBTC": "0x2f38a1bD385A9B395D01f2Cbf767b4527663edDB",
"MCD_JOIN_WBTC_A": "0xB879c7d51439F8e7AC6b2f82583746A0d336e63F",
"MCD_FLIP_WBTC_A": "0xc45A1b76D3316D56a0225fB02Ab6b7637403fF67",
"SAI": "0xC4375B7De8af5a38a93548eb8453a498222C4fF2",
"PIP_SAI": "0x62eaf847dfd5De95a09a2708366a0525749A1f6D",
"MCD_JOIN_SAI": "0x2d2672D655C95016e19909174d1fC72A6DE7D381",
"MCD_FLIP_SAI": "0x2F68D2A62ffeBF9Cf09b3908C6D423109b77254A",
"MCD_FLIP_WBTC_A": "0x28dd4263e1FcE04A9016Bd7BF71a4f0F7aB93810",
"TUSD": "0xD6CE59F06Ff2070Dd5DcAd0866A7D8cd9270041a",
"PIP_TUSD": "0xE4bAECdba7A8Ff791E14c6BF7e8089Dfdf75C7E7",
"MCD_JOIN_TUSD_A": "0xe53f6755A031708c87d80f5B1B43c43892551c17",
"MCD_FLIP_TUSD_A": "0xD4A145d161729A4B43B7Ab7DD683cB9A16E01a1b",
"ZRX": "0xC2C08A566aD44129E69f8FC98684EAA28B01a6e7",
"PIP_ZRX": "0x218037a42947E634191A231fcBAEAE8b16a39b3f",
"MCD_JOIN_ZRX_A": "0x85D38fF6a6FCf98bD034FB5F9D72cF15e38543f2",
"MCD_FLIP_ZRX_A": "0xe07F1219f7d6ccD59431a6b151179A9181e3902c",
"KNC": "0x9800a0a3c7e9682e1AEb7CAA3200854eFD4E9327",
"PIP_KNC": "0x10799280EF9d7e2d037614F5165eFF2cB8522651",
"MCD_JOIN_KNC_A": "0xE42427325A0e4c8e194692FfbcACD92C2C381598",
"MCD_FLIP_KNC_A": "0x644699674D06cF535772D0DC19Ad5EA695000F51",
"MANA": "0x221F4D62636b7B51b99e36444ea47Dc7831c2B2f",
"PIP_MANA": "0xE97D2b077Fe19c80929718d377981d9F754BF36e",
"MCD_JOIN_MANA_A": "0xdC9Fe394B27525e0D9C827EE356303b49F607aaF",
"MCD_FLIP_MANA_A": "0x5CB9D33A9fE5244019e6F5f45e68F18600805264",
"PROXY_PAUSE_ACTIONS": "0x7c52826c1efEAE3199BDBe68e3916CC3eA222E29",
"PROXY_DEPLOYER": "0xA9fCcB07DD3f774d5b9d02e99DE1a27f47F91189",
"SAI_TUB": "0xa71937147b55Deb8a530C7229C442Fd3F31b7db2",
"MIGRATION": "0x411B2Faa662C8e3E5cF8f01dFdae0aeE482ca7b0",
"MIGRATION_PROXY_ACTIONS": "0xF56765d255463139d3aff1613705a5520764Ab93"
"PROXY_DEPLOYER": "0xA9fCcB07DD3f774d5b9d02e99DE1a27f47F91189"
}
41 changes: 27 additions & 14 deletions libexec/mcd/conf/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"MCD_CAT": "0x78F2c2AF65126834c51822F56Be0d7469D7A523E",
"MCD_VOW": "0xA950524441892A31ebddF91d3cEEFa04Bf454466",
"MCD_JOIN_DAI": "0x9759A6Ac90977b93B58547b4A71c78317f391A28",
"MCD_FLAP": "0xdfE0fb1bE2a52CDBf8FB962D5701d7fd0902db9f",
"MCD_FLOP": "0x4D95A049d5B0b7d32058cd3F2163015747522e99",
"MCD_FLAP": "0xC4269cC7acDEdC3794b221aA4D9205F564e27f0d",
"MCD_FLOP": "0xA41B6EF151E06da0e34B009B86E828308986736D",
"MCD_PAUSE": "0xbE286431454714F511008713973d3B053A2d38f3",
"MCD_PAUSE_PROXY": "0xBE8E3e3618f7474F8cB1d074A26afFef007E98FB",
"MCD_GOV_ACTIONS": "0x4F5f0933158569c026d617337614d00Ee6589B6E",
Expand All @@ -25,34 +25,47 @@
"PROXY_ACTIONS_END": "0x7AfF9FC9faD225e3c88cDA06BC56d8Aca774bC57",
"PROXY_ACTIONS_DSR": "0x07ee93aEEa0a36FfF2A9B95dd22Bd6049EE54f26",
"CDP_MANAGER": "0x5ef30b9986345249bc32d8928B7ee64DE9435E39",
"DSR_MANAGER": "0x373238337Bfe1146fb49989fc222523f83081dDb",
"GET_CDPS": "0x36a724Bd100c39f0Ea4D3A20F7097eE01A8Ff573",
"ILK_REGISTRY": "0xbE4F921cdFEf2cF5080F9Cf00CC2c14F1F96Bd07",
"OSM_MOM": "0x76416A4d5190d071bfed309861527431304aA14f",
"FLIPPER_MOM": "0x9BdDB99625A711bf9bda237044924E34E8570f75",
"PROXY_FACTORY": "0xA26e15C895EFc0616177B7c1e7270A4C7D51C997",
"PROXY_REGISTRY": "0x4678f0a6958e4D2Bc4F1BAF7Bc52E8F3564f3fE4",
"ETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"PIP_ETH": "0x81FE72B5A8d1A857d176C3E7d5Bd2679A9B85763",
"MCD_JOIN_ETH_A": "0x2F0b23f53734252Bda2277357e97e1517d6B042A",
"MCD_FLIP_ETH_A": "0xd8a04F5412223F513DC55F839574430f5EC15531",
"MCD_FLIP_ETH_A": "0x0F398a2DaAa134621e4b687FCcfeE4CE47599Cc1",
"BAT": "0x0D8775F648430679A709E98d2b0Cb6250d2887EF",
"PIP_BAT": "0xB4eb54AF9Cc7882DF0121d26c5b97E802915ABe6",
"MCD_JOIN_BAT_A": "0x3D0B1912B66114d4096F48A8CEe3A56C231772cA",
"MCD_FLIP_BAT_A": "0xaA745404d55f88C108A28c86abE7b5A1E7817c07",
"MCD_FLIP_BAT_A": "0x5EdF770FC81E7b8C2c89f71F30f211226a4d7495",
"USDC": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"PIP_USDC": "0x77b68899b99b686F415d074278a9a16b336085A0",
"MCD_JOIN_USDC_A": "0xA191e578a6736167326d05c119CE0c90849E84B7",
"MCD_FLIP_USDC_A": "0xE6ed1d09a19Bd335f051d78D5d22dF3bfF2c28B1",
"MCD_FLIP_USDC_A": "0x545521e0105C5698f75D6b3C3050CfCC62FB0C12",
"MCD_JOIN_USDC_B": "0x2600004fd1585f7270756DDc88aD9cfA10dD0428",
"MCD_FLIP_USDC_B": "0x6002d3B769D64A9909b0B26fC00361091786fe48",
"WBTC": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
"PIP_WBTC": "0xf185d0682d50819263941e5f4EacC763CC5C6C42",
"MCD_JOIN_WBTC_A": "0xBF72Da2Bd84c5170618Fbe5914B0ECA9638d5eb5",
"MCD_FLIP_WBTC_A": "0x3E115d85D4d7253b05fEc9C0bB5b08383C2b0603",
"SAI": "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359",
"PIP_SAI": "0x54003DBf6ae6CBa6DDaE571CcdC34d834b44Ab1e",
"MCD_JOIN_SAI": "0xad37fd42185Ba63009177058208dd1be4b136e6b",
"MCD_FLIP_SAI": "0x5432b2f3c0DFf95AA191C45E5cbd539E2820aE72",
"MCD_FLIP_WBTC_A": "0xF70590Fa4AaBe12d3613f5069D02B8702e058569",
"TUSD": "0x0000000000085d4780B73119b644AE5ecd22b376",
"PIP_TUSD": "0xeE13831ca96d191B688A670D47173694ba98f1e5",
"MCD_JOIN_TUSD_A": "0x4454aF7C8bb9463203b66C816220D41ED7837f44",
"MCD_FLIP_TUSD_A": "0x04C42fAC3e29Fd27118609a5c36fD0b3Cb8090b3",
"ZRX": "0xE41d2489571d322189246DaFA5ebDe1F4699F498",
"PIP_ZRX": "0x7382c066801E7Acb2299aC8562847B9883f5CD3c",
"MCD_FLIP_ZRX_A": "0x92645a34d07696395b6e5b8330b000D0436A9aAD",
"MCD_JOIN_ZRX_A": "0xc7e8Cd72BDEe38865b4F5615956eF47ce1a7e5D0",
"KNC": "0xdd974D5C2e2928deA5F71b9825b8b646686BD200",
"PIP_KNC": "0xf36B79BD4C0904A5F350F1e4f776B81208c13069",
"MCD_FLIP_KNC_A": "0xAD4a0B5F3c6Deb13ADE106Ba6E80Ca6566538eE6",
"MCD_JOIN_KNC_A": "0x475F1a89C1ED844A08E8f6C50A00228b5E59E4A9",
"MANA": "0x0F5D2fB29fb7d3CFeE444a200298f468908cC942",
"PIP_MANA": "0x8067259EA630601f319FccE477977E55C6078C13",
"MCD_FLIP_MANA_A": "0x4bf9D2EBC4c57B9B783C12D30076507660B58b3a",
"MCD_JOIN_MANA_A": "0xA6EA3b9C04b8a38Ff5e224E7c3D6937ca44C0ef9",
"PROXY_PAUSE_ACTIONS": "0x6bda13D43B7EDd6CAfE1f70fB98b5d40f61A1370",
"PROXY_DEPLOYER": "0x1b93556AB8dcCEF01Cd7823C617a6d340f53Fb58",
"SAI_TUB": "0x448a5065aeBB8E423F0896E6c5D525C040f59af3",
"MIGRATION": "0xc73e0383F3Aff3215E6f04B0331D58CeCf0Ab849",
"MIGRATION_PROXY_ACTIONS": "0x2E1F6062d9fB227069741E40f89186DF222FB426"
"PROXY_DEPLOYER": "0x1b93556AB8dcCEF01Cd7823C617a6d340f53Fb58"
}
6 changes: 5 additions & 1 deletion libexec/mcd/mcd-gem
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
### mcd-gem -- Collateral management
### Usage: mcd --ilk=<id> [--urn=<address>] gem [<command>]
###
### Commands: gem symbol Gem id e.g WETH
### Commands: gem name Gem name e.g Wrapped Ether
### gem symbol Gem id e.g WETH
### gem decimals Number of decimals in gem
### gem balance Print balances for a given urn (default: ETH_FROM)
### gem join <amt> Add collateral to an urn
Expand Down Expand Up @@ -35,6 +36,9 @@ case $1 in
gem=$(seth call "$(mcd gem adapter)" 'gem()')
seth --abi-decode 'f()(address)' "$gem"
;;
name)
mcd ilks | sed -n "/$MCD_ILK/p" | awk '{$1=$2=$3=""; print $0}' | sed 's/^ *//g'
;;
symbol)
mcd ilks | sed -n "/$MCD_ILK/p" | awk '{print $2}'
;;
Expand Down
47 changes: 46 additions & 1 deletion libexec/mcd/mcd-ilks
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
#!/usr/bin/env bash
set -e
awk -F'|' '{printf "%5s %5s %5s %5s\n", $1, $2, $3, $4}' "${0%/*}/conf/ilks"

FILENAME="ilk-types.txt"
FILEPATH="/tmp/$FILENAME"

function writeData {
ILKS="$(seth call "$ILK_REGISTRY" "list()(bytes32[])")"

ILK_LIST="ILK | GEM | DEC | DESC\n"
ILK_LIST+=" | | | \n"
for i in ${ILKS//,/ }
do
ILK_INFO="$(seth call "${ILK_REGISTRY?}" 'info(bytes32)(string,string,uint256,address,address,address,address)' "${i}" | tr -d '\0')"
SAVEIFS=$IFS # Save current IFS
IFS=$'\n' # Change IFS to new line
INFO_ARR=($ILK_INFO) # split to array
IFS=$SAVEIFS # Restore IFS

# Info Array from Registry:
# 0: Wrapped Ether (name)
# 1: WETH (symbol)
# 2: 18 (decimals)
# 3: 0xd0A1E359811322d97991E03f863a0C30C2cF029C (gem)
# 4: 0x75dD74e8afE8110C8320eD397CcCff3B8134d981 (pip)
# 5: 0x775787933e92b709f2a3C70aa87999696e74A9F8 (join)
# 6: 0xB40139Ea36D35d0C9F6a2e62601B616F1FfbBD1b (flip)
ILK_TAG="$(mcd --to-ascii "$i")"
ILK_GEM="${INFO_ARR[1]}"
ILK_DEC="${INFO_ARR[2]}"
ILK_DSC="${INFO_ARR[0]}"

ILK_LIST+="$(printf "%s | %s | %s | %s" "$ILK_TAG" "$ILK_GEM" "$ILK_DEC" "$ILK_DSC")\n"
done

echo -e "$ILK_LIST" > "$FILEPATH"
}

# Cache the ilk data and only re-acquire every 10 minutes if not in active use
if [[ -f "$FILEPATH" && $(($(date +%s)-$(date -r $FILEPATH +%s))) -lt "600" ]]; then
# Update modification time
touch -m $FILEPATH
else
# File is stale, re-acquire and rewrite
writeData
fi

awk -F'|' '{printf "%-8s %8s %5s %s\n", $1, $2, $3, $4}' "$FILEPATH"
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.7-rc.1
1.0.9-rc.1

0 comments on commit 996fe7f

Please sign in to comment.