Skip to content

Commit

Permalink
Merge pull request #22 from open-dollar/cleanup-header
Browse files Browse the repository at this point in the history
Cleanup header, images
  • Loading branch information
pi0neerpat authored Sep 20, 2023
2 parents bbbe41a + 61c3463 commit 17d0930
Show file tree
Hide file tree
Showing 29 changed files with 31 additions and 530 deletions.
26 changes: 0 additions & 26 deletions docs/GEB.md

This file was deleted.

30 changes: 0 additions & 30 deletions docs/flx-mechanics.md

This file was deleted.

41 changes: 20 additions & 21 deletions docs/liquidation-protection/liquidation-protection-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Liquidation Protection is a unique feature that \(as of the date of this guide\)

There are two key advantages in protecting your SAFE:

* Capital efficiency - protecting your SAFE means that you can mint more RAI with the same amount of ETH and have a higher guarantee that your capital will stay safe
* Peace of mind - an extra layer of cover for your SAFE means you can sleep better knowing that your capital is in a safer place
- Capital efficiency - protecting your SAFE means that you can mint more RAI with the same amount of ETH and have a higher guarantee that your capital will stay safe
- Peace of mind - an extra layer of cover for your SAFE means you can sleep better knowing that your capital is in a safer place

## 2. Walkthrough to Protect a SAFE

Expand All @@ -27,7 +27,7 @@ Your SAFE can be protected from liquidation by what we call a "saviour". A savio

To start connecting a saviour to your SAFE, you can click on **Add a Saviour** which is on every SAFE's details page:

![](/assets/untitled-design.png)
![](/assets/liq-protection.png)

You should see the onboarding page for saviours:

Expand All @@ -39,10 +39,10 @@ Once you click on **Configure**, you should see the configuration screen:

You will notice a couple of things:

* You can deposit LP tokens in a saviour that protects your SAFE. During a liquidation, the saviour will first try to pull your liquidity from a DEX \(in this case, Uniswap v2\) and repay some of your debt or add more ETH in the SAFE
* There is a Target Rescue CRatio. This is the collateralization ratio that your SAFE will have in case it is successfully saved. If the saviour cannot bring the SAFE's collateralization ratio to the target that you specify, it will not save the SAFE at all \(the SAFE will end up getting liquidated\)
* The Protected Liquidation Point is the minimum collateralization ratio at which your SAFE can get liquidated and the saviour still manages to save it. If the SAFE gets liquidated below this threshold, these is a high chance it will not be saved
* There is a Rescue Fee. This is a flat fee that has to be paid to the address that initially wanted to liquidate your SAFE but ended up saving it. The saviour must both pay this fee and manage to bring the CRatio of your SAFE to the Target Rescue CRatio that you picked, otherwise your SAFE will end up getting liquidated. The Rescue Fee can be changed by governance
- You can deposit LP tokens in a saviour that protects your SAFE. During a liquidation, the saviour will first try to pull your liquidity from a DEX \(in this case, Uniswap v2\) and repay some of your debt or add more ETH in the SAFE
- There is a Target Rescue CRatio. This is the collateralization ratio that your SAFE will have in case it is successfully saved. If the saviour cannot bring the SAFE's collateralization ratio to the target that you specify, it will not save the SAFE at all \(the SAFE will end up getting liquidated\)
- The Protected Liquidation Point is the minimum collateralization ratio at which your SAFE can get liquidated and the saviour still manages to save it. If the SAFE gets liquidated below this threshold, these is a high chance it will not be saved
- There is a Rescue Fee. This is a flat fee that has to be paid to the address that initially wanted to liquidate your SAFE but ended up saving it. The saviour must both pay this fee and manage to bring the CRatio of your SAFE to the Target Rescue CRatio that you picked, otherwise your SAFE will end up getting liquidated. The Rescue Fee can be changed by governance

Once you pick an amount of tokens to deposit in the saviour and a Target Rescue CRatio, you can click on **Review Transaction** and then on **Confirm Transaction**. After your transaction is confirmed, you should see a screen like this:

Expand All @@ -52,22 +52,22 @@ Congrats, your SAFE is now being protected! 🎉

Let's see what happens after one of your SAFEs gets saved. If you go to the SAFE details page, you'll see a button called **Collect Saviour Balance**:

![](/assets/untitled-design-1-.png)
![](/assets/liq-protection-2.png)

Sometimes, the saviour doesn't need to use all the tokens you deposited in order to save your SAFE. You can collect these unused tokens \(e.g ETH & RAI withdrawn from Uniswap\) by clicking on **Collect Saviour Balance**.

