GMXDeployment
Documentation for eth_defi.gmx.whitelist.GMXDeployment Python class.
- class GMXDeployment
Bases:
objectGMX deployment configuration for Guard whitelisting.
This dataclass encapsulates all GMX-related configuration needed when deploying a Lagoon vault with GMX perpetuals trading support. Pass an instance to
deploy_automated_lagoon_vault()to automatically whitelist GMX contracts and markets during deployment.Example:
# Recommended: use factory method with dynamic address fetch gmx_deployment = GMXDeployment.create_arbitrum( markets=[ "0x70d95587d40A2caf56bd97485aB3Eec10Bee6336", # ETH/USD "0x47c031236e19d024b42f8AE6780E44A573170703", # BTC/USD ], )Attributes summary
GMX ExchangeRouter contract address
GMX SyntheticsRouter contract address
GMX OrderVault contract address
List of GMX market addresses to whitelist for trading
Optional: specific tokens to whitelist as collateral If None, tokens are not explicitly whitelisted (use anyAsset or manual whitelisting)
Methods summary
__init__(exchange_router, synthetics_router, ...)create_arbitrum([markets, tokens])Create a GMXDeployment for Arbitrum mainnet with dynamically fetched addresses.
- exchange_router: eth_typing.evm.HexAddress
GMX ExchangeRouter contract address
- synthetics_router: eth_typing.evm.HexAddress
GMX SyntheticsRouter contract address
- order_vault: eth_typing.evm.HexAddress
GMX OrderVault contract address
- markets: list[eth_typing.evm.HexAddress]
List of GMX market addresses to whitelist for trading
- tokens: list[eth_typing.evm.HexAddress] | None
Optional: specific tokens to whitelist as collateral If None, tokens are not explicitly whitelisted (use anyAsset or manual whitelisting)
- classmethod create_arbitrum(markets=None, tokens=None)
Create a GMXDeployment for Arbitrum mainnet with dynamically fetched addresses.
Fetches the latest GMX contract addresses from the GMX contracts registry on GitHub, ensuring addresses are always up-to-date even after GMX upgrades.
- Parameters
markets (list[eth_typing.evm.HexAddress] | None) – List of market addresses to whitelist. If None, no markets are whitelisted.
tokens (list[eth_typing.evm.HexAddress] | None) – List of token addresses to whitelist as collateral.
- Returns
GMXDeployment configured for Arbitrum mainnet.
- Raises
ValueError – If addresses cannot be fetched from the GMX API.
- Return type
- __init__(exchange_router, synthetics_router, order_vault, markets=<factory>, tokens=None)
- Parameters
exchange_router (eth_typing.evm.HexAddress) –
synthetics_router (eth_typing.evm.HexAddress) –
order_vault (eth_typing.evm.HexAddress) –
markets (list[eth_typing.evm.HexAddress]) –
tokens (list[eth_typing.evm.HexAddress] | None) –
- Return type
None