On-chain derivative transaction system based on token liquidity pool and dynamic liquidation algorithm

Through the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm, problems such as limited types and scale of liquidity pool assets and leverage operations being restricted by pool depth have been solved. It has achieved unlimited liquidity expansion, self-balancing risks and zero-friction liquidation, and improved the robustness of on-chain derivatives trading and user experience.

CN120707133APending Publication Date: 2025-09-26WUHAN LANGYI INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510789520.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In on-chain derivatives trading, the types and scale of liquidity pool assets are limited, leverage operations are constrained by pool depth, liquidity providers bear unhedged market beta risk, the automated market maker mechanism leads to large transaction slippage, and oracle delays cause liquidation deviations, resulting in poor system robustness and user experience.

Method used

It adopts a tokenized liquidity pool and a dynamic liquidation algorithm. By converting the assets deposited by users into liquidity share tokens, combined with oracle price feedback, leveraged trading engine, dynamic liquidation module and funding rate balance module, it realizes the integration of liquidity pool and margin pool. It adopts an 'asset-transaction' separation model, and casts or destroys share tokens in real time for liquidation, dynamically adjusting market supply and demand.

Benefits of technology

It achieves unlimited liquidity expansion, self-balancing risks, resilience against extreme market conditions and zero-friction clearing, supports trading of any asset, reduces transaction costs and system risks, and improves system robustness and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120707133A_ABST
    Figure CN120707133A_ABST
Patent Text Reader

Abstract

The invention discloses an on-chain derivative transaction system based on a token liquidation pool and a dynamic liquidation algorithm, and relates to the technical field of on-chain derivative transaction. Comprising a mobility pool token coin module, an oracle machine price feedback module, a lever transaction engine module, a dynamic clearing module, a fund rate balance module, a mobility incentive distribution module and a mobility management module. The mobility pool token conversion module is used for converting the cash deposit stored by the investment transaction user and the assets injected by the mobility provider user into share tokens, and the investment transaction user needs to convert the cash deposit into mobility share tokens and carries out investment transaction by using the tokens; the oracle machine price feedback module is connected with the mobility pool token coin module and is used for acquiring an external market price index through a decentralized oracle machine and inputting real-time price data into an intelligent contract; and the lever transaction engine module is respectively connected with the mobility pool token coin module and the oracle machine price feedback module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of on-chain derivatives trading technology, and in particular to an on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm. Background Art

[0002] On-chain derivatives trading refers to the trading of financial derivatives products on blockchain platforms. These derivatives can be futures, options, swaps, and other products. Unlike traditional financial markets, on-chain derivatives trading relies on smart contracts to automatically execute transaction terms, reducing human intervention and improving transparency and efficiency. Furthermore, it allows participants anywhere in the world to trade directly without going through centralized financial institutions, significantly lowering the barrier to entry and providing users with a new way to allocate assets. Therefore, how to leverage advanced technologies to enhance the intelligence and security of on-chain derivatives trading has become a pressing issue.

[0003] In the field of on-chain derivatives trading, in traditional DeFi derivatives trading (decentralized exchanges), there are the following prominent pain points:

[0004] Liquidity pools are limited in both asset types and size (for example, the mainstream platform GMX only supports four trading pairs), resulting in maximum opening positions being constrained by pool depth. When users attempt high leverage (>50x), pool assets are insufficient to cover potential losses. This structural flaw can lead to liquidity depletion in extreme market conditions, creating a death spiral. When prices fluctuate drastically, a run on liquidity providers (LPs) accelerates system collapse. A prime example is the Terra UST decoupling incident in May 2022, which saw DEX liquidity shrink by over 40% in a single day.

[0005] Passive matching mechanisms that rely on oracle price feeds are ill-equipped to withstand unilateral market shocks. When the long-short position ratio is severely imbalanced (e.g., 90% of users are concentrated in long positions), liquidity pools, acting as rigid counterparties, are subject to significant losses. For example, during the Silicon Valley Bank crisis in March 2023, BTC long positions on the decentralized perpetual swap platform dYdX reached 82%, resulting in an average weekly loss rate of 15.7% for LPs (data source: TokenInsight Q1 / 2023 report). This type of asymmetric risk significantly reduces system robustness.

