Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pages/addresses/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Deployments
This provides valuable information for developers interacting with Descent Protocol deployments. This includes deployments on the following networks:

- Base Mainnet (comming soon)
- Base Mainnet (coming soon)
- Base Goerli Testnet

### Base Goerli Testnet - Core Protocol Contract
Expand Down
6 changes: 3 additions & 3 deletions pages/guides/collateral.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Users or community members propose new collateral assets through a governance me

## Collateral Data structure
### Collateralisation Ratio
The collateralisation ratio determines the amount of Currency a borrower is allowed to mint relative to their deposited collateral. If the collateralisation ratio of currency xNGN with collateral USDC is 80%, this means that for every deposited USDC, the borrower can only mint at most least 80% xNGN worth of USDC.
The collateralization ratio determines the amount of Currency a borrower is allowed to mint relative to their deposited collateral. If the collateralization ratio of currency xNGN with collateral USDC is 80%, this means that for every deposited USDC, the borrower can only mint at least 80% xNGN worth of USDC.

Take this example,

Expand All @@ -26,12 +26,12 @@ USER A can mint at most 80% xNGN worth of 100 USDC
i.e 80 USDC * 1,000 (exchange rate) = 80,000 xNGN
```

As you can imagine, this check is enforced when a borrower wants to borrow a currency. It is important to have this gap especially for volatile collateral or currencies to reduce the possibilities of a position suddenly being under-collaterised before liquidations can take place. This threshold would vary per collateral per currency as their volatility has to be put into consideration.
As you can imagine, this check is enforced when a borrower wants to borrow a currency. It is important to have this gap especially for volatile collateral or currencies to reduce the possibilities of a position suddenly being under-collateralized before liquidations can take place. This threshold would vary per collateral per currency as their volatility has to be put into consideration.

### Minimum Collateral
This is a parameter used to enforce a minimum collateral value a user can borrow a currency against. This is important to make sure positions are always profitable to liquidate after gas fees are considered. If a position of $1 has a health factor less than 1, if liquidated, the liquidator will get a profit of {'<='} $0.1.
If the current gas fees to do this is {'>='} $0.1, it won't likely get liquidated because there's no profit to be made.
Setting the minimum collateral value a user can borrow a currency against to be a reasonably high amount prevents this and this parameter would vary per chain due to varying gas fees per chain.

### Debt Ceiling
This is set to cap the total amount of Currency that can be minted by all borrowers with a particular collateral at any given point in time. This helps manage the risk associated with a particular collateral.
This is set to cap the total amount of Currency that can be minted by all borrowers with a particular collateral at any given point in time. This helps manage the risk associated with a particular collateral.
2 changes: 1 addition & 1 deletion pages/guides/currency.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ The xNGN token uses the permit() function to provide offchain approvals, As the
you can use the permit() function to sign a permission that grants allowance to another address. The address that receives permission can then execute the transfer with the allocated allowance.

For the most part, currency.sol functions as a typical ERC20 token.
These tokens have been already been heavily documented here and it is recommended to read through that documentation for the core functions of an ERC20 token.
These tokens have already been heavily documented here and it is recommended to read through that documentation for the core functions of an ERC20 token.
12 changes: 6 additions & 6 deletions pages/guides/liquidation.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
This is first and immediate pattern used to maintain solvency and the peg of a currency to it's offchain representation.
This is the first and immediate pattern used to maintain solvency and the peg of a currency to it's offchain representation.
Liquidation involves a third party paying off a borrowers position which is below the base health factor and getting a reward (liquidation bonus) in return for helping sustain the protocol.

### Liquidation Threshold
Liquidation threshold is very similar to the collateralisation ratio in the sense that they're both ratios (and can be the same value). It simply says, the point where we want anybody to be able to liquidate a position as the worth of it's collateral relative to the borrowed currency reduce. We want this to happen before we get under-collaterised so as to be able to incentivise liquidators.
Liquidation threshold is very similar to the collateralization ratio in the sense that they're both ratios (and can be the same value). It simply says, the point where we want anybody to be able to liquidate a position as the worth of it's collateral relative to the borrowed currency reduce. We want this to happen before we get under-collateralized so as to be able to incentivize liquidators.

Take the example,

Expand All @@ -29,7 +29,7 @@ And the new ratio is now
-------- * ----- = 80.08008
99,900 1
```
The position is now above the max threshold and now any body can liquidate it
The position is now above the max threshold and now anybody can liquidate it

