Author: outprog
Review: 0xmiddle
Source: Content Guild - News
Originally published on Permaswap Twitter
Original link: https://x.com/Permaswap/status/1854212032511512992
Overview
Permaswap recently released an AgentFi demonstration use case based on FusionFi Protocol (FFP) on AO, adding a new case of creating an automated market maker agent (AMM Agent) and performing arbitrage operations. Through FFP, developers can create an AMM agent pool with a few lines of code to achieve asset exchange. 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 such as AgentFi and sovereign finance, and then introduce two typical Agent examples, Orderbook Agent and AMM Agent, to show how the FFP protocol integrates two different transaction processes, and then use this to illustrate the key role that FFP can play in the future financial ecosystem.
Basic Concepts
AgentFi introduces the concept of "agent" based on DeFi, allowing users to deploy their own smart contract agents (Agents) to automatically manage interactions with the protocol. Through Agents, users can autonomously and automatically perform various financial operations, such as asset management, strategy execution, etc.
Traditional DeFi protocols use smart contracts to implement operations such as asset exchange and lending, but these assets are usually locked in a single smart contract. On the one hand, users must entrust their funds to the contract, and on the other hand, users lose the flexibility to customize related functions and parameters. AgentFi breaks through this limitation, allowing each user to have an independent agent with financial functions and conduct personalized financial business through it. In other words, AgentFi allows users' agents to become independent financial entities, allowing individuals to formulate financial rules, such as asset exchange, lending agreements, and asset issuance rules, to achieve personalized financial management and break through the limitations of traditional centralization.
This is sovereign finance!
Unlike the traditional centralized system where financial rules are controlled by the central bank, sovereign finance allows users to formulate and control their own financial rules , no longer relying on a single contract or central institution provided by developers.
AgentFi's foundation: performance and flexibility
One of the reasons why traditional DeFi protocols centrally manage funds is the limitation of Ethereum performance: it cannot provide independent proxy computing power for each user. Therefore, platforms like Compound and Uniswap have optimized their code to adapt to the limitations of the blockchain. In addition, the low flexibility of traditional blockchain smart contracts makes it difficult to modify or redeploy, which limits the computing flexibility of the agent.
As a decentralized global super parallel computer, AO provides independent computing units (called processes), each of which has independent computing resources, solving performance bottlenecks. 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 AO's decentralized network, AgentFi will be widely adopted, and applications can generate several independent financial entities. For example, NPCs in the game can provide not only game services, but also financial services. For example, a pawnshop NPC can accept players' NFT mortgages and provide loan services. This NPC is an independent Agent, that is, a sovereign financial individual. All users and processes on AO can use this method to create financial agents, and any computing unit can become a "financial institution" to provide customized financial services.
If different types of financial agents develop on their own, different protocol specifications will inevitably be generated, and the interaction between agents becomes a major problem. In order to solve the interoperability problems caused by business differences, FusionFi Protocol (FFP) came into being.
FusionFi Protocol is a protocol specification and development tool that aims to connect different financial agents, build information bridges, achieve interoperability, integrate diverse financial services, and enable FFP-compatible agents to interconnect.
For users who do not have time to delve into financial details, they can also use FFP SDK to convert their Agent into an Agent with specific financial attributes. By reducing the difficulty of implementing AgentFi, FFP makes sovereign finance within reach.
Practice and interoperability
Order Book and AMM (Automated Market Maker) are two different trading mechanisms, each with significant differences in the trading process. Order Book records all buying and selling intentions through the order book. The transaction needs to wait for the price match between the buyer and the seller to be completed, so it relies on the participation of the counterparty. AMM does not rely on the counterparty. It allows users to trade directly with the assets in the pool through liquidity pools and algorithms. Liquidity providers deposit funds into the pool, and AMM uses algorithms (such as the constant product formula) to automatically adjust the price, allowing users to complete transactions without waiting for matching.
FFP can handle Orderbook and AMM transactions in a unified manner 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 FFP's orderbook demo, developers can create an orderbook agent and trade assets:
- Create Orderbook Agent: Create an orderbook agent process through the
createOrderbookProcess
function. At this time, an AO process will be deployed and the orderbook-related business logic will be loaded, making it an independent financial entity responsible for recording and managing orders. - Deposit assets: Use
deposit.js
script to deposit tokens into the orderbook agent to provide transaction funds for the order. - Create an order: Create a buy or sell order in the order book through
agent.makeOrder
method. All orders are sent to the AO network in a specific FFP Schema . After that, the order will be transparently displayed in the blockchain network in a specific format and wait for matching. - Take orders: Use
agent.takeOrder
method to take orders. The system automatically completes the transaction and updates the assets.
Automated Market Maker Agent (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 independently provide asset exchange functions without relying on centralized platforms or traditional exchanges. The following is the core process of AMM Agent:
- Create AMM Agent: Create an AMM Agent process through the
createAMMProcess
function and deploy it as a user-controlled AO process, making it a personal financial entity with liquidity management capabilities. - Depositing assets: Users deposit tokens into the AMM Agent to inject funds into the liquidity pool to support trading needs.
- Add liquidity: Call the
agent.addLiquidity
method, and the deposited assets can be added to the liquidity pool. Users can set the pricing and exchange ratio of the assets in the pool through smart contracts. - Automatic exchange: 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 who requested the transaction in a specific FFP Schema .
- Remove liquidity: When a user wants 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 in liquidity management and can provide asset exchange services without a counterparty, thereby establishing a personalized decentralized trading environment.
It can be considered that when a user creates an Agent (whether it is an AMM Agent or an Orderbook Agent), they are actually creating a decentralized exchange with personal sovereignty. AgentFi completely breaks the traditional concept of an exchange, allowing users to trade without relying on a specific platform. By setting up Agents with specific functions and smart contract rules, users can independently provide a "place" for exchange and realize personalized financial services. The process of creating an Agent only requires one line of code.
Interoperability
FFP Schema is a structured format used in FusionFi Protocol (FFP) to standardize transaction and settlement data. It defines the data format and communication protocol in different transaction processes (such as Orderbook and AMM), ensuring smooth intercommunication and compatibility between different types of financial agents (Agents). This unified data format enables key data such as price, order status, asset information, etc. in the transaction process to be shared and parsed between various Agents.
In the fourth step of the Orderbook Agent and AMM Agent, both the Orderbook order and the AMM request adopt the unified FFP Schema format to achieve a consistent settlement data structure. The FFP Schema standardizes interoperability across agents:
- Arbitrageurs can query Orderbook orders directly on the chain, compare the quotes of Orderbook and AMM through FFP Schema, and find the price difference.
- Arbitrageurs only need to submit transaction data in a unified format to the FFP settlement process to achieve atomic transactions across agents. The FFP specification ensures that multiple hedging orders are either completed or failed, avoiding the risk of inconsistent transactions.
In the FFP case, the different transaction processes of Orderbook and AMM are interconnected. FFP breaks the boundary between the two types of businesses and achieves synergy and integration between them.
characteristic
FFP supports atomic settlement of multiple transactions and provides the following advanced features for DEX built on FFP:
- Large transaction 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 large orders to be split into multiple small orders and executed between different agents to obtain the best price in the network.
- Multiple transaction consolidation : Scattered orders in the market can be merged into one atomic order, enhancing the interoperability of Orderbook and AMM, which makes trading more flexible.
- Multi-hop transaction : Multi-hop transaction is an extended application of the order consolidation function. For example, if a trader wants to exchange asset A for C, and there is no AC trading pair in the market, but there are AB and BC trading pairs, FFP can merge the two transactions of AB and BC into one order to achieve the transaction 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 own funds. Arbitrageurs only need to submit two orders to the settlement process, and the system will automatically complete the asset exchange and distribute the spread income to the arbitrageurs.
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 circulation of value.
prospect
In short, FFP provides a unified framework for financial agents, breaking down the barriers between different financial scenarios. Not only Orderbook and AMM, but also through FFP, in the future, it will be possible to achieve seamless integration of various financial businesses such as loans, futures, and synthetic assets, and build a cross-application, cross-scenario decentralized financial ecosystem.
Through a unified 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 popularization of true sovereign finance and personalized financial services.