William Griffiths
    • 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
    # xDai to Mainnet/Arbitrum migration (wip) Honey is currently native to xDai and the bottlekneck for security of Honey is the xDai bridge validators. Since xDai is dragging it's heels it seems wise to construct an exit strategy as L2 solutions become available. Arbitrum seems to be the most promising solution, atleast in the short term. Arbitrum also allows for arbitrary L1/L2 bridging transactions out of the box. Note Arbitrum L2 -> L1 transactions will currently take one week (plus batch submission delay, 8 hours on Rinkeby) due to the need to wait for the chains dispute period to pass. L1 -> L2 transactions seem to take ~5 minutes on Rinkeby, presumably some batch submission period. I expect mainnet to be similar. Using this bridging feature the initial plan for migration to an L2 is to migrate the Honey token to the Ethereum mainnet and issuance, voting, conviction voting, celeste etc to Arbitrum. With HoneyV2 on L1 if in future we decide Arbitrum isn't the right home for 1Hive's governance infrastructure, we can vote to move the ability to mint/burn HoneyV2 to a different L2 without having to migrate to a new token. ## HoneyV2 Since there will be no governance actions on Ethereum/L1, HoneyV2 could be a standard ERC20 with the permit pattern eg [Aragon's Govern Token](https://github.com/aragon/govern/blob/develop/packages/govern-token/contracts/GovernToken.sol) instead of a MiniMeToken which is quite inefficient and only necessary for doing on chain governance decisions using Aragon infrastructure. The bridged HoneyV2 on Arbitrum/L2 will be a MiniMeToken, the total supply of which must mirror the total supply of HoneyV2 on Ethereum so it can be used within the 1Hive protocol to enable issuance and voting as it currently is. This means that instead of minting and burning new HoneyV2 during bridging, some of the total supply of the Arbitrum HoneyV2 will be granted and locked. HoneyV2 could be rebased so the max supply is closer to 30million or 30billion. I'm convinced there are psychological benefits to doing this. The multiplier used can be discussed. Before HoneyV2 is deployed, issuance of Honey must be stopped, and the common pool Honey burnt. The initial deployment of HoneyV2 will mint the current total supply of Honey and send it to the xDai migration contract. ### Honey to HoneyV2 Migration A migration contract will allow Honey holders to convert their Honey to HoneyV2 on xDai with one transaction. They can then bridge to whatever chain they like using standard bridging methods or hopefully connext. ## Bridging Governance Most governance decisions will occur and only result in changes to contracts on L2. However, updating the minter/burner of the HoneyV2 token on L1 will require an L2 -> L1 transaction. This should be straight forward as the caller of a cross chain function is recorded by ArbOs on L2 and can be checked when it's equivalant function is called on L1, this will ensure only the 1Hive decision/vote app is able to update the HoneyV2 minter/burner. ## Bridging Issuance Since HoneyV2 will live on Ethereum (L1) and issuance will live on Arbitrum (L2), we will need to modify the issuance contract to make an L1 transaction that mints or burns HoneyV2 on Ethereum. Provided the MiniMeToken that represents HoneyV2 on Arbitrum accurately mirrors the total supply of HoneyV2 on Ethereum, and issuance on Arbitrum is the only entity able to modify the total supply of HoneyV2 on Ethereum (via mint/burn functions through the bridge) then we can use the MiniMeToken on Arbitrum to accurately calculate issuance. Issuance will then update the Arbitrum HoneyV2 (call this HoneyL2) and make a L1 call to update Ethereum HoneyV2 (call this HoneyL1). Each of issuance burn and mint will have a slightly different process. To execute an issuance burn we will do one L2 -> L1 transaction signalling to burn some amount of HoneyL1 from the L1 bridge contract. Upon submission we would burn the same amount of HoneyL2 from the common pool on L2. To execute an issuance mint, we will do an L2 -> L1 transaction signalling we want to mint some tokens which will mint HoneyL1 to the bridge contract. Upon submission we would mint the necessary HoneyL2 for the common pool on L2. Note both processes assume that the L1 operation is guaranteed to eventually happen. And they will take roughly one week on mainnet Arbitrum to execute the L2 -> L1 transaction. This means that the total supply of HoneyL1 will always be roughly one week behind HoneyL2, which is available through conviction voting. This shouldn't be a problem as long as there isn't more Honey accessible outside of the common pool than is available on the L1 bridge. ## Hella Techs (mainly for my own understanding but might be interesting...) #### L1 -> L2 retry transaction. Get maxSubmissionCost from ArbRetryableTx.getSubmissionPrice. Get maxGas and gasPriceBid from NodeInterface.estimateRetryableTicket (requires correct maxSubmissionCost) Note that the L2 gas payment for the L2 transaction will come from the L2 account that submitted the retryTicket on L1, unless it is sent with the retryTicket as msg.value, in which case it will effectively be deposited into the L2 address and used to pay for submission, the left over sent where specified. Can get the sender from msg.sender on L2 #### L2 -> L1 Need to submit proof with detail to Outbox.executeTransaction(). Get proof etc from NodeInterface.lookupMessageBatchProof(). Check l2 block of random batch and index to triangulate. Get outbox from rollup contract. Can get the sender from Outbox.l2tol1Sender(). Note the outbox referenced in the bridge can be updated by the bridge owner which ultimately could fake the outbox to allow a different address to successfully submit the L1 transaction. Must check who has ability to update/add to the outboxes in the bridge if we use the Inbox.bridge.outbox path to get the outbox. #### To deploy token Deploy L2CustomGateway, deploy L1CustomGateway with address of L2CustomGateway. Call registerTokenToL2 from ERC20 or forceRegisterTokenToL2 from EOA on the L1CustomGateway. Register the gateway to the L1GatewayRouter, requires calling from the token contract itself. Stops anyone from registering incorrect/fraudulent addresses with an L1 token. Can only move L1 -> L2 by calling the L1GatewayRouter. Moving L2 -> L1 can call the L2Gateway directly. Afaik, attempting to move ERC20's from L2 -> L1 using the L2GatewayRouter will revert (unless the L2Gateway has the same address as the L1Gateway). #### To use AMB Execute `requireToConfirmMessage` here: https://blockscout.com/xdai/mainnet/address/0x75Df5AF045d91108662D8080fD1FEFAd6aA0bb59/write-proxy then put the transaction hash into here: https://alm-xdai.herokuapp.com/100/0x5c37b036d20d62398283347b229419dc98f787a1d6389f778eccae25754715a8 (replace the current one in the URL). Once validators have confirmed we can call `execute` at the bottom of the UI to call the function (which calls `executeSignatures` here: https://etherscan.io/address/0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e#writeProxyContract). The gas estimation is a lot higher than necessary, see transaction: https://etherscan.io/tx/0x7c8928c0e9a15549d5dbe8e0a11cafa509c99b387a9e1f085aad7190bee5e28a but this should allow us to burn and mint Honey at the behest of the xdai bridge validators. #### Contract work - L2 MiniMeToken implementing IArbToken interface that holds available Honey and grants/locks upon Arbitrum bridge calls. The grant/lock functionality could be a separate contract although it wouldn't explicitly conform to the IArbToken interface. Implementation: https://github.com/1Hive/minime/pull/3/files - L2 Issuance as specified above. Implementation: https://github.com/1Hive/issuance/pull/1/files - L1 ERC20 with permit etc and functions to register itself with the gateway. Implementation: https://github.com/1Hive/honey-token/pull/1/files - L1 Minter/burner callable from L2 Issuance, including function to update owner of L1 ERC20 callable from L2 voting on L2. Note no tests yet. Implementation same repo as above: https://github.com/1Hive/honey-token/pull/1/files - xDai burn contract to allow burning HoneyV1 for HoneyV2. See the XdaiHoneyMigrator.sol contract (other migration contracts in PR are likely unused). Implementation same repo as above: https://github.com/1Hive/honey-token/pull/1/files

    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