HackMD
    • 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

      This note has no invitees

    • 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
    • Note Insights
    • 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 Note Insights 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

    This note has no invitees

  • 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
    **Stablecoins are defined as:** *A stablecoin is a digital currency that is pegged to a “stable” reserve asset like the U.S. dollar or gold. Stablecoins are designed to reduce volatility relative to unpegged cryptocurrencies like Bitcoin. — [1]* The total stablecoin supply has increased by more than 450% year-over-year, from $26b to $150b [2]. Not only stablecoins are used to facilitate trading in other cryptocurrencies, but also to make transfer between the legos of crypto-finance (exchanges, staking, lending, asset management, prediction markets, etc.). As the native portal to the NEAR ecosystem, Ref Finance aims to empower NEARians by facilitating what they can do with stablecoins, such as: - Minimise volatility - Trade and save - Earn interest Above all, Ref Finance aims to provide an automated market making solution for stablecoins, allowing users to swap one stable for another in an efficient way. ### Problem and solution The invariant ‘xy = k’ is not suitable for something which is meant to be stable. In his StableSwap paper, published in 2019, Michael Egorov (Curve Finance) explained why. *[…] The problem is that the price slippage is enormous, and one should provide enormous funds to keep a meaningful liquidity. On the flip side, if one for example loads DAI and USDC into Uniswap’s liquidity pool, the returns will be tiny (perhaps, several percent per year). — [3]* Then introducing the StableSwap as a solution to the problem. *For StableSwap, there was a middle-ground invariant found (Fig. 1). As expected, the price (equal to derivative) only slightly deviates from 1 when number of coins is closed to balance. — [4]* ![](https://i.imgur.com/yZdsTuE.png) ###### *Figure 1: Comparison of StableSwap invariant with Uniswap (constant-product) and constant price invariants. The portfolio consists of coins X and Y which have the “ideal” price of 1.0. There are x = 5 and y = 5 coins loaded up initially. As x decreases, y increases, and the price is the derivative dy/dx. — [5]* Thus, the new invariant provides a better tool for DeFi users to swap stablecoins, while reducing market friction by improving DeFi arbitrage. The equation for StableSwap pool is: ![](https://i.imgur.com/qBQsvzS.png) Where: * *D* is the invariant * *A* is a coherent factor, which is set to 240 (can be adjusted by the DAO) * *n* is the number of stable tokens In the ideal situation (no fee), no action (add / remove liquidity and swap) will change the invariant D. In reality (with fee), the invariant *D* will slightly increase as a result of every action. ### Sauce and fee protocol upgrade As the 3pool on Curve [6], the Sauce pool on Ref will have USDT, USDC and DAI as token reserves. ![](https://i.imgur.com/y5eebBz.jpg) ###### Figure 2: Ref Finance StableSwap User Interface Mockup The Sauce pool fee will be set at 0.05%. Moreover, the new solution will introduce a fee protocol upgrade. Today, Ref Finance has a fixed protocol fee, whatever the pool fee. * 0.04% goes to the protocol * 0.01% goes to potential referrals The new protocol fee will be set as a percentage of the total pool fee. * 16% of the total fee goes to the protocol * 4% of the total fee goes to potential referrals For example, the Sauce pool fee (0.05%) will be distributed as followed: * LP fee: 0.04% * Protocol fee: 0.008% * Referral fee: 0.002% Unlike the common pool, the Sauce pool may incur a small fee resulting from liquidity actions. As the protocol encourages balanced token reserves, any user willing to remove their liquidity in different proportion will be charged accordingly. ### Conclusion The team is now in the last phase of the StableSwap feature deployment, expected to be live on mainnet for beta testing on the 16th of December, and fully launched on the 20th of December. Once the testing phase is fully completed, the team will communicate more details relating to: * Swap and liquidity user guide * Sauce pool liquidity incentives Stay tunned! By *Didier, Product Manager* **References** [1] https://www.coinbase.com/learn/crypto-basics/what-is-a-stablecoin [2] https://www.theblockcrypto.com/data/decentralized-finance/stablecoins [3] https://curve.fi/files/stableswap-paper.pdf — page 2 [4] https://curve.fi/files/stableswap-paper.pdf — page 2 [5] https://curve.fi/files/stableswap-paper.pdf — page 3 [6] https://curve.fi/3pool --- ### About Ref Finance Ref Finance is a community-led, multi-purpose Decentralized Finance (DeFi) platform built on NEAR Protocol. Ref takes full advantage of NEAR’s low fees ($0.005 per swap), one-to-two second finality, and WebAssembly-based runtime (hello, Rust smart contracts!). Using the Rainbow Bridge (NEAR <> ETH), traders can utilize the billions of dollars in ERC-20-compliant assets from Ethereum, and eventually, from any chain (BSC, Polygon/Matic, Cosmos/IBC, and others) on NEAR. Ref Finance’s first product is an automated market maker (AMM). It is similar to Uniswap, with a few changes (not limited to): * Multiple pools in a single contract * Ability to trade across pools atomically in a single transaction * Customizable swap fee per pool, giving to LPs the possibility to charge higher fees for volatile tokens Make sure you are following us on [Twitter](https://twitter.com/finance_ref) for the latest news and announcements, and do make sure you join our [Discord](http://discord.gg/PgNZgbeEGT) or [Telegram](https://t.me/ref_finance) for deeper levels of engagement with our Team and Community! --- **Disclaimer** Ref Finance does not endorse or promote any of the projects, platforms or cryptocurrencies mentioned in this blogpost. Any descriptions of functionality and services provided are for information only. Ref Finance is not responsible for any loss of funds or other damages caused as a result of using the projects, platforms or cryptocurrencies described above.

    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