backstop-protocol / dss-cdp-manager

GNU Affero General Public License v3.0
1 stars 3 forks source link

1. Introduction (Summary)

Summary: The DssCdpManager (aka manager) was created to enable a formalized process for CDPs to be transferred between owners. In short, the manager works by having a dss wrapper that allows users to interact with their CDPs in an easy way, treating them as non-fungible tokens (NFTs).

2. Contract Details

Key Functionalities (as defined in the smart contract)

Note: dst refers to the destination address.

Storage Layout

3. Key Mechanisms & Concepts

Summary

The CDP manager was created as a way to enable CDPs to be treated more like assets that can be exchanged as non-fungible tokens (NFT) would. Originally when created, the dss core contracts did not have the functionality to enable the transfer of CDP positions, hence the CDP manager was created to wrap this functionality and enable transferring between users. Since then, the core contracts have also implemented a native transfer functionality called fork which allows the transferring of a CDP to another address. However, there is a restriction, which is that the address owner that will be receiving the CDP needs to provide authorization that they do in fact want to receive it. This was created for the situation when a user is transferring the collateral that is locked as well as the debt generated. If you are simply moving collateral to another address, there is no issue but in the case that you are also transferring the debt generated, there is a chance of putting a perfectly safe CDP in a risky position. This makes the contract functionality a little more restrictive. Therefore, the CDP manager is a good option to keep a simple way of transferring CDPs and recognizing them via a numeric Id.

High-level Purpose

CDP Manager Usage Example (common path):

4. Gotchas (Potential source of user error)

5. Failure Modes (Bounds on Operating Conditions & External Risk Factors)

Potential Issues around Chain Reorganization

When open is executed, a new urn is created and a cdpId is assigned to it for a specific owner. If the user uses join to add collateral to the urn immediately after the transaction is mined, there is a chance that a reorganization of the chain occurs. This would result in the user losing the ownership of that cdpId/urn pair, therefore losing their collateral. However, this issue can only arise when avoiding the use of the proxy functions (https://github.com/makerdao/dss-proxy-actions) via a profile proxy (https://github.com/dapphub/ds-proxy) as the user will open the cdp and join collateral in the same transaction.