What is the GammaSwap protocol? A detailed explanation of the blockchain GammaSwap

The GammaSwap protocol is a protocol for going long on gamma through constant function market makers (CFMMs) such as Uniswap, Sushiswap, Balancer, etc. GammaSwap allows users to not only buy long straddles, but also earn themselves returns similar to the functionality of call and put options.

GammaSwap Oracle-free decentralized platform for volatility trading and commission-free token trading

The GammaSwap protocol is a protocol for going long on gamma through constant function market makers (CFMMs) such as Uniswap, Sushiswap, Balancer, etc. GammaSwap allows users to not only buy long straddles, but also earn themselves returns similar to the functionality of call and put options.

As a side benefit, the protocol also allows for the possibility of fee-free DEX.

What is GammaSwap Protocol Blockchain-1

The GammaSwap protocol cannot function without the existence of volatility sellers. Those are the liquidity providers for CFMMs.

Liquidity providers will provide liquidity to CFMMs, just as they currently do, the difference is that they will provide liquidity through GammaSwap. That is, LPs will send their tokens to GammaSwap, and GammaSwap will deposit them into CFMMs (such as Uniswap, Pancakeswap, etc.) in exchange for LP tokens.

However, these LP tokens from other CFMMs will not be provided to liquidity providers who short Gamma. Instead, they will remain in GammaSwap. GammaSwap will issue its own GammaSwap liquidity pool tokens, which are the same as the liquidity pool tokens in CFMMs, such as Uniswap (such as ERC-20 tokens), representing the liquidity providers' shares in the CFMM liquidity pool.

What is GammaSwap Protocol Blockchain-2

When liquidity providers seek to withdraw their deposited liquidity, they will exchange GammaSwap liquidity pool tokens for reserve tokens. To do this, GammaSwap measures their representation in the CFMM’s liquidity pool tokens, then destroys the tokens and uses the CFMM’s liquidity pool tokens to withdraw the tokens deposited by liquidity providers.

The accrued fees from GammaSwap wrapped AMM pools will be credited to GammaSwap liquidity providers along with the additional funding rate paid by those who borrow LP tokens to long volatility.

The incentive to provide liquidity on GammaSwap is that you will earn higher returns on your LP positions. The only additional risk is the additional smart contract risk that LPs incur from using GammaSwap, which can be mitigated through audits and bug bounties.

What is GammaSwap Protocol Blockchain-3

It is assumed that the assets provided as liquidity are borrowed and therefore hedged.

What is GammaSwap Protocol Blockchain-4
k is the price of one asset relative to another, α is the annual yield of the CFMM from trading fees, g_d is the additional annual yield that GammaSwap pays to depositors from borrowed liquidity tokens, t is the time (in years), and r is the annual interest rate that the liquidity provider borrows the asset to ensure that he is hedged against changes in the asset price (assuming that he does not need to provide collateral as is common in DeFi lending protocols).

A graphical representation of the reward function for providing liquidity through GammaSwap assuming that the asset is borrowed as liquidity is as follows. For comparison, I added the rewards for providing liquidity to CFMMs outside of GammaSwap.

What is GammaSwap Protocol Blockchain-5

At any point in time, liquidity providers providing liquidity through GammaSwap are performing better than those providing liquidity directly through CFMMs.

What is GammaSwap Protocol Blockchain-6
The returns from shorting an asset (borrowing today and selling to buy back at a future date) are the opposite of going long an asset (buying today and selling at a future date).

If providing liquidity to a CFMM enables a short Gamma position, then selling short liquidity from a CFMM will enable a long Gamma position. CFMM liquidity can be shorted by borrowing liquidity from the CFMM and withdrawing the reserve tokens it represents and holding them, turning impermanent losses into impermanent gains. Impermanent gains are the ability of borrowers to buy more LP tokens with their reserve tokens.

The borrower will of course also owe transaction fees for the borrowed liquidity.

What is GammaSwap Protocol Blockchain-7
All variables are the same as in the previous function.

A graphical representation of this returned function is as follows

