Getting MakerDAO vaults basic data
===================================
.. http:get:: /api/(version)/blockchains/ETH/modules/makerdao/vaults
Doing a GET on the makerdao vault resource will return the basic information for each vault the user has
.. note::
This endpoint can also be queried asynchronously by using ``"async_query": true``
.. note::
This endpoint also accepts parameters as query arguments.
**Example Request**:
.. http:example:: curl wget httpie python-requests
GET /api/1/blockchains/ETH/modules/makerdao/vaults HTTP/1.1
Host: localhost:5042
:reqjson bool async_query: Boolean denoting whether this is an asynchronous query or not
**Example Response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"result": [{
"identifier": 1,
"name": "ETH-A",
"collateral_asset": "ETH",
"collateral_amount": "5.232",
"debt_value": "650",
"collateralization_ratio": "234.21%",
"liquidation_ratio": "150%"
}, {
"identifier": 55,
"name": "USDC-A",
"collateral_asset": "USDC",
"collateral_amount": "150",
"debt_value": "50",
"collateralization_ratio": "250.551%",
"liquidation_ratio": "150%"
}]
"message": ""
}
:resjson object result: A list of all vaults auto detected for the user's accounts
:resjsonarr string identifier: A unique integer identifier for the vault.
:resjsonarr string name: The name of the vault given by the system.
:resjsonarr string collateral_asset: The asset deposited in the vault as collateral. As of this writing supported assets are ``["ETH", "BAT", "USDC", "WBTC"]``
:resjsonarr string collateral_amount: The amount of collateral currently deposited in the vault
:resjsonarr string debt_value: The amount of DAI owed to the vault. So generated DAI plus the stability fee interest.
:resjsonarr string collateralization_ratio: A string denoting the percentage of collateralization of the vault.
:resjsonarr string liquidation_ratio: This is the current minimum collateralization ratio. Less than this and the vault is going to get liquidated.
:statuscode 200: Vaults succesfuly queried
:statuscode 409: User is not logged in. Or makerdao module is not activated.
:statuscode 500: Internal Rotki error.
:statuscode 502: An external service used in the query such as etherscan could not be reached or returned unexpected response.
Getting MakerDAO vault details
===================================
.. http:get:: /api/(version)/blockchains/ETH/modules/makerdao/vaultdetails
.. note::
This endpoint is only available for premium users
Doing a GET on the makerdao vault details resource will return additional details for each vault and also the list of vault events such as deposits, withdrawals, liquidations, debt generation and repayment.
.. note::
This endpoint can also be queried asynchronously by using ``"async_query": true``
.. note::
This endpoint also accepts parameters as query arguments.
**Example Request**:
.. http:example:: curl wget httpie python-requests
GET /api/1/blockchains/ETH/modules/makerdao/vaultdetails HTTP/1.1
Host: localhost:5042
:reqjson bool async_query: Boolean denoting whether this is an asynchronous query or not
**Example Response**:
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"result": [{
"identifier": 1,
"liquidation_price": "105.01",
"collateral_usd_value": "2550.22",
"creation_ts": 1589067898,
"total_interest_owed": "0.02341",
"events": [{
"event_type": "deposit",
"amount": "5.551",
"timestamp": 1589067899,
"tx_hash": "0x678f31d49dd70d76c0ce441343c0060dc600f4c8dbb4cee2b08c6b451b6097cd"
}, {
"event_type": "generate",
"amount": "325",
"timestamp": 1589067900,
"tx_hash": "0x678f31d49dd70d76c0ce441343c0060dc600f4c8dbb4cee2b08c6b451b6097cd"
}]
}, {
"identifier": 56,
"liquidation_price": "0.82",
"collateral_usd_value": "1500.21",
"creation_ts": 1589067897,
"total_interest_owed": "0.000141",
"events": [{
"event_type": "deposit",
"amount": "1050.21",
"timestamp": 1589067899
"tx_hash": "0x678f31d49dd70d76c0ce441343c0060dc600f4c8dbb4cee2b08c6b451b6097cd"
}, {
"event_type": "generate",
"amount": "721.32",
"timestamp": 1589067900
"tx_hash": "0x678f31d49dd70d76c0ce441343c0060dc600f4c8dbb4cee2b08c6b451b6097cd"
}]
}]
"message": ""
}
:resjson object result: A list of all vault details detected.
:resjsonarr string liquidation_price: The USD price that the asset deposited in the vault as collateral at which the vault is going to get liquidated.
:resjsonarr string collateral_usd_value: The current value in USD of all the collateral in the vault according to the MakerDAO price feed.
:resjsonarr int creation_ts: The timestamp of the vault's creation
:resjsonarr string total_interest_owed: Total amount of DAI lost to the vault as interested rate.
:resjson object events: A list of all events that occured for this vault
:resjsonarr string event_type: The type of the event. Valid types are: ``["deposit", "withdraw", "generate", "payback", "liquidation"]``
:resjsonarr string amount: The amount associated with the event. So collateral deposited/withdrawn, debt generated/paid back, amount of collateral lost in liquidation.
:resjsonarr int timestamp: The unix timestamp of the event
:resjsonarr string tx_hash: The transaction hash associated with the event.
:statuscode 200: Vault details succesfuly queried
:statuscode 409: User is not logged in. Or makerdao module is not activated.
:statuscode 500: Internal Rotki error.
:statuscode 502: An external service used in the query such as etherscan could not be reached or returned unexpected response.
Frontend
Under the Decentralized Finance menu add a new entry called "Borrowing". Also rename "Loans" to "Lending".
When the user clicks on the Borrowing page he will go a similar view as Loans where he will see MakerDAO Vaults instead of DSR.
List of vaults will be autodetected and much like in the DSR will be selectable via a dropdown menu.
Basic version
In the basic version if a vault is selected the user can see:
identifier of the vault
how much collateral (and which collateral) is in the vault
the generated debt (how much DAI you got out of the vault plus any interest rates due to the stability fee)
the current collateralization ratio
the current liquidation rate (aka collateralization ratio under which you are open to liquidation)
Premium version
Same as basic version but with the addition of:
Creation date
Vault's liquidation price
Vault's collateral's USD value
Total interest owed: Total amount of DAI lost to the vault as interested rate.
[MAYBE] Show user % of his asset that is exposed in the vault. So if say you have 100 ETH and 10 ETH is locked in the vault this would show 10%
A table of actions that the user performed on the vault. Basically offer the same table they have in defi save: https://defiexplore.com/cdp/1455
Warn the user with a dismissible popup if the current collateral price is $X close to liquidation price. X should be configurable.
Also include Vault profit loss in the tax report. Will need to probably put a new category of taxable actions and bunch it together with the makerdao DSR loans.
Feature Description
If the user has opened a maker vault to lock up ETH and earn DAI Rotki should be able to track it.
Miscelaneous Info
Maker Vaults info: https://community-development.makerdao.com/makerdao-mcd-faqs/faqs/vault Maker Vaults docs: https://docs.makerdao.com/smart-contract-modules/rates-module/jug-detailed-documentation Example vault: https://defiexplore.com/cdp/1455
Specification
Backend
Rest API endpoints
Frontend
Under the Decentralized Finance menu add a new entry called "Borrowing". Also rename "Loans" to "Lending".
When the user clicks on the Borrowing page he will go a similar view as Loans where he will see MakerDAO Vaults instead of DSR.
List of vaults will be autodetected and much like in the DSR will be selectable via a dropdown menu.
Basic version
In the basic version if a vault is selected the user can see:
Premium version
Same as basic version but with the addition of:
$X
close to liquidation price.X
should be configurable.Also include Vault profit loss in the tax report. Will need to probably put a new category of taxable actions and bunch it together with the makerdao DSR loans.