-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CDP Spec #328
Add CDP Spec #328
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Left a few comments regarding terms and concepts, then mostly typos/wording suggestions.
x/cdp/spec/01_concepts.md
Outdated
|
||
In the event of a decrease in the price of the collateral, the total value of all collateral in CDPs may drop below the value of all the issued pegged asset. This undesirable event is countered through two mechanisms. | ||
|
||
**CDP Liquidations** Each CDP is monitored for ratio of collateral value to debt value. When this drops too low the collateral and debt is seized by the system. The collateral is sold off through an auction to bring in pegged asset which is burned against the seized debt. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear use of 'pegged asset'. I think this could be confusing to outside readers. I would reccommend stable asset instead.
x/cdp/spec/02_state.md
Outdated
Listed here is the state stored by the module. | ||
For details see the types package. In particular `keys.go` describes how state is stored in the key-value store. | ||
<!-- | ||
Store key structures are not listed here - they seem like an implementation detail best documented by code comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment. I'm fine with leaving the keys to code comments.
x/cdp/spec/02_state.md
Outdated
# State | ||
|
||
Listed here is the state stored by the module. | ||
For details see the types package. In particular `keys.go` describes how state is stored in the key-value store. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link to the file keys.go
x/cdp/spec/03_messages.md
Outdated
|
||
## DrawDebt | ||
|
||
DrawDebt creates debt in a CDP, minting new pegged asset which is sent to the sender. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DrawDebt creates debt in a CDP, minting new pegged asset which is sent to the sender. | |
DrawDebt creates debt in a CDP, minting new stable asset which is sent to the sender. |
x/cdp/spec/03_messages.md
Outdated
## DrawDebt | ||
|
||
DrawDebt creates debt in a CDP, minting new pegged asset which is sent to the sender. | ||
<!-- TODO Can the sender own have same collateral multiple CDPs? if so how do they choose between them. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment. Not sure what's being asked... clarify if you still have questions.
x/cdp/spec/03_messages.md
Outdated
|
||
- `Collateral` taken from depositor and sent to cdp module account | ||
- the depositor's `Deposit` struct is updated or a new one created | ||
- fees are updated (see below) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to mention that the collateral index is updated? Same applies to other state changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be in favour of leaving it out. I'd prefer not to describe too much details
x/cdp/spec/04_begin_block.md
Outdated
## Update Fees | ||
|
||
- The total fees accumulated since the last block across all CDPs are calculated. | ||
- An equal amount of debt coins are minted and sent to the system's liquidator module account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- An equal amount of debt coins are minted and sent to the system's liquidator module account. | |
- An equal amount of debt coins are minted and sent to the system's cdp module account. | |
- An equal amount of stable asset coins are minted and sent to the system's liquidator module account |
x/cdp/spec/04_begin_block.md
Outdated
|
||
## Net Out System Debt, Re-Balance | ||
|
||
- Burn the maximum possible equal amount of debt and pegged asset from the liquidator module account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Burn the maximum possible equal amount of debt and pegged asset from the liquidator module account. | |
- Burn the maximum possible equal amount of debt and stable asset from the liquidator module account. |
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few final suggestions, LGTM after those changes.
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
* add overview and basic structure * add state and params * add basic messages * add state transitions * add begin block state transitions * add missing titles * add concepts * add events * update state and concepts * update for liquidator changes * update events * mention module accounts * update begin block * update params * update page numbering * add fee descriptions * add broken link linter * add broken link linter to CI * move link check to end of CI * update typo Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com> * address review comments * Update x/cdp/spec/06_params.md Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com> * Update x/cdp/spec/README.md Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com> * Update x/cdp/spec/README.md Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com> Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
TODO
Notes:
Proposal: