{"id":13803391,"url":"https://github.com/makerdao/mcd-cli","last_synced_at":"2025-05-13T15:33:26.587Z","repository":{"id":47032249,"uuid":"145792107","full_name":"makerdao/mcd-cli","owner":"makerdao","description":"MCD Command-line interface","archived":true,"fork":false,"pushed_at":"2022-10-03T15:41:56.000Z","size":347,"stargazers_count":18,"open_issues_count":5,"forks_count":8,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-08-04T01:02:23.289Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makerdao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-23T02:57:28.000Z","updated_at":"2023-04-18T13:29:42.000Z","dependencies_parsed_at":"2023-01-19T01:45:14.136Z","dependency_job_id":null,"html_url":"https://github.com/makerdao/mcd-cli","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makerdao%2Fmcd-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makerdao%2Fmcd-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makerdao%2Fmcd-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makerdao%2Fmcd-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makerdao","download_url":"https://codeload.github.com/makerdao/mcd-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225239762,"owners_count":17442823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T01:00:31.096Z","updated_at":"2024-11-18T19:31:35.212Z","avatar_url":"https://github.com/makerdao.png","language":"Shell","funding_links":[],"categories":["Projects Using Seth"],"sub_categories":[],"readme":"# THIS PROJECT IS DEPRECATED\n\n## mcd-cli is no longer being actively maintained and is potentially dangerous to use.\n\n### If you are interested in maintaining this project reach out to a member of Protocol Engineering Services in the MakerDAO Discord [#protocol-engineering-public](https://discord.com/channels/893112320329396265/897479589171986434)\n\n-----------------------\n\n## MCD Command-line interface\n\n```\nMCD - Multi-collateral Dai\n\nUsage: mcd [\u003coptions\u003e] \u003ccommand\u003e [\u003cargs\u003e]\n   or: mcd help [\u003ccommand\u003e]\n\nCommands:\n\n   bite            Trigger liquidation of an unsafe Urn\n   bites           Recent bites\n   cdp             CDP managerment\n   dai             Dai management\n   debt            Total dai issuance\n   drip            Trigger stability fee accumulation\n   duty            Calculate an annual rate accumulator value\n   flap            Trigger a flap auction\n   flips           View flips and kick-off auctions\n   flog            Release queued bad-debt for auction\n   flop            Trigger a flop auction\n   frob            Urn management\n   frobs           Recent frobs\n   gem             Collateral management\n   help            Print help about mcd or one of its subcommands\n   ilk             Ilk (collateral type) parameters\n   line            Total debt ceiling\n   live            Liveness flag\n   poke            Update the spot price for a given Ilk\n   unwrap          Unwrap WETH to ETH\n   urn             CDP state\n   vice            Total bad debt\n   vow             Liquidator balances\n   wrap            Wrap ETH to WETH\n```\n\n## Installation\n\nInstall Nix if you haven't already:\n\n```\n# user must be in sudoers\ncurl -L https://nixos.org/nix/install | sh\n\n# Run this or login again to use Nix\n. \"$HOME/.nix-profile/etc/profile.d/nix.sh\"\n```\n\nThen run via the installer:\n\n```sh\n$ curl https://raw.githubusercontent.com/makerdao/mcd-cli/master/install.sh | sh\n```\n\n\n## Configuration\n\n`mcd` is built on [Seth](https://github.com/dapphub/dapptools/tree/master/src/seth) and uses the same network configuration options, which just like Seth, can be defined in the `~/.sethrc` initialisation file.\n\nSimilar to Seth, `mcd` also supports transaction signing with Ledger hardware wallets and can run against both local and remote nodes.\n\nSince `mcd` will always be used against a known deployment of the system, defaults can be loaded wherever possible. In most cases the only required configuration parameter is the `-C, --chain=\u003cchain\u003e` (`MCD_CHAIN`) option and `-F, --from=\u003caddress\u003e` (`ETH_FROM`) sender account when not using a testnet.\n\nExample `~/.sethrc`:\n\n```sh\n#!/usr/bin/env bash\nexport ETH_FROM=0x4Ffa8667Fe2db498DCb95A322b448eA688Ce430c\nexport SETH_CHAIN=kovan\nexport ETH_PASSWORD=\"/home/user/makerdao/pass.txt\"\nexport ETH_KEYSTORE=\"/home/user/.ethereum/keystore\"\nexport ETH_RPC_URL=\"https://kovan.infura.io/v3/c928d....\"\n```\n\n#### Kovan\n\nRun against the latest Kovan deployment by setting the `-C, --chain` option to `kovan`. Specify a sender account when sending transactions using the `-F, --from` option, or via the `ETH_FROM` env variable.\n\n```sh\n$ export ETH_FROM=0x4Ffa8667Fe2db498DCb95A322b448eA688Ce430c\n$ mcd --chain=kovan dai join 100\n```\n\n#### Remote testchain\n\nRun agaist remote testchain deployments by setting the `-C, --chain` option to the remote testchain Id. Mcd will auto-configure account settings via the testchain api so that no further configuration is required. To view a list of available testchains run:\n\n```sh\n$ mcd testnet chains`\n```\n\nThen set the chain option, or the chain env  variable to the appropriate testchain Id.\n\n```sh\n$ export MCD_CHAIN=12899149080555595289\n$ mcd dai join 100\n```\n\n#### Local testnet\n\nRun against a locally running instance of [Dapp testnet](https://github.com/dapphub/dapptools/tree/master/src/dapp) where the system has been deployed by setting the `C, --chain` option to `testnet`. Mcd will auto-configure account testings for `dapp testnet` so that no further configuration is required.\n\nBy default, Mcd assumes that the output of the testchain deployment script is available at `~/.dapp/testnet/8545/config/addresses.json`. Configuration addresses can be loaded from a different location by setting the `--config` (`MCD_CONFIG`) option.\n\n```sh\n$ export MCD_CONFIG=~/testchain-deployment-scripts/out/addresses.json\n$ mcd -C testnet dai join 100\n```\n\n---\n\n## Ilk\n\nIlks are collateral types with corresponding risk parameters which have been approved by system governance. Use the `ilks` command to view the list off available Ilks.\n\n```sh\n$ mcd ilks\nILK      GEM    DEC   DESC\n\nETH-A    WETH   18    Ethereum\nBAT-A    BAT    18    Basic Attention Token\nWBTC-A   WBTC   8     Wrapped Bitcoin\nUSDC-A   USDC   6     USD Coin\n```\n\nEach Ilk has its own set of configuration parameters which can be viewed via the `ilk` command. The `I, --ilk=\u003cid\u003e` option is used to scope commands to a particular Ilk:\n\n```sh\n$ mcd --ilk=ETH-A ilk\nArt  40.000000000000000000                      Total debt (DAI)\nrate 1.000080370887129123082627939              WETH DAI exchange rate\nspot 99.333333333333333333333333333             WETH price with safety mat (USD)\nline 1000.0000000000000000000000000000000000000 Debt ceiling (DAI)\ndust 0.0000000000000000000000000000000000000000 Debt floor (DAI)\nflip 0x9d905effff127a01da3b38124f8da88e766eb8dd Flip auction contract\nchop 1.000000000000000000000000000              Liquidation penalty\nlump 10000.000000000000000000                   Flip auction lot size\ntax  1.000000000782997609082909351              Stability fee\nrho  1552802862                                 Last drip timestamp\npip  0x98312e16f5b2c0def872a1f7484a8456e5a67a3b Price feed contract\nmat  1.500000000000000000000000000              Liquidation ratio\n```\n\nIndividial ilk values can be retrieved by adding the parameter name as an argument to the `ilk` command:\n\n```sh\n$ mcd --ilk=ETH-A ilk spot\n99.333333333333333333333333333\n```\n\n## Gem\n\nGems are collateral tokens. Collateral is added and removed from the via adapters, which abstract away the differences between various token behaviours. Use `gem [\u003csubcommand\u003e]` to manage collateral balances for any given Ilk.\n\n```sh\ngem --ilk=\u003cid\u003e name               Gem name e.g. Wrapped Ether\ngem --ilk=\u003cid\u003e symbol             Gem symbol e.g. WETH\ngem --ilk=\u003cid\u003e decimals           Number of decimals on gem e.g. 18\ngem --ilk=\u003cid\u003e balance            Print balances for a given urn (default: ETH_FROM)\ngem --ilk=\u003cid\u003e join \u003cwad\u003e         Add collateral to a given Urn (default: ETH_FROM)\ngem --ilk=\u003cid\u003e exit \u003cwad\u003e [\u003cguy\u003e] Remove collateral from an Urn (default: ETH_FROM)\n```\n\nThe `join` command can add collateral from the sender account to any specified Urn. The `exit` command can remove collateral from a specified Urn, provided that the sender controls the private key associated with that Urn.\n\nBy default, `ETH_FROM` is used to determine which Urn should be credited with collateral. Use `U, --urn=\u003caddress\u003e` to optionally credit an Urn other than the default.\n\n```sh\n$ mcd --ilk=ETH-A --urn=0x123456789abcdef0123456789abcdef012345678 join 100\n```\n\nThe `exit` command can remove collateral from a specified Urn, provided that the sender controls the private key associated with that Urn. The `exit` command can also withdraw collateral to an account other than `ETH_FROM` buy passing the destination address as an additional argument:\n\n```sh\n$ mcd --ilk=ETH-A exit 100 0xDecaf00000000000000000000000000000000000\n```\n\n## Urn\n\nUrns represent Cdp state for any given Urn address.\n\nUse the `urn` command to view Urn state for any given Ilk:\n\n```sh\nilk  ETH-A                                      Collateral type\nurn  0xC93C178EC17B06bddBa0CC798546161aF9D25e8A Urn handler\nink  45.000000000000000000                      Locked collateral (WETH)\nart  120.000000000000000000                     Issued debt (Dai)\ntab  120.000244107582797248312544980            Outstanding debt (Dai)\nrap  0.000244107582797248312544980              Accumulated stability fee (Dai)\n--\u003e  37.24                                      Collateralization ratio\n\nspot 99.333333333333333333333333333             WETH price with safety mat (USD)\nrate 1.000002034229856643749638820              WETH DAI exchange rate\n```\n\nBy default, `ETH_FROM` is used to determine which Urn to query. Use the `U, --urn=\u003caddress\u003e` option to query Urns at other indexes.\n\n#### Urn management\n\nUrn state (`urn.ink` and `urn.art`) is managed via the `frob \u003cdink\u003e \u003cdart\u003e` command, where `dink` and `dart` are delta amounts by which `ink` (Locked collateral) and `art` (Outstanding debt) should be changed. For example, to lock 100 WETH and draw 400 Dai on the ETH-A Ilk:\n\n```sh\n$ mcd --ilk=ETH-A frob -- 100 400\n```\n\nTo reduce outstanding debt by 200 Dai whilst keeping the amount of locked collateral constant:\n\n\n```sh\n$ mcd --ilk=ETH-A frob -- 0 -200\n```\n\n## Dai\n\nSimilar to Gem adapters, a Dai adapter is used to exchange Vat Dai for ERC20 token Dai which can then be used outside the system. Use `dai [\u003csubcommand\u003e]` to manage dai balances.\n\n```sh\ndai balance    Print balances for a given urn (default: ETH_FROM)\ndai join \u003cwad\u003e Exchange DSToken Dai for Vat Dai\ndai exit \u003cwad\u003e Exchange Vat Dai for DSToken Dai\n```\n\nOnce Dai has been drawn on an Urn, it can be withdrawn for use outside the system using `dai exit`. Dai can be returned to repay Urn debt via `dai join`.\n\nThe `dai balance` command displays the internal system (vat) balance and the external (ext) token balance:\n\n```sh\n$ mcd dai balance\nvat 1030.003120998308631176024235912000000000000000000 Vat balance\next 0.000000000000000000 ERC20 balance\n```\n\nIndividial balance values can be retrieved by adding `vat` or `ext` as an argument to the `balance` command:\n\n```\n$ mcd dai balance vat\n1030.003120998308631176024235912000000000000000000\n```\n\n## Cdp\n\nThe `cdp` command provides compatability with CDPs managed via the CDP Portal and uses\nthe same proxy contract and [Cdp Manager](https://github.com/makerdao/dss-cdp-manager)\nfont-end. This allows CDPs to be managed via a unique integer identifier rather than the\n`I, --ilk` and `U, --urn` options.\n\n```sh\nUsage: mcd cdp [\u003cid\u003e] [\u003ccommand\u003e]\n\nCommands: ls [\u003cowner\u003e]     List Cdps\n          count [\u003cowner\u003e]  Cdp count\n          open             Open a new Cdp\n          \u003cid\u003e urn         Cdp state\n          \u003cid\u003e lock \u003cwad\u003e  Join \u0026 lock collateral\n          \u003cid\u003e free \u003cwad\u003e  Free \u0026 exit collateral\n          \u003cid\u003e draw \u003cwad\u003e  Draw \u0026 exit dai\n          \u003cid\u003e wipe \u003cwad\u003e  Join \u0026 wipe dai\n```\n\n---\n\n## Examples\n\nNote: examples assume that `ETH_FROM` is set to an address controlled by the user, and that the `MCD_CHAIN` env variable has been set to a vaild chain identifier.\n\n### 1. Native Urn - lock 100 ETH \u0026 draw 500 Dai\n\nNote: The system doesn't handle ETH directly but instead uses WETH to represent\nETH collateral. For convenience, the `wrap` and `unwrap` commands are provided\nfor exchanging ETH to WETH and visa versa.\n\n```sh\n# i) Wrap\n$ mcd wrap 100\neth  900.000000000000000000\nweth 100.000000000000000000\n\n# ii) Gem join\n$ mcd --ilk=ETH-A gem join 100\n$ Grant approval to move WETH to the Vat? [Y/n]: Y\nvat 100.000000000000000000 Free collateral (WETH)\nink   0.000000000000000000 Locked collateral (WETH)\next   0.000000000000000000 External account balance (WETH)\next 900.000000000000000000 External account balance (ETH)\n\n# iii) Lock \u0026 Draw\n$ mcd --ilk=ETH-A frob 100 500\nilk  ETH-A                                      Collateral type\nurn  0xC93C178EC17B06bddBa0CC798546161aF9D25e8A Urn handler\nink  100.000000000000000000                     Locked collateral (WETH)\nart  500.000000000000000000                     Issued debt (Dai)\ntab  500.000244107582797248312544980            Outstanding debt (Dai)\nrap  0.000244107582797248312544980              Accumulated stability fee (Dai)\n--\u003e  19.86                                      Collateralization ratio\n\n# iv) Withdraw Dai\n$ mcd dai exit 500\nvat 0.000060682318362511884962000000000000000000000 Vat balance\next 500.000000000000000000 ERC20 balance\n```\n\n### 2. Managed Cdp - lock 100 BAT \u0026 draw 50 Dai\n\n```sh\n# i) Open\n$ mcd --ilk=BAT-A cdp open\nmcd-cdp-open: Waiting for transaction receipt...\n0x800e5578d3ac4b77b7ada1aba48cf80d0d238d4392d2676d79159eac2c2cdd73\nOpened: cdp 19\n\n# ii) Lock\n$ mcd --ilk=BAT-A cdp 19 lock 100\nseth-send: Published transaction with 260 bytes of calldata.\nseth-send: 0x4d30cb4863ca997d24ff2346c9a92e86648369ce7b4a86ed004c73b8d4ef299a\nseth-send: Waiting for transaction receipt...\nseth-send: Transaction included in block 333.\nilk  BAT-A                                      Collateral type\nurn  0x4518c4709a50C915b7996A0e6Dfb38c67248BBcF Urn handler\nink  100.000000000000000000                     Locked collateral (BAT)\nart  0.000000000000000000                       Issued debt (Dai)\ntab  0                                          Outstanding debt (Dai)\nrap  0                                          Accumulated stability fee (Dai)\n--\u003e  0                                          Collateralization ratio\n\n# iii) Draw\n$ mcd --ilk=BAT-A cdp 19 draw 500\nseth-send: Published transaction with 260 bytes of calldata.\nseth-send: 0xd5fb7ddf94bb910fbba2af118ecde88a03a13129b2e1979238236afe672781c3\nseth-send: Waiting for transaction receipt...\nseth-send: Transaction included in block 335.\nilk  BAT-A                                      Collateral type\nurn  0x4518c4709a50C915b7996A0e6Dfb38c67248BBcF Urn handler\nink  100.000000000000000000                     Locked collateral (BAT)\nart  49.999505439113270178                      Issued debt (Dai)\ntab  50.000000000000000000000000000             Outstanding debt (Dai)\nrap  0.000494560886729822000020743              Accumulated stability fee (Dai)\n--\u003e  16.66                                      Collateralization ratio\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakerdao%2Fmcd-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakerdao%2Fmcd-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakerdao%2Fmcd-cli/lists"}