[0006] Existing DEXs require limited partners to provide specific asset portfolios (such as GMX's BTC / ETH / stablecoin basket), making them incompatible with emerging asset classes. This prevents long-tail assets (such as RWA tokens and NFT indices) from gaining on-chain derivatives support, hindering financial innovation. According to Dune Analytics, only 12% of newly issued assets in Q1 2023 were traded on major DEXs, a stark contrast to the asset coverage of traditional financial markets.

[0007] Liquidity providers (LPs) bear unhedged market beta risk.

[0008] Automated market maker (AMM) mechanisms can cause slippage exceeding 1% for large trades (measured data from Uniswap V3), and on-chain price delays can lead to liquidation bias. Typical examples include the December 2021 ETH flash crash (a 22% drop in 5 minutes) and the delayed Chainlink oracle update that resulted in 42% of stop-loss orders being invalidated (Chainalysis incident report). These execution risks pose a major obstacle to user experience. Summary of the Invention

[0009] In view of the above existing problems, the present invention is proposed.

[0010] This invention provides an on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm. It creatively integrates the liquidity pool and the margin pool into one design, and adopts an "asset-transaction" separation model. Transactions use liquidity tokens as the medium, and transaction profits and losses are liquidated through the minting of liquidity tokens.

[0011] In order to solve the above-mentioned industry technical problems, the present invention provides the following technical solutions:

[0012] In a first aspect, the present invention provides an on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm, comprising:

[0013] Liquidity pool tokenization module, oracle price feedback module, leverage trading engine module, dynamic liquidation module, funding rate balance module, liquidity incentive allocation module and liquidity management module;

[0014] The liquidity pool tokenization module is used to convert the margin deposited by investment trading users and the assets injected by liquidity provider users into share tokens. Investment trading users need to convert their margin into liquidity share tokens first and then use these tokens to conduct investment transactions;

[0015] The oracle price feedback module is connected to the liquidity pool tokenization module and is used to obtain external market price indices through decentralized oracles and input real-time price data into smart contracts;

[0016] The leveraged trading engine module is connected to the liquidity pool tokenization module and the oracle price feedback module respectively, and is used to open derivative contract positions based on the leverage multiple and direction selected by the user, using the "asset-transaction" separation model and using share tokens as collateral;

[0017] The dynamic liquidation module is connected to the oracle price feedback module and the leveraged trading engine module respectively, and is used to settle the trader's profit and loss in real time by minting or destroying share tokens according to the oracle price changes, and update the total supply of tokens in the pool to complete real-time on-chain liquidation;

[0018] The funding rate balancing module is connected to the dynamic liquidation module and is used to charge fees to the advantaged party and distribute them to the disadvantaged party based on time when there is an imbalance in long and short positions, thereby dynamically adjusting market supply and demand;

[0019] The liquidity incentive allocation module is connected to the dynamic liquidation module and is used to distribute the platform transaction fee ρ to the share token holders in real time, directly increasing the token price;

[0020] The liquidity management module is connected to the dynamic liquidation module and the liquidity pool tokenization module respectively, and is used to exchange the original assets at the current share token price when the investment users and liquidity providing users exit liquidity and close their positions.

[0021] As a preferred solution of the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, the steps of converting the user deposited margin and the assets injected by the liquidity provider into share tokens are as follows:

[0022] The address and amount of the original assets from the user are verified through the on-chain smart contract to ensure that the assets have been successfully transferred to the liquidity pool contract account and record their initial value;

[0023] Read the current total net value V from the liquidity pool status t and the current total amount of tokens S t , used to calculate the number of tokens minted corresponding to the newly added assets;

[0024] The initial price of the share token is: 1 token = 1 USDT. The expression for calculating the share token price is:

[0025]

[0026] Among them, V t = The sum of the prices of all assets added to the liquidity pool according to the oracle, in USDT, i.e. V tRefers to the total value of all assets in the liquidity pool converted into USDT based on the market price obtained by the decentralized oracle;

[0027] Calculate the number of share tokens that should be minted. The expression is:

[0028]

[0029] Among them, s is the number of share tokens that should be minted to the user, A i V is the value of the assets deposited by the user this time, t is the total net value of the current liquidity pool, S t is the total amount of share tokens currently in circulation;

[0030] Based on the calculated s value, call the ERC-20 standard interface function to mint the corresponding number of share tokens to the user address;

[0031] Deposit the user into asset value A i Added to the total net asset value V of the liquidity pool t+1 =V t +A i , and update the total supply of tokens S t+1 =S t +s, and write the new state to the on-chain storage.

[0032] As a preferred solution for the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, wherein: the external market price index is obtained through a decentralized oracle and the real-time price data is input into the smart contract. The specific steps are as follows:

[0033] Use the oracle call interface function preset in the smart contract to initiate a price index request for the target asset to the decentralized oracle network;

[0034] The oracle node obtains the latest transaction price at the current timestamp from multiple exchanges or data sources to form an original quotation set

[0035] Calculate the weighted median price P wmed , the expression is:

[0036]

[0037] Among them, P wmed is the weighted median price, p i is the original quote of the ith exchange, σ p is the standard deviation of all quotes, which is used to measure the volatility of quotes. p >η% when liquidation is suspended, η is the safety threshold set by the system, ∈ is a very small positive number to prevent division by zero errors;

[0038] Introducing a time decay factor To reflect the impact of data freshness, the aggregated price is adjusted by the time decay factor to obtain the final on-chain price, which is expressed as:

[0039]

[0040] Where t is the current timestamp, t0 is the quote generation timestamp, and λ is the decay rate constant;

[0041] The processed real market price is written into the on-chain storage variable for the leverage trading engine and subsequent components of the dynamic liquidation module to call.

[0042] As a preferred solution for the on-chain derivatives trading system with a tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, the following steps are used to open a derivatives contract position using share tokens as collateral based on the user's selected leverage ratio and direction:

[0043] Receive transaction instructions initiated by users through the smart contract interface function, check the balance of the user account to ensure that they hold sufficient tokens and are not locked by other transactions;

[0044] The nominal position value is calculated based on the leverage selected by the user. The expression is:

[0045] Position Size = Margin L;

[0046] Among them, Position Size is the nominal number of tokens in the position, the unit is tokens, Margin is the actual number of tokens pledged by the user, the unit is tokens, and L is the leverage multiple selected by the user;

[0047] Create a structure inside the smart contract to store information;

[0048] The information includes user address, transaction direction, position notional value, collateral value, position opening timestamp, and preset liquidation threshold;

[0049] Transfer the user-specified share tokens to the contract escrow account and set a lock-up period until the position is closed or liquidated.

[0050] As a preferred solution for the on-chain derivatives trading system with a tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, the following steps are used to settle traders’ profits and losses in real time by minting or destroying token shares based on oracle price changes, and to update the total supply of tokens in the pool:

[0051] Read the latest on-chain price of the underlying asset corresponding to the user's position from the smart contract, as well as the historical price recorded at the time the position was opened;

[0052] Calculate the price change ratio of the user's position. The expression is:

[0053]

[0054] Where r represents the rate of change of the underlying asset price relative to the time of opening the position. If r>0, it means the price has risen, and if r<0, it means the price has fallen.

[0055] According to the user's transaction direction d∈{1,0} and leverage L, the user's actual profit and loss ratio is calculated as follows:

[0056] g=d·L·r+(1-d)·(-L)·r;

[0057] Where d=1 indicates long, d=0 indicates short, and g is the actual profit / loss ratio of the user's position. When the user goes long, the profit is magnified by L times as the price rises, and when the user goes short, the profit is magnified by L times as the price falls.

[0058] Adjust the value of the user's mortgage assets according to the profit and loss ratio g. The expression is:

[0059] Margin'=Margin·(1+g);

[0060] Among them, Margin is the original number of mortgage tokens, and Margin' is the effective number of tokens after transaction adjustment. If g>0, it means profit, and the user's equity will be increased by minting new share tokens. If g<0, it means loss, and the user's equity will be reduced by destroying some share tokens.

[0061] Calculate the number of share tokens to be minted or destroyed. The expression is:

[0062] Δs=Margin′-Margin;

[0063] Δs>0 means that new share tokens should be minted, Δs<0 means that some share tokens should be destroyed. If Δs=0, no operation is performed;

[0064] Δs for all users i The sum of the net profits and losses of traders in the entire system is ∑(Δs i ), perform corresponding operations based on the positive or negative sign of this sum, and update the status of the liquidity pool, including:

[0065] Update the total net value V in the liquidity pool t ;

[0066] Update total token supply S t+1 =S t +∑(Δs i );

[0067] Among them, V t is the current pool net value, S t is the total amount of share tokens currently in circulation. The newly added net value comes from the redistribution of user profits and losses. Δs i The number of share tokens that need to be minted or destroyed by the i-th user.

[0068] As a preferred solution for the on-chain derivatives trading system with a tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, when the long-short position is unbalanced, funding fees are charged to the advantaged party over time and distributed to the disadvantaged party, dynamically adjusting market supply and demand. The specific steps are as follows:

[0069] By traversing the mapping table stored in the smart contract, the total notional value of the long direction and the total notional value of the short direction are calculated respectively, where:

[0070] Represents the sum of the notional values ​​of all long positions;

[0071] Represents the sum of the notional values ​​of all short positions;

[0072] Calculate the long-short ratio using the following expression:

[0073]

[0074] Among them, is the long-short imbalance index, ∈ is a very small positive number used to prevent division by zero errors;

[0075] When Skew ≥ 1, it indicates an asymmetry between long and short forces. When Skew = 1, the market is in a completely balanced state. Skew > 1 indicates that there is a dominant position. The larger the value, the more serious the imbalance.

[0076] The basic funding rate is calculated based on the long-short ratio Skew. The expression is:

[0077] f0=k·(Skew-1);

[0078] Where f0 is the basic funding rate, and k is the sensitivity adjustment coefficient;

[0079] The actual funding rate within a unit period is adjusted according to the time interval Δt. The expression is:

[0080]

[0081] Among them, T bis the benchmark settlement period, Δt is the time difference since the last settlement, and the final funding rate is calculated using a time-weighted approach to ensure fair and consistent fees.

[0082] If N long >N short , then the long side is the dominant position holder and the funding rate f is charged to it. The collected funds will be evenly distributed to all short position holders;

[0083] Otherwise, the short seller will be considered as holding a dominant position and will be charged a funding rate of f. The collected funds will be evenly distributed among all long position holders.

[0084] For each user holding a position in the advantageous direction, the expression for deducting funding fees from their collateral assets is:

[0085]

[0086] Position Size is the nominal number of tokens in the position, and Funding Fee is the funding fee. Both are expressed in tokens. The Funding Fee token value is deducted from each user holding a favorable position, and ω% of the corresponding tokens are returned to the account of the user holding the disadvantaged position in real time. The remaining 1-ω% of the fee is transferred to the platform account as platform operating expenses.

[0087] The funding cost allocation expression is:

[0088] F dist =ω%·Funding Fee

[0089] Destroying this portion of tokens in real time during each transaction settlement is a disguised way of increasing token prices, which is equivalent to allocating incentive funds to all liquidity providers.

[0090] Calculate the number of share tokens to be destroyed Δs destroy , the expression is:

[0091] Δs destroy =F bist ;

[0092] Destroy Δs in real time through the smart contract interface function destroy Number of share tokens;

[0093] Update total token supply S t+1 =S t -Δs destroy , and adjust the total net value V of the liquidity pool accordingly t ;

[0094] As a preferred solution for the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, wherein: the platform transaction fee ρ is distributed to the share token holders in real time to directly increase the token price. The specific steps are as follows:

[0095] Every time a user opens, closes, or adjusts a position, ρ is extracted from the transaction fee as an incentive fund.

[0096] The total handling fee ρ is automatically extracted at the time of each transaction settlement through the smart contract interface function. The expression is:

[0097] F dist =ρ·f total ;

[0098] Among them, f total The total transaction fee generated by this transaction, the unit of which is tokens, used to pay the transaction fee with tokens, F dist It is the incentive fund allocated to share token holders, and its unit is also tokens;

[0099] The portion of tokens is destroyed in real time during each transaction settlement, which is a disguised increase, equivalent to allocating incentive funds to all liquidity providers;

[0100] Calculate the number of share tokens to be destroyed Δs destroy , the expression is:

[0101] Δs destroy =F dist ;

[0102] Destroy Δs in real time through the smart contract interface function destroy Number of share tokens;

[0103] Update total token supply S t+1 =S t -Δs destroy , and adjust the total net value V of the liquidity pool accordingly t ;

[0104] The remaining fee amount of 1-ρ will be used as platform operating fee and transferred to the platform account.

[0105] As a preferred solution of the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, wherein: the user's position closing includes active closing and passive closing;

[0106] The amount of liquidity tokens obtained after the active liquidation is Margin', specifically:

[0107] Receive the user's closing instructions through the smart contract interface function, and the user account obtains the amount of liquidity tokens as Margin';

[0108] The passive liquidation is a margin call, i.e., market fluctuations cause the margin loss to be reduced to zero, specifically:

[0109] Real-time monitoring of users' margin levels. When market fluctuations cause users' margin losses to decrease to the set conditions, a passive forced liquidation mechanism is triggered.

[0110] The dynamic expression of forced liquidation condition is:

[0111]

[0112] Among them, Price is the real-time price of the transaction subject, Entry is the opening price of the transaction, and MaintenanceRate is the set forced liquidation threshold.

[0113] Automatically execute forced liquidation operations through smart contracts to close the user's position, calculate the user's actual loss in the event of liquidation, and deduct the corresponding amount from the user's margin;

[0114] Adjust the number of tokens held by the user in the liquidity pool based on the user's actual losses. If the user's margin is insufficient to cover the losses (which is extremely unlikely), the remaining losses will be shared by other user providers in the liquidity pool.

[0115] Update the total net asset value V in the liquidity pool t and the total number of share tokens in circulation S t ;

[0116] The liquidity exit includes:

[0117] The liquidity share tokens held by investment trading users and liquidity provider users are converted into original assets for exit;

[0118] Get the current share token price p share =V t / S t , where the share token price p share For real-time changes;

[0119] Calculate the amount of assets that should be returned to the user. The expression is:

[0120] A return =s withdraw ·p share ;

[0121] Among them, A return The original asset value that the user should obtain after closing the position, s withdraw The number of share tokens that the user applies to withdraw, p share is the current share token price;

[0122] The original asset is any original asset currently in the liquidity pool;

[0123] A smart contract is used to destroy the user's locked share tokens, transfer the original assets of equal value from the liquidity pool to the user's address, and update the net value and total token amount in the liquidity pool status.

[0124] In a second aspect, the present invention provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, it implements any step of the on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm as described in the first aspect of the present invention.

[0125] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm as described in the first aspect of the present invention.

[0126] The beneficial effects of this invention are: through the creative integration of the liquidity pool and the margin pool, and the tokenization of dynamic liquidity shares, the adoption of an "asset-transaction" separation model, the use of tokens for trading, and the combination of a tiered funding rate algorithm and a multi-oracle verification mechanism, a trinity of technological breakthroughs are achieved, realizing the first on-chain derivatives trading system:

[0127] Unlimited liquidity expansion: support instant online trading of any RWA asset, support trading of any compliant underlying index, no trading leverage restrictions, no trading volume restrictions;

[0128] Risk self-balancing: Dynamic funding rate + real-time minting and burning to eliminate the imbalance between long and short positions;

[0129] Resilience to extreme market conditions: The "asset-transaction" separation model eliminates the risk of death spirals and bank runs;

[0130] Zero-friction liquidation: Token minting replaces traditional asset transfers, significantly reducing gas consumption;

[0131] Decentralized full-chain closed-loop clearing system: This system provides the first key and feasible on-chain derivatives infrastructure for the trillion-dollar RWA market. BRIEF DESCRIPTION OF THE DRAWINGS

[0132] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0133] Figure 1 Schematic diagram of the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm in Example 1.

