GMX (GMX)

From CryptoWiki

Revision as of 03:00, 9 December 2024 by Grand Master Pepe (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GMX is a popular decentralized derivatives exchange on Arbitrum and Avalanche (as of 8-2022) that specializes in perpetual contracts.

Basics

History

GMX launched in July 2021, transitioning from XVIX and Gambit tokens.

Audits & Exploits

  • Bug bounty program can be found here and goes up to $5M (22-8-2022).
  • V2 only scored 54%. Team is anon. No test results. "The protocol is audited and offers a significant bug bounty, but gaps in protocol and front-end monitoring could pose risks. Admin Controls: Information on code immutability and upgradeability is available, but details on admin addresses, roles, capabilities, and a transaction signing policy are lacking, important for governance understanding."
  • Scored 85% on DeFi Safety (22-4-2022):

GMX links every core smart contract to their respective source code locations in their GitHub. Although GMX does not have a public code coverage report, they certainly have a very in-depth testing suite. There is no visible test result report in any of GMX's documentation or GitHub repositories. GMX has not undergone a Formal Verification test. GMX has been audited once pre-launch by ABDK Consulting. Any major issues found were resolved by the GMX team, as mentioned here.

Bugs/Exploits

"I plotted users' selling habits after unstaking, and for example, found out that for a user with burned APY higher than 60%, there’s a >70% chance of selling the coins within 5 minutes of unstaking. Using this information one could build a probabilistic sandwich bot.. except I found there already is one! This MeV strategy sandwiches high volume unstaking actions, selling right after they unstake and buying back after they sell. Using this strategy they’ve generated 55 GMX (2270$) in 45 days. This strategy is probabilistically profitable as can be seen by the unstaking probability graph shown above, and is most efficient with large unstakers as they create the largest sandwich opportunity. Sometimes it fails as users don't sell, but mostly it works. GMX has been made aware and rewarded me with 500$ for this finding."

Governance

Admin Keys

"Admin Controls: Information on code immutability and upgradeability is available, but details on admin addresses, roles, capabilities, and a transaction signing policy are lacking, important for governance understanding."

"GMX details their admin control information at this location, which took a bit of searching since it does not reside in their main gitbooks repository, and is instead linked from it. GMX clearly mentions that the logic of their contracts is immutable, but peripheral functions such as fees and pricing calculations can be updated. As such, GMX contracts inherently do not possess an upgradeable structure. GMX contracts are controlled by a controlled account owned by the team. In addition, there is a Multisig consisting of advisors and community members. This multisig is composed of:  - Ben Simon - Han Wen - Krunal Amin GMX identifies all parameters that they can change/upgrade, and to what extent:  - Setting of swap and margin trading fees up to a maximum of 5% - Setting of token weights for the GLP pool, token weights affect the dynamic fees of swaps, these fees are such that a swap which increases the balance towards the specified token weight will be lower, while a swap that moves the token weight away from the desired amounts will have higher fees, the details of the calculation can be found from Vault.vaultUtils.getSwapFeeBasisPoints  - Pausing of swaps or leverage trading for emergency use  - Setting of the maximum allowed leverage  - Setting of maximum total capacity for long and short positions    Additional timelock parameters include:    - Listing of new tokens  - UpdatingVault.priceFeed  - UpdatingVault.vaultUtils, the VaultUtils contract validates the opening and closing of positions and also specifies how fees are calculated  - Updating of gov` values

Along with a clear explanation about the contracts' core logic being immutable, GMX details that any malicious transaction is sent, it is theoretically possible for a draining of all user funds to occur. However, any transaction that can enable this must pass through a rigorous process of internal verification, which leaves a lot of room for finding and mitigating such an event. GMX details this in clear, user friendly language:  

"In the event of a malicious transaction being sent, it is possible for all funds in the pool to be compromised. To mitigate this, all actions which can impact user funds must pass through the signal, time gap, execute process mentioned above. If a malicious transactions is detected through the monitoring process or Bug Bounty, a multi-sig consisting of advisors and community members can be used to override the Timelock.admin value, this would prevent the action from being executed. This also applies for actions such as pausing trading when there was no need to, in this case, the admin can be replaced by the multi-sig and trading can be re-activated".

GMX clearly explains that their pause function can be used to halt swapping or leverage trading. GMX's timelock has a duration of 28 days for token supply upgrades. GMX's additional timelock docs identify a 24 hour timelock for anything upgrade-related. GMX mentions that 24h was selected for this subsequent timelock as it allows them to "respond quickly to any issues that may occur"."

DAO

Treasury

Token

Launch

Token Allocation

  • From their docs (7-2022):

"The forecasted max supply is 13.25 million GMX tokens. The supply of GMX can be viewed on the Dashboard.

Minting beyond the max supply of 13.25 million is controlled by a 28 day timelock. This option will only be used if more products are launched and liquidity mining is required, a governance vote will be conducted before any changes.

6 million GMX from the XVIX and Gambit migration.

2 million GMX paired with ETH for liquidity on Uniswap.

2 million GMX reserved for vesting from Escrowed GMX rewards.

2 million GMX tokens to be managed by the floor price fund.

1 million GMX tokens reserved for marketing, partnerships and community developers.

250,000 GMX tokens distributed to the team linearly over 2 years."

Utility

Has a dual token system. From the website (22-8-2022):

"GMX is the utility and governance token. Accrues 30% of the platform's generated fees.

GLP is the liquidity provider token. Accrues 70% of the platform's generated fees."

Other Details

  • From their docs (7-2022):

"The GMX token has a floor price fund in ETH and GLP. It grows in two ways:

  1. GMX/ETH liquidity is provided and owned by the protocol, the fees from this trading pair will be converted to GLP and deposited into the floor price fund
  2. 50% of funds received through Olympus bonds are sent to the floor price fund, the other 50% is used for marketing

The current floor price fund is viewable on the Dashboard.

The floor price fund helps to ensure liquidity in GLP and provide a reliable stream of ETH rewards for all staked GMX. As the floor price fund grows, it can also be used to buyback and burn GMX if the (Floor Price Fund) / (Total Supply of GMX) is less than the market price, this would lead to a minimum price for GMX in terms of ETH and GLP."

Coin Distribution

  • Arthur Hayes is currently the largest individual holding address of $GMX (8-2-2023).
  • AIgod revealed he is one of the top token holders (3-12-2022). He also said he is not directly affiliated with GMX.

Technology

"With 220 commits and 7 branches, GMX's main software repository is robustly developed."

Implementations

How it works

"There is a liquidity pool GLP, a multi-asset pool that provides liquidity for margin trading: users can long/short & perform swaps via minting & burning GLP tokens. This pool earns LPs fees from swap and leverage trading which are distributed back to both GMX and GLP holders.

To do leverage trading, traders deposit collateral into the protocol. Traders can select the leverage up to 30x, and the higher the leverage, the higher the liquidation price which will increase gradually as borrow fee accrues to it.

When entering a long on ETH for example, a trader is ‘renting out’ the upside in ETH from the GLP pool; when entering a short on ETH, a trader is ‘renting out’ upside of the stablecoins versus ETH, from the GLP pool. But none of the assets in GLP pool is actually rented out. When the position is closed, if the trader wins, profits will be paid from GLP pool in the form of token being longed; otherwise, losses will be deducted from the collateral and paid into the pool. GLP pool profits from traders’ losses, and loses from traders’ profits.

In the process, traders pay swap fees, fees to open/close a position and borrow fees in return for the upside of longing/ shorting specified tokens (BTC, ETH, AVAX, UNI and LINK) against USD. If what a trader chooses to withdraw is different from the deposited collateral, it is regarded as a swap activity, and a swap fee will be charged as a % of collateral size.

GLP represents shares of a liquidity pool, which is like an index of assets used for swaps and leverage trading. It can be minted using any of asset in the index and burnt to redeem any index asset. GLP token price is the value of total worth of assets in index including UNREALIZED profits and losses of open positions divided by GLP supply. The underlying assumption is that every open position could be closed in the next second.

By minting and holding GLP tokens, LPs have exposure to the delta risk of the index of assets, i.e. holding a basket of crypto assets based on the current portion, so that if the market value of the pool increases after LPs deposit any specified crypto asset. Since GLP is minted based on the market value of the capital pool, new minting activities won't make existing LP holders better/ worse off.

Fees of minting/ burning GLP depend on if index assets are underweight/ overweight, i.e. weight of an asset in the index is below or above its target weight. If ETH is underweight, the fees for minting GLP by depositing ETH is lower and hence incentivized. How is target weight set? It is adjusted weekly based on open interest: if a lot of traders are long ETH on Arbitrum, GLP pool will set a higher ETH target weight, and vice versa with stable coins if a large proportion are short.

Instead of the standard Automated Market Maker model (AMM) (x*y=k), GMX uses dynamic aggregated oracle price feeds provided by Chainlink (sourced from Binance & FTX) to determine the ‘true price’ of an asset. This helps achieve zero slippage of executing market orders. This is because GMX just pulls prices in real time from CEXs to give traders the best execution, without arbitrageurs aligning the price difference of different DEXs. LP’s are also protected from impermanent loss, as they need not incur cost of price discovery."

"The protocol utilizes a unique model where users can act as the counterparty for traders on the DEX by providing liquidity to a basket of assets. This pool is known as GLP. GLP primarily consists of majors such as ETH and wBTC as well as stablecoins, and is designed to give index-type exposure to LPs.

To open positions on GMX, traders borrow from GLP, with a borrowing fee replacing the traditional funding rate. This, along with fees generated from traders opening positions, liquidations, and swaps are paid out in ETH or AVAX to GLP holders and GMX stakers at a 70/30 split."

  • From Bankless (16-8-2022):

"Its perpetual swap markets allowing traders to long or short major tokens with up to 30x leverage. When going long or short on GMX, the minimum leverage possible is 1.1x while the maximum allowed leverage is 30x. To start a perp trade, you’d first provide collateral in the form of one of GMX’s supported collateral types. After this, the protocol’s multi-asset liquidity pool would lend you the necessary funds to open your long or short position."

Fees

"In the process, traders pay swap fees, fees to open/close a position and borrow fees in return for the upside of longing/ shorting specified tokens (BTC, ETH, AVAX, UNI and LINK) against USD. If what a trader chooses to withdraw is different from the deposited collateral, it is regarded as a swap activity, and a swap fee will be charged as a % of collateral size."

  • From Bankless (16-8-2022):

"GMX charges an opening fee of 0.1% on your position size and a closing fee that charges the same. There is also an ongoing borrowing fee that margin traders must pay hourly to GMX LPs."

Upgrades

The second iteration of the GMX protocol went live on Arbitrum and Avalanche mainnet (3-8-2023):

"For Traders:

  1. New assets are now available for trading: these include SOL, XRP, LTC, DOGE, & ARB on Arbitrum, and SOL, XRP, LTC, and DOGE on Avalanche. Additional V2 markets will be added in the future.
  2. Multiple collateral types can be used for trading positions. For example, a 0.1 ETH position can be opened with 1 ETH of collateral, for a low-cost and low-leverage ETH long.
  3. Faster execution speed and lower slippage. The new oracle system signs prices every block. This helps to ensure that orders get executed at the closest execution price possible, even if there are a high number of transactions.
  4. Low-fee swaps of 5-7 bps. Traders now pay just 0.05% to 0.07% to swap between crypto assets.

For Liquidity Providers:

  1. Isolated pools: Liquidity in V2 is provided through isolated GM (GMX Market) Pools. This allows liquidity providers to customize their exposure to only the tokens which they prefer.
  2. Long / Short balancing incentives: V2 has increased incentives for open interest for longs and shorts to be balanced. This balance helps to automatically hedge liquidity providers against trader profits.
  3. Swap incentives: Increased swap incentives help to keep the tokens in the pool balanced, allowing the GM Pool token’s price to track the price of the underlying tokens more closely."

Staking

"Staking $GMX on the platform will get 30% of platform fees, esGMX and Multiplier Points. esGMX is an escrow model similar to ve-model of @CurveFinance but it does not have the hard-lock system. Instead, esGMX is vested in a year linearly if one chooses to claim the reward."

  • From their docs (7-2022):

"Staked GMX receives three types of rewards:

  1. Escrowed GMX
  2. Multiplier Points
  3. ETH / AVAX Rewards

30% of fees generated from swaps and leverage trading are converted to ETH / AVAX and distributed to staked GMX tokens. If you are staking on Arbitrum you would receive ETH, if you are staking on Avalanche then you would receive AVAX. Note that the fees distributed are based on the number after deducting referral rewards and the network costs of keepers, keeper costs are usually around 1% of the total fees.

Also has Escrowed GMX:

"Escrowed GMX (esGMX) can be used in two ways:

  1. Staked for rewards similar to regular GMX tokens
  2. Vested to become actual GMX tokens over a period of one year

Each staked Escrowed GMX token will earn the same amount of Escrowed GMX and ETH / AVAX rewards as a regular GMX token."

Validator Stats

Liquidity Mining

Scaling

Interoperability

For bridging between Arbitrum and Avalanche you can use Synapse (7-2022).

Other Details

Oracle Method

"GMX briefly mentions the use of Chainlink and TWAP oracles here. In addition, GMX fully breaks down their price feed architecture in their notion docs.

GMX mitigates front running attacks "through the two step transaction process, swap fees and KeeperDAO integration covered in the "Router" section". This information is documented in the GMX Notion docs. GMX outlines their flash loan exploit mitigation/prevention strategy in their Notion docs."

Their Other Projects

Roadmap

  • Can be found here (7-2022).

Usage

"Has crossed over $2.3B in cumulative volume. The project’s $260M+ total value locked (TVL) on Arbitrum makes it the largest dApp on the largest L2 as it stands today."

Projects that use or built on it

Competition

Pros and Cons

Pros

Cons

Team, Funding and Partners

Team

  • Full team can be found [here].
  • GMX is run by anonymous developers (22-4-2022).

Funding

Partners

(:

Knowledge empowers all and will help us get closer to the decentralized world we all want to live in!

Making these free wiki pages is fun but takes a lot of effort and time.

If you have enjoyed reading, tips are appreciated :) This will help us to keep expanding this archive of information.

ETH tip address: 0x83460bE5F218b1520B69D702cE60A1DE37dD8E31