Haustoria
Last updated
Last updated
Haustoria is a set of smart contracts that interact with different DeFi protocols across various networks, using user liquidity as collateral and distributing the averaged profit to the end user in native yield.
Haust integrates native yield generation functionality directly into the protocol. All tokens sent to Haust Network through Haustoria automatically compound over time.
Such as, hUSDT, hUSDC, hBTC (hWBTC), hETH(hWETH)
The yield generation process leverages a permissionless, programmatic approach by interacting with various liquid staking protocols deployed across supported blockchain networks. These decentralized protocols employ smart contracts to facilitate the secure and transparent staking of various crypto assets. The returns accrued by these protocols are automatically distributed back to Haust users at predetermined intervals.
1. Deposit & Distribution: Users initiate the process by depositing funds into a Haustoria contract on a chosen donor network(out of the currently available networks with Haustoria). Then the contract distributes these funds across pre-selected high-yield programs within that network.
2. Risk-Adjusted Allocation: Haustoria intelligently allocates funds based on predefined parameters. This ensures a balance between maximizing potential yield and minimizing inherent risks associated with different DeFi protocols.
3. Tokenized Representation: In exchange for their deposited funds, users receive hTokens in Haust Network. These tokens represent a user's proportional ownership within the Haustoria system.
4. Passive Income Distribution: As yield is generated from the underlying programs, Haustoria automatically distributes these profits proportionally among all token holders.
To fully understand the mechanics lets bring in some terminology:
hToken - token in the Haust network that has passed through Haustoria
hToken/Token rate - the ratio of the value of one hToken to a regular Token
Donor network - a blockchain from which hTokens can be added to the wallet. In the first release, tokens from the Ethereum, Polygon, and BSC networks can be added.
Collection service - a backend service responsible for collecting user funds to Vault in the donor network
Vault - a smart contract for receiving user funds in donor networks, which store 10% of it and the rest - 90% go to the staking Protocols through the Protocol plugins.
Protocol - one of the lending/staking protocols (further everything will be described for one AAVE protocol)
Protocol plugin - a contract through which the transfer from the protocol or to the protocol occurs.
Proportion - the ratio of funds in Vault to funds in the protocol, set by the platform administrator. In order to reduce the number of requests to the protocol to maintain the proportion during the restaking process, the proportion is floating at +-2%. This means that the proportion can periodically be in the range of 8/92 - 12/88
Restaking - backend service, responsible for submitting requests for the withdrawal of hTokens to the donor network, balancing of Vault/Protocol ratio to comply with the proportion set by the administrator, updating the hToken / Token rate
HaustHub - a contract contributing aggregating information in the Haust network about the balance of tokens in donor networks
hTokenTotalSupply - a variable in the contract of hTokens, denoting the amount of this token in the Vault + Protocol for all donor networks
TokenTotalSupply - a variable in the contract of hTokens, denoting the total amount of this token in the Haust network
Liquidity in Vault - the number of tokens which users contributed to the donor network. (In the first release, 12 Vault’s - 4 tokens in 3 networks. For example, USDT vault in Polygon, BSC and Ethereum)
Liquidity in Protocol - the amount of user funds currently allocated in the AAVE protocol in donor networks, broken down by tokens. There are 12 liquidities in AAVE (for example, the amount of USDT in AAVE in Polygon, BSC, and Ethereum)
Total liquidity in the donor network - the amount of liquidity in Vault and Protocol, broken down by tokens and networks. For example, total liquidity of USDT in Polygon = liquidity of USDT Vault in Polygon and USDT in AAVE in Polygon.
Yield in Protocol—When liquidity is contributed to the AAVE Protocol, its value is fixed and grows over time. Therefore, further in the text, these terms mean how much the initially contributed liquidity has increased.
To receive some amount of hUSDT in a Haust Wallet through Haustoria, the user needs to deposit USDT tokens to the generated address in the selected network.
The number of hUSDT received by the user may be less than the number of USDT deposited, depending on the current hUSDT/USDT exchange rate.
The minimum deposit volume restrictions is implemented depending on the network: $100 - Polygon, BSC and $200 - Ethereum.
Conditions:
hUSDT - received token
Polygon - donor network
Liquidity of USDT in Vault in Polygon = 0
Liquidity of USDT in AAVE in Polygon = 0
Total liquidity of USDT in Polygon = 0
Based on the three parameters above:
hUSDTTotalSupply = 0
TotalSupply = 0, on the hUSDT contract
Based on the two parameters above:
1 hUSDT = 1 USDT - current rate
The example is considered only on one donor network, so by default it does not change further in the process:
Liquidity of USDT in Vault in Ethereum and BSC = 0
Liquidity of USDT in AAVE in Ethereum and BSC = 0
Total liquidity of USDT in other networks = 0
The user deposits 100 USDT to the generated address and pays for the transfer transaction in Polygon.
The Collection service backend sees the deposit on the address and transfers 100 USDT to the Vault in Polygon.
At the same time, a Haustoria transaction occurs to the Haust Hub, transmitting information that 100 USDT appeared in the Polygon network, which means that the variable hUSDTTotalSupply should be increased by 100.
New states:
Liquidity of USDT in Vault in Polygon = 100
Liquidity of USDT in AAVE in Polygon = 0
Total liquidity of USDT in Polygon = 100
Based on the three parameters above:
hUSDTTotalSupply = 100
TotalSupply = 100, on the hUSDT contract
Based on the two parameters above:
Exchange rate hUSDT/USDT = 1 or 1 hUSDT = 1 USDT
Every n hours (n is a variable set by the platform administrator), as the yield in Protocols are generated, the restaking is initiated—a backend procedure that performs the following tasks:
Changes the variable hTokenTotalSupply in the hToken contract on the Haust Network to update the hToken/Token rate.
Executes withdrawal requests in the donor networks.
Balances liquidity in the Vault and the AAVE protocol to achieve the proportion set by the administrator.
Let's enhance the example above with restaking.
Conditions before the start of restaking:
Liquidity of USDT in Vault in Polygon = 100
Liquidity of USDT in AAVE in Polygon = 0
Total liquidity of USDT in Polygon = 100
Based on the three parameters above:
hUSDTTotalSupply = 100
TotalSupply = 100, on the hUSDT contract
Based on the two parameters above:
The rate of hUSDT/USDT = 1 or 1 hUSDT = 1 USDT
Restaking
The proportion set by the platform administrator = 10/90, which means that 10% of the total liquidity of USDT in Polygon should be in the Vault for instant withdrawal and 90% should be in AAVE for yield generation.
The backend assesses the current liquidity of USDT in Vault in Polygon, the liquidity of USDT in AAVE, and the total liquidity of USDT in Polygon, and observes that the current total liquidity is distributed as follows:
100% is in the Vault,
0% is in AAVE.
Based on this, the backend directs 90% of the liquidity from the Vault (90 USDT) to the AAVE protocol to maintain the proportion set by the platform administrator.
New states as a result of restaking:
Liquidity of USDT in Vault in Polygon = 10
Liquidity of USDT in AAVE in Polygon = 90
Total liquidity of USDT in Polygon = 100
Based on the three parameters above:
hUSDTTotalSupply = 100
TotalSupply = 100, on the hUSDT contract
Based on the two parameters above:
The rate of hUSDT/USDT = 1 or 1 hUSDT = 1 USDT
The hToken/Token rate increases when the total liquidity across networks grows due to an increase in liquidity in the AAVE protocol as yield was generated.
When users deposit or withdraw hTokens, the exchange rate does not change.
Let's expand the example above with restaking, during which yield was generated in AAVE.
States before the start of restaking:
Liquidity of USDT in Vault in Polygon = 10 - 10% of total liquidity
Liquidity of USDT in AAVE in Polygon = 90 + n yield - 90% of total liquidity (amount of the yield is unknown at this point)
Total liquidity of USDT in Polygon = 100 + n yield
Based on the three parameters above:
hUSDTTotalSupply = 100
TotalSupply = 100, on the hUSDT contract
Based on the two parameters above:
Exchange rate of hUSDT/USDT = 1 or 1 hUSDT = 1 USDT
Restaking The backend evaluates the current states above and makes a request to the AAVE contract to find out what USDT liquidity is currently in AAVE. It receives a response that:
USDT in AAVE = 95 (90 deposited and 5 as yield)
Based on this information, the backend evaluates the current liquidity state:
Liquidity of USDT in Vault in Polygon = 10 USDT - 9.524% out of total liquidity
Liquidity of USDT in AAVE in Polygon = 95 USDT - 90.476% out of total liquidity
Total liquidity of USDT in Polygon = 105 USDT
Since the current proportion is within the limits set by the platform administrator (8/92 - 12/88), no withdrawal from AAVE is made.
However, since the total USDT liquidity in Polygon has changed (from 100 to 105), the restaking backend sends a transaction to the hUSDT contract and increases the hUSDTTotalSupply by 5.
Thus, the new state:
hUSDTTotalSupply = 105
TotalSupply = 100, on the hUSDT contract
Based on the two parameters above:
Exchange rate of hUSDT/USDT = 1.05 or 1 hUSDT = 1.05 USDT
Thus, the balance of the user who initially deposited 100 USDT:
100 hUSDT = 105 USDT
Thу restrictions on the minimum withdrawal amount depending on the donor network:
$100 - Polygon, BSC
$200 - Ethereum
Additionally, when withdrawing hTokens, a fee is applied:
Fee = gas cost for the transfer transaction in the donor network * platform coefficient set by the administrator
Since the total liquidity during restaking is distributed in a proportion set by the administrator, the user is limited when withdrawing hTokens by:
the available liquidity in the selected network,
the available liquidity in the Vault in the selected network.
Based on this, if the withdrawn liquidity in hTokens does not exceed the total liquidity in the selected network, there are two possible scenarios:
Instant withdrawal of hTokens to the selected network - regular tokens are transferred to the user in the selected network.
Delayed withdrawal - the user wants to withdraw more than what is available in the Vault, so they will have to wait for the next restaking for the liquidity to be withdrawn from the AAVE protocol first.
Let’s check the first scenario with the example below (excluding fees and minimum withdrawal restrictions for now). The second scenario will be covered later, with an example of restaking with queues.
Current states after the last restaking:
Liquidity of USDT in Vault in Polygon = 10 USDT - 9.524% out of the total liquidity
Liquidity of USDT in AAVE in Polygon = 95 USDT - 90.476% out of the total liquidity
Total liquidity of USDT in Polygon = 105 USDT
hUSDTTotalSupply = 105 TotalSupply = 100, on the hUSDT contract
Based on the two parameters above:
Exchange rate of hUSDT/USDT = 1.05 or 1 hUSDT = 1.05 USDT
The user wants to send and chose hUSDT, selects Polygon, enters 5 hUSDT, sees the information that will receive 5 * 1.05 = 5.25 USDT, and confirms the transaction in the Haust network.
At this moment, the following changes occur on the hUSDT contract:
TotalSupply = 100 => TotalSupply = 95, as there are 5 hUSDT from Haust network was withdrawn.
hUSDTTotalSupply = 105 => 99.75, as the number of USDT in the donor network decreased by this value(5.25).
At the same time, the hUSDT/USDT rate remains the same: 99.75/95 = 1.05
In Polygon, a transfer from the Vault to the address specified by the user occurs.
New states after the user’s withdrawal:
Liquidity of USDT in Vault in Polygon = 4.75 USDT - 4.762% out of the total liquidity
Liquidity of USDT in AAVE in Polygon = 95 USDT + n yield - 95.238% out of the total liquidity
Total liquidity of USDT in Polygon = 99.75 + n yield in USDT
hUSDTTotalSupply = 99.75 TotalSupply = 95, on the hUSDT contract
Based on the two parameters above:
Exchange rate of hUSDT/USDT = 1.05 or 1 hUSDT = 1.05 USDT
Restaking The backend assesses the states above and queries the AAVE protocol to find out the current state of liquidity in AAVE. It sees the following values:
Liquidity of USDT in Vault in Polygon = 4.75 USDT - 4.535% out of the total liquidity
Liquidity of USDT in AAVE in Polygon = 100 USDT - 95.465% out of the total liquidity
Total liquidity of USDT in Polygon = 104.75 USDT
Since the proportion of Vault/AAVE in Polygon has shifted from the values set by the administrator, backend made a decision to withdraw some funds from the AAVE protocol, and a withdrawal from AAVE is executed:
104.75 * 0.1 - 4.75 = 9.975 - 4.750 = 5.725 USDT, where:
104.75 - Total liquidity of USDT in Polygon,
0.1 - 10% should be in the Vault,
4.75 - current amount USDT in the Vault in Polygon.
New states after withdrawal from AAVE:
Liquidity of USDT in Vault in Polygon = 10.475 USDT - 10% out of the total liquidity
Liquidity of USDT in AAVE in Polygon = 94.275 USDT - 90% out of the total liquidity
Total liquidity of USDT in Polygon = 104.75 USDT
Additionally, the restaking backend sees that the total liquidity in USDT in Polygon does not match the hUSDTTotalSupply on the hUSDT contract in Haust Network and updates this value.
hUSDTTotalSupply = 99.75 => hUSDTTotalSupply = 104.75 TotalSupply = 95, on the hUSDT contract remains the same
Thus, the rate is updated considering new yield generated in AAVE: hUSDT/USDT = 104.75/95 = 1.1 or 1 hUSDT = 1.1 USDT
If a user wants to withdraw liquidity exceeding the amount available for immediate withdrawal (the amount in the Vault on the chosen network), the user will be placed in a queue awaiting the next restaking when withdrawing funds.
Let’s consider the following states after the previous restaking and some elapsed time:
Liquidity of USDT in Vault in Polygon = 10,000 USDT - 10% out of total liquidity
Liquidity of USDT in AAVE in Polygon = 90,000 + n yield USDT - 90% out of total liquidity
Total liquidity of USDT in Polygon = 100,000 + n yield USDT
hUSDTTotalSupply = 100,000 USDT TotalSupply = 80,000 hUSDT (considering a scenario where many users deposited into Haust Network without withdrawing, resulting in an increase in USDT in Polygon but no increase in hUSDT)
hUSDT/USDT = 100,000 / 80,000 = 1.25 or 1 hUSDT = 1.25 USDT
User's balance = 50,000 hUSDT = 62,500 USDT, and wants to withdraw all of it.
The user makes a transaction on the Haust Network and the variables on the hUSDT contract are changing:
hUSDTTotalSupply = 100,000 => hUSDTTotalSupply = 37,500 TotalSupply = 80,000 => 30,000
The rate remains the same: 37,500 / 30,000 = 1.25
Restaking The backend evaluates the liquidity states and requests AAVE to check the liquidity of USDT in AAVE in Polygon. It observes the following state:
Liquidity of USDT in Vault in Polygon = 10,000 USDT - 9.524% of total liquidity
Liquidity of USDT in AAVE in Polygon = 95,000 USDT - 90.476% of total liquidity
Total liquidity of USDT in Polygon = 105,000 USDT
Meanwhile, the backend sees a withdrawal request for 62,500 USDT.
Based on this information, the restaking backend forms a withdraw request from the AAVE protocol for the amount:
62,500 - 10,000 + (105,000 - 62,500) * 0.1 = 56,750 USDT, where:
62,500 - withdrawal request 10,000 - current amount USDT in the Vault in Polygon (105,000 - 62,500) * 0.1 - should be in the Vault after fulfilling the withdrawal request.
Thus, the liquidity states after fulfilling the withdrawal request and balancing liquidity:
Liquidity of USDT in Vault in Polygon = 4,250 USDT - 10% out of total liquidity
Liquidity of USDT in AAVE in Polygon = 38,250 USDT - 90% out of total liquidity
Total liquidity of USDT in Polygon = 42,500 USDT
Since yield in AAVE was generating, affecting the USDT balance in Polygon, these need to be accounted for in the hUSDT contract, so a transaction is made:
hUSDTTotalSupply = 37,500 => hUSDTTotalSupply = 42,500 TotalSupply = 30,000, remains unchanged
Thus, the rate of hUSDT/USDT = 42,500 / 30,000 = 1.417 or 1 hUSDT = 1.417 USDT
The only parameter that is considered cumulatively across all donor networks is hTokenTotalSupply — a variable that affects the hToken/Token exchange rate.
Based on this, let's break down a large example that will include all the aforementioned mechanics, using three networks as an example.
Initial data based on the results of the last restaking:
Liquidity
Liquidity of USDT in Vault in Polygon = 10,000 USDT - 10% out of total liquidity
Liquidity of USDT in AAVE in Polygon = 90,000 USDT - 90% out of total liquidity
Total liquidity of USDT in Polygon = 100,000 USDT
Liquidity of USDT in Vault in BSC = 40,000 USDT - 10% out of total liquidity
Liquidity of USDT in AAVE in BSC = 360,000 USDT - 90% out of total liquidity
Total liquidity of USDT in BSC = 400,000 USDT
Liquidity of USDT in Vault in Ethereum = 100 USDT - 10% out of total liquidity
Liquidity of USDT in AAVE in Ethereum = 900 USDT - 90% out of total liquidity
Total liquidity of USDT in Ethereum = 1,000 USDT
Total Supply and Exchange Rate hUSDTTotalSupply = 501,000 USDT TotalSupply = 350,000 hUSDT
Exchange rate of hUSDT/USDT = 1.431 or 1 hUSDT = 1.431 USDT
Operations Before the Next Restaking Between the last restaking and the next, yield was generated in AAVE in each Network, increasing the liquidity in AAVE, which is not accounted for until the next restaking.
Additionally, the following operations occurred:
In Polygon: Several users collectively withdrew 5,000 USDT, resulting in the following changes:
Liquidity of USDT in Vault in Polygon = 10,000 => 5,000 USDT
hUSDTTotalSupply = 501,000 USDT => 496,000 USDT
TotalSupply = 350,000 hUSDT => 346,506 hUSDT (refer to Example 4 to understand these values)
One user requested to withdraw 20,000 USDT, resulting in the following changes:
hUSDTTotalSupply = 496,000 USDT => 476,000 USDT
TotalSupply = 346,506 hUSDT => 332,529.76 hUSDT (refer to Example 4 to understand these values)
In BSC: There were no withdrawals, but many users collectively deposited 150,000 USDT, leading to the following changes:
Liquidity of USDT in Vault in BSC = 40,000 USDT => 190,000 USDT
hUSDTTotalSupply = 476,000 USDT => 626,000 USDT
TotalSupply = 332,529.76 hUSDT => 437,351.563 hUSDT
In Ethereum: No deposits or withdrawals were made.
Restaking The restaking backend evaluates the USDT liquidity in Vaults across all networks, requests the current USDT liquidity from the AAVE protocol across all networks, analyzes withdrawal requests, and observes the following state:
Liquidity
Liquidity of USDT in Vault in Polygon = 5,000 USDT - 4.762% out of total liquidity
Liquidity of USDT in AAVE in Polygon = 95,000 USDT - 95.238% out of total liquidity
Total liquidity of USDT in Polygon = 100,000 USDT
Liquidity of USDT in Vault in BSC = 190,000 USDT - 33% out of total liquidity
Liquidity of USDT in AAVE in BSC = 380,000 USDT - 67% out of total liquidity
Total liquidity of USDT in BSC = 570,000 USDT
Liquidity of USDT in Vault in Ethereum = 100 USDT - 9.852% out of total liquidity
Liquidity of USDT in AAVE in Ethereum = 915 USDT - 90.148% out of total liquidity
Total liquidity of USDT in Ethereum = 1,015 USDT
Total liquidity across the three networks = 671,015 USDT
Total Supply and Exchange Rate:
hUSDTTotalSupply = 626,000 USDT
TotalSupply = 437,351.563 hUSDT
Exchange rate of hUSDT/USDT = 1.431 or 1 hUSDT = 1.431 USDT
Withdrawal Requests Polygon = 20,000 USDT
Operations in Polygon Since the backend sees withdrawal requests, it must determine how much to withdraw from AAVE to:
Ensure all withdrawal requests are fulfilled
Ensure that 10% out of the total USDT liquidity in the network is maintained in the Vault
Therefore, in Polygon, the following liquidity is withdrawn from AAVE:
20,000 - 5,000 + (100,000 - 20,000) * 0.1 = 23,000 USDT, where:
20,000 USDT is needed to withdraw to the user,
5,000 is already in the Vault,
(100,000 - 20,000) * 0.1 should be in the Vault after the user's withdraw
Liquidity in Polygon after payments and rebalancing proportions:
Liquidity of USDT in Vault in Polygon = 8,000 USDT - 10% out of total liquidity
Liquidity of USDT in AAVE in Polygon = 72,000 USDT - 90% out of total liquidity
Total liquidity of USDT in Polygon = 80,000 USDT
Operations in BSC There are no withdrawal requests, so the restaking backend only checks if the proportion is within the established limits.
Since the current proportion in BSC is 33/67, which falls outside the established limits (8/92 - 12/88), the backend creates a supply transaction to the AAVE protocol for the amount:
190,000 - 570,000 * 0.1 = 133,000 USDT, where:
190,000 is the current amount in the Vault,
570,000 * 0.1 is the required amount in the Vault considering the total USDT liquidity in BSC
After the transaction in BSC to the AAVE protocol, the liquidity state is as follows:
Liquidity of USDT in Vault in BSC = 57,000 USDT - 10% out of total liquidity
Liquidity of USDT in AAVE in BSC = 513,000 USDT - 90% out of total liquidity
Total liquidity of USDT in BSC = 570,000 USDT
Operations in Ethereum There are no withdrawal requests, so the restaking backend only checks if the proportion is within the established limits.
Since the current proportion in Ethereum is within the established limits, no transaction to AAVE is performed to rebalance due to minor deviations from the target proportion.
Liquidity of USDT in Vault in Ethereum = 100 USDT - 9.852% out of total liquidity
Liquidity of USDT in AAVE in Ethereum = 915 USDT - 90.148% out of total liquidity
Total liquidity of USDT in Ethereum = 1,015 USDT
Operations in Haust The final task of restaking is to determine the current amount of USDT in all three networks, compare the obtained value with the hUSDTTotalSupply variable on the hUSDT token contract, and adjust the variable value if necessary.
As a result of the last operation before restaking, the variable states on the hUSDT token contract are:
hUSDTTotalSupply = 626,000 USDT
TotalSupply = 437,351.563 hUSDT
Exchange rate of hUSDT/USDT = 1.431 or 1 hUSDT = 1.431 USDT
Current total liquidity across all three networks: 570,000 + 80,000 + 1,015 = 651,015 USDT
The restaking backend makes a transaction in the Haust network and changes the value of the hUSDTTotalSupply variable on the hUSDT token contract:
hUSDTTotalSupply = 626,000 USDT => 651,015
TotalSupply = 437,351.563 hUSDT - remains unchanged
Based on this, the exchange rate is updated:
Exchange rate of hUSDT/USDT = 1.489 or 1 hUSDT = 1.489 USDT
A verification can also be performed:
Since the difference in hUSDTTotalSupply before and after restaking consists of the yield generated in AAVE, we can check that the final difference in hUSDTTotalSupply before and after restaking should be equal to 5,000 (yield in Polygon) + 20,000 (yield in BSC) + 15 (yield in Ethereum) = 25,015 USDT.