[0134] Figure 2 This is a schematic diagram of the tokenization process in Example 1.

[0135] Figure 3 This is the status update logic diagram in Example 1.

[0136] Figure 4 This is a schematic diagram of the dynamic liquidation process in Example 1. DETAILED DESCRIPTION

[0137] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0138] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0139] Secondly, the term "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in various places throughout this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive of other embodiments.

[0140] Example 1, with reference to Figures 1 to 4 , which is the first embodiment of the present invention, provides an on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm, including:

[0141] Liquidity pool tokenization module, oracle price feedback module, leverage trading engine module, dynamic liquidation module, funding rate balance module, liquidity incentive allocation module and liquidity management module;

[0142] The liquidity pool tokenization module is used to convert the margin deposited by investment trading users and the assets injected by liquidity provider users into share tokens. Investment trading users need to convert their margin into liquidity share tokens first and then use these tokens to conduct investment transactions;

[0143] The oracle price feedback module is connected to the liquidity pool tokenization module and is used to obtain external market price indices through decentralized oracles and input real-time price data into smart contracts;

[0144] The leveraged trading engine module is connected to the liquidity pool tokenization module and the oracle price feedback module respectively, and is used to open derivative contract positions based on the leverage multiple and direction selected by the user, using the "asset-transaction" separation model and using share tokens as collateral;

[0145] The dynamic liquidation module is connected to the oracle price feedback module and the leveraged trading engine module respectively, and is used to settle the trader's profit and loss in real time by minting or destroying share tokens according to the oracle price changes, and update the total supply of tokens in the pool to complete real-time on-chain liquidation;

[0146] The funding rate balancing module is connected to the dynamic liquidation module and is used to charge fees to the advantaged party and distribute them to the disadvantaged party based on time when there is an imbalance in long and short positions, thereby dynamically adjusting market supply and demand;

[0147] The liquidity incentive allocation module is connected to the dynamic liquidation module and is used to distribute the platform transaction fee ρ to the share token holders in real time, directly increasing the token price;

[0148] The liquidity management module is connected to the dynamic liquidation module and the liquidity pool tokenization module respectively, and is used to exchange the original assets at the current share token price when the investment users and liquidity providing users exit liquidity and close their positions.

[0149] As a preferred solution of the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, the steps of converting the user deposited margin and the assets injected by the liquidity provider into share tokens are as follows:

[0150] The address and amount of the original assets from the user are verified through the on-chain smart contract to ensure that the assets have been successfully transferred to the liquidity pool contract account and record their initial value;

[0151] Read the current total net value V from the liquidity pool status t and the current total amount of tokens S t , used to calculate the number of tokens minted corresponding to the newly added assets;

[0152] The initial price of the share token is: 1 token = 1 USDT. The expression for calculating the share token price is:

[0153]

[0154] Among them, V t = The sum of the prices of all assets added to the liquidity pool according to the oracle, in USDT, i.e. V tRefers to the total value of all assets in the liquidity pool converted into USDT based on the market price obtained by the decentralized oracle;

[0155] Calculate the number of share tokens that should be minted. The expression is:

[0156]

[0157] Among them, s is the number of share tokens that should be minted to the user, A i V is the value of the assets deposited by the user this time, t is the total net value of the current liquidity pool, S t is the total amount of share tokens currently in circulation;

[0158] Based on the calculated s value, call the ERC-20 standard interface function to mint the corresponding number of share tokens to the user address;

[0159] Deposit the user into asset value A i Added to the total net asset value V of the liquidity pool t+1 =V t +A i , and update the total supply of tokens S t+1 =S t +s, and write the new state to the on-chain storage.

[0160] As a preferred solution for the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, wherein: the external market price index is obtained through a decentralized oracle and the real-time price data is input into the smart contract. The specific steps are as follows:

[0161] Use the oracle call interface function preset in the smart contract to initiate a price index request for the target asset to the decentralized oracle network;

[0162] The oracle node obtains the latest transaction price at the current timestamp from multiple exchanges or data sources to form an original quotation set

[0163] Calculate the weighted median price P wmed , the expression is:

[0164]

[0165] Among them, P wmed is the weighted median price, p i is the original quote of the ith exchange, σ p is the standard deviation of all quotes, which is used to measure the volatility of quotes. p >η% when liquidation is suspended, η is the safety threshold set by the system, ∈ is a very small positive number to prevent division by zero errors;

[0166] Introducing a time decay factor To reflect the impact of data freshness, the aggregated price is adjusted by the time decay factor to obtain the final on-chain price, which is expressed as:

[0167]

[0168] Where t is the current timestamp, t0 is the quote generation timestamp, and λ is the decay rate constant;

[0169] The processed real market price is written into the on-chain storage variable for the leverage trading engine and subsequent components of the dynamic liquidation module to call.

[0170] As a preferred solution for the on-chain derivatives trading system with a tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, the following steps are used to open a derivatives contract position using share tokens as collateral based on the user's selected leverage ratio and direction:

[0171] Receive transaction instructions initiated by users through the smart contract interface function, check the balance of the user account to ensure that they hold sufficient tokens and are not locked by other transactions;

[0172] The nominal position value is calculated based on the leverage selected by the user. The expression is:

[0173] Position Szie=Margin·L;

[0174] Among them, Position Size is the nominal number of tokens in the position, the unit is tokens, Margin is the actual number of tokens pledged by the user, the unit is tokens, and L is the leverage multiple selected by the user;

[0175] Create a structure inside the smart contract to store information;

[0176] The information includes user address, transaction direction, position notional value, collateral value, position opening timestamp, and preset liquidation threshold;

[0177] Transfer the user-specified share tokens to the contract escrow account and set a lock-up period until the position is closed or liquidated.

[0178] As a preferred solution for the on-chain derivatives trading system with a tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, the following steps are used to settle traders’ profits and losses in real time by minting or destroying token shares based on oracle price changes, and to update the total supply of tokens in the pool:

[0179] Read the latest on-chain price of the underlying asset corresponding to the user's position from the smart contract, as well as the historical price recorded at the time the position was opened;

[0180] Calculate the price change ratio of the user's position. The expression is:

[0181]

[0182] Where r represents the rate of change of the underlying asset price relative to the time of opening the position. If r>0, it means the price has risen, and if r<0, it means the price has fallen.

[0183] According to the user's transaction direction d∈{1,0} and leverage L, the user's actual profit and loss ratio is calculated as follows:

[0184] g=d·L·r+(1-d)·(-L)·r;

[0185] Where d=1 indicates long, d=0 indicates short, and g is the actual profit / loss ratio of the user's position. When the user goes long, the profit is magnified by L times as the price rises, and when the user goes short, the profit is magnified by L times as the price falls.

