MYX.Finance has completed the first major upgrade, forging the foundation of MYX’s trading ecosystem

MYX.Finance
7 min readJun 29, 2024

--

Since the launch of the MYX mainnet, we’ve witnessed incredible progress. In just a few months, MYX has handled over $23 billion in trading volume with a liquidity pool of just over $10 million. Our revolutionary Matching Pool Mechanism, which enables unlimited Open Interest with limited capital, has allowed us to offer fees and liquidity levels comparable to top-tier centralized exchanges.

Thanks to the unwavering support and enthusiasm from our community, we now feel confident that our engine can fulfill its purpose as the liquidity hub for perpetual DEXes. As a result, we’re thrilled to announce the first major upgrade since our launch. This upgrade marks MYX’s transition from its MVP stage to a more advanced and sophisticated perpetual DEX.

Scheduled for June 27th, this upgrade has been meticulously audited by our security partner, SlowMist. The focus is to create a comprehensive trading ecosystem, addressing a gap that most DEXes currently face.

Key features like the referral system, VIP system, and maker rebate system have been instrumental in the success of centralized exchanges (CEXs). These systems are crucial for acquiring new users, retaining existing ones, and providing deep liquidity. With our VIP system already in place, this upgrade will introduce a referral system and a maker rebate system, completing the foundation of MYX’s trading ecosystem.

Upgrade Content:

  1. Enhanced Order Execution Check

MYX employs extensive execution checks to safeguard intersts of LPs and traders. Prior to this upgrade, orders failing the execution check were canceled upon execution, which often led to unexpected cancellations of take profit and stop loss orders during large price fluctuations. This upgrade ensures that users’ TP/SL orders will be fulfilled even in the most turbulent market conditions.

The following check specifically contributes to unwanted cancellation of orders:

Relevant Execution Check Parameters:

  • Oracle Check: The deviation between the oracle price and the price sent by keepers must be within a certain configurable threshold.

Impact: cancels orders in extreme turbulent market conditions where the price is changing dramatically quickly such that the keeper prices sent in deviates significantly from current oracle price.

Fix: Optimized so that orders are not cancelled and guarantees execution of take profit/Stop loss orders

  • Slippage Tolerance: Users set a maximum slippage tolerance.

Impact: Orders could be cancelled unexpectedly when price is moving in the traders favor for too much

Fix: Adjust logic so that orders are executed if the prices are moving in the traders’ favor

New Slippage Check Rules:

  • Market Orders:

Buy Orders (Buy to Open/BTO; Buy to Close/BTC): Executed if the execution price ≤ user-set price * (1 + slippage), or else order is cancelled.

Sell Orders (Sell to Close/STC; Sell to Open/STO): Executed if the execution price ≥ user-set price * (1 — slippage), or else order is cancelled.

  • Other Types of Orders: Other types of orders, like limit orders, take-profit orders and stop-loss orders, will not be cancelled

Buy to Open (BTO): Executed if the execution price ≤ user-set price * (1 + slippage), order will not be cancelled even if the check is failed

Sell to Close (STC): Executed if the execution price ≥ user-set price * (1 — slippage), order will not be cancelled even if the check is failed

2. Upgraded Fee Determination Logic

Previously, MYX determined whether an order was a taker or maker based on the state of imbalance of open interests before the trade was executed. The new logic determines fees based on the estimated result of the trade’s execution on imbalance of available long and short liquidity, preventing incorrect fee categorization.

Key Changes:

  • Balancing Measurement:

Shift from balancing open interest to balancing available long and short liquidity. This adjustment allows MYX to list tokens with imbalanced pools, such as Solana on Linea, where the pool is composed entirely of stablecoins and the Solana exposure is synthetically created through short positions.

By maintaining a balanced available long/short, we aim to provide better liquidity and and reduced likelihood of automated deleveraging (ADL).

Defining the new Equilibrium Index(E): Equilibrium Index (E) = Available Long Liquidity — Available Short Liquidity

  • Fee Calculation:

Initial E (t0)> 0, LP assumes long exposures, if estimated execution of order satisfies the condition such that E (t0) > E (t1) ≥ 0 , maker fee is applied, otherwise taker fee is applied

Initial E (t0) < 0, LP assumes short exposures, if estimated execution of order satisfies the condition such that E (t0)<E (t1) ≤ 0, maker fee is applied, otherwise taker fee is applied

Initial E (t0) = 0, taker fee is charged.

3. Introducing Maker Rebate System

This upgrade introduces the ability for MYX to provide rebates to market makers who help balance the market.

New Features:

  1. Negative VIP Fees: Previously, VIP fees could only be positive, meaning the minimum fee charged was 0%. Now, fees can be set to negative, indicating a rebate for the users.
  2. Asynchronous Matching and Rebate Mechanism:

Challenge: Ensuring there are always enough fees to rebate and that the rebate does not exceed the fees collected.

Solution:

  • Negative Balance Allowance: Fee recipients can maintain a negative balance when there are not enough stablecoins for rebates. This effectively allows them to borrow from the pool temporarily and repay the loan when new fees are collected. Collection of fees is restricted when the claimable balance is negative due to temporary loans.
  • Dynamic Rebate Calculation: The rebate is calculated based on the LP’s entry price and the current market conditions. The formula ensures that makers receive a rebate only when they act in the best interest of LPs, encouraging optimal trading behavior.

Rebate Formula:

Rebate = Volume (coins)* LP Average Entry Price * Max(0, abs(Rebate Rate) + Min(0, LP PnL%))

A couple of noteworthy points in the formula are:

  1. Rebates are calculated based on LP’s average entry price. This prevents LP from paying more rebates than total fees collected in a hypothetical scenario where the price moved significantly higher after the position was taken by the LP
  2. Rebates can be reduced if LP is making a loss at the current price. When the LP is making a loss, the rebate rate goes from nominal rebate rate to a minimum of 0 when the LP’s loss exceeds the rebate rate. However, if the price fluctuates back to a level where the LP is making less losses or making profit, a full rebate is paid.

This ensures:

  1. LPs have a fixed cost for trades to be hedged.
  2. Makers are incentivized to hedge positions when LPs are not losing money.

4. Maker-Only Orders

Traders can now place a maker-only order that prevents them from being charged a taker fee due to incorrect volume. We added a new parameter into the maker-only orders, the Maximum Maker Amount, so that the execution amount of a maker-only order will be:

Maker-Only execution Volume = Min (Order Amount, Maximum Amount, Maximum Maker Amount)

Where Maximum Maker Amount is the amount of volume that will move the Equilibrium Index (E) back to precisely 0.

5. Decentralized Referral System

We are rolling out a referral system powered by a decentralized keeper network.

Keeper Network:

  • Responsibilities: Previously, the keeper network was responsible for listening and executing orders, as well as monitoring positions. Now, they will also track all traders’ monthly volume and their referral relationships.
  • Staking and Rewards: Keepers must stake a sufficient amount of MYX tokens to be eligible and are entitled to a portion of the fees for their services. Initially managed by MYX, this system will be decentralized once the MYX token is live.
  • Operational Details: The keeper network is decentralized and relies solely on public on-chain data and public rules to deterministically send correct parameters for all traders to smart contracts. It is designed to solve the challenge of tracking user volume and referral relationships directly in smart contracts across multiple chains.

Referral System Operation:

  • Tracking Volume and VIP Levels: Keepers will track volumes independently in a trustless manner. The fee structure and required volume to reach each VIP level are publicly written in configuration smart contracts, which can be updated by the DAO. When executing trades, Keepers calculate and input all traders’ VIP levels based on volume through public on-chain data and operate using the same rules.
  • Tracking Referral Relationships: When users accept invitations, they sign a message confirming their acceptance using their wallet. This signed message is stored on IPFS for all keepers to monitor. When executing trades, keepers will look up referral relationships and embed this information into transactions. Referral rebates are deducted before fees are distributed to fee recipients.

Conclusion

Implementing features like referral systems and VIP programs is simpler for protocols using centralized order books, whether operated by centralized exchanges or dedicated chains controlled by proprietary nodes.

At MYX, we embrace true decentralization, with our execution logic embedded in smart contracts deployable on any chain. This approach ensures transparency, credibility, privacy, and composability — key benefits of a truly decentralized protocol. However, it also presents challenges, such as optimizing capital efficiency and managing operational costs for systems like referrals and VIP programs.

Thanks to the dedication of our team and the support of our partners, we are addressing these challenges head-on, aiming to bring decentralized exchanges into the mainstream. We are fortunate to have such a supportive community and partners to grow with us.

We eagerly await your feedback on these upgrades and look forward to sharing more exciting developments with you soon!

--

--