FusionFi Protocol: Building the Core Bridge for AgentFi Interoperability

PermaDAO
2024-12-05 10:13:53
Collection
FusionFi Protocol serves as the core bridge for AgentFi interoperability, connecting various financial agents through standardized protocols, simplifying transaction processes, and enabling seamless asset management and innovative arbitrage mechanisms.

Overview

Permaswap recently released a demonstration case of AgentFi based on the FusionFi Protocol (FFP) on AO, introducing a case for creating automated market maker agents (AMM Agents) and conducting arbitrage operations. Through FFP, developers can create AMM agent pools with just a few lines of code to facilitate asset exchanges. FFP serves as the standard protocol on the AO network, providing interoperability support for different types of agents.

This article will first clarify core concepts such as AgentFi and sovereign finance, followed by an introduction to two typical agent examples: Orderbook Agent and AMM Agent, demonstrating how the FFP protocol integrates two different trading processes, thereby elucidating the key role FFP can play in the future financial ecosystem.

Basic Concepts

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

Traditional DeFi protocols use smart contracts to perform operations like asset exchanges and lending, but these assets are usually locked in a single smart contract, which means users must entrust their funds to the contract and lose the flexibility to customize related functions and parameters. AgentFi breaks through this limitation, enabling each user to have an independent agent with financial functions and conduct personalized financial operations through it. In other words, AgentFi allows users' agents to become independent financial entities, enabling individuals to set financial rules, such as asset exchange, lending agreements, and asset issuance rules, achieving personalized financial management and breaking the constraints of traditional centralization.

This is sovereign finance!

Unlike the traditional centralized system where financial rules are controlled by central banks, sovereign finance allows users to set and control financial rules themselves, no longer relying on a single contract or central institution provided by developers.

The Foundation of AgentFi: Performance and Flexibility

One reason traditional DeFi protocols manage funds centrally is due to the performance limitations of Ethereum: it cannot provide independent computational capabilities for each user. Therefore, platforms like Compound and Uniswap have optimized their code to adapt to the limitations of the blockchain. Additionally, traditional blockchain smart contracts have low flexibility, making them difficult to modify or redeploy, which restricts the computational flexibility of agents.

AO, as a decentralized global super-parallel computer, provides independent computing units (called processes), each with its own computing resources, solving the performance bottleneck. Meanwhile, the contract code running in the process is controlled by the process owner, allowing for flexible updates and upgrades, providing a solid foundation for the flexibility of AgentFi.

FusionFi Protocol

In AO's decentralized network, AgentFi will be widely adopted, allowing for the generation of several independent financial entities. For example, NPCs in games can not only provide gaming services but also financial services. For instance, a pawn shop NPC can accept players' NFT collateral and provide loan services; this NPC is an independent agent, i.e., a sovereign financial entity. All users and processes on AO can create financial agents in this way, allowing any computing unit to become a "financial institution" providing customized financial services.

If different types of financial agents develop independently, it will inevitably lead to different protocol standards, making interaction between agents a significant challenge. To address the interoperability issues arising from business differences, the FusionFi Protocol (FFP) was born.

FusionFi Protocol is a protocol specification and development tool designed to connect different financial agents, build information bridges, achieve interoperability, and integrate diverse financial operations, allowing FFP-compatible agents to 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 lowering the implementation difficulty of AgentFi, FFP makes sovereign finance accessible.

Practice and Interoperability

Order Book (Orderbook) and AMM (Automated Market Maker) are two different trading mechanisms, each with significant differences in trading processes. Order Book records all buying and selling intentions through an order book, and trades must wait for price matching between buyers and sellers, thus relying on counterparties' participation. AMM, on the other hand, does not depend on counterparties. It allows users to trade directly with assets in the liquidity pool through algorithms. Liquidity providers deposit funds into the pool, and AMM uses algorithms (such as the constant product formula) to automatically adjust prices, enabling users to complete trades without waiting for matching.

FFP can handle Orderbook and AMM transactions in a unified manner and process, thereby merging the liquidity of both.

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

