Multi Collateral Dai (MCD) CLI
Welcome to the MCD CLI
Installation
First install dapp tools:
$ curl https://dapp.tools/install | shThen install the mcd package:
$ dapp pkg install mcd
The following list details all of the commands available when interacting with the command-line interface:
MCD - Multi-collateral Dai
Usage: mcd [<options>] <command> [<args>]
or: mcd help [<command>]
Commands:
bite Trigger liquidation of an unsafe Urn
bites Recent bites
cdp CDP managerment
dai Dai management
debt Total dai issuance
drip Trigger stability fee accumulation
flap Trigger a flap auction
flips View flips and kick-off auctions
flog Release queued bad-debt for auction
flop Trigger a flop auction
frob Urn management
frobs Recent frobs
gem Collateral management
help Print help about mcd or one of its subcommands
ilk Ilk (collateral type) parameters
line Total debt ceiling
live Liveness flag
poke Update the spot price for a given Ilk
unwrap Unwrap WETH to ETH
urn CDP state
vice Total bad debt
vow Liquidator balances
wrap Wrap ETH to WETHConfiguration
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:
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.
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:
Then set the chain option, or the chain env variable to the appropriate testchain Id.
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.
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.
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:
Individial ilk values can be retrieved by adding the parameter name as an argument to the ilk command:
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.
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.
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:
Urn
Urns represent Cdp state for any given Urn address.
Use the urn command to view Urn state for any given Ilk:
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:
To reduce outstanding debt by 200 Dai whilst keeping the amount of locked collateral constant:
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.
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:
Individial balance values can be retrieved by adding vat or ext as an argument to the balance command:
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.
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.
2. Managed Cdp - lock 100 REP & draw 50 Dai
Last updated