What is GammaSwap Protocol Blockchain-8
The r variable will be the interest on lending the reserve tokens to earn a yield which will reduce the cost of trading fee earnings in the CFMM.

Unfortunately, CFMM platforms do not allow borrowing liquidity. This is what makes GammaSwap different from other liquidity provision platforms.

The GammaSwap protocol aggregates liquidity tokens from popular CFMMs such as Uniswap, Pancakeswap, Sushiswap, etc. to allow them to be lent to other users who want to achieve long-term gamma exposure.

The GammaSwap protocol lends liquidity deposited into CFMMs by extracting reserve tokens and holding them as collateral in the GammaSwap smart contract. GammaSwap tracks the rate at which reserve tokens are extracted, as well as the price of the tokens at the time the borrower took out the loan. The impermanent loss experienced by the lender becomes the impermanent gain for the liquidity borrower. In exchange, the liquidity borrower will incur interest on the liquidity they borrowed plus the transaction fees accrued by the CFMM liquidity.

Since the liquidity token debt could grow larger than the liquidity reserve tokens she withdraws, the liquidity borrower will have to overcollateralize to ensure there is enough funds to acquire the liquidity tokens and pay the accrued returns on transaction fees and interest from liquidity providers.

The process of building a long position in Gamma is described as follows:

What is GammaSwap Protocol Blockchain-9
The liquidity borrower receives an NFT (ERC-721) that he can use to identify his long Gamma position in the GammaSwap smart contract.

Since the LP's impermanent loss becomes the borrower's impermanent gain, the borrower will obtain a long gamma position, whose return can be expressed by the following function

What is GammaSwap Protocol Blockchain-10
The variable g_b is the interest rate that GammaSwap charges liquidity borrowers for borrowing liquidity from the platform. All other variables are the same as in the previous function.

The graphical representation of the above function is as follows

What is GammaSwap Protocol Blockchain-11
Although it may be possible to lend reserve tokens from the liquidity drawn at r, this is likely impossible without adequate risk measures. Therefore, r is likely to be 0.

Since the borrowed liquidity will not be inside the CFMM, no transaction fees will be charged from the CFMM.

For this reason, GammaSwap will track the transaction fees generated by CFMM using the following function

What is GammaSwap Protocol Blockchain-12
x and y are the reserve assets, L is the invariant which is the geometric mean of the reserve assets in a CFMM like Uniswap. LP_Shares is the number of liquidity pool shares in a CFMM. The formula for the return on trading fees in a CFMM is essentially the growth of the invariant divided by the growth of the liquidity pool shares.

GammaSwap is able to track liquidity providers’ returns by processing loans based on the invariants they represent in the CFMM rather than on LP shares.

The yield that LPs earn in CFMMs is an invariant growth that is a geometric mean of reserves in platforms like Uniswap, not a change in LP shares. Therefore, all interest owed by borrowers and paid to lenders is tracked in the form of additional invariant units from the CFMM.

What is GammaSwap Protocol Blockchain-13

The accrued interest owed by borrowers will be tracked by an ever-increasing index within GammaSwap, the growth rate of which will vary based on the pool's utilization rate. This growth rate represents the actual interest charged to borrowers. Since the utilization rate is always less than 1, the lending yield paid to depositors (liquidity providers) is always lower than the borrowing yield.

What is GammaSwap Protocol Blockchain-14
Function f(*) is based on the interest rate model used by AAVE. Future implementations may use different interest rate models. U_optimal is the optimal utilization rate. When the utilization rate exceeds U_optimal, the interest rate will rise faster to stimulate the increase of liquidity and the closing of loans. The number 2,336,000 comes from the number of blocks produced by Ethereum in a year, with an average block rate of one block every 13.5 seconds.

From the above functions, functions can be derived to calculate the total amount collected from borrowers and paid to lenders in the pool at any given time. These functions are as follows

What is GammaSwap Protocol Blockchain-15

So. As the available liquidity to borrow dries up through a utilization rate approaching 1, the platform’s interest will rise, which will incentivize LPs to provide liquidity through GammaSwap.

