mirror of
https://github.com/lux-apps/papers.git
synced 2026-10-30 18:15:21 +00:00
Restructured from flat .tex/.pdf files into per-paper subdirectories. Added Antje Worring as co-author on all papers. Synced PDFs to pdfs/ for download site.
82 lines
2.1 KiB
TeX
82 lines
2.1 KiB
TeX
\section{GMX2 Integration}
|
|
|
|
|
|
\subsection{Liquidity Pool Model}
|
|
|
|
We adopt GMX2's GLP token model with enhancements:
|
|
|
|
\begin{lstlisting}[caption={Enhanced GLP Manager}]
|
|
contract EnhancedGLPManager {
|
|
struct PoolComposition {
|
|
address[] tokens;
|
|
uint256[] weights;
|
|
uint256[] utilizations;
|
|
uint256 totalValue;
|
|
}
|
|
|
|
function addLiquidity(
|
|
address token,
|
|
uint256 amount
|
|
) external returns (uint256 glpAmount) {
|
|
uint256 aum = getAUM();
|
|
uint256 tokenValue = getTokenValue(token, amount);
|
|
|
|
// Apply dynamic fees based on pool balance
|
|
uint256 fee = calculateDynamicFee(token, amount, true);
|
|
uint256 netValue = tokenValue.sub(fee);
|
|
|
|
glpAmount = aum == 0
|
|
? netValue
|
|
: netValue.mul(glpSupply).div(aum);
|
|
|
|
_mint(msg.sender, glpAmount);
|
|
vault.directPoolDeposit(token, amount);
|
|
|
|
emit AddLiquidity(msg.sender, token, amount, glpAmount);
|
|
}
|
|
}
|
|
\end{lstlisting}
|
|
|
|
\subsection{GLP Token Mechanics}
|
|
|
|
GLP represents liquidity provider shares with dynamic pricing:
|
|
|
|
\begin{equation}
|
|
\text{GLP}_{\text{price}} = \frac{\text{AUM} - \text{PnL}_{\text{traders}}}{\text{GLP}_{\text{supply}}}
|
|
\end{equation}
|
|
|
|
\subsection{Fee Distribution}
|
|
|
|
Fees flow to multiple recipients:
|
|
|
|
\begin{table}[h]
|
|
\centering
|
|
\begin{tabular}{|l|c|c|}
|
|
\hline
|
|
\textbf{Fee Type} & \textbf{Rate} & \textbf{Distribution} \\
|
|
\hline
|
|
Opening Fee & 0.1\% & 70\% LP, 30\% Treasury \\
|
|
Closing Fee & 0.1\% & 70\% LP, 30\% Treasury \\
|
|
Funding Fee & Variable & 100\% Counterparty \\
|
|
Liquidation Fee & 0.5\% & 50\% Liquidator, 50\% Insurance \\
|
|
Borrowing Fee & 0.01\%/hour & 100\% LP \\
|
|
\hline
|
|
\end{tabular}
|
|
\caption{Fee structure and distribution}
|
|
\end{table}
|
|
|
|
\subsection{Cross-Margin vs Isolated Margin}
|
|
|
|
Cross-margin shares collateral across positions:
|
|
|
|
\begin{equation}
|
|
M_{\text{account}} = C_{\text{total}} - \sum_{i} L_i - \sum_{i} F_i
|
|
\end{equation}
|
|
|
|
Isolated margin segregates risk:
|
|
|
|
\begin{equation}
|
|
M_{\text{position}} = C_{\text{position}} - L_{\text{position}} - F_{\text{position}}
|
|
\end{equation}
|
|
|