Johann Barbie
    • 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 No publishing access yet

      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.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      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 New
    • Engagement control
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # HARB Technical Design Document ## 1 - Project Overview HARB is an economic experiment aimed at balancing issuance with taxation. The HARB token is structured to distribute value among participants in a manner that encourages participation, investment, and long-term engagement: - Providing a Universal Basic Income(UBI), it caters to each and every token holder. - With staking it introduces a new asset class that embodies a form of “partial ownership”, situated between private and common ownership. This approach is designed to explore the dynamics of value distribution and economic sustainability within a decentralized economy. ## 2 - HARB Holders HARB holders acquire and retain tokens to participate in the ecosystem, primarily benefiting from eligibility for UBI distributions. ### 2.1 UBI Distribution - **Eligibility:** Available to all HARB holders, excluding stakers. - **Mechanism:** Proportional to the [time-weighted average balance](https://v4-docs.netlify.app/protocol/design/twab-controller) of HARB held. The following formula is used to compute how much UBI a user is entitled to receive since the last claim: $$UbiAmount = averageUbiPot * \frac{averageUserBalance}{averageTotalSupply}$$ **TODO:** describe TWAB Controller here - Has to be claimed manually. ### 2.2 Tax Pool Contribution - **Source:** Taxes from staked HARB fund the UBI pool. The tax rate is dynamic, and determined by a collective decision making process influenced by the expansion and contraction of the token supply. ## 3 - HARB Staking By staking their tokens, stakers' percentage of the total supply of HARB is locked in and remains constant, safeguarding their investment's value against dilution from new token minting. This engagement provides dilution protection and the opportunity for strategic gains through active management of their staking positions. ### 3.1 Staking Mechanism **Functionality:** Provides dilution protection without eligibility for basic income. The amount of HARB that can be staked is limited to 20% of its total supply. When holders stake, their HARB is transfered to the staking contract account. The staking contract subdivides this common pool with a percentage number for each user. 100% of the pool are represented by `AUTHORIZED_STAKE = 2 * 10^6 * 1 HARB`. Staking freezes the user's share of the total supply. In exchange each holder receives a staking position, which is defined as follows: ``` struct StakingPosition { uint256 stakeShare; address owner; uint32 positionID; ... } ``` Where: - **stakeShare** represents the % of HARB total supply staked by the user. Its range is between **MIN_STAKE** and **AUTHORIZED_STAKE**, where `MIN_STAKE = AUTHORIZED_STAKE / 2000`. This effectively devides the stake into discrete sections of 0.01% of the HARB supply, prevening high fragmentation. fragmentation is undesired for [snatching](#34-Snatching), as it will increase the gas cost. - **owner** is address of the user who owns the staking position, - **positionID** unique identifier for each staking position, useful for tracking and managing individual stakes, especially in operations like snatch() and unstake(). **Share Calculation:** the stake amount follows a simple percentage calculation. $$stakeShare = \frac{harbAmount * AUTHORIZED\_STAKE}{harbActiveSupply}$$ Where: - **stakeShare** a percentage amount stakers receives for their HARB, - **harbAmount** the amount of HARB which has been put into staking, - **harbActiveSupply** the current total supply of harb excluding the staking contract's balance, - **outstandingStake** the outstanding stake is the sum of all stake given to users. While not being part of the formulate, it is needed for limiting the stake to 20% of total supply of HARB. (TODO: can this be done in HARB instead of in stake? like `harbAmount + balanceOf(stakingPool) <= activeSupply * 0.2`) The outstanding stake can not exceed authorized Stake, so the staking function needs to validate that `stakeShare + outstandingStake <= authrozideStake`. **Unstaking:** ustaking is the inverste of the staking formula: $$harbAmount = \frac{stakeShare * harbAciveSupply}{AUTHORIZED\_STAKE}$$ ### 3.2 Harberger Tax Mechanism Stakers actively participate in the Harberger Tax mechanism, setting their tax rates to maintain or improve their stake in the token supply. - **Concept:** Allows staking positions to be "snatched" by others willing to pay a higher tax rate. - **Dynamics:** Encourages active tax rate management, acting as a prediction market. ### 3.3 Tax Mechanism for Stakers **Initial Rate:** Starts at 0%, adjustable by new stakers offering a higher rate. **Structure** To enable the Harberger Tax the staking position struct is extended with two additional dates as follows: ``` struct StakingPosition { ... uint32 lastTaxPaymentTimestamp; uint32 perSecondTaxRate; } ``` Where: - **lastTaxPaymentTimestamp** is a unix timestamp noting when the last tax payment was made for this staking position. It is ranging from the staking initiation time until the current block timestamp or the unstake event. - **perSecondTaxRate** the rate applied to the staking position, stored in a way to allow per-second calculation. The tax payment function for each staking position can be called at any time and calculates the **taxDue** as follows: $$taxDue = \frac{stakeShare * harbActiveSupply}{AUTHORIZED\_STAKE} * \frac{elapsedTime * perSecondTaxRate}{10000}$$ Where - **impliedHoldingExpiryTimestamp** `= (now - pos.creationTime < taxFloorDuration) ? pos.creationTime + taxFloorDuration : now;` - **elapsedTime** `= ihet - position.lastTaxPaymentTimestamp`. **Tax Floor Duration:** There is a minimum duration as basis for fee calculation, regardless of actual holding time, if a user decides to exit its staking position. It is set to 3 days. This disincentivises grieving other positions by snatching with a higher tax, then exiting the position immediately. **Post-Tax Adjustment:** After paying the tax, the stakeShare is recalculated to reflect the decrease in the account's value. This involves recalculating the share as a percentage of the new total pool balance minus the tax paid. $$newStakeShare = stakeShare - \frac{taxDue * AUTHORIZED\_STAKE}{activeSupply}$$ ### 3.4 Snatching **Concept:** Allows staking positions to be "snatched" by others willing to pay a higher tax rate. **Dynamics:** Encourages active tax rate management, acting as a prediction market. To make snatching less discrete and improve the UI, a snatch can extend accross many positions, and even include partial snatching of a position, as long as the new tax rate is higher than the tax rate of all positions touched. ![harb-snatch](https://hackmd.io/_uploads/r1hcVp3iT.jpg) Notice that a positoin can also be liquidated, if the accrued tax has consumed the whole balance of the stake. ## 4 - Token Economy Structure ### 4.1 Liquidity Manager Contract (LMC) - **Role:** Entrusted with managing the liquidity pool on Uniswap V3 and endowed with the authority to mint and burn HARB tokens in response to market demands. - **Key Functionality:** Features public `stretch()` and `shrink()` functions tasked with adjusting the liquidity position in line with prevailing market conditions. - **Actions:** When the price diverges from the center of a liquidity position the functiosn will attempt to rebalance by minting HARB for an ETH overhang during `stretch()` or burning HARB for a HARB overhang during `shrink()`. Every time the `stretch()` function is called 5% of the newly gained ETH (the SAVINGS_RATE) will be channeled to a savings account in the LMC instead of being invested in the new liquidity position. - **addLiquidity():** This is a special function with restricted access rights. It has the ability to take ETH from the savings account and create a new liquidity position with a custom range around the current tick. The functions are visually explained in the following drawing: ![LMC functions (1)](https://hackmd.io/_uploads/r1jwMnh6T.png) A strategy can be implemented by carefully selecting the range, size and timing of new liquidity positions. Details are explained in [Liquidity Provisioning in HARB](https://hackmd.io/yNiN3TyETT2A1uwQVGYiSA). ### 4.2 Token Supply Mechanism - **Initial Supply:** Commences at zero, with the supply dynamically regulated through minting and burning actions dictated by liquidity needs, as managed by the LMC. - **Supply Adjustments:** Methodically executed by the LMC to counteract ETH overhang or HARB overhang, maintaining equilibrium in the liquidity pool. ### 4.3 Founders' Contribution and Rewards - **Procedure:** Founders contribute 10 ETH, bootstrapping HARB liquidity on UniSwap V3. - **Fee Allocation:** Liquidity Provider Fees directed to founders' multisig wallet as compensation. ### 4.4 Economic Activities - **Trading:** Facilitated primarily through Uniswap V3, with additional market access provided by arbitrage bots that bridge liquidity across platforms. - **Staking:** Designed to offer a hedge against dilution, allowing participants to secure a fixed proportion of the total supply. Stake is taxed by a self-assigned tax rate. - **Basic Income:** Allocated to HARB holders on the basis of a time-weighted average balance, exclusive of staked amounts. ### 4.5 Minting & Burning When new HARB tokens are minted, they must be allocated proportionally between the LMC's account and the staking contract's account. The formula $$offsetAmount = \frac{stakingPoolBalance * mintAmount}{harbActiveSupply + dormantStake}$$ should be used, where: - **offsetAmount** is the additional amount minted to the staking contract, - **stakingPoolBalance** is the current size of the staking pool in HARB, - **mintAmount** is the amount of HARB being minted to the account of the LMC, - **harbActiveSupply** the current total supply of harb excluding the staking contract's balance, - **AUTHORIZED_STAKE** a constant representing the maximum staking limit adjusted for precision by 5^10. See [Staking Mechanism](#31-Staking-Mechanism) for dietails. - **dormantStake** `= AUTHORIZED_STAKE * 4`. For burning HARB tokens, the goal is to reduce the stakingPoolBalance in a way that the staked tokens decrease in number but remain constant in percentage terms relative to the new total supply. Assuming **harbBurned** is the amount of HARB to be removed from the account of the LMC, the formula to adjust the staking contract's balance could be expressed as: $$offsetAmount = \frac{stakingPoolBalance * harbBurned}{harbActiveSupply − harbBurned + dormantStake}$$ Where: - **offsetAmount** is the amount of HARB being removed from the staking pool. ### 4.6 Parameters and open Questions - **Staking limit:** is the amount of HARB that can be staked. In the spec it is set to 20% of active supply. It affects dilution, and by that the volatility of the token. This can be any value up to 99% of the supply. when it is set to >= 50% it would lead to at least a quadrupling of total supply whenever active supply doubles. It could be adjustable after launch, if needed. - **MIN_STAKE: (potential governance paramater)** set to `AUTHORIZED_STAKE / 2000` above. this limits the amount of stakers to max 2000. high fragmentation of stake is undesired, as snatching would potentially fail with block gas limit. first implementation will shed more light on cost and limits. - **Initial Tax Rate:** set to 1% above. but could be 1/5/x%. a bit of basic income would probably be very encouraging for HARB holders at any time. - **Max Tax Rate:** should there be a max tax? obivous points to cap it would be at 100%. why though? - **Initial liquidity:** it is described as 10 ETH collected by founders. This can be any value, but obviously more initial liquidity would stability the price and create awareness for people monitoring the uniswap pool factory. - **ERC 721 interface:** as each staking position has a `positionID`, the staking contract could implement the ERC721 interface with ease. I have decided to leave it out, together with a transfer function, to avoid confusion on decentrazide markets, where an NFT could be snatched while being on sale. ERC721 has a benefit of widely know, and making the stake more visible in wallets and 3rd party interfaces. need to weigh pros and cons for final decision. - **Which network to launch on:** Optimism/Arbitrum/Mainnet? - **SAVINGS_RATE:** the percentage of newly gained ETH that is not reinvested in a new position when `stretch()` is called on the LMC. ### 4.7 Risks - **LP starvation:** LP ran out of money, no dilution -> no staking -> no tax -> no users. Worth [it's own document](https://hackmd.io/yNiN3TyETT2A1uwQVGYiSA) - **inflation attack:** see [docs by open zepplin](https://docs.openzeppelin.com/contracts/4.x/erc4626#inflation-attack). the stake is a kind of vault and vulnerable too inflation attack. not sure I have fully mittigated it by putting the decimals of stake at `10^5 * 1 HARB`. - **snatch collisions:** too many reverts could frustrate users. ## 5. Launch Network ### 5.1 Arbitrum - has the [most TVL](https://info.uniswap.org/#/arbitrum/) among all Layer 2's in uniswap and in general - has the most volume among [new projects and protocols](https://www.dextools.io/app/en/arbitrum/pairs) ### 5.2 Optimism - [most volume](https://defillama.com/dexs/chains/optimism) in Uniswap; biggest TVL in velodrome - mission alligned due to "Harberger Tax" ### 5.3 Base - low TVL in [general](https://l2beat.com/scaling/tvl) and on [Uniswap](https://info.uniswap.org/#/base/) - [many shitcoins ](https://www.dextools.io/app/en/base/pairs)

    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
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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