Product Recipe
How to provide Perpetual Futures Trade
Under developing Page
The following describes how the flow actually takes place when the user enters each value such as aperp=ETH amount and asquart=Squart amount.
How to make Squart(√ETH)
First, the Uniswap v3 LP position shall be minted with the following Tokens:
requiredeth=2asquart(p1−pb1)
requiredusdc=2asquart(p−pa)
where, m=Margin, p=ETH price, Pa=LowerPricerange and Pa=HigerPricerange.
In addition, add the following Token to retrieve Squart(√ETH).
offseteth=2asquartpb1
offsetusdc=2asquartpa
Therefore, the total Token amount of each of the above is required. See this Paper for detailed instructions.
Trading (entry position creation)
First, Exchange ETH and USDC with Uniswap.
SwappedForSquart=p′∗(requiredeth+offseteth)
entryperp=p′∗aperp
entrysquart=requiredusdc+offsetusdc+SwappedForSquart
where, p′=ETH Pricetrade and The unit on the left side of the formula is the value (unit price x quantity).
Position's Value and Vault's Value
vp=p∗aperp−entryperp+p∗asquart−entrysquart
VaultValue=vp+m
Asset and Debt Concept
Treat the following as an ASSET for positive cases and a DEBT for negative cases.
asseteth=aperp+offseteth
assetusdc=−entryperp−entrysquart+offsetusdc
As shown in this Paper, the OFFSET changes depending on the relocation of the range.
Reallocate Position
Protocol temporarily undertakes the liability when it relocates in place of User. This is expressed as Reallocation. The new debt needed at this time, or the debt to be returned, is as follows:
RequiredETH=2TotalSquartAmount(paprev1−pacurrent1)
RequiredUSDC=2TotalSquartAmount(pbprev−pbcurrent)
On the next trade, the debt is transferred to the trader by updating the offset.
offseteth←offseteth+2asquart(paprev1−pacurrent1)
offsetusdc←offsetusdc+2asquart(pbprev−pbcurrent)
The interest payments that occur while the protocol is shouldering the debt accumulate as ReallocationFeeGrowth.
Fee
This is expressed as a premium when considered as Option and as an interest rate when considered as Lending. The User earns Fee income from the Asset and pays a Fee on the Debt.
Debt Value
The settlement penalty is 0.05% of this debtValue.
Min Deposit
minValueWithinRange=min(v(pR),v(Rp))
minDeposit=PositionValue−minValueWithinRange
Where, R = risk params and it sets as 1.2.
Liquidation Price
Find √X satisfy vx=minDeposit
x1=2aperp(−asquart+asquart2−aperp∗(−entryperp−entryperp+m))∗R
x2=2aperp∗R(−asquart−asquart2−aperp∗(−entryperp−entryperp+m))
Margin Available
VaultValue=Margin+PositionValue
MarginUtilizing=Min.Deposit
MarginAvailable=VaultValue−MarginUtilizing
Withdraw−ableMargin=min(MarginAvailable,Margin)
Last updated