HAI Protocol: A Simple Overview

What is HAI?

Reza Jafery
Let’s Get HAI
Published in
10 min readFeb 19, 2024

--

HAI is a stablecoin protocol that is backed by a variety of collaterals. It maintains its stability through the use of a PI controller which dynamically sets interest rates that affect the price of HAI. HAI is backed by the value of the various collateral assets locked by users who mint HAI, similar to how traditional currencies used to be backed by gold or other assets.

How Does it work?

In the Let’s Get HAI Protocol, there are special accounts called Vaults where users can deposit different types of assets as collateral to mint HAI against. At launch, users can deposit OP, WETH, and wstETH as collateral. These assets remain yours — they are not commingled with other Vaults. Once placed in a Vault, a user can mint HAI against their locked collateral.

HAI uses a floating peg — unlike coins like USDC or USDT which are hard pegged to the U.S. Dollar. The floating peg is set by the PI controller in the form of the system's redemption price.

HAI has two prices: the market price (MP) and the redemption price (RP).

  • The MP is whatever HAI currently trades at on the open market.
  • The RP is the price that the HAI system values HAI at.

HAI maintains stability by using a PI controller which sets dynamic interest rates, based on the difference between the MP and the RP. If the MP goes over the RP, the PI controller sets a negative interest rate — which devalues the redemption price of HAI over time. In the case of the MP being over the RP, the negative rate set by the controller would make the debt that users had accrued in HAI cheaper over time. This directly incentivizes Vault owners to mint additional HAI and sell it at a premium against the system’s value of the debt. This user activity encourages system stability.

When the MP is below the RP, the opposite happens. The system sets a positive rate which affects the internal price of HAI (the RP) over time. In this example, a user could purchase HAI on the market for less than the Protocol value, paying off the user’s debt at a lower price.

Users should be careful to manage the amount of HAI they mint against the value of their locked collateral. Should the value of the collateral drop beyond acceptable limits, a user may have their collateral seized and sold via a collateral auction. These auctions are among the many things inside the protocol to protect the value of HAI and ensure users have confidence in the protocol’s backing.

If you’d like to take a deep dive into how the protocol works, check out this article by Dankrad on RAI. HAI is a fork of RAI and shares the same basic mechanics.

Why another stablecoin?

There are too many “dollar coins” in crypto. 99% of stablecoins are pegged to the U.S. dollar — HAI wants to give users optionality, allowing them to raise their hand and say, “I opt out of the traditional fiat system”.

By providing a free-floating decentralized stablecoin, HAI aims to offer a smooth and steady option for users amidst the often volatile cryptocurrency market. As well as a potentially attractive method to gain levered exposure on your staked ETH or other Optimism native collateral.

HAI’s deployment on Optimism, an Ethereum Layer 2, also provides a wide array of benefits. Users can open Vaults, mint HAI, and more — at a fraction of the gas costs they would have paid on L1.

Finally, the DAO believes that HAI’s novel control-theory technology manages supply and demand imbalances in ways that first-generation stablecoins simply cannot. RAI proved itself to be lindy, now our job is to take this system and propagate it.

Key Components of the HAI Protocol

Vaults: These accounts form the core of the HAI Protocol where users deposit various types of digital assets as collateral. Users can mint HAI stablecoins based on the value of their collateral.

HAI (System Coin): This is the primary stablecoin of the HAI Protocol. All HAI is minted by users. The value of HAI is supported by a greater value of locked collateral. The price of HAI is determined by the Market Price (which is determined externally) and the Redemption Price (which is determined programmatically).

KITE (Protocol Token): KITE is the governance token for the HAI Protocol. Holders can participate in voting for system changes and have a say in the protocol’s development (e..g, adding/removing collateral types). These tokens are also used in specific auction types within the protocol.

Collateral Auction House: This family of smart contracts handles the sale of collateral seized from undercollateralized Vaults. The process ensures that debts are covered by auctioning the collateral for HAI.

Debt Auction House: In situations where the protocol incurs bad debt, the Debt Auction House allows for the sale of newly minted KITE tokens in exchange for HAI to offset bad debt held by the protocol’s balance sheet. These auctions only occur in the unlikely scenario where the normal course of debt management fails.