[0186] Adjust the value of the user's mortgage assets according to the profit and loss ratio g. The expression is:

[0187] Margin'=Margin·(1+g);

[0188] Among them, Margin is the original number of mortgage tokens, and Margin' is the effective number of tokens after transaction adjustment. If g>0, it means profit, and the user's equity will be increased by minting new share tokens. If g<0, it means loss, and the user's equity will be reduced by destroying some share tokens.

[0189] Calculate the number of share tokens to be minted or destroyed. The expression is:

[0190] Δs=Margin′-Margin;

[0191] Δs>0 means that new share tokens should be minted, Δs<0 means that some share tokens should be destroyed. If Δs=0, no operation is performed;

[0192] Δs for all users i The sum of the net profits and losses of traders in the entire system is ∑(Δs i ), perform corresponding operations based on the positive or negative sign of this sum, and update the status of the liquidity pool, including:

[0193] Update the total net value V in the liquidity pool t ;

[0194] Update total token supply S t+1 =S t +∑(Δs i );

[0195] Among them, V t is the current pool net value, S t is the total amount of share tokens currently in circulation. The newly added net value comes from the redistribution of user profits and losses. Δs i The number of share tokens that need to be minted or destroyed by the i-th user.

[0196] As a preferred solution for the on-chain derivatives trading system with a tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, when the long-short position is unbalanced, funding fees are charged to the advantaged party over time and distributed to the disadvantaged party, dynamically adjusting market supply and demand. The specific steps are as follows:

[0197] By traversing the mapping table stored in the smart contract, the total notional value of the long direction and the total notional value of the short direction are calculated respectively, where:

[0198] Represents the sum of the notional values ​​of all long positions;

[0199] Represents the sum of the notional values ​​of all short positions;

[0200] Calculate the long-short ratio using the following expression:

[0201]

[0202] Among them, is the long-short imbalance index, ∈ is a very small positive number used to prevent division by zero errors;

[0203] When Skew ≥ 1, it indicates an asymmetry between long and short forces. When Skew = 1, the market is in a completely balanced state. Skew > 1 indicates that there is a dominant position. The larger the value, the more serious the imbalance.

[0204] The basic funding rate is calculated based on the long-short ratio SKew. The expression is:

[0205] f0=k·(Skew-1);

[0206] Where f0 is the basic funding rate, and k is the sensitivity adjustment coefficient;

[0207] The actual funding rate within a unit period is adjusted according to the time interval Δt. The expression is:

[0208]

[0209] Among them, T bis the benchmark settlement period, Δt is the time difference since the last settlement, and the final funding rate is calculated using a time-weighted approach to ensure fair and consistent fees.

[0210] If N long >N short , then the long side is the dominant position holder and the funding rate f is charged to it. The collected funds will be evenly distributed to all short position holders;

[0211] Otherwise, the short seller will be considered as holding a dominant position and will be charged a funding rate of f. The collected funds will be evenly distributed among all long position holders.

[0212] For each user holding a position in the advantageous direction, the expression for deducting funding fees from their collateral assets is:

[0213]

[0214] Position Size is the nominal number of tokens in the position, and Funding Fee is the funding fee. Both are expressed in tokens. The Funding Fee token value is deducted from each user holding a favorable position, and ω% of the corresponding tokens are returned to the account of the user holding the disadvantaged position in real time. The remaining 1-ω% of the fee is transferred to the platform account as platform operating expenses.

[0215] The funding cost allocation expression is:

[0216] F dist =ω%·Funding Fee

[0217] Destroying this portion of tokens in real time during each transaction settlement is a disguised way of increasing token prices, which is equivalent to allocating incentive funds to all liquidity providers.

[0218] Calculate the number of share tokens to be destroyed Δs destroy , the expression is:

[0219] Δs destroy =F dist ;

[0220] Destroy Δs in real time through the smart contract interface function destroy Number of share tokens;

[0221] Update total token supply S t+1 =S t -Δs destroy , and adjust the total net value V of the liquidity pool accordingly t ;

[0222] As a preferred solution for the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, wherein: the platform transaction fee ρ is distributed to the share token holders in real time to directly increase the token price. The specific steps are as follows:

[0223] Every time a user opens, closes, or adjusts a position, ρ is extracted from the transaction fee as an incentive fund.

[0224] The total handling fee ρ is automatically extracted at the time of each transaction settlement through the smart contract interface function. The expression is:

[0225] F dist =ρ·f total ;

[0226] Among them, f total The total transaction fee generated by this transaction, the unit of which is tokens, used to pay the transaction fee with tokens, F dist It is the incentive fund allocated to share token holders, and its unit is also tokens;

[0227] The portion of tokens is destroyed in real time during each transaction settlement, which is a disguised increase, equivalent to allocating incentive funds to all liquidity providers;

[0228] Calculate the number of share tokens to be destroyed Δs destroy , the expression is:

[0229] Δs destroy =F dist ;

[0230] Destroy Δs in real time through the smart contract interface function destroy Number of share tokens;

[0231] Update total token supply S t+1 =S t -Δs destroy , and adjust the total net value V of the liquidity pool accordingly t ;

[0232] The remaining fee amount of 1-ρ will be used as platform operating fee and transferred to the platform account.

[0233] As a preferred solution of the on-chain derivatives trading system with tokenized liquidity pool and dynamic liquidation algorithm described in the present invention, wherein: the user's position closing includes active closing and passive closing;

[0234] The amount of liquidity tokens obtained after the active liquidation is Margin', specifically:

[0235] Receive the user's closing instructions through the smart contract interface function, and the user account obtains the amount of liquidity tokens as Margin';

[0236] The passive liquidation is a margin call, i.e., market fluctuations cause the margin loss to be reduced to zero, specifically:

[0237] Real-time monitoring of users' margin levels. When market fluctuations cause users' margin losses to decrease to the set conditions, a passive forced liquidation mechanism is triggered.

[0238] The dynamic expression of forced liquidation condition is:

[0239]

[0240] Among them, Price is the real-time price of the transaction subject, Entry is the opening price of the transaction, and MaintenanceRate is the set forced liquidation threshold.

[0241] Automatically execute forced liquidation operations through smart contracts to close the user's position, calculate the user's actual loss in the event of liquidation, and deduct the corresponding amount from the user's margin;

[0242] Adjust the number of tokens held by the user in the liquidity pool based on the user's actual losses. If the user's margin is insufficient to cover the losses (which is extremely unlikely), the remaining losses will be shared by other user providers in the liquidity pool.

[0243] Update the total net asset value V in the liquidity pool t and the total number of share tokens in circulation S t ;

[0244] The liquidity exit includes:

[0245] The liquidity share tokens held by investment trading users and liquidity provider users are converted into original assets for exit;

[0246] Get the current share token price p share =Vt / S t , where the share token price p share For real-time changes;

