FusionFi Protocol: The core bridge for building AgentFi interoperability

This article is machine translated
Show original

Source: PermaDAO

Overview

Permaswap recently released a demo use case of AgentFi based on the FusionFi Protocol (FFP) on AO, adding a new case of creating an Automated Market Maker (AMM) Agent and conducting arbitrage operations. Through FFP, developers can create AMM agent pools and realize asset exchange with just a few lines of code. As a standard protocol on the AO network, FFP provides interoperability support for different types of Agents.

This article will first sort out the core concepts of AgentFi and Sovereign Finance, then introduce two typical Agent examples, Orderbook Agent and AMM Agent, and demonstrate how the FFP protocol integrates the two different trading processes, and then elaborate on the key role that FFP can play in the future financial ecosystem.

UCkAA2x0yiZ9UjEP4XBmXjtY7Iu6L0kOm8ITEqKe.jpeg

Basic Concepts

AgentFi introduces the concept of "agent" on the basis of DeFi, allowing users to deploy their own smart contract agents (Agents), thereby automatically managing their interactions with protocols. Through Agents, users can independently and automatically perform various financial operations, such as asset management and strategy execution.

Traditional DeFi protocols use smart contracts to implement operations such as asset exchange and lending, but these assets are usually concentrated and locked in a single smart contract, which on the one hand requires users to entrust their funds to the contract, and on the other hand also deprives users of the flexibility to customize related functions and parameters. AgentFi breaks through this limitation, allowing each user to have an independent agent (Agent) with financial functions, and to carry out personalized financial business through it. That is to say, AgentFi makes the user's agent an independent financial entity, allowing individuals to formulate financial rules, such as asset exchange, lending protocols and asset issuance rules, to achieve personalized financial management, breaking through the limitations of traditional centralization.

This is Sovereign Finance!

Unlike the traditional centralized system controlled by central banks, Sovereign Finance allows users to formulate and control financial rules themselves, no longer relying on the single contract or central institution provided by the developer.

The Foundation of AgentFi: Performance and Flexibility

One of the reasons why traditional DeFi protocols centrally manage funds is the performance limitation of Ethereum: it cannot provide independent agent computing capabilities for each user. Therefore, platforms like Compound and Uniswap have optimized their code to adapt to the limitations of the blockchain. In addition, the flexibility of traditional blockchain smart contracts is low, making it difficult to modify or redeploy, which limits the computing flexibility of agents.

As a decentralized global super-parallel computer, AO provides independent computing units (called processes), each with independent computing resources, solving the performance bottleneck. At the same time, the contract code running in the process is controlled by the process owner, and can be flexibly updated and upgraded, providing a solid foundation for the flexibility of AgentFi.

FusionFi Protocol

In the decentralized network of AO, AgentFi will be widely adopted, and applications can generate multiple independent financial entities. For example, NPCs in games can not only provide game services, but also provide financial services. For instance, a pawnshop NPC can accept players' Non-Fungible Tokens as collateral and provide loan services, and this NPC is an independent Agent, a sovereign financial entity. All users and processes on AO can create financial Agents in this way, and any computing unit can become a "financial institution" to provide customized financial services.

If different types of financial Agents develop independently, different protocol specifications will inevitably emerge, and the interaction between Agents becomes a major challenge. To solve the interoperability problem caused by business differences, the FusionFi Protocol (FFP) was born.

FusionFi Protocol is a protocol specification and development tool, aiming to connect different financial Agents, build information bridges, achieve interoperability, and integrate diversified financial businesses, so that compatible FFP Agents can interconnect.

For users who do not have the time to delve into financial details, they can also use the FFP SDK to convert their Agents into Agents with specific financial attributes. By reducing the difficulty of implementing AgentFi, FFP makes Sovereign Finance accessible.

Practice and Interoperability

Order Book and Automated Market Maker (AMM) are two different trading mechanisms, with significant differences in their trading processes. Order Book records all buy and sell intentions in the order book, and transactions need to wait for the prices of the buyer and seller to match before they can be completed, so they rely on the participation of counterparties. AMM, on the other hand, does not rely on counterparties. It uses liquidity pools and algorithms to allow users to directly trade with the assets in the pool. Liquidity providers deposit funds into the pool, and the AMM uses algorithms (such as the constant product formula) to automatically adjust prices, allowing users to complete transactions without the need for matching and waiting.

FFP can process the transactions of Order Book and AMM in a unified way and process, thereby integrating the liquidity of the two.

Please refer to the following demo code: https://github.com/permadao/ffp-demo

Orderbook Agent

In the orderbook demo of FFP, developers can create an Orderbook Agent and conduct asset trading:

  1. Create Orderbook Agent: Create an orderbook agent process through the createOrderbookProcess function, which will deploy an AO process and load the business logic related to the orderbook, making it an independent financial entity responsible for recording and managing orders.

  2. Deposit Assets: Use the deposit.js script to deposit tokens into the orderbook agent, providing trading funds for the orders.

  3. Create Orders: Create buy or sell orders in the order book through the agent.makeOrder method, and all orders will be sent to the AO network in a specific FFP Schema format, after which the orders will be transparently displayed on the blockchain network in a specific format and wait for matching.

  4. Take Orders: Use the agent.takeOrder method to take orders and complete the transaction, and the system will automatically complete the transaction and update the assets.

HnhVOwfiMa5nwL6IjQF2uLeiJo3RwGRNN1ffAoqE.jpeg

AMM Agent

In the AMM Agent demo, the Agent created by the user is equivalent to a personally sovereign liquidity pool. Through AgentFi, users can independently provide asset exchange functions without relying on centralized platforms or traditional exchanges. The core process of the AMM Agent is as follows:

  1. Create AMM Agent: Create an AMM Agent process through the createAMMProcess function, deploy it as a user-controlled AO process, making it a personal financial entity with liquidity management functions.

  2. Deposit Assets: Users deposit tokens into the AMM Agent, injecting funds to support the liquidity pool and support trading needs.

  3. Add Liquidity: Call the agent.addLiquidity method to add the deposited assets to the liquidity pool, and users can set the pricing and exchange ratio of the assets in the pool through smart contracts.

  4. Automatic Exchange: The AMM Agent uses algorithms (such as the constant product formula) to automatically calculate the exchange price, and the price result will be returned to the user requesting the transaction in a specific FFP Schema.

  5. Remove Liquidity: When users want to withdraw funds, they can use the agent.removeLiquidity method to remove the liquidity in the pool and withdraw the assets.

By creating an AMM Agent, users have complete autonomous liquidity management rights and can provide asset exchange services without counterparties, thereby establishing a personalized decentralized trading environment.

AVCAufYS04QFP45KD7gU2je2ANUHlwAKiseWvDNx.jpeg

It can be considered that when users create Agents (whether AMM Agents or Orderbook Agents), they are actually creating a personally sovereign decentralized exchange. AgentFi completely breaks the traditional concept of exchanges, allowing users to trade without relying on specific platforms. By setting Agents with specific functions and smart contract rules, users can independently provide the "venue" for exchange, realizing personalized financial services. And the process of creating an Agent only requires a single line of code.

Interoperability

The FFP Schema is a structured format for standardizing transaction and settlement data in the FusionFi Protocol (FFP). It defines the data format and communication protocols for different transaction processes (such as Orderbook and AMM), ensuring smooth interoperability and compatibility between different types of financial agents (Agents). This unified data format allows key data such as prices, order status, and asset information to be shared and parsed among various Agents during the transaction process.

In the fourth step of the Orderbook Agent and AMM Agent, both Orderbook orders and AMM requests adopt the unified FFP Schema format, achieving a consistent settlement data structure. The FFP Schema standardizes interoperability across Agents:

  • Arbitrageurs can directly query Orderbook orders on-chain, compare the quotes of Orderbook and AMM through the FFP Schema, and discover price differences.

  • Arbitrageurs only need to submit the transaction data in a unified format to the FFP settlement process to achieve atomic transactions across Agents. The FFP specification will ensure that multiple hedging orders are either all completed or all failed, avoiding the risk of inconsistent transactions.

In the FFP case, the different transaction processes of Orderbook and AMM achieve interoperability, and FFP breaks the boundaries of the two business types, realizing their collaboration and integration.

Features

FFP supports atomic settlement of multiple transactions and provides the following advanced features for DEXs built on FFP:

  • Large order splitting: Traders can split large orders into multiple small orders. For example, a trader needs to complete a $1 million transaction, but a single Agent may not be able to provide the best quote. FFP allows the large order to be split into multiple small orders and executed across different Agents to obtain the optimal price in the network.

  • Order aggregation: Scattered orders in the market can be aggregated into a single atomic order, enhancing the interoperability of Orderbook and AMM, making transactions more flexible.

  • Multi-hop trading: Multi-hop trading is an extended application of the order aggregation function. For example, if a trader wants to exchange asset A for C, but there is no A-C trading pair in the market, but there are A-B and B-C trading pairs, FFP can combine the A-B and B-C transactions into a single order to achieve the trading purpose.

  • Zero-capital arbitrage: Arbitrageurs can profit from the price difference between two hedging orders in the market. Unlike traditional arbitrage schemes, FFP's zero-capital arbitrage does not require the arbitrageur's own funds. The arbitrageur only needs to submit the two orders to the settlement process, and the system will automatically complete the asset exchange and distribute the profit difference to the arbitrageur.

RdFrHXXh4mlgZsQyhRXtrhZ5PrTAoK1XHGgafgE8.jpeg

These innovative features brought by FFP not only simplify the user's trading experience and ensure the best price, but also improve the capital efficiency of arbitrageurs and ensure the efficient flow of value.

Prospects

In summary, FFP provides a unified framework for financial agents (Agents), breaking down the barriers between different financial scenarios. Not only Orderbook and AMM, through FFP, in the future, various financial services such as lending, futures, and synthetic assets can be seamlessly integrated to build a cross-application, cross-scenario decentralized finance ecosystem.

By unifying the data structure (FFP Schema), FFP simplifies communication and settlement between agents, improving the flexibility and efficiency of transactions. As more types of financial Agents emerge, FFP is expected to become the core protocol of the AgentFi ecosystem on AO, promoting the widespread adoption of sovereign finance and personalized financial services.

Source
Disclaimer: The content above is only the author's opinion which does not represent any position of Followin, and is not intended as, and shall not be understood or construed as, investment advice from Followin.
Like
Add to Favorites
Comments