Perpetual DEX Module
The perpetual side of Amara is forked from GMX and adapted to run natively on Odyssey Chain. It provides leverage trading through a vault-based collateral model, backed by smart contracts that manage deposits, orders, liquidations, and fees.
Vault At the heart of the perpetual system is the Vault contract. Liquidity providers deposit assets such as USDC, DIONE into this vault. These assets serve as collateral for traders opening long and short positions. The Vault tracks balances, applies profit and loss from open trades, and ensures that withdrawals are only possible when funds are available.
Router The Router acts as the main entry point for traders. When a user wants to open, adjust, or close a position, they submit the transaction through the Router. The Router validates inputs, interacts with the Vault to lock collateral, and creates an order record. It ensures a standardized workflow so that all positions follow the same lifecycle.
Position Manager The Position Manager is responsible for maintaining open trades. It handles leverage calculations, applies funding rates, and checks margin requirements. If a position falls below required thresholds, it flags it for liquidation. This module also integrates with the Oracle system to update positions with the latest price data.
Asynchronous Execution Flow Orders in Amara are executed asynchronously, mirroring GMX’s design. When a trader submits an order, it does not execute instantly. Instead:
The order is stored on-chain through the Router.
Off-chain keepers monitor pending orders.
Once conditions are met (such as price, time, or collateral checks), a keeper executes the order.
The Oracle provides the latest price feed at the moment of execution.
This design protects users from frontrunning and ensures fairness, as execution always uses the most recent validated price.
Fee Logic Fees in the perpetual system are dynamic. Beyond standard swap and funding fees, Amara introduces impact-based adjustments.
If a trade improves pool balance, it is charged a lower fee.
If a trade worsens pool balance, it incurs a higher fee. This mechanism discourages imbalances in collateral pools and incentivizes healthier market activity.
Market Utilities The perpetual module also includes supporting utilities:
Liquidation logic: Automatically closes undercollateralized positions.
Funding rate adjustments: Keeps long and short positions balanced over time.
Auto-deleveraging (ADL): Protects the protocol in extreme scenarios by partially reducing positions to stabilize the pool.
Together, these components allow Amara to run a secure, capital-efficient perpetual exchange with support for synthetic carbon credits and native Odyssey assets.
Last updated
