HackMD
  • API
    API  HackMD API beta testing
    HackMD API is now in beta, join us for a test drive.
    Getting started Got it
      • Create new note
      • Create a note from template
    • API  HackMD API beta testing
      API  HackMD API beta testing
      HackMD API is now in beta, join us for a test drive.
      Getting started Got it
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Save as template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
      • ODF (Beta)
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
    Menu Sharing Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Gist
    Import
    Dropbox Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML ODF (Beta)
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    Write
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    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

    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 lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    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 via Google

    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

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    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

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    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. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        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
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

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

        Syncing

        Push failed

        Push successfully