[0247] Calculate the amount of assets that should be returned to the user. The expression is:

[0248] A return =s withdraw ·p share ;

[0249] Among them, A return The original asset value that the user should obtain after closing the position, s withdraw The number of share tokens that the user applies to withdraw, p share is the current share token price;

[0250] The original asset is any original asset currently in the liquidity pool;

[0251] A smart contract is used to destroy the user's locked share tokens, transfer the original assets of equal value from the liquidity pool to the user's address, and update the net value and total token amount in the liquidity pool status.

[0252] It should be noted that this module is responsible for handling both active user withdrawal from liquidity (such as active liquidation) and passive withdrawal from liquidity (such as margin call), ensuring that the liquidity pool can maintain stable operation in different market environments. In the case of active withdrawal, user assets are accurately returned based on the current token price to ensure the safety of user funds; in the case of passive withdrawal, the loss assets are recovered through the automatic liquidation mechanism to prevent the net value of the liquidity pool from being impacted. The design of the liquidity exit mechanism takes into account both user experience and system security, allowing users to withdraw their assets quickly and efficiently under any circumstances, while also providing strong support for risk control of the liquidity pool.

[0253] Examples of hypothetical scenarios for innovative applications of this patented technology in the RWA financial sector are as follows:

[0254] 1. A Nasdaq Composite Index trading solution using a mixed pool of USD and HKD stablecoins. Through this mixed pool, investors can seamlessly trade the Nasdaq Composite Index, while achieving cross-currency risk hedging and high leverage. This solution combines dynamic liquidity pools, multi-oracle aggregation, and a tiered fee model, providing Asia-Pacific investors with a low-friction, highly flexible investment tool for US stock indexes. This approach can also be applied to the construction of on-chain investment tools for other stock indexes.

[0255] 2. Real Estate Tokenized Index Trading System. This patent application builds a real estate RWA tokenized trading architecture based on the SLP-REAL pool, enabling on-chain indexed circulation of real estate assets. Technical Implementation: By injecting real estate tokens into an independent liquidity pool, a derivatives trading system linked to the US Case-Shiller House Price Index is established. Traders can conduct long and short trades based on real-time index quotes from an oracle, with smart contracts automatically executing 1:100 leveraged position opening instructions. For example, Chicago property owners can hedge against falling house prices by shorting the local index, avoiding the 12-18% transaction costs associated with physical sales and achieving regional risk hedging. Liquidity Provider Revenue Model: Liquidity providers receive a share of transaction fees and funding fees. For example, the XXXXX office building tokenization project can provide a near-fixed income. Asset Title Confirmation Mechanism: The ERC-3525 standard is used to achieve fragmented property rights, reducing the minimum investment threshold to $100 (compared to $50,000 for traditional REITs).

[0256] 3. Bond Interest Rate Volatility Arbitrage Engine. This Treasury yield index trading system, built on a liquidity pool, achieves on-chain innovation in traditional fixed income products. Technical Implementation Architecture: Combining US Treasury ETF tokens with stablecoins to create a hybrid pool, supporting 10x leverage trading of the "10-Year US Treasury Yield Index." Dynamic Fee Algorithm: When short positions exceed 75% before the Federal Reserve meeting, the fee factor automatically increases to 1.5x, discouraging one-sided speculation.

[0257] 4. Carbon neutral financial infrastructure. The SLP-CARBON pool will establish a carbon credit derivatives market, creating an on-chain pricing system for environmental equity assets. Technical features: Carbon credit tokens are linked to the EUA futures index, enabling companies to short-sell and hedge emissions reduction costs. Environmental funds, acting as liquidity providers (LPs), can earn stable returns, significantly improving capital utilization compared to traditional carbon funds. Companies like Tesla are using this system to hedge their 2025 EU carbon quota shortfall, reducing compliance costs.

[0258] 5. Cross-border exchange rate risk management agreement. This initiative builds an emerging market currency hedging system based on a liquidity pool, revolutionizing the traditional foreign exchange derivatives market. Technical solution: A hybrid pool is created between the Brazilian Real (BRLT) and the US Dollar (USD) stablecoin to support BRL / USD index contract trading. Intelligent risk control during election cycles: A political risk index triggers a fee factor to mitigate trader imbalances. Economic benefits achieved: Foreign exchange hedging costs for small and medium-sized export enterprises are significantly reduced; a real-time clearing mechanism significantly improves hedging efficiency.

[0259] The above is an RWA financial infrastructure built based on this patented technology, covering the stock, real estate, fixed income, environmental rights and foreign exchange markets, to realize the on-chain trading of traditional assets.

[0260] This embodiment also provides a computer device, which is suitable for the on-chain derivatives trading system of the tokenized liquidity pool and the dynamic liquidation algorithm, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute computer-executable instructions to implement the on-chain derivatives trading system of the tokenized liquidity pool and the dynamic liquidation algorithm proposed in the above embodiment.

[0261] The computer device may be a terminal, comprising a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse.

[0262] This embodiment also provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements an on-chain derivatives trading system that implements a tokenized liquidity pool and a dynamic liquidation algorithm as proposed in the above embodiment; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0263] In summary, innovative design has the following core advantages:

[0264] The dynamic share token mechanism and the "asset-transaction" separation model achieve a breakthrough in liquidity, making it possible to trade any index target with any asset and any leverage. The liquidity pool can adopt two architectures: a hybrid pool (DLP): supports the free combination of stablecoins to generate share tokens, eliminating the dependence on a single asset; a standalone pool (SLP): allows any asset (such as BTC, real estate RWA tokens) to build an exclusive fund pool. The technical effects that can be achieved are: ① Asset support is extended to any index that can be verified by the oracle (such as the BTC index, the RWA real estate index); ② The leverage multiple breaks through physical limitations (theoretically unlimited leverage);

[0265] The nonlinear funding rate adjustment function designed in this invention can achieve the following technical effects: ① The larger the position deviation, the nonlinear increase in the advantage side rate, dynamically controlling the risk of long-short imbalance; ② The ω% funding fee is injected into the liquidity pool in real time, and the systemic risk is automatically compensated through the smart contract.

[0266] Establish three-tier execution guarantees: (a) Use multiple oracles (e.g. Chainlink+Pyth, etc.), data deviation σ p >η% triggers a liquidation pause; (b) a real-time token minting mechanism; (c) token prices are anchored to the underlying asset value in real time. This achieves the following technical benefits: ① minimal deviation between the mark price and the oracle index; ② liquidity withdrawal is based on real-time share redemption, avoiding temporary losses in traditional AMMs.

[0267] The principle of this invention is that the exchange is neutral. Whenever possible, the counterparty to a transaction is the trader's long or short position, rather than the liquidity provider. Due to the limitations of blockchain technology, long and short positions cannot be directly matched. Therefore, a liquidity pool provided by liquidity providers is designed as a transit point to enable cross-temporal matching of long and short positions. However, liquidity providers are not inherently counterparties to transactions. Therefore, we creatively combine the liquidity pool with the margin pool, using liquidity tokens as the medium for long and short transactions. This perfectly achieves the neutral design of the exchange and allows matching transactions to occur primarily between long and short positions. Furthermore, this invention also constructs a diversified revenue distribution system, where liquidity providers receive a share of transaction fees and funding fees, generating revenue, attracting more liquidity providers, and achieving a closed-loop model.

[0268] A decentralized, fully closed-loop liquidation process is achieved: The system integrates the liquidity pool and margin pool, and adopts an asset-transaction separation model. Liquidity tokens are used as the medium for transactions, and trading profits and losses are settled through the minting of liquidity tokens. Dynamic forced liquidation triggers are used to mitigate the risk of margin calls, achieving: ① theoretically unlimited trading limits; ② the system can withstand any extreme unilateral market conditions without causing liquidity depletion and a death spiral, eliminating the risk of bank runs; and ③ eliminating the risk of human manipulation of custodial assets.

[0269] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. An on-chain derivatives trading system with a tokenized liquidity pool and dynamic liquidation algorithm, featuring: include: Liquidity pool tokenization module, oracle price feedback module, leverage trading engine module, dynamic liquidation module, funding rate balance module, liquidity incentive allocation module and liquidity management module; The liquidity pool tokenization module is used to convert the margin deposited by investment trading users and the assets injected by liquidity provider users into share tokens. Investment trading users need to convert their margin into liquidity share tokens first and then use these tokens to conduct investment transactions; The oracle price feedback module is connected to the liquidity pool tokenization module and is used to obtain external market price indices through decentralized oracles and input real-time price data into smart contracts; The leveraged trading engine module is connected to the liquidity pool tokenization module and the oracle price feedback module, respectively, and is used to open derivative contract positions based on the leverage multiple and direction selected by the user, using the "asset-transaction" separation model and using share tokens as collateral; The dynamic liquidation module is connected to the oracle price feedback module and the leveraged trading engine module respectively, and is used to settle the trader's profit and loss in real time by minting or destroying share tokens according to the oracle price changes, and update the total supply of tokens in the pool to complete real-time on-chain liquidation; The funding rate balancing module is connected to the dynamic liquidation module and is used to charge fees to the advantaged party and distribute them to the disadvantaged party based on time when there is an imbalance in long and short positions, thereby dynamically adjusting market supply and demand; The liquidity incentive allocation module is connected to the dynamic liquidation module and is used to distribute the platform transaction fee ρ to the share token holders in real time, directly increasing the token price; The liquidity management module is connected to the dynamic liquidation module and the liquidity pool tokenization module respectively, and is used to exchange the original assets at the current share token price when the investment users and liquidity providing users exit liquidity and close their positions.

2. The on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm according to claim 1, characterized in that: The specific steps for converting the user's deposited margin and the assets injected by the liquidity provider into share tokens are as follows: The address and amount of the original assets from the user are verified through the on-chain smart contract to ensure that the assets have been successfully transferred to the liquidity pool contract account and record their initial value; Read the current total net value V from the liquidity pool status t and the current total amount of tokens S t , used to calculate the number of tokens minted corresponding to the newly added assets; The initial price of the share token is: 1 token = 1 USDT. The expression for calculating the share token price is: Among them, V t = The sum of the prices of all assets added to the liquidity pool according to the oracle, in USDT, i.e. V t Refers to the total value of all assets in the liquidity pool converted into USDT based on the market price obtained by the decentralized oracle; Calculate the number of share tokens that should be minted. The expression is: Among them, s is the number of share tokens that should be minted to the user, A i V is the value of the assets deposited by the user this time, t is the total net value of the current liquidity pool, S t is the total amount of share tokens currently in circulation; Based on the calculated s value, call the ERC-20 standard interface function to mint the corresponding number of share tokens to the user address; Deposit the user into asset value A i Added to the total net asset value V of the liquidity pool t+1 =V t +A i , and update the total supply of tokens S t+1 =S t +s, and write the new state to the on-chain storage.

3. The on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm according to claim 2, characterized in that: The decentralized oracle obtains the external market price index and inputs the real-time price data into the smart contract. The specific steps are as follows: Use the oracle call interface function preset in the smart contract to initiate a price index request for the target asset to the decentralized oracle network; The oracle node obtains the latest transaction price at the current timestamp from multiple exchanges or data sources to form an original quotation set Calculate the weighted median price P wmed , the expression is: Among them, P wmed is the weighted median price, p i is the original quote of the ith exchange, σ p is the standard deviation of all quotes, which is used to measure the volatility of quotes. p >η% when liquidation is suspended, η is the safety threshold set by the system, ∈ is a very small positive number to prevent division by zero errors; Introducing a time decay factor To reflect the impact of data freshness, the aggregated price is adjusted by the time decay factor to obtain the final on-chain price, which is expressed as: Where t is the current timestamp, t0 is the quote generation timestamp, and λ is the decay rate constant; The processed real market price is written into the on-chain storage variable for the leverage trading engine and subsequent components of the dynamic liquidation module to call.

4. The on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm according to claim 3, characterized in that: Based on the leverage ratio and direction selected by the user, the derivatives contract position is opened with the share tokens as collateral. The specific steps are as follows: Receive transaction instructions initiated by users through the smart contract interface function, check the balance of the user account to ensure that they hold sufficient tokens and are not locked by other transactions; The nominal position value is calculated based on the leverage selected by the user. The expression is: Position Size = Margin L; Among them, Position Size is the nominal number of tokens in the position, the unit is tokens, Margin is the actual number of tokens pledged by the user, the unit is tokens, and L is the leverage multiple selected by the user; Create a structure inside the smart contract to store information; The information includes user address, transaction direction, position notional value, collateral value, position opening timestamp, and preset liquidation threshold; Transfer the user-specified share tokens to the contract escrow account and set a lock-up period until the position is closed or liquidated.

