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

Commit d7561dd

Browse files
committed
cdp: Readme
1 parent aaa5b0f commit d7561dd

File tree

2 files changed

+94
-26
lines changed

2 files changed

+94
-26
lines changed

README.md

+86-18
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Usage: mcd [<options>] <command> [<args>]
99
Commands:
1010
1111
bite Trigger liquidation of an unsafe Urn
12-
bites ReUrns
12+
bites Recent bites
13+
cdp CDP managerment
1314
dai Dai management
1415
debt Total dai issuance
1516
drip Trigger stability fee accumulation
@@ -22,6 +23,8 @@ Commands:
2223
gem Collateral management
2324
help Print help about mcd or one of its subcommands
2425
ilk Ilk (collateral type) parameters
26+
line Total debt ceiling
27+
live Liveness flag
2528
poke Update the spot price for a given Ilk
2629
unwrap Unwrap WETH to ETH
2730
urn CDP state
@@ -46,7 +49,7 @@ $ dapp pkg install mcd
4649

4750
## Configuration
4851

49-
Mcd is built on top of [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.
52+
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.
5053

5154
Similar to Seth, `mcd` also supports transaction signing with Ledger hardware wallets and can run against both local and remote nodes.
5255

@@ -167,14 +170,16 @@ Urns represent Cdp state for any given Urn address.
167170
Use the `urn` command to view Urn state for any given Ilk:
168171

169172
```sh
170-
$ mcd --ilk=ETH-A urn
171-
ilk ETH-A Collateral type
172-
urn 4Ffa8667Fe2db498DCb95A322b448eA688Ce430c Owner
173-
ink 204.000000000000000000 Locked collateral (WETH)
174-
art 40.000000000000000000 Outstanding debt (DAI)
175-
spot 99.333333333333333333333333333 Price with safety mat (USD)
176-
rate 1.000080370887129123082627939 WETH DAI exchange rate
177-
fill 50655 Collateralisation ratio (%)
173+
ilk ETH-A Collateral type
174+
urn 0xC93C178EC17B06bddBa0CC798546161aF9D25e8A Urn handler
175+
ink 45.000000000000000000 Locked collateral (WETH)
176+
art 120.000000000000000000 Issued debt (Dai)
177+
tab 120.000244107582797248312544980 Outstanding debt (Dai)
178+
rap 0.000244107582797248312544980 Accumulated stability fee (Dai)
179+
--> 37.24 Collateralization ratio
180+
181+
spot 99.333333333333333333333333333 WETH price with safety mat (USD)
182+
rate 1.000002034229856643749638820 WETH DAI exchange rate
178183
```
179184

180185
By default, `ETH_FROM` is used to determine which Urn to query. Use the `U, --urn=<address>` option to query Urns at other indexes.
@@ -220,13 +225,38 @@ Individial balance values can be retrieved by adding `vat` or `ext` as an argume
220225
$ mcd dai balance vat
221226
1030.003120998308631176024235912000000000000000000
222227
```
228+
229+
## Cdp
230+
231+
The `cdp` command provides compatability with CDPs managed via the CDP Portal and uses
232+
the same proxy contract and [Cdp Manager](https://github.com/makerdao/dss-cdp-manager)
233+
font-end. This allows CDPs to be managed via a unique integer identifier rather than the
234+
`I, --ilk` and `U, --urn` options.
235+
236+
```sh
237+
Usage: mcd cdp [<id>] [<command>]
238+
239+
Commands: ls [<owner>] List Cdps
240+
count [<owner>] Cdp count
241+
open Open a new Cdp
242+
<id> urn Cdp state
243+
<id> lock <wad> Join & lock collateral
244+
<id> free <wad> Free & exit collateral
245+
<id> draw <wad> Draw & exit dai
246+
<id> wipe <wad> Join & wipe dai
247+
```
248+
249+
---
250+
223251
## Examples
224252

225253
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.
226254

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

229-
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.
257+
Note: The system doesn't handle ETH directly but instead uses WETH to represent
258+
ETH collateral. For convenience, the `wrap` and `unwrap` commands are provided
259+
for exchanging ETH to WETH and visa versa.
230260

231261
```sh
232262
# i) Wrap
@@ -244,16 +274,54 @@ ext 900.000000000000000000 External account balance (ETH)
244274

245275
# iii) Lock & Draw
246276
$ mcd --ilk=ETH-A frob 100 500
247-
ilk ETH-A Collateral type
248-
urn 41dc7BaBdEE52047e00F5F55973F3122985E7eBc Owner
249-
ink 100.000000000000000000 Locked collateral (WETH)
250-
art 500.000000000000000000 Outstanding debt (DAI)
251-
spot 100.000000000000000000000000000 Price with safety mat (USD)
252-
rate 1.000000000000000000000000000 WETH DAI exchange rate
253-
fill 2000 Collateralization Ratio (%)
277+
ilk ETH-A Collateral type
278+
urn 0xC93C178EC17B06bddBa0CC798546161aF9D25e8A Urn handler
279+
ink 100.000000000000000000 Locked collateral (WETH)
280+
art 500.000000000000000000 Issued debt (Dai)
281+
tab 500.000244107582797248312544980 Outstanding debt (Dai)
282+
rap 0.000244107582797248312544980 Accumulated stability fee (Dai)
283+
--> 19.86 Collateralization ratio
254284

255285
# iv) Withdraw Dai
256286
$ mcd dai exit 500
257287
vat 0.000060682318362511884962000000000000000000000 Vat balance
258288
ext 500.000000000000000000 ERC20 balance
259289
```
290+
291+
### 2. Managed Cdp - lock 100 COL1 & draw 50 Dai
292+
293+
```sh
294+
# i) Open
295+
$ mcd --ilk=COL1-A cdp open
296+
mcd-cdp-open: Waiting for transaction receipt...
297+
0x800e5578d3ac4b77b7ada1aba48cf80d0d238d4392d2676d79159eac2c2cdd73
298+
Opened: cdp 19
299+
300+
# ii) Lock
301+
$ mcd --ilk=COL1-A cdp 19 lock 100
302+
seth-send: Published transaction with 260 bytes of calldata.
303+
seth-send: 0x4d30cb4863ca997d24ff2346c9a92e86648369ce7b4a86ed004c73b8d4ef299a
304+
seth-send: Waiting for transaction receipt...
305+
seth-send: Transaction included in block 333.
306+
ilk COL1-A Collateral type
307+
urn 0x4518c4709a50C915b7996A0e6Dfb38c67248BBcF Urn handler
308+
ink 100.000000000000000000 Locked collateral (COL1)
309+
art 0.000000000000000000 Issued debt (Dai)
310+
tab 0 Outstanding debt (Dai)
311+
rap 0 Accumulated stability fee (Dai)
312+
--> 0 Collateralization ratio
313+
314+
# iii) Draw
315+
$ mcd --ilk=COL1-A cdp 19 draw 500
316+
seth-send: Published transaction with 260 bytes of calldata.
317+
seth-send: 0xd5fb7ddf94bb910fbba2af118ecde88a03a13129b2e1979238236afe672781c3
318+
seth-send: Waiting for transaction receipt...
319+
seth-send: Transaction included in block 335.
320+
ilk COL1-A Collateral type
321+
urn 0x4518c4709a50C915b7996A0e6Dfb38c67248BBcF Urn handler
322+
ink 100.000000000000000000 Locked collateral (COL1)
323+
art 49.999505439113270178 Issued debt (Dai)
324+
tab 50.000000000000000000000000000 Outstanding debt (Dai)
325+
rap 0.000494560886729822000020743 Accumulated stability fee (Dai)
326+
--> 16.66 Collateralization ratio
327+
```

libexec/mcd/mcd-cdp

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
### mcd-cdp -- CDP managerment
33
### Usage: mcd cdp [<id>] [<command>]
44
###
5-
### Commands: cdp ls [<owner>] List Cdps
6-
### cdp count [<owner>] Cdp count
7-
### cdp open Open a new Cdp
8-
### cdp urn Get Cdp state
9-
### cdp <id> lock <wad> Join & lock collateral
10-
### cdp <id> free <wad> Free & exit collateral
11-
### cdp <id> draw <wad> Draw & exit dai
12-
### cdp <id> wipe <wad> Join & wipe dai
5+
### Commands: ls [<owner>] List Cdps
6+
### count [<owner>] Cdp count
7+
### open Open a new Cdp
8+
### <id> urn Cdp state
9+
### <id> lock <wad> Join & lock collateral
10+
### <id> free <wad> Free & exit collateral
11+
### <id> draw <wad> Draw & exit dai
12+
### <id> wipe <wad> Join & wipe dai
1313
set -e
1414
shopt -s extglob
1515

0 commit comments

Comments
 (0)