wavey
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Resupply Finance: Auditor Roadmap Resupply is a CDP-based lending protocol with the aim of allowing simple, low-risk, leveraged yield farming while encouraging the use of value-added ecosystem protocols' underlying stables like Curve's crvUSD and Frax's FRAX. Resupply is a modified fork of Fraxlend, from which some naming is inherited (e.g. we use "pair" to refer to each collateral deposit contract). ## Core Protocol ### Collaterals and Oracles - Collaterals should all be 4626-compliant lending positions that use crvUSD and Frax as the supply token. Such as tokenized deposits from Curve's Llama Lend and Frax's Fraxlend. - Collaterals will all be considered stable - i.e. the system will trust that the `underlying` asset (FRAX, crvUSD) has a price of $1. - This simplifies a lot of the logic, as well as facilitating the goal of increasing crvUSD and FRAX adoption. ### Fees: - Borrow interest rates will be half the APR of the lending product, half the “risk free rate” using sfrax as an oracle, or 2%, whichever value is greater. - Mint fees are programmed in but currently undecided if it will be used. Further, it's plausible that having a mint fee present can serve as an economic defense against certain scenarios. - There will also be redemption fees, which are shared between: - borrowers (who receive in terms of an extra debt write off) - the protocol (received as debt tokens, forwarded to governance stakers). - Planned, but not yet implemented is a `RedemptionFeeCalculator.sol` which is designed to dynamically modify the redemption fee based on time-since-last-redemption. The aim is to prevent a situation where some pairs get redeemed against far more frequently than others. ### CDP logic: - Users will create collateralized debt positions, deposit their chosen collateral into the "pair" (term for the contract which holds collateral and issues debt), and mint (up to a debt cap) in accordance with the pair's parameters. - The CDP's logic is a modified fork of Fraxlend. - Changes include: - "single supplier" issuance of a stablecoin, rather than user supplied liquidity (removed isolated pairs). - Introduction of an Insurance Pool - Modified liquidation flow: liquidations are funded from a pool of deposits rather than from the liquidator himself - Redemptions: a peg stability mechanism which allows for permissionless exhange of system stablecoin for user collateral. - Reward system for issuing token incentives to users - Underlying based interest rates instead of utilization based - Oracles - Change in how admin fees are handled ### Insurance Pool + Liquidations: - The Insurance Pool is a vault-like contract to which users supply system stablecoin (reUSD) in exchange for shares. - Deposits will be incentivized, as they are required for the system to execute liquidations in the event of user positions becoming unhealthy, or bad debt accruing to a pair. - Liquidations tap into the insurance pool to pay off debt of the liquidated user in exchange for collateral. Thus no flashloans or swaps are needed on behalf of the caller. Just a simple execution that removes debt from the pool and transfers collateral. - After liquidation is complete: - the Insurance Pool share price will decrease as a result of losing backing assets - Insurance Pool depositors will have new collateral-underlying available to claim - the collateral will move to the Liquidation Handler contract which attempts to withdraw all the underlying tokens. If there is not enough liquidity it will wait for the next call to withdraw. ### Redemptions: - Similar to Liquity (and other forks like Prisma), redemptions serve as a floor mechanism by allowing anybody to redeem collateral from the system in exchange for units of debt tokens that the system prices at $1. - Unlike Liquity/Prisma, its implementation should maximize capital efficiency, while minimizing pain and sophisticated management for the user. For this reason, Resupply is introducing a novel redemption mechanism which targets debt holders in a socialized way based on shares rather than individualized way based on sorting. - Because FraxLend pairs use shares to denominate debt, it is a nice starting point for us to evenly distribute redemptions across all users' remaining debt for a given pool. Erasing debt is straightforward from a FraxLend implementation perspective, but applying it equally to collateral required a few changes. - Beyond expressing debt as shares, the other key component is the introduction of a debt write-off "token". This is not a transferrable token. It is minted during a redemption and distributed to debt holders proportionally to represent the amount of collateral which was taken. Thus, actual collateral should now be represented by the userCollateral mapping subtrated by the value of their write off tokens. - Debt write off tokens will be distributed via established logic within rewards distribution in other systems. - Additionally, fee to redeem, so it's not exactly 1:1. For instance, if 1 reUSD returns 0.99$ in collateral, the borrower pool receives the remaining 0.01$ as profit. The token would have a soft floor below 1. This redemption fee can also be dynamic, growing as it is used, creating a "buy the dip" period for users who prefer to buy and hold or pay back, as opposed to buying and redeeming. - The spread should include a protocol fee. Some or most of the gains go back to the pool users, while the protocol can take a percentage. - Other factors, beyond platform revenue, may necessitate fees on redemptions. For example, if redemptions were 1:1, you could force collateral to withdraw and create high lending rates for the remaining depositors. - As with liquidations, the underlying may not be fully redeemable at any given time due to it being a lending product. In current implementation, redeemer may choose which pool to redeem from. ## Governance ### Tokenomics: RSUP tokens will be minted in two phases: 1. **One-time** mint at token generation event (TGE). - RSUP governance tokens will be distributed to predetermined groups of stakeholders. - The chart below outlines a hypothetical TGE distribution scenario. - All TGE tokens will be distributed via vesting in `VestManager.sol`. Different groups have different vesting durations and allocations. The clock on vesting begins for all user vests at the system start time, regardless of when claims are made. - Convex and Yearn will each receive their TGE tokens to a speacial-purpose `PermaStaker.sol` contracts which are limited only to staking. 2. **Continuous** emissions will be distributed as unlocked tokens (no vest), to incentivize actions which promote the health of the system. - Emissions are are defined in `EmissionsController.sol`, which will serve as the sole RSUP token minter. - The emissions rate and schedule will be controlled by the RSUP DAO and can be adjusted on an as-needed basis via governance proposals. ![image](https://hackmd.io/_uploads/SkT9de-Xkg.png) ![image](https://hackmd.io/_uploads/H1bJTlWX1g.png) ### Emissions - The system gives emissions to contracts called `Receivers`, which can be any contract that complies with the basic interface. - To register a receiver for emissions, governance must call `EmissionsController.registerReceiver(receiver)`. Once registered, and given a weight, it can begin accumulating emissions each epoch. - Receivers can be built directly into a contract that serves some other purpose, or alternatively, we have a factory (`SimpleReceiverFactory.sol`) which can deploy generic receivers to be used for nearly any use case. - The diagram below describes the intended emissions flow to two main targets: Insurance Pool deposits, and Borrowers. - ![image](https://hackmd.io/_uploads/BkpNFlZQ1g.png) #### Borrow rewards - Borrow rewards aim to be entirely algorithmic, incentivizing the pools that generate the most revenue. - All protocol pairs claim their emissions from the same contract, according to weights set in `SimpleRewardStreamer.sol`. Each pair is given a "weight" according to its rate of revenue contributed (interest earned to the protocol) since it's last checkpoint. ### Ownership and Configuration ![image](https://hackmd.io/_uploads/BJmo2eZQJe.png) - `Core.sol` is the main owner of all contracts. It is a simple contract with execute function that allows for arbitrary calls. - A single `Voter.sol` contract exists separately from Core. While Core owns all contracts, the voter is able to execute any transaction as if it were Core. - Operator contracts may be introduced by the DAO at any time. These contracts may be granted more granular access to Core. An example may be a guardian operator, which is a contract with access to the `pauseProtocol()` function. - Access is given to operators based on target + function selector combinations. And can optionally be limited by adding pre and post hooks. ### Governance Staking - Stakers of RSUP tokens earn protcol revenue, and perform governance voting. Unstaking is subject to a cooldown period in which no rewards are granted. - The staking contract works on an epoch system. The epoch length with likely be set to 1 week. - Rewards are distributed immediate upon staking, and cesase immediately upon unstake. - New stakes must endure a warm up period (e.g. 1 epoch) before they are granted goverance voting power. - Technically, governance voting is still possible while in cooldown due to how the weights are snapshotted.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully