For the complete documentation index, see llms.txt. This page is also available as Markdown.

AGmxV2

AGmxV2

constructor

constructor() public

onlyDelegateCall

modifier onlyDelegateCall()

requiredVersion

function requiredVersion() external pure returns (string)

Returns the minimum implementation version to use an external application.

Adapters must implement it when modifying proxy state or storage.

Return Values

Name
Type
Description

[0]

string

String of the minimum supported version.

createIncreaseOrder

function createIncreaseOrder(struct IBaseOrderUtils.CreateOrderParams params) external returns (bytes32 orderKey)

Opens or increases a leveraged position via a GMX v2 market increase order.

Uses GMX's own CreateOrderParams. The adapter enforces safe values for receiver, cancellationReceiver, callbackContract, uiFeeReceiver, swapPath, executionFee, callbackGasLimit, shouldUnwrapNativeToken, referralCode, dataList, and orderType (always MarketIncrease) — caller-supplied values for these fields are ignored. Only addresses.market, addresses.initialCollateralToken, numbers.initialCollateralDeltaAmount, numbers.sizeDeltaUsd, numbers.acceptablePrice, and isLong are used from the caller.

Parameters

Name
Type
Description

params

struct IBaseOrderUtils.CreateOrderParams

GMX CreateOrderParams (security-critical fields are overridden by the adapter).

Return Values

Name
Type
Description

orderKey

bytes32

The unique key of the created GMX order.

createDecreaseOrder

Decreases or closes a leveraged position via a GMX v2 decrease order.

Uses GMX's own CreateOrderParams. The adapter enforces safe values for receiver, cancellationReceiver, callbackContract, uiFeeReceiver, swapPath, executionFee, callbackGasLimit, shouldUnwrapNativeToken, referralCode, dataList, and decreasePositionSwapType (always NoSwap) — caller-supplied values for these fields are ignored. Forcing NoSwap keeps the returned collateral in the already-tracked collateral token. The market's directional PnL token (longToken for longs, shortToken for shorts) is proactively tracked at increase time, so profits returned in that token are visible to NAV computation even for keeper-driven closes and liquidations. orderType must be one of MarketDecrease, LimitDecrease, or StopLossDecrease, otherwise the call reverts.

Parameters

Name
Type
Description

params

struct IBaseOrderUtils.CreateOrderParams

GMX CreateOrderParams (security-critical fields are overridden by the adapter).

Return Values

Name
Type
Description

orderKey

bytes32

The unique key of the created GMX order.

updateOrder

Updates size, price or fee of an existing pending GMX order.

Matches the GMX ExchangeRouter selector exactly. Tops up the execution fee automatically (same on-chain formula as createOrder). Only limit-type orders are updatable; calling on MarketIncrease/Decrease reverts at GMX level.

Parameters

Name
Type
Description

key

bytes32

The unique order key to update.

sizeDeltaUsd

uint256

New size delta in USD (GMX 10^30 precision).

acceptablePrice

uint256

New acceptable execution price.

triggerPrice

uint256

New trigger price for limit/stop-loss orders.

minOutputAmount

uint256

New minimum output amount.

validFromTime

uint256

New valid-from timestamp.

autoCancel

bool

New auto-cancel flag.

cancelOrder

Cancels a pending GMX order and recovers collateral / execution fees back to the pool.

Parameters

Name
Type
Description

key

bytes32

The order key to cancel.

claimFundingFees

Claims accumulated funding fees for one or more market/token pairs.

Matches the GMX ExchangeRouter selector exactly. Claimed tokens are always sent to the pool (address(this) in delegatecall context) regardless of the receiver argument. Claimed tokens are registered in the active tokens set when they have a valid price feed.

Parameters

Name
Type
Description

markets

address[]

Array of GMX market addresses to claim from.

tokens

address[]

Array of token addresses corresponding to each market.

address

claimCollateral

Claims collateral freed from positions where the negative price impact threshold was exceeded.

Matches the GMX ExchangeRouter selector exactly. Claimed tokens are always sent to the pool (address(this) in delegatecall context) regardless of the receiver argument. Claimed tokens are registered in the active tokens set when they have a valid price feed. Note: the deployed GMX ExchangeRouter reverts with an arithmetic underflow when claimable amount is zero — callers must only invoke this when collateral is claimable.

Parameters

Name
Type
Description

markets

address[]

Array of GMX market addresses to claim from.

tokens

address[]

Array of token addresses corresponding to each market.

timeKeys

uint256[]

Array of time bucket keys identifying each claimable collateral batch.

address

Last updated