Maker Docs
Search…
Multi Collateral Dai (MCD) CLI
Welcome to the MCD CLI

Installation

First install dapp tools:
1
$ curl https://dapp.tools/install | sh
Copied!
Then install the mcd package:
1
$ dapp pkg install mcd
Copied!

The following list details all of the commands available when interacting with the command-line interface:

1
MCD - Multi-collateral Dai
2
3
Usage: mcd [<options>] <command> [<args>]
4
or: mcd help [<command>]
5
6
Commands:
7
8
bite Trigger liquidation of an unsafe Urn
9
bites Recent bites
10
cdp CDP managerment
11
dai Dai management
12
debt Total dai issuance
13
drip Trigger stability fee accumulation
14
flap Trigger a flap auction
15
flips View flips and kick-off auctions
16
flog Release queued bad-debt for auction
17
flop Trigger a flop auction
18
frob Urn management
19
frobs Recent frobs
20
gem Collateral management
21
help Print help about mcd or one of its subcommands
22
ilk Ilk (collateral type) parameters
23
line Total debt ceiling
24
live Liveness flag
25
poke Update the spot price for a given Ilk
26
unwrap Unwrap WETH to ETH
27
urn CDP state
28
vice Total bad debt
29
vow Liquidator balances
30
wrap Wrap ETH to WETH
Copied!

Configuration