Conversely, when it falls, it will incentivize borrowers to short liquidity through GammaSwap.

What is GammaSwap Protocol Blockchain-16

Each liquidity loan will also track the block in the Ethereum blockchain, the number of GammaSwap borrow indexes it started at, and the borrowed liquidity. The interest accrued by the borrower will always be calculated using the following formula

What is GammaSwap Protocol Blockchain-17

When the liquidity borrower is ready to close a position, he simply closes the position.

Liquidity borrowers will either lose collateral or gain reserve tokens, depending on the price delta of the token pair in the CFMM minus transaction fees and GammaSwap interest paid to LPs.

The process of closing a loan is as follows:

What is GammaSwap Protocol Blockchain-18

The borrower initiates a liquidation in GammaSwap. The smart contract calculates the LP tokens of accrued interest that the loan represents and deposits enough reserve tokens into the CFMM to receive those LP tokens to repay the liquidity providers. The borrower then receives the remainder of her collateral plus the impermanent return she earned on price changes minus the interest she owes from trading fees accrued to the CFMM and interest owed to the liquidity providers.

The result is a market where borrowers of liquidity pool shares pay the CFMM trading fee yield plus the GammaSwap borrow yield, and liquidity providers earn the CFMM trading fee yield plus the GammaSwap borrow yield.

What is GammaSwap Protocol Blockchain-1

The GammaSwap protocol not only creates the opportunity to buy straddles, but also customizes volatility exposure to approximate the returns of a call or put option. This is achieved by changing the proportion of tokens held as collateral in GammaSwap, which essentially changes the payment function of the impermanent return.

For example, suppose a gamma buyer decides to exchange delta units of token x for token y, such that the ratio of reserve tokens held as collateral from borrowed liquidity is now different from the ratio she held at the inception of the loan.

What is GammaSwap Protocol Blockchain-19
delta is a value between -1 and 1, exclusive.

Her return function now looks like this:

What is GammaSwap Protocol Blockchain-20
g is the GammaSwap borrowing rate.

Therefore, one can tilt the ratio more towards one token or the other and get a payoff function similar to a traditional call or put option.

What is GammaSwap Protocol Blockchain-21
Prefer Token x and benefit more from positive price movements.
What is GammaSwap Protocol Blockchain-22
Lean more towards token y and benefit more from negative price movements

You may have noticed that the amount that needs to be deposited as collateral has increased significantly in both cases. This is necessary to make the position immune to flash loan attacks. However, it is possible to finance such positions through loans on decentralized lending platforms such as Aave or Compound.

The calculation formula for the price when the position loss is the largest (maximum loss price) is as follows

What is GammaSwap Protocol Blockchain-23
P_0 is the initial price of borrowing liquidity

The liquidity represented by the collateral token at any point in time is given by the following formula

What is GammaSwap Protocol Blockchain-24

Since borrowed liquidity is constant and only grows with transaction fees and the GammaSwap borrow yield, we can use the formula above to see how much liquidity the collateral can provide at the maximum loss price (p_max)

What is GammaSwap Protocol Blockchain-25

Therefore, additional collateral needs to be added based on tokens x and y to ensure that the position remains overcollateralized above the required maintenance threshold at the p_max price.

By varying the proportion of reserve tokens used as collateral, you essentially gain a perpetual long volatility position that benefits more from a one-way directional movement in the market. This is similar to what you can achieve with a call or put option. However, the added benefit is that if the price moves against you, you may still have a gain.

Of course, if GammaSwap is used with a CFMM like Balancer, where the reserve token is already weighted to one side, the benefit of higher delta (the rate of change in the value of the position due to a change in the underlying price) as price moves in one direction will be more pronounced.

Since the loan may become undercollateralized if the transaction fees plus the accrued interest exceed the collateral amount to open the long Gamma position, there is an incentive to liquidate the loan.

That is, gamma buyers will be required to deposit collateral exceeding a certain threshold and maintain the collateral above a certain threshold, otherwise they will face third-party liquidation, and the third party will receive a certain percentage of the collateral compensation.