Orderbook Agent

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

  1. Create Orderbook Agent: Use the createOrderbookProcess function to create an orderbook agent process, which will deploy an AO process and load the orderbook-related business logic, 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 orders.
  3. Create Orders: Use the agent.makeOrder method to create buy or sell orders in the order book, with all orders sent to the AO network in a specific FFP Schema, after which the orders will be transparently displayed in a specific format on the blockchain network and await matching.
  4. Take Orders: Use the agent.takeOrder method to fill orders, with the system automatically completing the transaction and updating assets.

AMM Agent

In the AMM Agent demo, the agent created by the user is equivalent to a personal sovereign liquidity pool. Through AgentFi, users can autonomously 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: Use the createAMMProcess function to create an AMM Agent process, deploying it as a user-controlled AO process, making it a personal financial entity with liquidity management capabilities.
  2. Deposit Assets: Users deposit tokens into the AMM Agent, injecting funds into the liquidity pool to support trading needs.
  3. Add Liquidity: Call the agent.addLiquidity method to add deposited assets to the liquidity pool, allowing users to set pricing and exchange ratios for assets in the pool through smart contracts.
  4. Automatic Exchange: The AMM Agent uses algorithms (such as the constant product formula) to automatically calculate exchange prices, with the price results returned to the requesting user in a specific FFP Schema.
  5. Remove Liquidity: When users want to withdraw funds, they can use the agent.removeLiquidity method to remove liquidity from the pool and withdraw assets.

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

It can be considered that when users create an agent (whether it is an AMM Agent or an Orderbook Agent), they are essentially creating a personal sovereign decentralized exchange. AgentFi completely breaks the traditional concept of exchanges, allowing users to trade without relying on specific platforms. By setting up agents with specific functions and smart contract rules, users can autonomously provide a "venue" for exchanges, achieving personalized financial services. Moreover, the process of creating an agent only requires a single line of code.

Interoperability

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

In the fourth step of both the Orderbook Agent and AMM Agent, the Orderbook orders and AMM requests both 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, comparing Orderbook and AMM quotes through the FFP Schema to identify price discrepancies.
  • Arbitrageurs only need to submit uniformly formatted trading data to the FFP settlement process to achieve atomic transactions across agents; the FFP specification ensures that multiple hedging orders either complete entirely or fail entirely, avoiding the risk of transaction inconsistency.

In the FFP case, the different trading processes of Orderbook and AMM achieve interoperability, breaking the boundaries between the two types of businesses and realizing their collaboration and integration.

Features

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

  • Large Order Splitting: Traders can split large orders into multiple smaller orders. For example, if a trader needs to complete a $1 million transaction, a single agent may struggle to provide the best quote. FFP allows large orders to be split into smaller orders executed across different agents to obtain the best prices in the network.
  • Multiple Transactions Consolidation: Fragmented orders in the market can be merged into a single atomic order, enhancing the interoperability between Orderbook and AMM, making trading more flexible.
  • Multi-hop Trading: Multi-hop trading is an extended application of the consolidation feature. For instance, if a trader wants to exchange asset A for C, but there is no A-C trading pair in the market, yet 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 goal.
  • Zero Capital Arbitrage: Arbitrageurs can profit from the price differences between two hedging orders in the market. Unlike traditional arbitrage schemes, FFP's zero capital arbitrage does not require personal funds; arbitrageurs only need to submit the two orders to the settlement process, and the system will automatically complete the asset exchange and distribute the profit to the arbitrageurs.

These innovative features brought by FFP not only simplify the trading experience for users, ensuring optimal prices but also enhance the capital efficiency of arbitrageurs, safeguarding the efficient circulation of value.

Prospects

In summary, FFP provides a unified framework for financial agents, breaking down barriers between different financial scenarios. Not only Orderbook and AMM, but through FFP, seamless integration of various financial operations such as lending, futures, synthetic assets, etc., can be achieved in the future, constructing a decentralized financial ecosystem that spans applications and scenarios.

By standardizing the data structure (FFP Schema), FFP simplifies communication and settlement between agents, enhancing the flexibility and efficiency of trading. 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 true sovereign finance and personalized financial services.

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
banner
ChainCatcher Building the Web3 world with innovators