GMXDeployment

Documentation for eth_defi.gmx.whitelist.GMXDeployment Python class.

class GMXDeployment

Bases: object

GMX 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

exchange_router

GMX ExchangeRouter contract address

synthetics_router

GMX SyntheticsRouter contract address

order_vault

GMX OrderVault contract address

markets

List of GMX market addresses to whitelist for trading

tokens

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
Returns

GMXDeployment configured for Arbitrum mainnet.

Raises

ValueError – If addresses cannot be fetched from the GMX API.

Return type

eth_defi.gmx.whitelist.GMXDeployment

__init__(exchange_router, synthetics_router, order_vault, markets=<factory>, tokens=None)
Parameters
Return type

None