Rebuilding AGFI

Rebuilding AGFI
Photo by Christopher Burns / Unsplash

Aggregated Finance has officially migrated to a Version 3 token contract, and with this migration the project has replaced its foundations to better enable growth for the long-term. Before we dig into all of the amazing new features within V3, lets look at why this was necessary.

The problems with the original AGFI

AGFI V1 was a fork of another project, which was likely also a fork from many others before it. When Multi-Chain Capital launched in late 2021, it gave birth to a number of token forks of a reflections-based reward systems. A bug was inherited by all of these forks: every time a tax was collected and distributed as reflections to all holders, it distributes more than what the tax actually collected. With higher volume, more tokens would be entering circulation than what had been minted at launch.

What are reflections? They're a way to distribute tokens to all holders simultaneously through the use of a mathematical function. Every token holder's balance increases without actually needing to send them all those tokens manually.

AGFI's implementation to cancel out the effects of this bug was to burn 60% of the total supply at launch, and let the burn address receive the majority of the reflections to ensure any bugged tokens were unusable. This still left lingering issues:

  1. The burn address got close to a balance of 1 trillion AGFI, which didn't matter but was an endless source of confusion as people were confused as to how 99% of the supply was already burned (but it wasn't really).
  2. Market cap calculations were never consistent, with every tracker showing different values. Again, a source of confusion.
  3. Reflections are tightly coupled with transaction volume. If the project wanted to distribute rewards to holders then they can't add to the pool of reflected tokens, they must do so through other mechanisms on top (such as staking) which could impact reflections.

The contract also could not recognise the difference between Uniswap swaps and standard transfers and would tax all, so people could not move tokens between wallets without losing 10% of their balance. The Wrapped AGFI (wAGFI) contract was deployed to give people a tool to move tokens around but a multi-step process (and multi-transaction fee process) for just moving tokens around was not a user-friendly experience.

And finally the AGFI team saw the problems arising in other projects around centralization and decided to move the project to a proper Decentralized Autonomous Organization (DAO) structure. The team built a Governor contract for the original AGFI, and got it audited, but because that token contract was built without the ability to snapshot balances a number of fixes were needed to be injected to protect the DAO against vote duplication.

The main fixes for snapshots meant that every DAO participant would need to manually snapshot their own balances periodically, doubling the amount of fees they would pay to the network.

There were some other limitations of the token contract, including:

  • Taxes were a single configurable rate: whole numbers between 1 and 25%, and fixed to split in 50/50 between a treasury wallet and a "marketing" wallet.
  • The "marketing" wallet could not be changed after launch.
  • Tax collection could not be switched on and off easily.
  • Rewards to holders could only be reflections, nothing else.

The great rewrite

With a growing list of issues in the original AGFI, a growing list of fixes that were needed for what should have been a simple DAO contract, and consistent confusion around the supply of the token, the question just continued to come up of "why not just rip the band-aids off and move to V2?"

AGFI V2 was built from a basis of a few other projects, but modified to be even more flexible. Instead of just a "treasury" and "marketing" tax that most other projects build, a 5-channel tax structure was built in. Instead of tax rates applying to both buys and sells, each transaction type would have its own specific tax rate. Rewards would be distributed to holders as ETH instead of the token. Tax rates would be configurable down to 2 decimal places instead of whole integers. Instead of taxing all transactions, only Uniswap trades would be taxed. And this would all be built on ERC20Votes/ERC20Snapshot standards rather than the standard ERC20 token standard, building in the snapshots essential for the DAO.

This was a huge rewrite. AGFI went from a relatively simple token contract to a behemoth of a new token with huge amounts of functionality. But those huge amounts of functionality introduced their own problems.

The great rewrite, again

When AGFI V2 launched, it was functional at the beginning. However with 5 tax channels being introduced it brought in its own new issue - if all the tax channels executed at once during a Uniswap trade after they grew to a substantial size it would need a significant amount of gas (network fees) to complete the trade. Not an impossible amount of gas, but more than what websites could estimate to move a transaction to the confirmation step. The end result is people would attempt to sell the token on Uniswap and just have the "Confirm" button stuck showing.

The team considered making a custom swap tool to force the correct amount of gas needed for executing transactions, but this was just introducing a new band-aid for the problem. This needed to be addressed in a clean way, and so a V3 token contract was prepared immediately.

AGFI V3 is fundamentally the same as V2, however it brought in one crucial change: instead of all tax channels selling off at once it iterates through them selling them off one-by-one. This way each token seller pays a lot less in gas to execute one of the tax channels. In fact because only a single tax channel is execute during a trade, the gas needed for trading AGFI is a lot less compared to other taxed tokens.

Some other small features had to be removed, including maximum sizes for wallets and transactions at launch, purely because AGFI V3 is so large it actually sits at the maximum size on-chain for a smart contract. Only non-essential features were removed to ensure it would be deployable.

Changes in Tokenomics

Every AGFI V1 and V2 holder has been airdropped their balances in AGFI V3. The issue that comes from every airdrop is all the new tokens that enter circulating supply outside of a liquidity pool, and so the liquidity pool for V3 needed to be increased to provide a stable base in relation to the number of airdropped tokens. If the liquidity pool is not stable then the token cannot perform its primary function as a decentralized exchangeable asset. It also would suffer huge price impact from small trades. And so the liquidity for V3 was established to bring liquidity to approximately 20% of the market cap of the project, and use that as the new platform to build the project on.

A huge limiting factor for establishing liquidity for V3 was the lack of capital required to launch it at parity with earlier versions of the token, and so the rebuilding of the liquidity is dependent on longer-term actions instead of just seeding the launch pool with $500k worth of wETH.

What now?

AGFI V3 has already proven itself to be fully functional, and is primed to build the project into its destiny: the premier FaaS project. Now the project can turn its focus back to its core mission: decentralization and the community. The community is the power of AGFI, so now's your time to get involved! The first votes for the DAO will be for establishing new Proposal Managers and for what pieces should be added to the AGFI ecosystem next.

So follow AGFI on Twitter and join the discussion on Telegram to keep up with all the latest news and community discussions and see what's coming next!

Subscribe to Aggregated Finance

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]