It is recommended to not borrow amounts that put your position too close to the liquidation threshold to avoid getting liquidated if a little fluctuation in price happens.

Expand Down Expand Up @@ -62,7 +62,7 @@ If we plug in USER A's vault info we get

We can see that the position is at the base health factor, 1, which we know is risky. A fluctuation in price will take it below 1 and hence can be liquidated. Let's see this in action

Using the liqudiation example from earlier
Using the liquidation example from earlier
```tsx
Exchange rate: 1 USDC = 999 xNGN
Currency user ratio = 80.08008
Expand All @@ -77,7 +77,7 @@ Liquidatable!
The position can be liquidated because the health factor is below 1.

### Liquidation Bonus
When a liquidation happens, the liquidator earns some reward that scales proportional to the liquidated amount.
When a liquidation happens, the liquidator earns some reward that scales proportionally to the liquidated amount.
If the liquidation bonus is 10%, this means the liquidator would be able to get at most 10% more collateral after liquidation. This 10% comes from the borrower's collateral.

### Now let's look at the full flow of a liquidation.
Expand Down Expand Up @@ -115,4 +115,4 @@ If the liquidation bonus is 10%, this means the liquidator would be able to get
* User A Ratio : Infinity


Liquidations can also happen partially.
Liquidations can also happen partially.
4 changes: 2 additions & 2 deletions pages/guides/oracle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ The feed contract is responsible for reading and updating the price of collatera
### [Median.sol](https://github.com/Descent-Collective/oracle-module/blob/main/src/median.sol)

The median contract is Descent’s trusted price reference. Every time a new list of prices is received, the median of these is computed and used to update the stored value. It stores a mapping of authorized nodes who are allowed to post price updates. These nodes will ideally be determined and updated via governance.
The contract validates that the prices sent are by authorised nodes before updating values.
E.g. Let’s say this median contract needs a minimum of 10 sources, we would need to send it 10 signatures. It will then proceed to go through each of them and validate that whoever sent the the data has been authorised to do so.
The contract validates that the prices sent are by authorized nodes before updating values.
E.g. Let’s say this median contract needs a minimum of 10 sources, we would need to send it 10 signatures. It will then proceed to go through each of them and validate that whoever sent the data has been authorized to do so.
In the case of it being an authorized node, it will check if it signed the message with a timestamp that is greater than the last one. This is done for the purpose of ensuring that it is not a stale message.

### Relayer Client
Expand Down
6 changes: 3 additions & 3 deletions pages/guides/rates.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ The fees gotten from the base rate goes to the protocol and can be used for diff
The Collateral rate is dependent on the collateral and can vary. It's meant to represent the riskiness of a given collateral, i.e the more risky the collateral, the higher it's collateral rate should be.
The fees gotten from the collateral rate goes to the [Stability Module](http://docs.descentdao.com/guides/system-stabilizer) where it is kept and used to bail out the protocol in the case of bad debt.

This goes to show how the rate of a collateral should fully reflect it's volatility and risk so as to be able to cover any bad debt resulting from a sharp decline in the price of that collateral relative to it's currency.
This goes to show how the rate of collateral should fully reflect it's volatility and risk so as to be able to cover any bad debt resulting from a sharp decline in the price of that collateral relative to it's currency.
The rate charged to a borrower is a combination of the two rates associated with the currency-collateral pair they wish to borrow from.
For example, for xNGN - USDC, if the base rate is 1% per year and the collateral rate for USDC is 1.5% per year, a borrower would pay 2.5% per year on their borrowed value. If another collateral is available to borrow xNGN against, say Ether, and it's collateral rate is 5% (considering it's way more volatile than USDC), a borrower would pay 6% per year on their borrowed value.

### Market Impact
Change in rate for a currency-collateral pair can affect the demand and hence the price of the currency in question in the market. Say a xNGN - USDC pair exist and xNGN has a base rate of 1% while USDC has a collateral rate of 1.5% (totalling 2.5%) and everyone is okay with this rate.
Change in rate for a currency-collateral pair can affect the demand and hence the price of the currency in question in the market. Say a xNGN - USDC pair exist and xNGN has a base rate of 1% while USDC has a collateral rate of 1.5% (totaling 2.5%) and everyone is okay with this rate.

If the total rate is increased to 5% suddenly, this would drive demand relative to supply as borrowers would want to buy xNGN and pay back their debt as they feel 5% is too much.
This would also remove xNGN from the market.

On the other hand, if the total rate was reduced to 1%, people would want to borrow more as the rate is relatively low, which means they would mint xNGN and thereby putting more xNGN into the market and reducing demand relative to supply.
This actions can be used in the case where the currency in question loses its peg in any direction for any reason whatsoever.
This actions can be used in the case where the currency in question loses its peg in any direction for any reason whatsoever.
6 changes: 3 additions & 3 deletions pages/guides/system-stabilizer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This module, as the name implies is in charge of helping the protocol stay solve
* The system stability module also has a cap on how much fees can be stored at a given point in time.
If this cap is exceeded, the excesses are used to buy the governance token $DSN which are in turn burnt!
* In the case of a vault incurring bad debt or having a health factor below the base health factor,
it uses from these reserve of earned fees to liquidate the vault at a loss, in essence the reserve of fees is used to bail out the protocol if a vault is too low in debt to profit any liquidator liquidating it.
it uses from these reserves of earned fees to liquidate the vault at a loss, in essence the reserve of fees is used to bail out the protocol if a vault is too low in debt to profit any liquidator liquidating it.
* In the scenario where the fees reserve is insufficient to cover the bad debt, the system stability module can mint (after a governance proposal on it has passed) the governance token $DSN, sells it for the currency that is experiencing bad debt and uses this to cover the bad debt of the protocol.

![System stabilizer Diagram](/dsn.png "System stabilizer Diagram")

From this, it can be noticed that governance token holders are incentivised to vote in favour of the progress of the protocol because,
From this, it can be noticed that governance token holders are incentivised to vote in favor of the progress of the protocol because,
good proposals limit bad debt and in turn attracts usage from customers which in turn pay fees which over time and at some cap can be burnt to further benefit the governance token holders.
They are incentivised to vote for safe collateral rates, liquidation thresholds, currency savings rate and other vital parameters as they have skin in the game/stake in the protocol.
They are incentivised to vote for safe collateral rates, liquidation thresholds, currency savings rate and other vital parameters as they have skin in the game/stake in the protocol.
4 changes: 2 additions & 2 deletions pages/how-does-it-work.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Descent protocol works by allowing people borrow Dollar Backed Currency Notes (DBCN) like xNGN against any collateral asset.
Descent protocol works by allowing people to borrow Dollar Backed Currency Notes (DBCN) like xNGN against any collateral asset.

### Borrowing
1. **Create and Collateralize a Vault**
Expand All @@ -22,4 +22,4 @@ Once all xNGN is completely returned and all collateral is retrieved, the Vault
Inside the Descent ecosystem, the native $DSN token allows token holders to influence certain aspects of the protocol such as:
* What should the be the annual borrowing fee be (stability fee)?
* How much collateral should be backing each Vault (collateralization ratio)?
* Shutting down the protocol in the case of a flash crash of the value of USD/NGN or any other unforeseen situation (emergency shutdown)?
* Shutting down the protocol in the case of a flash crash of the value of USD/NGN or any other unforeseen situation (emergency shutdown)?