Emperor

Posted on Nov 05, 2022Read on Mirror.xyz

Understanding Aera Finance

A new era in DAO Treasury Management.

Since its initial summer in 2020, DeFi has run into various walls along the adoption path. Some of these have been user experience being too complicated; user interface not being intuitive enough, protocols not recovering from hacks, protocols needing scale which they probably can’t achieve actually to perform, ponzinomics which prop value but show unreal yield thus delaying" actual” adoption, the need for “trust” for protocols to become more capital efficient.

Capital Efficiency is one of the core problems in crypto. It sits at the heart of every mechanism design and is one of the most critical problems to solve. Why do we arrive at this problem? A thought occurred to me about the core problem of DeFi and general crypto a few days ago.

https://twitter.com/0x_emperor/status/1581894603883843584?s=20&t=0eRqev_eRa9PMxwM1V4baA

One example of this is, let’s say you need a loan from a bank today, You walk into the bank, and the terms are put forth depending on the kind of loan you want to secure and the country you are in. In a country like India, you would end up furnishing around 12-14% for an education loan, while housing loans are about 8-10%. One thing you might be aware of, though, is to get a loan, you usually have to secure it with some collateral. This collateral is just a percentage of the loan that guarantees they can sell it if you default. The bank also has all your identity details, so they have proof of “person”.

All in all, this unlocks capital efficiency because these components build trust. In the on-chain world of crypto that is pseudonymous, any such faith is not possible (or has at least not been achieved in a scalable manner), which thus requires most loans and any such lending practices to secure their loan from 125% to as much as 500% in some instances. While there are protocols like goldfinch and maple which might be working on the problem, the solution involves off-chain KYC to offer these loans, which is an acceptable middle-ground for now but runs into problems at scale.

Almost every progressive step in crypto in the past two years has been about unlocking capital efficiency on some level.

  • Uniswap v2 → Uniswap v3

  • Liquidity bonds offer more robust liquidity for illiquid tokens

  • Rari’s permissionless pools collateralized at about 100% vs overcollateralized elsewhere

  • Goldfinch/maple’s attempt at undercollateralized loans

  • Perps on chain moving from the Synthetix model to DyDx to GMX etc.

Where does all of this connect with treasury management, though? Treasury management is an underrecognized problem in the DeFi landscape, and few have tried to solve it. It is well-known that almost all protocol treasuries primarily comprise the protocol’s native token. This makeup of a treasury also leads to value erosion of the treasury in case of downturns, and sometimes this can also mean the project's death. One of the most significant raises in 2021 was by Fei Protocol which raised about 1.3B $ in its genesis event. While it might have been marred with some issues early on, the DAO treasury was never managed to its fullest and was left to the mercy of the market and was in a constant downturn ever since the Crypto top in Nov 2021.

Fei also merged with Rari Capital, a lending protocol to synergize the stablecoin offering with lending to increase their capital base and make it more efficient. Rari got hacked in April and exploited by a reentrancy attack in April for 80M. Fei’s treasury was ultimately insufficient to repay the entirety and make the people who lost the money whole. The Rari hack was also a reason for Babylon finance, another protocol, to shut down. Fei Protocol ultimately winded down its operations around September 2022.

https://twitter.com/joey__santoro/status/1460693391474184197

DeFi protocols, in rare events, do not have a backstop to protect themselves or their users or ensure the sustenance of a project. Defi protocols are not FDIC insured, which in the case of TradFi banks, gives some relief and acts as a trust mechanism for depositors in case of some rare event that takes the bank under and the users are made whole to an extent. A common practice in the case of Centralized Exchanges in crypto is to keep insurance funds from their fees and otherwise, which is utilized in the case of hacks or other extreme events, like the Binance SAFU fund, something similar is also maintained by BitMEX; Deribit etc. Deribit, in a recent hack, covered losses using its company reserves. This does not include rare events of liquidity cascades and rapid drawdowns of assets, which sometimes leave these protocols with bad debt.

DeFi Treasury management is challenging since many treasuries are filled with native tokens from the projects. A lot of pushback occurs whenever there are mentions of treasury swaps to secure stablecoin for operations or other required operations—for example, the Love-001 Maker DAO Proposal, the Sushi DAO proposal for a strategic raise etc.