Mcd is built on Seth and uses the same network configuration options, which just like Seth, can be defined in the ~/sethrc initialisation file.
Similar to Seth, mcd also supports transaction signing with Ledger hardware wallets and can run against both local and remote nodes.
Since 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=<chain> (MCD_CHAIN) option and -F, --from=<address> (ETH_FROM) sender account when not using a testnet.
Example ~/.sethrc:
1
#!/usr/bin/env bash
2
export ETH_FROM=0x4Ffa8667Fe2db498DCb95A322b448eA688Ce430c
3
export MCD_CHAIN=kovan
Copied!
Kovan
Run 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.
1
$ export ETH_FROM=0x4Ffa8667Fe2db498DCb95A322b448eA688Ce430c
2
$ mcd --chain=kovan dai join 100
Copied!
Remote testchain
Run 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:
1
$ mcd testnet chains`
Copied!
Then set the chain option, or the chain env variable to the appropriate testchain Id.
1
$ export MCD_CHAIN=12899149080555595289
2
$ mcd dai join 100
Copied!
Local testnet
Run against a locally running instance of Dapp testnet 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.
By 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.
1
$ export MCD_CONFIG=~/testchain-deployment-scripts/out/addresses.json
2
$ mcd -C testnet dai join 100
Copied!

Ilk

Ilks 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.
1
$ mcd ilks
2
ILK GEM DESC
3
4
ETH-A WETH Ethereum
5
ETH-B WETH Ethereum
6
REP-A REP Augur
Copied!
Each Ilk has its own set of configuration parameters which can be viewed via the ilk command. The I, --ilk=<id> option is used to scope commands to a particular Ilk:
1
$ mcd --ilk=ETH-A ilk
2
Art 40.000000000000000000 Total debt (DAI)
3
rate 1.000080370887129123082627939 WETH DAI exchange rate
4
spot 99.333333333333333333333333333 WETH price with safety mat (USD)
5
line 1000.0000000000000000000000000000000000000 Debt ceiling (DAI)
6
dust 0.0000000000000000000000000000000000000000 Debt floor (DAI)
7
flip 0x9d905effff127a01da3b38124f8da88e766eb8dd Flip auction contract
8
chop 1.000000000000000000000000000 Liquidation penalty
9
lump 10000.000000000000000000 Flip auction lot size
10
tax 1.000000000782997609082909351 Stability fee
11
rho 1552802862 Last drip timestamp
12
pip 0x98312e16f5b2c0def872a1f7484a8456e5a67a3b Price feed contract
13
mat 1.500000000000000000000000000 Liquidation ratio
Copied!
Individial ilk values can be retrieved by adding the parameter name as an argument to the ilk command:
1
$ mcd --ilk=ETH-A ilk spot
2
99.333333333333333333333333333
Copied!

Gem

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.
1
gem --ilk=<id> symbol Gem symbol e.g. WETH
2
gem --ilk=<id> balance Print balances for a given urn (default: ETH_FROM)
3
gem --ilk=<id> join <wad> Add collateral to a given Urn (default: ETH_FROM)
4
gem --ilk=<id> exit <wad> [<guy>] Remove collateral from an Urn (default: ETH_FROM)
Copied!
The 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.
By default, ETH_FROM is used to determine which Urn should be credited with collateral. Use U, --urn=<address> to optionally credit an Urn other than the default.
1
$ mcd --ilk=ETH-A --urn=0x123456789abcdef0123456789abcdef012345678 join 100
Copied!
The 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:
1
$ mcd --ilk=ETH-A exit 100 0xDecaf00000000000000000000000000000000000
Copied!

Urn

Urns represent Cdp state for any given Urn address.
Use the urn command to view Urn state for any given Ilk:
1
ilk ETH-A Collateral type
2
urn 0xC93C178EC17B06bddBa0CC798546161aF9D25e8A Urn handler
3
ink 45.000000000000000000 Locked collateral (WETH)
4
art 120.000000000000000000 Issued debt (Dai)
5
tab 120.000244107582797248312544980 Outstanding debt (Dai)
6
rap 0.000244107582797248312544980 Accumulated stability fee (Dai)
7
--> 37.24 Collateralization ratio
8
9
spot 99.333333333333333333333333333 WETH price with safety mat (USD)
10
rate 1.000002034229856643749638820 WETH DAI exchange rate
Copied!
By default, ETH_FROM is used to determine which Urn to query. Use the U, --urn=<address> option to query Urns at other indexes.
Urn management
Urn state (urn.ink and urn.art) is managed via the frob <dink> <dart> 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:
1
$ mcd --ilk=ETH-A frob 100 400
Copied!
To reduce outstanding debt by 200 Dai whilst keeping the amount of locked collateral constant:
1
$ mcd --ilk=ETH-A frob -- 0 -200
Copied!

Dai

Similar 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 [<subcommand>] to manage dai balances.
1
dai balance Print balances for a given urn (default: ETH_FROM)
2
dai join <wad> Exchange DSToken Dai for Vat Dai
3
dai exit <wad> Exchange Vat Dai for DSToken Dai
Copied!
Once 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.
The dai balance command displays the internal system (vat) balance and the external (ext) token balance:
1
$ mcd dai balance
2
vat 1030.003120998308631176024235912000000000000000000 Vat balance
3
ext 0.000000000000000000 ERC20 balance
Copied!
Individial balance values can be retrieved by adding vat or ext as an argument to the balance command:
1
$ mcd dai balance vat
2
1030.003120998308631176024235912000000000000000000
Copied!

Cdp

The cdp command provides compatability with CDPs managed via the CDP Portal and uses the same proxy contract and Cdp Manager font-end. This allows CDPs to be managed via a unique integer identifier rather than the I, --ilk and U, --urn options.
1
Usage: mcd cdp [<id>] [<command>]
2
3
Commands: ls [<owner>] List Cdps
4
count [<owner>] Cdp count
5
open Open a new Cdp
6
<id> urn Cdp state
7
<id> lock <wad> Join & lock collateral
8
<id> free <wad> Free & exit collateral
9
<id> draw <wad> Draw & exit dai
10
<id> wipe <wad> Join & wipe dai
Copied!

Examples

Note: 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.

1. Native Urn - lock 100 ETH & draw 500 Dai

Note: The system doesn't handle ETH directly but instead uses WETH to represent ETH collateral. For convenience, the wrap and unwrap commands are provided for exchanging ETH to WETH and visa versa.
1
# i) Wrap
2
$ mcd wrap 100
3
eth 900.000000000000000000
4
weth 100.000000000000000000
5
6
# ii) Gem join
7
$ mcd --ilk=ETH-A gem join 100
8
$ Grant approval to move WETH to the Vat? [Y/n]: Y
9
vat 100.000000000000000000 Free collateral (WETH)
10
ink 0.000000000000000000 Locked collateral (WETH)
11
ext 0.000000000000000000 External account balance (WETH)
12
ext 900.000000000000000000 External account balance (ETH)
13
14
# iii) Lock & Draw
15
$ mcd --ilk=ETH-A frob 100 500
16
ilk ETH-A Collateral type
17
urn 0xC93C178EC17B06bddBa0CC798546161aF9D25e8A Urn handler
18
ink 100.000000000000000000 Locked collateral (WETH)
19
art 500.000000000000000000 Issued debt (Dai)
20
tab 500.000244107582797248312544980 Outstanding debt (Dai)
21
rap 0.000244107582797248312544980 Accumulated stability fee (Dai)
22
--> 19.86 Collateralization ratio
23
24
# iv) Withdraw Dai
25
$ mcd dai exit 500
26
vat 0.000060682318362511884962000000000000000000000 Vat balance
27
ext 500.000000000000000000 ERC20 balance
Copied!

2. Managed Cdp - lock 100 REP & draw 50 Dai

1
# i) Open
2
$ mcd --ilk=REP-A cdp open
3
mcd-cdp-open: Waiting for transaction receipt...
4
0x800e5578d3ac4b77b7ada1aba48cf80d0d238d4392d2676d79159eac2c2cdd73
5
Opened: cdp 19
6
7
# ii) Lock
8
$ mcd --ilk=REP-A cdp 19 lock 100
9
seth-send: Published transaction with 260 bytes of calldata.
10
seth-send: 0x4d30cb4863ca997d24ff2346c9a92e86648369ce7b4a86ed004c73b8d4ef299a
11
seth-send: Waiting for transaction receipt...
12
seth-send: Transaction included in block 333.
13
ilk REP-A Collateral type
14
urn 0x4518c4709a50C915b7996A0e6Dfb38c67248BBcF Urn handler
15
ink 100.000000000000000000 Locked collateral (REP)
16
art 0.000000000000000000 Issued debt (Dai)
17
tab 0 Outstanding debt (Dai)
18
rap 0 Accumulated stability fee (Dai)
19
--> 0 Collateralization ratio
20
21
# iii) Draw
22
$ mcd --ilk=REP-A cdp 19 draw 500
23
seth-send: Published transaction with 260 bytes of calldata.
24
seth-send: 0xd5fb7ddf94bb910fbba2af118ecde88a03a13129b2e1979238236afe672781c3
25
seth-send: Waiting for transaction receipt...
26
seth-send: Transaction included in block 335.
27
ilk REP-A Collateral type
28
urn 0x4518c4709a50C915b7996A0e6Dfb38c67248BBcF Urn handler
29
ink 100.000000000000000000 Locked collateral (REP)
30
art 49.999505439113270178 Issued debt (Dai)
31
tab 50.000000000000000000000000000 Outstanding debt (Dai)
32
rap 0.000494560886729822000020743 Accumulated stability fee (Dai)
33
--> 16.66 Collateralization ratio
Copied!
Last modified 2yr ago