## 3. Best Practices

* Avoid minting more RAI after you protect your SAFE. If you do mint more after you protect it \(regardless of whether you add more ETH or not\), try to add more LP tokens in the saviour to make sure your SAFE can still be saved now that it has more debt
* Liquidation Protection is **not** a completely set and forget system. You should still watch your SAFE. The idea for protection is that it makes RAI more capital efficient \(you can mint more RAI with the same amount of ETH\) and liquidators are forced to try and save your SAFEs before they liquidate you
* You should deposit more LP tokens than the minimum recommended amount \(which can be found in the app when you deposit cover for a SAFE\). By depositing more tokens than the minimum, you take into account the fact that your SAFE accrues debt over time \(because of the interest rate\), meaning that you will slowly need more and more tokens to save it
- Avoid minting more RAI after you protect your SAFE. If you do mint more after you protect it \(regardless of whether you add more ETH or not\), try to add more LP tokens in the saviour to make sure your SAFE can still be saved now that it has more debt
- Liquidation Protection is **not** a completely set and forget system. You should still watch your SAFE. The idea for protection is that it makes RAI more capital efficient \(you can mint more RAI with the same amount of ETH\) and liquidators are forced to try and save your SAFEs before they liquidate you
- You should deposit more LP tokens than the minimum recommended amount \(which can be found in the app when you deposit cover for a SAFE\). By depositing more tokens than the minimum, you take into account the fact that your SAFE accrues debt over time \(because of the interest rate\), meaning that you will slowly need more and more tokens to save it

## 4. Gotchas

* If the saviour you're using cannot bring the collateralization ratio of a protected SAFE to the **Target Rescue CRatio** you picked, the saviour will not save the SAFE at all
* When a saviour saves a SAFE, it will withdraw all your liquidity from a DEX using the LP tokens you deposited. If you want your SAFE to be protected after it's saved, you need to deposit tokens again in the saviour
* You must have enough tokens deposited in the saviour so that it can both save your SAFE and also reimburse the liquidator that ended up paying for the save action
* Once a SAFE is saved, there are probably leftover tokens that were withdrawn from Uniswap and not used for anything. You can redeem these extra tokens at any time by going back to the SAFE's details page and clicking on **Collect Saviour Balance**
- If the saviour you're using cannot bring the collateralization ratio of a protected SAFE to the **Target Rescue CRatio** you picked, the saviour will not save the SAFE at all
- When a saviour saves a SAFE, it will withdraw all your liquidity from a DEX using the LP tokens you deposited. If you want your SAFE to be protected after it's saved, you need to deposit tokens again in the saviour
- You must have enough tokens deposited in the saviour so that it can both save your SAFE and also reimburse the liquidator that ended up paying for the save action
- Once a SAFE is saved, there are probably leftover tokens that were withdrawn from Uniswap and not used for anything. You can redeem these extra tokens at any time by going back to the SAFE's details page and clicking on **Collect Saviour Balance**

## 5. Why Use Liquidation Protection Instead of DeFi Saver?

Expand All @@ -77,11 +77,10 @@ Liquidation Protection is not meant to replace platforms such as DeFi Saver. Rat

When someone starts to liquidate a Safe and the saviour steps in, it will try to do the following:

* Withdraw all the Uniswap liquidity using the LP tokens allocated to save the liquidated Safe
* Calculate how much RAI would need to be repaid in order to bring the Safe's collateralization ratio above the **Target Rescue CRatio**
* If the amount of RAI calculated is higher than the amount of RAI withdrawn from Uniswap and calculate the amount of ETH that would need to be added in the Safe \(besides the amount of RAI withdrawn from Uniswap which will be used to repay debt\)
* If the calculated ETH amount is higher than the ETH amount withdrawn from Uniswap, the saviour will revert and the Safe will continue to be liquidated. The saviour will also revert if there isn't enough ETH and/or RAI to reimburse the liquidator \(who is spending gas to save the Safe\) for saving the Safe
* On the other hand, if the calculated ETH amount is lower than the ETH amount withdrawn from Uniswap, the saviour will successfuly save the Safe \(by repaying some of the debt and adding the ETH in the Safe\). Any amount of ETH and/or RAI that we not used to save will be kept in the saviour until the owner of the Safe will withdraw them
- Withdraw all the Uniswap liquidity using the LP tokens allocated to save the liquidated Safe
- Calculate how much RAI would need to be repaid in order to bring the Safe's collateralization ratio above the **Target Rescue CRatio**
- If the amount of RAI calculated is higher than the amount of RAI withdrawn from Uniswap and calculate the amount of ETH that would need to be added in the Safe \(besides the amount of RAI withdrawn from Uniswap which will be used to repay debt\)
- If the calculated ETH amount is higher than the ETH amount withdrawn from Uniswap, the saviour will revert and the Safe will continue to be liquidated. The saviour will also revert if there isn't enough ETH and/or RAI to reimburse the liquidator \(who is spending gas to save the Safe\) for saving the Safe
- On the other hand, if the calculated ETH amount is lower than the ETH amount withdrawn from Uniswap, the saviour will successfuly save the Safe \(by repaying some of the debt and adding the ETH in the Safe\). Any amount of ETH and/or RAI that we not used to save will be kept in the saviour until the owner of the Safe will withdraw them