Although in the past year, a variety of protocols have slowly started garnering attention and gaining traction, they have not achieved sustained high volume usage and barely pass a few basis points of the total asset value that they cover (e.g., you would imagine that a successful options protocol would at least have a few billion dollars worth of eth If it were successful). This usage of products differs from traditional finance because corporations tend to hedge products they offer using derivatives, options or other exotic products. Hence, this leads to the products having some continued usage (which is non-speculative).

Total Treasury Value - DeepDao.io

Top 10 Treasuries on 3rd November - DeepDao.io

DAOs and Allocation Problems

So the institution of scale that exists on-chain for utilizing these protocols are Decentralized Autonomous Organizations (DAOs). DAOs are not profit-maximizing entities but might instead have a variety of objectives they might want to look at or achieve. In that case, they are similar to entities with some goals and hand over the money to “professional” services that manage these funds, like venture funds or hedge funds.

DAO funds need to be managed for a variety of reasons:

  • The DAO treasury might want to maintain an insurance fund to cover the shortfall from their liabilities. In this case, the DAO has to ensure that the insurance fund’s assets are worth more than the liabilities.

  • The DAO treasury might want to secure the “runway” of the protocol, thus ensuring continued research and development.

Unlike Traditional ways of adherence to terms secured by the law, on-chain DAOs have to resort to smart-contract calls through governance proposals to do anything that involves their treasury. For example, if Uniswap wished to convert some of its treasury in UNI to USDT/DAI/USDC today, it would first launch a proposal and then access the funds. This ultimately makes you think that liquid funds are essential for an ideal and suitable allocation protocol (in case the protocol needs to remove the funds in case of rare events immediately), and the interaction required to deposit or withdraw should be kept at one smart-contract call each.

So let’s think about this for a second. We have DAOs who have treasuries that could be optimized better, and we have DAO stakeholders, i.e. token holders who hold the protocol token and might be opposed to any sale of assets since that erodes their value. We may have analysts and speculators who could be outsiders or funds invested in the protocol who think the DAO treasury can be managed better, thus managing protocol risk and ensuring the project’s existence. We have multiple parties whose incentives need to be aligned.

Decentralized Allocation as an Adversarial Optimization Problem

In this framework, we formulate the problem in this way, we have

  • W → The wealth of the asset allocator

  • π → The portfolio which allocates W to a variety of assets

  • Nₐₛₛₑₜₛ → All the assets that are possible

  • Σ → Onchain state of the protocol

  • Σₜ → Onchain state of the protocol at time t

  • f → A convex objective function that determines asset quality, essentially the function you want to measure the performance with; you want this function to be maximized

    • f(π, Σₜ) → The parameters of this function f are the portfolio π and the onchain environment Σ, which can also be Σₜ, i.e. the environment at time t, the function would take in these parameters and output a measure of asset quality.

So in this formulation, we have an asset manager whose job is to use the wealth W and allocate the portfolio across assets. In most cases, this simple asset allocation would be like active fund managing, where depositors deposit money, and the asset allocator gets a fee based on performance. Still, in our case, the wealth W belongs to a DAO managing a protocol. The onchain protocol’s state might defer at different points in time, so the context of managing these funds must be adjusted to the protocol's needs. For example, as mentioned earlier, if a lending protocol wants to hedge its outstanding loan book, its on-chain state is of prime importance since it is dynamic across time. Additionally, you have to allocate assets in such a way that the potential shortfalls are addressed.

So thinking of it as an optimization problem, you are searching for the optimal portfolio, which is the best possible portfolio given your protocol and various possible combinations of the portfolio across the variety of assets available

where π* gives the optimal portfolio.

This formulation is perfectly valid in case there was just one fund manager/analyst/speculator who had the power to call all the shots. In the case of a decentralized organization setup by design, multiple people have the ability to suggest and request changes.

