Bifrost
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners 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
    • 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 Help
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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners 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
    # SALP 2.0 需求文档 ###### tags: `需求文档` `2月` | *版本* | *时间* | *维护人* | *备注* | | ---- | ---- | --- | --- | | v1.0.0 | 2022/02/08 | Yancy | | ## 需求背景 1. 当前 SALP vsToken + vsBond 的模式虽然解决了部分锁仓 KSM 流动性的释放问题,但 vsKSM 由于单独无法刚性承兑,其承载的价值和所能释放的流动性比例只有一半左右。而 vsBond 现在碎片化严重,通过 vsBond Market 挂单的形式确实可以满足部分用户的交易需求,但实际体验和效率都比较打折扣。故需要通过新的机制和方案,让 vsBond 的流通更加顺畅,更好地满足用户快速释放完全流动性,和套利者便于计算套利年化等多方的需求。 2. 随着插槽竞拍的常态化以及一些插槽的到期,直接 Bid 插槽而不通过 Crowdloan 的需求场景逐渐增多,故需要考虑是否可以让 SALP 也支持直接出价 Bid,通过平行链地址直接 Bid 某个插槽。 3. SALP 后续的发展是希望能更多地被其他项目所集成,而无需通过 Bifrost Dapp 使用。由于现在需要先将 KSM 跨链至 Bifrost 网络再操作 Contribute。整个过程需要两步签名操作。不利于集成和用户体验。故需要调研 SALP 是否可以实现在 Kusama 网络上一次交易签名即可完成铸币。 ## 主要解决方案 1. 引入 vsToken 和 vsBond 互相转换的机制。由于不同的 vsBond 具有不一样的赎回期,赎回期越近的 vsBond 其价值会更高,所以需要引入系统定价机制,系统根据 vsBond 到期时间的不同给出不同的转换汇率,从而实现非同质化非同价值的 vsBond 到完全同质化的 vsToken 的转换。 2. 增加 Bid 生成 SALP 衍生品方法 3. 增加 KSM 上直接发起单一指令可触发 KSM 跨链进入 Bifrost & Bifrost contribute 方法 ## vsToken 与 vsBond 互转经济模型 ### 基本设定 1. 参与众贷用户可以以系统定价汇率将 vsBond 兑换成一定量的 vsKSM 2. 套利者可以购买 vsKSM 以另一个系统汇率将 vsKSM 兑换成 vsBond 3. vsBond 只有在有用户提供给系统时才支持对应数量的兑换(vsBond 不增发) 4. vsBond → vsKSM 汇率大概从 0.6 → 1 (参考机会成本和 Staking 年化收益) 5. vsBond → vsKSM 汇率为 0.6 时,vsKSM → vsBond 汇率为 1.25 (如果按原汇率为 1.666) ### 汇率设定 当 vsKSM 价格为 0.5 KSM 时: |剩余 lease|剩余时间|vsBond → vsKSM 汇率|vsKSM → vsBond 汇率|折现可得 KSM|套利收益|收益年化| |---|---|---|---|---|---|---| |8|336|0.5|0.7|0.75|17.65%|19.17%| |7|294|0.55|0.74|0.775|14.94%|18.55%| |6|252|0.6|0.78|0.8|12.36%|17.90%| |5|210|0.65|0.82|0.825|9.89%|17.19%| |4|168|0.7|0.86|0.85|7.53%|16.35%| |3|126|0.75|0.9|0.875|5.26%|15.25%| |2|84|0.85|0.94|0.925|3.09%|13.44%| |1|42|0.95|0.97|0.97|1.27%|11.00%| |0|0|1|1|1|0.00%|0.00%| dot 汇率表(基于 vsDOT = 0.5 DOT): |剩余 lease|剩余时间|vsBond → vsDOT 汇率|vsDOT → vsBond 汇率|折现可得 DOT|套利收益|收益年化| |---|---|---|---|---|---|---| |8|672|0.25|0.35|0.625|48.15%|26.15%| |7|588|0.35|0.43|0.675|39.86%|24.74%| |6|504|0.45|0.52|0.725|31.58%|22.87%| |5|420|0.55|0.61|0.775|24.22%|21.05%| |4|336|0.65|0.7|0.825|17.65%|19.17%| |3|252|0.75|0.78|0.875|12.36%|17.90%| |2|168|0.85|0.87|0.925|6.95%|15.10%| |1|84|0.95|0.96|0.975|2.04%|8.87%| |0|0|1|1|1|0.00%|0.00%| 当 vsKSM 价格为 0.45 KSM 时: |剩余 lease|剩余时间|vsBond → vsKSM 汇率|vsKSM → vsBond 汇率|折现可得 KSM|套利收益|收益年化| |---|---|---|---|---|---|---| |8|336|0.5|0.7|0.675|30.72%|33.37%| |7|294|0.55|0.74|0.6975|27.71%|34.41%| |6|252|0.6|0.78|0.72|24.84%|35.98%| |5|210|0.65|0.82|0.7425|22.10%|38.41%| |4|168|0.7|0.86|0.765|19.47%|42.31%| |3|126|0.75|0.9|0.7875|16.96%|49.13%| |2|84|0.85|0.94|0.8325|14.55%|63.21%| |1|42|0.95|0.975|0.8775|12.52%|108.78%| |0|0|1|1|0.9|11.11%|+无限大| 从表中可以发现,当 vsKSM 价格稳定在 0.5 KSM 时,套利者可以根据锁仓时间的长短获得稳定的收益率。锁定时间越长,年化收益率越高。 当 vsKSM 价格下降时,会大大提高套利者全时段的套利收益率。对于快到期的 vsBond 收益率提升更为明显。 ## 具体需求 ### 新增存储 #### Kusama 中继链当前 lease 保存当前 Kusama 链上的当前 lease 数据,用于计算。通过 Motion 更新 #### Polkadot 中继链当前 lease 保存当前 Kusama 链上的当前 lease 数据,用于计算。通过 Motion 更新 #### vsBond → vsKSM 汇率 不同剩余到期 lease vsBond 转换为 vsKSM 的汇率(剩余到期 Lease = vsBond 到期 lease - 当前 Lease + 1 ) 大概格式: Kusama 8:0.5 7:0.55 6:0.6 5:0.65 4:0.7 3:0.75 2:0.85 1:0.95 0:1 Polkadot 8:0.25 7:0.35 6:0.45 5:0.55 4:0.65 3:0.75 2:0.85 1:0.95 0:1 dot 汇率表(基于 vsDOT = 0.5 DOT): |剩余 lease|剩余时间|vsBond → vsDOT 汇率|vsDOT → vsBond 汇率|折现可得 DOT|套利收益|收益年化| |---|---|---|---|---|---|---| |8|672|0.25|0.35|0.625|48.15%|26.15%| |7|588|0.35|0.43|0.675|39.86%|24.74%| |6|504|0.45|0.52|0.725|31.58%|22.87%| |5|420|0.55|0.61|0.775|24.22%|21.05%| |4|336|0.65|0.7|0.825|17.65%|19.17%| |3|252|0.75|0.78|0.875|12.36%|17.90%| |2|168|0.85|0.87|0.925|6.95%|15.10%| |1|84|0.95|0.96|0.975|2.04%|8.87%| |0|0|1|1|1|0.00%|0.00%| #### vsKSM → vsBond 汇率 格式与 vsBond → vsKSM 汇率一致,只是需要在数值上设置不同,从而实现双向兑换时汇率不同 #### 兑换手续费 根据设置的手续费费率,在兑换成功过程中收取一定数量的兑换方 token 作为手续费冲入国库 #### 当前 vsBond 库存量 可以查询到当前以不同到期 lease 分组的 vsBond 在兑换系统中的存量。 ### 新增方法 #### 兑换 vsBond 为 vsKSM 参数1:指定需要兑换的 vsBond 类型 参数2:指定需要兑换的 vsBond 的数量 参数3:指定需要获得的 vsKSM 的最小值 基于参数,将用户的 vsBond 存入系统账号,并根据系统汇率表中的汇率以及输入的 vsBond,新发行对应数量的 vsKSM 给用户,并验证发行的 vsKSM 是否大于指定最小值。 #### 兑换 vsKSM 为 vsBond 参数1:指定需要兑换的 vsBond 的类型(无需指定 paraid) 参数2:指定需要兑换的 vsKSM 的数量 参数3:指定需要获得的 vsBond 的最小值 基于参数,将用户的 vsKSM 销毁,并根据系统汇率表中的对应汇率将对应数量的 vsKSM 兑换为 vsBond,vsBond 必须小于当前系统中存有的 vsBond。在兑换过程中,同一 lease 但不同 paraid 的 vsBond 按照 paraid 从小到大顺次供给给用户。 #### 修改互转费率(root 权限) 参数1:新费率 #### 修改兑换汇率(motion权限) 参数1:完整的汇率表数值 ## Contribute via Bid(已取消不用做) ### 新增方法bid(跨链接口) 参数1:bid KSM 的数量 参数2:bid paraid 参数3:bid para类型(KSM) 参数4:bid 起始 lease 参数5:bid 结束 lease 参数6:bid aution 轮次 基于请求的数据,跨链调用通过平行链账号在中继链上发起同参数的 bid 操作。后端确认服务需要考虑以下场景: * 跨链失败或跨链成功无对应auction事件无需操作(无效bid) * 跨链调用成功且收到auction[`BidAccepted`](https://github.com/paritytech/polkadot/blob/41ab002d7451766324a9f314fee11c9c53314350/runtime/common/src/auctions.rs#L505)事件,说明出价被接受暂时赢得卡槽,则调用平行链相关接口锁定relay currency到相关链的模块子账户,等待auction结束根据最终获胜结果统一释放衍生品 * 监控平行链账号对应的auction[`Unreserved`](https://github.com/paritytech/polkadot/blob/41ab002d7451766324a9f314fee11c9c53314350/runtime/common/src/auctions.rs#L498)事件,说明同卡槽段有更高出价,则返还锁定的relay currency给对应bidder(这个逻辑如复杂可先不做,手工返还并根据竞拍结果发放衍生品) ### 新增方法issue 发行衍生品,确认服务根据卡槽竞拍实际结果给获胜方发放 ### 新增方法lock 锁定relay currency到暂时获胜竞拍项目的模块子账户 ### 新增方法unlock 解锁失败竞拍项目锁定的relay currency,从模块子账户里返还bidder ### 新增存储 * auction及相关状态(通过oracle或治理和relaychain保持一致,auction未开始或vrf结束期不能bid) * 当前auction通过salp参选获胜bid列表(考虑到结束期随机选择,获胜列表内的bid不一定是最终赢得卡槽的bid,需要根据auction结束后实际获胜结果来发放衍生品)

    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