SynFutures 백서

SynFutures

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 2쪽 중 2쪽

the limit price, the order size, and the margin amount. The smart contract then creates an Order struct for the user and stores it in the user’s account for this pair with an index composed of the limit price and the nonce of this Order. The nonce is a system-generated number indicating the version of limit orders at this price. The native limit order in Oyster AMM is designed and implemented asynchronously. 5 A Single Model for Unified liquidity Oyster AMM unifies both concentrated liquidity and limit orders in a single model. In smart contract terms, Range and Order can provide liquidity at each price point. For Range covering the same price point, their liquidity, or square root of k, is added for AMM curve-related calculation. For Order at the – 7 – SynFutures v3 : The Oyster AMM Model for Next-Gen DeFi Derivatives. same price point, their order sizes are added together to cater to the taker ns trade size. In addition, Order is always consumed before liquidity from Range is consumed. struct Pearl { uint128 liquidityGross; // total range liquidity that references this pearl int128 liquidityNet; // amount of net liquidity when the tick is crossed uint24 nonce; // nonce for record version control int96 left; // orders to be taken int96 taken; // orders to be filled uint128 fee; // should only be distributed w.r.t. filled order uint128 entrySocialLossIndex; // social loss index borne by taken but unfilled order int128 entryFundingIndex; // funding index owned by taken but unfilled order } The collection of concentrated liquidity covering a price point and all open limit orders on the same price point is described in a struct called Pearl and is stored in the smart contract indexed by price. Oyster AMM can be viewed as the collection of Pearl along with the AMM price curve. Among all the Pearl fields, liquidityGross and liquidityNet are related to Range and the rest are related to Order. Introducing native irreversible limit orders in Oyster AMM eliminated the need to create fully flexible concentrated liquidity of an extremely narrow range to mimic a limit order. Consequently, the fee distribution mechanism in Oyster AMM is significantly simplified compared to other spot-concentrated liquidity DEXes. This update drastically reduces engineering complexity and makes implementing Oyster AMM in smart contracts possible. In fact, Pearl serves as the pool for limit orders from makers, which is also the key to the feasibility of the asynchronous design of limit orders in Oyster AMM. In this way, logic on the takers’ side is simplified greatly, where takers take as much as they want and nothing more. With the fungible approach of Pearl, the gas cost of a trade is directly proportional to the price impact, i.e., the number of ticks crossed. For a trade of size S0, the process of trading, or consuming unified liquidity, follows the steps below and is shown in Figure 2. 1. In the Pearl of current price P0, check if there are unfilled limit orders. (a) If not, go to step 2 with S1 = S0. (b) If so, fill the limit orders as much as possible. i. If S0 is fully filled, terminate. (Note that the current price does not change in this case.) ii. If not, continue to step 2 with the remaining size S1. 2. Find the Pearl at the next price P1. (a) Trade for size S1 on the AMM curve between Pearl at P0 and P1. i. If S1 is fully filled, terminate. (Note that the current price does change in this case.) ii. If not, update the current price as P1 and go to step 1 with the remaining size S2. 6 Stabilization Mechanism for User Protection 6.1 Stabilized Mark Prices As in previous versions of SynFutures models, Oyster AMM maintains a few prices for different purposes. • Pfair: Price quoted by the Oyster AMM by combining all the concentrated liquidity and limit orders, like the mid-price of a CLOB system. This price is used to determine if concentrated liquidity is out of its price range. This price is also used when a concentrated liquidity is converted into a trading position. Simply put, this price is used for all liquidity-related calculations. – 8 – SynFutures v3 : The Oyster AMM Model for Next-Gen DeFi Derivatives. Yes No Yes / Cross Pearl No / Swap Fulfilled Yes No remaining order on current pearl ? Is swap fulfilled ? is next pearl reached ? take order on pearl swap on curve until next pearl End Start Figure 2: Overview of Swap Procedure • Pmark: Price used to determine the unrealized profit and loss and margin requirements of all po- sitions in a pair. This price is also used to determine the initial margin requirement to open a position. This is the price for position risk management. Note that unrealized profit is not avail- able for withdrawal until it is realized, i.e., when the position is closed. • Pspot: Price originated from oracles such as Chainlink or various spot DEX markets. • Psettlement: Time weight average price from oracles such as Chainlink or various spot DEX markets, used for final settlement of all positions in a dated futures market. Just as the derivative markets are related to the spot markets but function independently, these prices are closely related and can even be the same number, though they are often different. Pfair solely depends on the trading and liquidity of the pool, while Pspot and Psettlement solely depend on spot market data and time. Pmark is based on Pspot but also incorporates a daily interest component of the underlying trading pair. With the segregation of duty of trading and marking, the pricing mechanism in Oyster AMM shields all users from attacks, such as flash loan and price manipulation. – 9 – SynFutures v3 : The Oyster AMM Model for Next-Gen DeFi Derivatives. 6.2 Continuous Funding Fee As perpetual futures do not have a final settlement at the maturity to guarantee the convergence to the spot market index price, Oyster AMM employs continuous funding for its perpetual futures markets. The principle is to expect the deviation to converge in a daily cycle, and thus, the funding fee ratio for a period is defined below: FundingFeeRate = (Pfair − Pspot) /Pspot · ∆t/86400 ∆t is the time difference in seconds between the current timestamp and the last timestamp when the funding fee rate is calculated. Like other centralized and decentralized perpetual futures markets, the funding fee encourages traders to return the perpetual futures price to the index price by continuously rewarding positions against such deviation and punishing positions in favor of such deviation. 6.3 Liquidations When the margin supports a trading position that falls below its maintenance margin requirement, that position is subject to liquidation. Like in most decentralized margin trading systems, liquidation in Oyster AMM is performed primarily via the taking-over approach, where the liquidator takes over the target trading position along with the remaining margins and tops up the margin to meet the initial margin requirement. Effectively, the remaining margin of the trading position to be taken over is a potential profit for the liquidator ithat is, if the liquidator can adequately manage the risk. In addition, Oyster AMM also allows a liquidation mechanism where trading positions failing the maintenance margin requirement are forced to trade against the Oyster AMM directly to close the position. Both approaches support partial liquidation, where the initiator specifies the amount of position to be taken over or forcibly closed. DISCLAIMER This document serves solely for informational purposes. It is not intended as investment guidance, a suggestion, or an invitation to engage in the buying or selling of any products or investments. It should not be employed for assessing the appropriateness of any investment choices, nor should it be considered a source of accounting, legal, or tax counsel, or investment suggestions. The views expressed in this document are those of the authors at the time of publication and are not made on behalf of SynFutures. They may not necessarily represent the perspectives of SynFutures or individuals associated with the project. The expressed opinions are subject to change without notice or updates. – 10 –
프로젝트로 돌아가기