So now you end up thinking about the problem in this way, person A might be a token holder who owns the protocol token $X and believes that all the stablecoins in the treasury should be used to purchase the token $X, person B might have a short on $X and in some way pose as someone who wants to ensure the “runway” of the protocol and suggest selling all the $X assets or at least a few million dollars which leaves him profitable but seems benign for onlookers. When you think of the possibilities like this, you end up with n possible people who suggest changes, and each has their own objective function that they might be looking to maximize or profit from.

When you try to optimize multi-player optimization functions like this, it is likely that the optimal portfolio that the DAO might need does not intersect, i.e. is not the same as the ideal scenario for any of the participants who suggested changes to the asset allocation.

Another thing to note when on-chain DAOs are considered is the limited ways of portfolio rebalance because, to maintain transparency, there’s a predisposition to use on-chain mechanisms like AMMs, gnosis auctions or lending protocols (which can also involve using vaults from other protocols in some cases). But coming back to our earlier example, let’s say there’s a person C who wants to buy the token $X cheap, so suggests a treasury adjusted of selling all tokens to $, in case person C is an arbitrageur (someone who trades between onchain and off-chain marketplaces to profit from price divergence) then he would prefer large asset changes since that would present him a more significant opportunity to benefit in multiple ways. Therefore participants who suggest changes should have some skin in the game and accept some risk against any portfolio changes they offer.

Finally, the on-chain state of a protocol is subject to constant change. This would also mean that DAOs are best served when there are regular, and good portfolio rebalances, which optimize their position and ensure that the protocol is well-placed to handle any adverse events. This would require participants to suggest these changes at regular intervals. Incentivizing portfolio submissions is the best way to make this possible and, coupled with some skin in the game from the portfolio submitters, ensure high-quality submissions.

The design of a decentralized allocation protocol would thus need to account for the following:

  • All actors are adversarial: A good design principle which applies everywhere is “design for extremes, and the middle will take care of itself”. Assuming that every actor is adversarial is an extreme that the allocation protocol should consider, so it progresses despite diverging/malicious wants of agents.

  • Actor Collusion: As possible as adversarial actors are, multiple submitters can submit different portfolio directions and conspire to make inefficient allocations but yet profit from the same (arbitrageur collusion for profit by which each suggests huge asset allocations across different assets). Ensuring that collusion is a zero-sum game is important.

  • Submitter Incentivization: Pay submitters with respect to asset performance measured by reputation or contribution to ensure the quality of submissions and avoid submissions of portfolios which suggest random asset allocations to maintain the appearance of submissions.

Aera Finance - A decentralized allocation protocol

Aera protocol constructs a competition amongst agents who submit portfolios for treasury allocations. These agents are known as vault guardians. The competition is structured as an iterative skill-based model to maximize individual rewards. The DAO pays for these rewards.

Vault guardians have to stake assets that can be slashed if their Allocation causes the DAO to suffer a loss. The “slashing” mechanism is outsourced to arbitrageurs by allowing them to participate and suggest improved treasury allocation. They spot price discrepancies between the DAO portfolio and the global market. These arbitrage losses the DAO treasury faces are passed via slashing onto the vault guardians if the losses are sufficiently large.

Aera finance has a crucial feature which is time-scale separation between different participants. In other words, a DAO depositing money will have a very long-term view of their money and wouldn’t be prone to constant deposit and withdrawal due to the nature of their existence. At the same time, vault guardians, since they have to keep the on-chain environment in mind and risk slashing through arbitrageurs spotting price discrepancies, are in some sense forced to suggest changes in periodic intervals, thus constantly trying to achieve an optimal portfolio. It is the DAO that authorizes and selects the optimal Allocation among submissions.

The Allocation is done as follows:

  • A DAO treasury can be interest a small subset of all available assets (subject to changes, preferably infrequent)

  • These assets can be stablecoins, options, loans, AMM LP (Liquidity pool) shares, or any other possible ERC-20 representation.

  • Different guardians propose portfolios per DAO preferences and mention the percentage that the DAO treasury should be changed to different subsets.

  • The protocol then constructs a single portfolio taking all the submissions into account, and the DAO executes it.