What is GammaSwap Protocol Blockchain-26

To do this, the GammaSwap protocol will emit events detailing information about the loan, which can be read by liquidation bots to track the health of the loan and constantly check the Ethereum blockchain.

What is GammaSwap Protocol Blockchain-27

Lending platforms often rely on oracles to ensure asset security. The lack of a strong oracle for each asset leads to a problem of a reduced number of assets available for lending.

Unfortunately, these platforms must rely on oracles because relying on CFMMs for pricing data makes them vulnerable to flash loan attacks, in which the price of collateral can be temporarily depressed enough to force the liquidation of otherwise healthy loans.

Fortunately for GammaSwap, due to the shape of its yield curve, price manipulation via flash loans can never drive the value of the collateral down to zero. The value of that collateral can always be reduced to the minimum (besides additional collateral to cover trading fee yields and interest) that all volatility buyers need to maintain in order to open a position.

What is GammaSwap Protocol Blockchain-28

This opens up the possibility for GammaSwap to provide long-term gamma exposure not only to a small number of token pairs, but also to the entire crypto space, without relying on third parties for price verification, as is the case with Aave and Compound.

Therefore, even brand new and untested projects can provide long-term volatility exposure to increase the returns of their token liquidity providers and reduce the risk of participating in such projects.

Although, given the current implementation of CFMMs, it is possible that an attacker could perform enough round trips on a CFMM (paying a small fee, typically 0.6%, on each buy and sell) to cause the return on trading fees to spike high enough, the likelihood of forcing the liquidation of some positions is low given the cost required to design such a malicious attack.

Nonetheless, we have systems in place on our platform to prevent such attacks.

The total revenue paid to liquidity providers consists of transaction fees plus interest, and GammaSwap provides pricing functionality for interest.

It is conceivable that if GammaSwap used another CFMM for the same token pair that did not charge users trading fees, then GammaSwap’s total yield would be at least as good as that of the CFMM that charged trading fees.

Since GammaSwap can buy and sell volatility, there will be arbitrage opportunities if GammaSwap yields are significantly lower than other CFMMs.

What is GammaSwap Protocol Blockchain-29

Therefore, CFMMs do not need to charge transaction fees to their users using our model. The role of traders in GammaSwap is not to pay liquidity providers for the risk they are taking, but to net the positions of Gamma buyers, who are the actual buyers of the risk that liquidity providers are selling. A two-way market in volatility will be more efficient than a traditional AMM that sells volatility in exchange for volume.

What is GammaSwap Protocol Blockchain-30
Liquidity borrowers pay liquidity providers the GammaSwap borrow yield. Therefore, token traders do not need to pay commissions to liquidity providers. Instead, their role is to update the positions of volatility buyers and sellers in exchange for facilitating their trades. The difference between borrow and deposit yields is the bid/ask price of volatility. A spread that can be found in all markets.

Therefore, since LPs do not need to be compensated for the risk they take using fees, GammaSwap can be used to run a fee-free DEX. Gamma sellers earn income from gamma buyers while offsetting their positions against gamma buyers using spot buyers and sellers who trade commission-free. In addition to zero-commission trading and trading convenience, spot traders net-increase their positions in GammaSwap. Gamma traders are motivated by arbitrage opportunities on other exchanges that have reserve tokens at different prices than GammaSwap.

GammaSwap Protocol. A protocol that enables volatility trading through perpetual derivatives similar to straddles, calls, and puts in traditional financial markets.

These new types of derivatives have never existed before. They are perpetual and netted through a floating swap rate determined by market forces. Another benefit is that they enable commission-free trading of any token pair. The hope of the project is to correct the current mispricing in decentralized volatility markets to support the growth of decentralized financial liquidity, thus ensuring that the future of finance is decentralized.

GammaSwap official website:https://gammaswap.com/

GammaSwap Testnet:https://app.gammaswap.com/

GammaSwap Free Tutorial DeFi Decentralized Trading Platform Arbitrum New Public Chain

1/5 - (2 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *