Previous article review:

(AgentFi - A new concept DeFi powered by AO)

Continuing from the previous article. The entire blockchain industry is a historical evolution of scaling. Various routes are attempting to speed up and reduce costs, but each has its own ceiling. Until AO, a paradigm different from traditional blockchain emerged. Through clever design, the block space on AO is no longer a fixed supply scarce resource but a resource that can be infinitely created as needed, thus granting AO the ability to scale infinitely!

This also makes the finance model aimed at Agents—AgentFi—possible. Compared to traditional DeFi, AgentFi has a broader range of application scenarios.

Traditional DeFi protocols originated from Ethereum. Although various L2s and new high-performance public chains have emerged, people's imagination of the DeFi building paradigm has remained limited to Ethereum. Now, let us step into a platform completely free of performance constraints, reminiscent of the development stages of the internet from read-only to read-write, to algorithms, to autonomy, and reimagine what on-chain finance should look like. Does a brand new vision emerge in your mind? A vision where all users can create financial Agents, where any computational unit can become a 'financial institution,' providing customized financial services and financial equity!

Why is a standard protocol for Agents needed?

On AO computers, processes communicate through messages, and message passing follows certain standards. In financial scenarios, it is similar.

Customization is the starting point of diversification. If different types of financial Agents develop independently, they will inevitably produce different protocol standards. This leads to a major challenge: how to enable communication between Agents and facilitate their matching?

To avoid the lack of interoperability caused by the absence of a unified standard, the FusionFi Protocol (FFP) was born.

As an interaction protocol among Agents, the FusionFi Protocol defines the interaction rules between Agents, allowing various financial services created based on Agents to be interoperable and integrated. At the very beginning of AgentFi, such a protocol can be said to be quite forward-looking.

FFP (FusionFi Protocol)

FusionFi Protocol is a protocol introduced by EverVision founder outprog at the 2024 Arweave Asia conference.

The key concept in the FusionFi Protocol is the Note. It is an abstract representation model of a commitment, which can take the form of tokens, bonds, certificates, contract rights, etc. Utilizing the Note model as a medium, the FusionFi Protocol can support a rich variety of financial scenarios such as trading, lending, staking, etc.

The FusionFi Protocol not only provides a protocol specification but also offers developers a set of development tools for AgentFi (FFP SDK), helping developers create AgentFi more efficiently and simply.

Currently, the FusionFi Protocol already has two instances: AMM Agent and Orderbook Agent.

AMM Agent

Taking AMM Agents as an example, each AMM Agent can be understood as a 'personal sovereignty' liquidity pool, where the market-making rules of this liquidity pool can be self-configured. This also means that users do not need to rely on external platforms, such as a liquidity pool using a unified market-making algorithm, to autonomously implement swap functions, allowing them to find suitable counterparties across the entire network. In other words, when users create Agents, they are essentially creating their own decentralized exchanges. The FusionFi Protocol can then connect many such 'personal exchanges' into a peer-to-peer network for more efficient and flexible matching.

The following are the core processes of the AMM Agent:

It seems simple, but for LPs, it appears to be a standard process of creating deposits and then adding, exchanging, and withdrawing. The difference is that the Agent is controlled by the user themselves, and for LPs, the assets are in their hands. This is actually the capability of AgentFi itself, while FusionFi establishes a relatively unified entry point (and data structure) for this capability.

You can understand that, as an LP, all you need to do is complete deposit and withdrawal operations and call a unified entry function. The function itself can link to multiple DeFi projects, and how they interact and function thereafter can be ignored. This is the value of the protocol standard layer. It is similar to how the application layer adapts users once standards like ERC 20 are established.

Below is a specific code example for adding liquidity.

As can be seen, this functionality can be quickly implemented with just a few lines of core code.

const minLiquidity = await agent.getMinLiquidityByX(helloAmount, ammSlippageOfPercent)// Set quantity and slippage

const addLiquidityMessageId = await agent.addLiquidity(minLiquidity)// Initiate the message to add liquidity

const addLiquidityResult = await getProcessResult(addLiquidityMessageId, ammProcess)// Get result

Code example source:

https://github.com/permadao/ffp-demo

Note Lifecycle

Here, we can switch to the perspective of the Note and look at the transaction process between users and the AMM Agent.

1. When a user initiates a price inquiry request, all AMM Agents with corresponding liquidity will automatically create a quote. This quote is a Note, and its validity period is very short. If it cannot be quickly completed, the Note will expire. AMM Agents essentially act as makers.

2. All Notes will be centrally stored in the system's Note Pool, which acts as a shared storage space for easy access by other entities.

3. Users select the most suitable quote Note from the Note Pool through the front-end webpage and submit it to the Settlement Center for settlement. The Settlement Center is responsible for executing specific settlement operations, such as the swap here.

4. The Note is marked as 'settled,' and the Swap is successfully executed.

Here, the Settlement Center is a key component of the FusionFi Protocol, responsible for handling various Note settlement operations within the system.

The same applies to the Orderbook Agent. The limit order in the Orderbook Agent itself is a Note, and its settlement process is completely identical to that of the quote created by the AMM Agent. This means that the FusionFi Protocol can actually integrate liquidity from both AMM and order books.

This integration brings significant benefits. In the swap scenario, liquidity can come from user quotes as well as market-making nodes. Users can leverage routing protocols to search for liquidity throughout the Note pool, achieving the best transaction price. AMM provides foundational liquidity to the market, but it has issues of significant price impact and impermanent loss. On the other hand, the order book allows users to place their own orders, suitable for large transactions and users with specific price needs. After integration, AMM provides continuous liquidity, while the order book reduces price impact and increases depth, making large transactions more efficient. This model meets the needs of different types of users, allowing both retail and institutional participants to find suitable trading methods, thereby improving capital utilization and promoting further market maturity.

Multi-Note atomic settlement

The above example is limited to settling one Note at a time, but in reality, the FusionFi Protocol can also support settling multiple Notes at once, and this settlement is atomic. All Notes in a single settlement must be completed before the state of the Notes can be changed. Otherwise, the state of all Notes will remain unchanged.

This brings some useful features:

  • Large transaction splitting: Large orders are difficult to be fully executed by a single counterparty. FFP supports splitting large orders to fully utilize distributed liquidity.

  • Multiple transaction aggregation: Multiple transactions can be combined into a single atomic order. This can enhance transaction speed, which is crucial for high-frequency traders and complex trading scenarios.

  • Multi-hop trading: Multi-hop trading is an extension of the aggregation function. Suppose we want to complete a swap from A to C, but there is no direct path from A to C, yet a path A to B to C exists. FFP can realize the aggregation of A to B and B to C. Moreover, this multi-hop trading is atomic, meaning there won't be a situation where A to B succeeds and B to C fails.

  • Zero-fund arbitrage: This is often referred to as 'playing both ends.' Essentially, arbitrageurs take two notes that have an interest rate differential and settle them simultaneously. See the image below.

Image source: https://x.com/Permaswap/status/1854212032511512992

Permaswap is the first AgentFi DEX built on the FusionFi Protocol and is currently the most mature DEX in the AO ecosystem. Those interested can experience the aforementioned features at Permaswap (aopsn.com).

Settlement Center

Clearly, in the FusionFi Protocol, the Settlement Center is a key component. It processes all notes in chronological order; as long as the AO's SU system is functioning normally, it can obtain this chronological order. Anyone can extract notes from the note pool and submit them to the Settlement Center for settlement.

When the volume of requests for processing notes increases, the Settlement Center can also easily scale through a distributed approach, with multiple settlement processes to share and handle settlement tasks. The pressure can be calculated based on the note ID and distributed to different settlement processes for handling.

Diversified applications of Notes

The structured format of Notes defined by the FusionFi Protocol has very strong general applicability for various financial services. Therefore, the ways in which Notes can be applied are diverse. They can be used not only to represent quotes for spot trading but also for futures trading, contract trading, lending, and other scenarios. Thus, FusionFi can integrate not just liquidity but also a variety of financial forms.

Outlook

In the author's view, the essence of this internet world is multi-point transactions, so solving high-frequency trading between multiple groups has high value. The AgentFi model can cover almost all DeFi scenarios, while the FusionFi Protocol allows for more efficient peer-to-peer matching between Agents, and this matching is cross-protocol. In the DeFi field, where competition revolves around liquidity, and monopolizing liquidity is a profit model, the changes that the FusionFi Protocol can bring are disruptive!

Of course, the FusionFi Protocol is a completely new protocol standard that may still need to be continuously adjusted and optimized according to business needs. This can refer to the models of BIP (Bitcoin Improvement Proposal) and EIP (Ethereum Improvement Proposals), absorbing creativity through co-creation.

Reference materials:

1. Intelligent Finance: From AgentFi to FusionFi

https://x.com/perma_daoCN/status/1801474305597050906

2. FusionFi Protocol: Core Element for Achieving AgentFi Interoperability

https://x.com/Permaswap/status/1854212032511512992

3. FusionFi Protocol Documentation

https://github.com/zyjblockchain/ffp-doc/blob/main/doc/FusionFi Protocol Introduction.md

This article was first published on PermaDAO

Original link: https://mp.weixin.qq.com/s/r5bhvWVhoEdohbhTt_7b5A