The aggregation rule that Aera uses is a weighted median aggregation rule. It’s similar to the one used by the Pyth network (an oracle protocol on Solana). While better aggregation rules have been researched and found they are not feasible given the computational limits of blockchain. The aggregation rules also naturally correspond to the reputation scores of submitters; thus, higher reputation submitters have more weight.

How are the assets actually deployed? How are the guardians slashed? Once the single portfolio from all submissions is constructed, Aera puts the assets in a CFMM while ensuring relative proportions as arrived upon. The DAO will act as an LP to the CFMM that executes the trades for their treasury portfolio adjustment. Arbitrageurs can trade against the portfolio until the targetted asset proportions are reached. CFMMs incur an impermanent loss on LPs. Therefore, if an allocator submits a portfolio that deviates too much from the current state, this increases LP loss due to arbitrage. And this loss can be passed onto the guardian’s staked assets through slashing.

How are the portfolio submitters graded and incentivized? Portfolios submitted by participants are graded on their contribution to how much they change the final portfolio. Suppose adversarial/malicious portfolios are submitted which deviate from optimal values and take the portfolio in the other direction. In that case, it makes natural sense to either give them much less rewards or even slashing their staked assets in extreme cases.

Grading for participants

Another part of the grading also involves getting grades of each submitter to construct relative ranking in order to determine how much of the fees is distributed to whom. Shapley value is a concept from cooperative game theory. It essentially describes the contribution that each player makes to the overall cooperation/plan. In our case, the Shapley value of the ith player would represent how much player i contributed to the final portfolio. We get these Shapley values by constructing them from individual grades. The following equation gives the total fees spent by the DAO on block height h where i is the ith player, and lambda_i gives the Shapley value of player i.

Essentially, every player is given pro-rata fees/rewards relative to the set of all players who have contributed positively to the portfolio.

Comparison to Futarchy

There are some similarities between the solution offered by Aera finance for treasury management and Futarchy. Futarchy is the mechanism of executing governance decisions via prediction markets. The significant similarity in both is that participants (in our case, participants who submit portfolios) to succeed mostly need to make non-trivial calculations which sometimes involve asymmetric information. Another similarity is the usage of Automated market makers in both instances.

While there are similarities in how they formulated Futarchy and Aera, Aera vaults address very different markets and have other fundamental differences in how they operate. Futarchy needs an entirely new market to be created from scratch, while Aera offers the treasury management solution to existing DAOs with liquidity. This existence of a market allows Aera to bypass futarchy criticisms like the cold start problem, lack of liquidity etc. Also, it’s not just the existence of organizations but also the presence of participants, i.e. submitters and arbitrageurs, which makes offering such a solution easier.

Unlike LMSR (Logarithmic market scoring rule) used in the case of Futarchy has not seen much adoption beyond niche elections, Aera finance uses CFMMs, which have gained a lot of acceptance and traction and manage billions of dollars in liquidity today.

Time-scale separation is one of the essential features and also a difference between Futarchy and Aera. In the case of Futarchy, the participant can participate and hedge exposure until up to the last moment, and the payoff is binary. In the case of Aera, as we saw earlier, portfolio submitters are forced to keep the on-chain environment and the protocol status in mind and suggest periodic improvements/changes to the portfolio allocation for optimal performance and to keep the treasury allocation market aware.

Finally, Aera is fully on-chain and cares only about the on-chain environment and state, unlike prediction markets which generally try to solve the “oracle problem,” i.e. bringing off-chain information to an on-chain environment. Aera overcomes the significant problems of Futarchy, as mentioned above but also deals with the whale problem.

Insurance Funds in Crypto and Treasury Management

Insurance funds are a very contentious topic in crypto. There have been a variety of attempts at insurance protocols in crypto like Insurace, Nsure, Bridge Mutual, Risk Harbor, and Nexus Mutual. Some of these allow users to deposit a portion of their earned interest which pays out in the case of a liquidation event. Insurance was and is a much-desired protocol on-chain. Protocols have attempted to gain traction because it would be like an on-chain savings account, much like FDIC insurance, as earlier mentioned in this article.