Surplus Auction House: Over time, the stability fees collected from users are directed towards paying for the protocol’s smart contract costs (e.g., oracles and keepers) and towards building a surplus buffer as a protection against bad debt. Once this buffer has been sufficiently filled, users can call to auction the excess amount of HAI in exchange for KITE. This KITE is burned and permanently removed from the circulating supply.

Global Settlement: This mechanism acts as an emergency stop for the protocol. It winds down operations, allowing users to redeem HAI for underlying collateral.

PID Controller: A sophisticated controller within the HAI Protocol that dynamically adjusts the redemption rate of HAI. This adjustment is crucial to maintain the stablecoin’s peg to its target value, responding to market conditions.

Underlying Mechanics:

Over-Collateralization: Users lock collateral in Vaults to mint HAI, Every HAI minted is supported by a greater amount of locked collateral.

Auction Dynamics: The protocol uses various auction houses to manage collateral, debt, and surplus. These auctions play a pivotal role in maintaining the equilibrium of the system and creating a backstop for the protocol.

Governance and Participation: KITE token holders have the power to influence the protocol’s direction and decisions, ensuring a decentralized and community-driven approach.

Emergency Protocols: The Global Settlement feature provides a failsafe mechanism, preserving user assets and the integrity of the protocol during extreme situations.

Adaptive Redemption Rate Management: The PID controller’s continual adjustment of the redemption rate for HAI ensures that the stablecoin adapts to changing market conditions, maintaining stability and enhancing the balance of monetary supply and demand.

Governance

The HAI DAO will be facilitated through Tally. Users can delegate their KITE tokens and make proposals by following this link: https://gov.letsgethai.com/dao

History

HAI DAO is proud to introduce the HAI Protocol, a multi-collateral fork of the RAI stablecoin, created specifically for the Optimism network. Our journey began with a deep appreciation for RAI’s innovative approach to stablecoins, but we also recognized the need for improvements. Specifically, RAI’s single-collateral model, solely based on ETH, presented certain limitations, notably its consistent negative redemption rate widely believed to be due to the singular use of ETH as collateral.

We envisioned a more versatile and robust system. Thus, HAI was born, expanding the collateral base to include not just ETH but also RAI, staked ETH derivatives, and other valuable assets on Optimism. This diversification aims to mitigate the opportunity costs associated with RAI’s single-collateral framework and foster more positive equilibrium redemption rates for HAI.

Our mission goes beyond merely launching a new stablecoin. We’re committed to growing the ecosystem of open-source, controlled peg stablecoins and broadening the understanding of their benefits in the DeFi space. HAI represents a significant leap forward in this vision, offering enhanced governance features and a multi-collateral approach. Through HAI, we hope to bring a stablecoin that is not only more stable and versatile but also aligns closely with the needs of the DeFi community.

The development of HAI, spearheaded by DeFi Wonderland and supported by SpankChain and Number Group, marks our dedication to innovating within the stablecoin space. We believe HAI on Optimism is not just a technological advancement but a step towards a more inclusive and education-focused DeFi ecosystem.

Technical Docs

https://docs.letsgethai.com/

In the Press:

Frequently Asked Questions (FAQs) for the HAI Protocol

Why build on optimism?

Building on Optimism offers several key benefits for the HAI Protocol. It significantly reduces transaction costs, thanks to its lower gas fees compared to Ethereum’s mainnet, making operations more cost-effective. Transactions are also faster due to Optimism’s efficient Layer 2 scaling solution, which is crucial for enhancing the user experience in DeFi applications. Additionally, Optimism maintains strong compatibility with Ethereum, allowing seamless integration and access to Ethereum’s extensive ecosystem.

For example; because transaction fees are so much lower on Optimism than Ethereum, we’ll be able to allow users to open HAI Vaults with much less collateral than was necessary with RAI. RAI had a high minimum debt floor because, in the case of a liquidation, the Vault needed to be big enough to guarantee it wouldn’t turn into bad debt– which could occur due to the higher gas fees on Ethereum mainnet. With HAI on Optimism, users will be able to open Vaults with a much lower barrier to entry.

Crucially, Optimism’s ability to handle a higher volume of transactions per second greatly aids in scaling applications, a vital aspect for the success of DeFi protocols like HAI. It also inherits the robust security features of the Ethereum network, ensuring a secure and reliable platform for users.