5. The on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm according to claim 4, characterized in that: According to the oracle price changes, the trader's profit and loss are settled in real time by minting or destroying share tokens, and the total supply of tokens in the pool is updated. The specific steps are as follows: Read the latest on-chain price of the underlying asset corresponding to the user's position from the smart contract, as well as the historical price recorded at the time the position was opened; Calculate the price change ratio of the user's position. The expression is: Where r represents the rate of change of the underlying asset price relative to the time of opening the position. If r>0, it means the price has risen, and if r<0, it means the price has fallen. According to the user's transaction direction d∈{1,0} and leverage L, the user's actual profit and loss ratio is calculated as follows: g=d·L·r+(1-d)·(-L)·r; Where d=1 indicates long, d=0 indicates short, and g is the actual profit / loss ratio of the user's position. When the user goes long, the profit is magnified by L times as the price rises, and when the user goes short, the profit is magnified by L times as the price falls. Adjust the value of the user's mortgage assets according to the profit and loss ratio g. The expression is: Margin'=Margin·(1+g); Among them, Margin is the original number of mortgage tokens, and Margin' is the effective number of tokens after transaction adjustment. If g>0, it means profit, and the user's equity will be increased by minting new share tokens. If g<0, it means loss, and the user's equity will be reduced by destroying some share tokens. Calculate the number of share tokens to be minted or destroyed. The expression is: Δs=Margin′-Margin; Δs>0 means that new share tokens should be minted, Δs<0 means that some share tokens should be destroyed. If Δs=0, no operation is performed; Δs for all users i The sum of the net profits and losses of traders in the entire system is ∑(Δs i ), perform corresponding operations based on the positive or negative sign of this sum, and update the status of the liquidity pool, including: Update the total net value V in the liquidity pool t ; Update total token supply S t+1 =S t +∑(Δs i ); Among them, V t is the current pool net value, S t is the total amount of share tokens currently in circulation. The newly added net value comes from the redistribution of user profits and losses. Δs i The number of share tokens that need to be minted or destroyed by the i-th user.

6. The on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm according to claim 5, characterized in that: When there is an imbalance between long and short positions, funding fees are charged to the party holding the advantage and distributed to the party holding the disadvantage over time, dynamically adjusting market supply and demand. The specific steps are as follows: By traversing the mapping table stored in the smart contract, the total notional value of the long direction and the total notional value of the short direction are calculated respectively, where: Represents the sum of the notional values ​​of all long positions; Represents the sum of the notional values ​​of all short positions; Calculate the long-short ratio using the following expression: Among them, is the long-short imbalance index, ∈ is a very small positive number used to prevent division by zero errors; When Skew ≥ 1, it indicates an asymmetry between long and short forces. When SKew = 1, the market is in a completely balanced state. Skew > 1 indicates that there is a dominant position. The larger the value, the more serious the imbalance. The basic funding rate is calculated based on the long-short ratio SKew. The expression is: f0=k·(Skew-1); Where f0 is the basic funding rate, and k is the sensitivity adjustment coefficient; The actual funding rate within a unit period is adjusted according to the time interval Δt. The expression is: Among them, T b is the benchmark settlement period, Δt is the time difference since the last settlement, and the final funding rate is calculated using a time-weighted approach to ensure fair and consistent fees. If N long >N short , then the long side is the dominant position holder and the funding rate f is charged to it. The collected funds will be evenly distributed to all short position holders; Otherwise, the short seller will be considered as holding a dominant position and will be charged a funding rate of f. The collected funds will be evenly distributed among all long position holders. For each user holding a position in the advantageous direction, the expression for deducting funding fees from their collateral assets is: Position Size is the nominal number of tokens in the position, and Funding Fee is the funding fee. Both are expressed in tokens. The Funding Fee token value is deducted from each user holding a favorable position, and ω% of the corresponding tokens are returned to the account of the user holding the disadvantaged position in real time. The remaining 1-ω% of the fee is transferred to the platform account as platform operating expenses. The funding cost allocation expression is: F dist =ω%·Funding Fee The portion of tokens is destroyed in real time during each transaction settlement, which is a disguised increase, equivalent to allocating incentive funds to all liquidity providers; Calculate the number of share tokens to be destroyed Δs destroy , the expression is: Δs destroy =F dist ; Destroy Δs in real time through the smart contract interface function destroy Number of share tokens; Update total token supply S t+1 =S t -Δs destroy , and adjust the total net value V of the liquidity pool accordingly t。 7. The on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm according to claim 6, characterized in that: The ρ% of the platform transaction fee is distributed to the share token holders in real time, directly increasing the token price. The specific steps are as follows: Every time a user opens, closes, or adjusts a position, ρ is extracted from the transaction fee as an incentive fund. The smart contract interface function automatically extracts ρ% of the total handling fee at the time of each transaction settlement. The expression is: F dist =ρ%·f total ; Among them, f total The total transaction fee generated by this transaction, the unit of which is tokens, used to pay the transaction fee with tokens, F dist It is the incentive fund allocated to share token holders, and its unit is also tokens; The portion of tokens is destroyed in real time during each transaction settlement, which is a disguised increase, equivalent to allocating incentive funds to all liquidity providers; Calculate the number of share tokens to be destroyed Δs destroy , the expression is: Δs destroy =F dist ; Destroy Δs in real time through the smart contract interface function destroy Number of share tokens; Update total token supply S t+1 =S t -Δs destroy , and adjust the total net value V of the liquidity pool accordingly t ; The remaining 1-ρ% of the fee amount will be used as platform operating expenses and transferred to the platform account.

8. The on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm according to claim 6, characterized in that: The user's position closing includes active position closing and passive position closing; The amount of liquidity tokens obtained after the active liquidation is Margin', specifically: Receive the user's closing instructions through the smart contract interface function, and the user account obtains the amount of liquidity tokens as Margin'; The passive liquidation is a margin call, i.e., market fluctuations cause the margin loss to be reduced to zero, specifically: Real-time monitoring of users' margin levels. When market fluctuations cause users' margin losses to decrease to the set conditions, a passive forced liquidation mechanism is triggered. The dynamic expression of forced liquidation condition is: Among them, Price is the real-time price of the transaction subject, Entry is the opening price of the transaction, and MaintenanceRate is the set forced liquidation threshold. Automatically execute forced liquidation operations through smart contracts to close the user's position, calculate the user's actual loss in the event of liquidation, and deduct the corresponding amount from the user's margin; Adjust the number of tokens held by the user in the liquidity pool based on the user's actual losses. If the user's margin is insufficient to cover the losses, the remaining losses will be shared by other user providers in the liquidity pool. Update the total net asset value V in the liquidity pool t and the total number of share tokens in circulation S t ; The liquidity exit includes: The liquidity share tokens held by investment trading users and liquidity provider users are converted into original assets for exit; Get the current share token price p share =V t / S t , where the share token price p share For real-time changes; Calculate the amount of assets that should be returned to the user. The expression is: A return =s witdraw ·p share ; Among them, A return The original asset value that the user should obtain after closing the position, s withdraw The number of share tokens that the user applies to withdraw, p share is the current share token price; The original asset is any original asset currently in the liquidity pool; A smart contract is used to destroy the user's locked share tokens, transfer the original assets of equal value from the liquidity pool to the user's address, and update the net value and total token amount in the liquidity pool status.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm as described in any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the on-chain derivatives trading system with a tokenized liquidity pool and a dynamic liquidation algorithm as described in any one of claims 1 to 8 are implemented.