Most Insurance protocols, though directly, try to offer these insurance services to the users. In the last year, there have been a myriad of hacks that would have benefited from insurance on their assets. Some audit agencies provide insurance on audited code to a certain extent (10M $). Think about this for a second: User experience for insurance on the chain involves you manually insuring every position of yours in one of these protocols, which is like opening an account and then visiting an insurance agent for every financial account you might make. In TradFi, the institution directly purchases or holds the insurance on customer fund losses.

One way of achieving an Insurance fund in Defi is to use a protocol’s stake-based insurance fund and rebalance it to achieve the required criteria. For example, Aave and synthetic utilize stake-based insurance funds. The stakers are rewarded with the protocol’s native token. Still, if the system has liabilities, the insurance fund's assets can be sold to cover these liabilities.

The important part here, though, is the rebalancing to uncorrelated yield-bearing assets so that the insurance fund can handle rare events better. This also avoids overconcentration in a single asset. For example, let’s say a protocol had a token $Y and an insurance fund comprised of $Y, ETH etc., and the protocol operated a lending market on ETH. Let’s say there was a massive selloff in ETH, and the protocol’s lending market for $Y was exploited to some extent by oracle manipulation. If the insurance fund is denominated in the same assets, then it will also face the same drawdown that the assets it lends face. Therefore, it is of prime importance to diversify or at least remove the correlation between assets and liabilities. This rebalancing of the insurance fund to match its liabilities or hedge downside risk is called Risk-aware treasury management.

Aera Finance uses vaults, i.e. smart contracts that can assist DAOs with treasury management. Vaults have gained immense popularity in crypto for various uses. It has become a commonplace offering for all kinds of protocols. These Vaults employ various strategies involving rebalancing or distributing assets into different protocols, which might offer yields on the vaults' tokens. The vault, in essence, becomes an automatic rebalancing mechanism where the user gives the money and doesn’t have to worry about the strategy itself. One issue with vaults is that the transparent and public usage makes them prone to adverse selection, and most vaults right now optimize for yield maximization and haven’t explored more complex objectives. In the case of Risk-aware Treasury Management by Aera, a DAOs utility function is expressed as an objective function through code and is then used to grade submitters and determine their share of fees.

What is the duration between two subsequent rebalances of the vault? The question is hard to answer. Ideally, you want the vault to be volatility aware so that in sudden downturns, the vault tries to rebalance in favour of better assets or convert to stablecoins to incur fewer losses. Aera optimizes rebalancing by using a two-speed incentive mechanism with both a fast and slow path.

  • Slow path → Involves parameter submitters who submit a portfolio to the vault infrequently.

  • Fast path → Involves arbitrageurs who trade against the vault to rebalance portfolios.

As seen earlier, collusion between both parties is avoided because any huge loss is incurred at the other party's expense.

The final piece of this puzzle is incentivizing various participants. Submitters are crucial to the ecosystem, so rewarding them makes sense. But Parameter/portfolio submitters need some skin in the game and are hence required to stake “a sufficient quantity of capital” to make submissions, this could be an order of magnitude or two lower than the size of the vault if they are malicious actors then their submissions cause adverse outcomes or losses for the vault and this is, in turn, passed onto them by slashing their staked assets.

Submitters are incentivized to enter the portfolio contest only if they have sufficient confidence in their ability to predict suitable parameters. At the same time, rewards will be better if their influence on the performance of the treasury is higher as well. One crucial thing monitored is submission quality over time for submitters. The highest quality submitters over time should be rewarded and recognized. Aera calculates quality scores for submitters to keep track of this. The incentive of DAOs to use this service is to have better treasury management and avoid losses also because DAOs usually don’t have active asset managers and would like to avoid that by just focusing on protocol development and other stuff. Depositing DAO treasuries in Aera opens up submissions from best-in-class asset managers.

Aera has a running single submitter N-token vault, the specs for which are as follows.

In a future article, I will cover how quality scores are measured, how exactly protocol risk is hedged, and the considerations you make in objective function selection.

Aera finance is a solution for a critical problem in DeFi and, if successful can become the status quo for treasury management practices for DAOs and protocols while keeping risk in mind and not having to worry about market conditions impacting their treasury value.