Finally, we feel a strong alignment with the community at Optimism. The Optimism team has contributed heavily to the Ethereum ecosystem, and we’re excited to work with some of the biggest brains in the industry. Plus we really wanted to be able to say, “Get HAI on Optimism”.

We are also immensely grateful for the HAI protocol to be a grant recipient from the Optimism team. Their generous support has been instrumental in our development and in harnessing Optimism’s advanced features. Their commitment not only aids our project but also significantly contributes to the growth and innovation in the broader blockchain community.

What happens when an auction cannot cover the amount of bad debt?

In the liquidation process, many things would have to fail normal-course clearing of debt for the protocol to incur any bad debt. First, the protocol enforces a minimum collateral ratio on all collateral types in excess of 100%. This means that a user will face liquidation while the value of the collateral still remains above the value of the debt. This aims to ensure that a liquidator finds it opportunistic to offer HAI to clear the debt in exchange for a larger amount of collateral seized from the user.

Further, collateral auctions use dynamic pricing that increases this opportunity for liquidators over time. Should a collateral auction fail to settle initially, it is possible it may settle in the future once these parameters automatically adjust. Should the auction continue to fail, the protocol may be able to cover the debt via the system surplus, which is constructed from stability fees collected from user’s Vaults.

Finally, should all of these fail, a debt auction may occur which will auction newly minted KITE tokens in exchange for covering the HAI debt Throughout this process, KITE holders have the option to engage the process of emergency shutdown, which freezes and unwinds the protocol as a response to extreme conditions.

How is the redemption price of HAI calculated?

The redemption price of HAI is dynamically adjusted by the PID controller based on the market conditions and the protocol’s parameters.

Who controls the PID controller?

The PID controller in the HAI Protocol is an automated mechanism governed by preset rules and parameters. It’s not directly controlled by any individual or entity but operates based on the programming and algorithms set within the protocol to maintain the stability of HAI. More technical information on the PID controller here.

Can users influence decisions within the HAI Protocol?

Yes, users who hold KITE tokens have governance power within the HAI Protocol. They can vote on various proposals and decisions that affect the protocol’s direction and operational parameters such as adding/removing collateral types.

What is the role of Global Settlement in the HAI Protocol?

The Global Settlement acts as an emergency mechanism for winding down the HAI Protocol in extreme situations. It ensures that users can redeem their HAI for the underlying collateral remaining in the system, bringing all operations to a controlled and fair conclusion.

How does the HAI Protocol ensure the security of user assets?

The HAI Protocol employs multiple security measures, including smart contract audits, the Vault’s mechanism for collateral management, and the Global Settlement feature for emergencies. These layers help protect user assets and maintain the integrity of the system.

However, it is important to note that, like all decentralized finance and smart contract frameworks, interacting with the protocol carries technical risk and economic risk. Users should carefully consider all relevant and appropriate factors including, but not limited to, the mechanics of the protocol, the code underlying the protocol, the governance process of the protocol, and their own risk tolerances before engaging with the protocol.

Can the collateral types in Vaults be diversified?

Yes, the HAI Protocol is designed to handle multiple types of collateral in Vaults, allowing for a diversified approach to backing HAI and enhancing the system’s stability. A user can have as many Vaults as they would like, however each Vault is an independent position and cannot be used as collateral for another.

What happens to my collateral when I deposit it into the HAI Protocol?

When you deposit collateral into the HAI Protocol, specifically into a Vault, it is locked as value for minting HAI, the system’s stablecoin. This collateral remains in your Vault until you choose to withdraw it, subject to the condition that you have maintained sufficient collateralization as per the protocol’s requirements. While your collateral is locked, it backs the value of the HAI you’ve minted. You can manage your Vault, adjusting the amount of collateral or HAI as needed, but the initial collateral remains within the HAI Protocol’s secure system until you decide to retrieve it, ensuring the stablecoin’s value remains over-collateralized.

RISK DISCLOSURE: Are there any risks involved in participating in the HAI Protocol?

As with any DeFi platform, there are inherent risks, including market volatility, smart contract vulnerabilities, and regulatory changes. Users should conduct thorough research and consider their risk tolerance before participating and depositing collateral.

--

--

Reza Jafery
Let’s Get HAI

Ops @ PubDAO / Community @ Reflexer / Product @ Decrypt. Trying to change the rules and create a positive sum game.