Note that because the saviours withdraws all the liquidity from Uniswap when it saves, the Safe owner will need to deposit LP tokens again if they want to be protected moving forward.

12 changes: 0 additions & 12 deletions docs/multi-chain-rai.md

This file was deleted.

53 changes: 11 additions & 42 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@ const darkCodeTheme = require("prism-react-renderer/themes/dracula");
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Open Dollar Docs",
tagline: "The no brainer onboarding stack for web3.",
url: "https://docs.opendollar.com",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.png",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "UseKeyp", // Usually your GitHub org/user name.
projectName: "usekeyp-docs", // Usually your repo name.
favicon: "assets/favicon.png",

// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
Expand Down Expand Up @@ -47,7 +41,7 @@ const config = {
sidebarPath: require.resolve("./sidebars.js"),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/UseKeyp/usekeyp-docs/tree/main",
editUrl: "https://github.com/open-dollar/od-docs/tree/main",
sidebarCollapsed: false,
sidebarCollapsible: false,
},
Expand All @@ -62,44 +56,19 @@ const config = {
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
image: "img/docs-og-image-1200x630.png",
image: "assets/docs-og-image.png",
navbar: {
logo: {
alt: "Open Dollar Logo",
src: "img/full-logo.svg",
srcDark: "img/full-logo.svg",
src: "assets/full-logo.svg",
srcDark: "assets/full-logo.svg",
},
items: [
{
href: "https://usekeyp.com",
label: "Website",
position: "left",
},
{
href: "https://dev.usekeyp.com",
label: "Dev Portal",
position: "left",
},
{
href: "https://app.usekeyp.com",
label: "App",
position: "left",
},
{
href: "https://usekeyp.com/blog",
label: "Blog",
position: "right",
},
{
href: "https://github.com/usekeyp",
href: "https://github.com/open-dollar",
label: "GitHub",
position: "right",
},
{
href: "https://schedule.usekeyp.com",
label: "Partner with us",
position: "right",
},
],
},
footer: {
Expand All @@ -119,11 +88,11 @@ const config = {
items: [
{
label: "Discord",
href: "https://discord.usekeyp.com",
href: "https://discord.opendollar.com",
},
{
label: "Twitter",
href: "https://twitter.com/usekeyp",
href: "https://twitter.com/open_dollar",
},
],
},
Expand All @@ -132,16 +101,16 @@ const config = {
items: [
{
label: "Blog",
href: "https://blog.usekeyp.com",
href: "https://opendollar.com/blog",
},
{
label: "GitHub",
href: "https://github.com/usekeyp",
href: "https://github.com/open-dollar",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Keyp. Built with Docusaurus.`,
copyright: `Copyright © ${new Date().getFullYear()} Open Dollar`,
},
prism: {
theme: lightCodeTheme,
Expand Down
Empty file removed static/.nojekyll
Empty file.
Binary file added static/assets/docs-og-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed static/assets/untitled-diagram.png
Binary file not shown.
Binary file removed static/img/Keyp_Architecture_Roadmap_v5.png
Binary file not shown.
Binary file removed static/img/dev-portal-access-token.png
Binary file not shown.
Binary file removed static/img/dev-portal-client-gen.gif
Binary file not shown.
Binary file removed static/img/dev-portal-client-gen.png
Binary file not shown.
Binary file removed static/img/dev-portal-login-page.png
Binary file not shown.
Binary file removed static/img/dev-portal-postman-environment.png
Binary file not shown.
Binary file removed static/img/docs-og-image-1200x630.png
Binary file not shown.
Binary file removed static/img/docusaurus.png
Binary file not shown.
Binary file removed static/img/favicon.png
Binary file not shown.
Loading

0 comments on commit 17d0930

Please sign in to comment.