# GMX > On-chain contract: GMX. 118 functions, 21 events. MCP endpoint: https://gmx.mcp.junct.dev/mcp Domain: derivatives Auth: none ## Tools ## Read ### BASIS_POINTS_DIVISOR Calls BASIS_POINTS_DIVISOR(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### FUNDING_RATE_PRECISION Calls FUNDING_RATE_PRECISION(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### MAX_FEE_BASIS_POINTS Calls MAX_FEE_BASIS_POINTS(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### MAX_FUNDING_RATE_FACTOR Calls MAX_FUNDING_RATE_FACTOR(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### MAX_LIQUIDATION_FEE_USD Calls MAX_LIQUIDATION_FEE_USD(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### MIN_FUNDING_RATE_INTERVAL Calls MIN_FUNDING_RATE_INTERVAL(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### MIN_LEVERAGE Calls MIN_LEVERAGE(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### PRICE_PRECISION Calls PRICE_PRECISION(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### USDG_DECIMALS Calls USDG_DECIMALS(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### adjustForDecimals Calls adjustForDecimals(_amount: string, _tokenDiv: string, _tokenMul: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_amount` (string, required): uint256 (uint256, pass as decimal string). - `_tokenDiv` (string, required): address (Ethereum address, 0x-prefixed). - `_tokenMul` (string, required): address (Ethereum address, 0x-prefixed). ### allWhitelistedTokens [DISCOVERY] Calls allWhitelistedTokens(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns address. **Parameters:** - `param0` (string, required): uint256 (uint256, pass as decimal string). ### allWhitelistedTokensLength Calls allWhitelistedTokensLength(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### approvedRouters Calls approvedRouters(param0: string, param1: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). - `param1` (string, required): address (Ethereum address, 0x-prefixed). ### bufferAmounts Calls bufferAmounts(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### cumulativeFundingRates Calls cumulativeFundingRates(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### errorController Calls errorController(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns address. _No parameters required._ ### errors Calls errors(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns string. **Parameters:** - `param0` (string, required): uint256 (uint256, pass as decimal string). ### feeReserves Calls feeReserves(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### fundingInterval Calls fundingInterval(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### fundingRateFactor Calls fundingRateFactor(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### getDelta Calls getDelta(_indexToken: string, _size: string, _averagePrice: string, _isLong: boolean, _lastIncreasedTime: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns { _0: boolean, _1: string }. **Parameters:** - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_size` (string, required): uint256 (uint256, pass as decimal string). - `_averagePrice` (string, required): uint256 (uint256, pass as decimal string). - `_isLong` (boolean, required): bool. - `_lastIncreasedTime` (string, required): uint256 (uint256, pass as decimal string). ### getFeeBasisPoints Calls getFeeBasisPoints(_token: string, _usdgDelta: string, _feeBasisPoints: string, _taxBasisPoints: string, _increment: boolean). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_usdgDelta` (string, required): uint256 (uint256, pass as decimal string). - `_feeBasisPoints` (string, required): uint256 (uint256, pass as decimal string). - `_taxBasisPoints` (string, required): uint256 (uint256, pass as decimal string). - `_increment` (boolean, required): bool. ### getFundingFee Calls getFundingFee(_token: string, _size: string, _entryFundingRate: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_size` (string, required): uint256 (uint256, pass as decimal string). - `_entryFundingRate` (string, required): uint256 (uint256, pass as decimal string). ### getGlobalShortDelta Calls getGlobalShortDelta(_token: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns { _0: boolean, _1: string }. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### getMaxPrice Calls getMaxPrice(_token: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### getMinPrice Calls getMinPrice(_token: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### getNextAveragePrice Calls getNextAveragePrice(_indexToken: string, _size: string, _averagePrice: string, _isLong: boolean, _nextPrice: string, _sizeDelta: string, _lastIncreasedTime: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_size` (string, required): uint256 (uint256, pass as decimal string). - `_averagePrice` (string, required): uint256 (uint256, pass as decimal string). - `_isLong` (boolean, required): bool. - `_nextPrice` (string, required): uint256 (uint256, pass as decimal string). - `_sizeDelta` (string, required): uint256 (uint256, pass as decimal string). - `_lastIncreasedTime` (string, required): uint256 (uint256, pass as decimal string). ### getNextFundingRate Calls getNextFundingRate(_token: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### getNextGlobalShortAveragePrice Calls getNextGlobalShortAveragePrice(_indexToken: string, _nextPrice: string, _sizeDelta: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_nextPrice` (string, required): uint256 (uint256, pass as decimal string). - `_sizeDelta` (string, required): uint256 (uint256, pass as decimal string). ### getPosition Calls getPosition(_account: string, _collateralToken: string, _indexToken: string, _isLong: boolean). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns { _0: string, _1: string, _2: string, _3: string, _4: string, _5: string, _6: boolean, _7: string }. **Parameters:** - `_account` (string, required): address (Ethereum address, 0x-prefixed). - `_collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_isLong` (boolean, required): bool. ### getPositionDelta Calls getPositionDelta(_account: string, _collateralToken: string, _indexToken: string, _isLong: boolean). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns { _0: boolean, _1: string }. **Parameters:** - `_account` (string, required): address (Ethereum address, 0x-prefixed). - `_collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_isLong` (boolean, required): bool. ### getPositionFee Calls getPositionFee(_sizeDelta: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_sizeDelta` (string, required): uint256 (uint256, pass as decimal string). ### getPositionKey Calls getPositionKey(_account: string, _collateralToken: string, _indexToken: string, _isLong: boolean). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bytes32. **Parameters:** - `_account` (string, required): address (Ethereum address, 0x-prefixed). - `_collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_isLong` (boolean, required): bool. ### getPositionLeverage Calls getPositionLeverage(_account: string, _collateralToken: string, _indexToken: string, _isLong: boolean). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_account` (string, required): address (Ethereum address, 0x-prefixed). - `_collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_isLong` (boolean, required): bool. ### getRedemptionAmount Calls getRedemptionAmount(_token: string, _usdgAmount: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_usdgAmount` (string, required): uint256 (uint256, pass as decimal string). ### getRedemptionCollateral Calls getRedemptionCollateral(_token: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### getRedemptionCollateralUsd Calls getRedemptionCollateralUsd(_token: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### getTargetUsdgAmount Calls getTargetUsdgAmount(_token: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### getUtilisation Calls getUtilisation(_token: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### globalShortAveragePrices Calls globalShortAveragePrices(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### globalShortSizes Calls globalShortSizes(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### gov Calls gov(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns address. _No parameters required._ ### guaranteedUsd Calls guaranteedUsd(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### hasDynamicFees Calls hasDynamicFees(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. _No parameters required._ ### inManagerMode Calls inManagerMode(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. _No parameters required._ ### inPrivateLiquidationMode Calls inPrivateLiquidationMode(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. _No parameters required._ ### includeAmmPrice Calls includeAmmPrice(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. _No parameters required._ ### isInitialized Calls isInitialized(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. _No parameters required._ ### isLeverageEnabled Calls isLeverageEnabled(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. _No parameters required._ ### isLiquidator Calls isLiquidator(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### isManager Calls isManager(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### isSwapEnabled Calls isSwapEnabled(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. _No parameters required._ ### lastFundingTimes Calls lastFundingTimes(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### liquidationFeeUsd Calls liquidationFeeUsd(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### marginFeeBasisPoints Calls marginFeeBasisPoints(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### maxGasPrice Calls maxGasPrice(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### maxLeverage Calls maxLeverage(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### maxUsdgAmounts Calls maxUsdgAmounts(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### minProfitBasisPoints Calls minProfitBasisPoints(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### minProfitTime Calls minProfitTime(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### mintBurnFeeBasisPoints Calls mintBurnFeeBasisPoints(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### poolAmounts Calls poolAmounts(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### positions Calls positions(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns { size: string, collateral: string, averagePrice: string, entryFundingRate: string, reserveAmount: string, realisedPnl: string, lastIncreasedTime: string }. **Parameters:** - `param0` (string, required): bytes32 (32-byte hex string, 0x-prefixed). ### priceFeed Calls priceFeed(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns address. _No parameters required._ ### reservedAmounts Calls reservedAmounts(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### router Calls router(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns address. _No parameters required._ ### shortableTokens [DISCOVERY] Calls shortableTokens(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### stableFundingRateFactor Calls stableFundingRateFactor(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### stableSwapFeeBasisPoints Calls stableSwapFeeBasisPoints(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### stableTaxBasisPoints Calls stableTaxBasisPoints(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### stableTokens [DISCOVERY] Calls stableTokens(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### swapFeeBasisPoints Calls swapFeeBasisPoints(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### taxBasisPoints Calls taxBasisPoints(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### tokenBalances Calls tokenBalances(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### tokenDecimals Calls tokenDecimals(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### tokenToUsdMin Calls tokenToUsdMin(_token: string, _tokenAmount: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_tokenAmount` (string, required): uint256 (uint256, pass as decimal string). ### tokenWeights Calls tokenWeights(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### totalTokenWeights Calls totalTokenWeights(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### usdToToken Calls usdToToken(_token: string, _usdAmount: string, _price: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_usdAmount` (string, required): uint256 (uint256, pass as decimal string). - `_price` (string, required): uint256 (uint256, pass as decimal string). ### usdToTokenMax Calls usdToTokenMax(_token: string, _usdAmount: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_usdAmount` (string, required): uint256 (uint256, pass as decimal string). ### usdToTokenMin Calls usdToTokenMin(_token: string, _usdAmount: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_usdAmount` (string, required): uint256 (uint256, pass as decimal string). ### usdg Calls usdg(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns address. _No parameters required._ ### usdgAmounts Calls usdgAmounts(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ### useSwapPricing Calls useSwapPricing(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. _No parameters required._ ### validateLiquidation Calls validateLiquidation(_account: string, _collateralToken: string, _indexToken: string, _isLong: boolean, _raise: boolean). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns { _0: string, _1: string }. **Parameters:** - `_account` (string, required): address (Ethereum address, 0x-prefixed). - `_collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_isLong` (boolean, required): bool. - `_raise` (boolean, required): bool. ### whitelistedTokenCount Calls whitelistedTokenCount(). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns uint256. _No parameters required._ ### whitelistedTokens [DISCOVERY] Calls whitelistedTokens(param0: string). Read-only — does not modify contract state. Unrestricted — any address can call this read function. Returns bool. **Parameters:** - `param0` (string, required): address (Ethereum address, 0x-prefixed). ## Write ### addRouter Calls addRouter(_router: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_router` (string, required): address (Ethereum address, 0x-prefixed). ### buyUSDG Calls buyUSDG(_token: string, _receiver: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_receiver` (string, required): address (Ethereum address, 0x-prefixed). ### clearTokenConfig Calls clearTokenConfig(_token: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### decreasePosition Calls decreasePosition(_account: string, _collateralToken: string, _indexToken: string, _collateralDelta: string, _sizeDelta: string, _isLong: boolean, _receiver: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. Returns uint256. **Parameters:** - `_account` (string, required): address (Ethereum address, 0x-prefixed). - `_collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_collateralDelta` (string, required): uint256 (uint256, pass as decimal string). - `_sizeDelta` (string, required): uint256 (uint256, pass as decimal string). - `_isLong` (boolean, required): bool. - `_receiver` (string, required): address (Ethereum address, 0x-prefixed). ### directPoolDeposit Calls directPoolDeposit(_token: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### increasePosition Calls increasePosition(_account: string, _collateralToken: string, _indexToken: string, _sizeDelta: string, _isLong: boolean). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_account` (string, required): address (Ethereum address, 0x-prefixed). - `_collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_sizeDelta` (string, required): uint256 (uint256, pass as decimal string). - `_isLong` (boolean, required): bool. ### initialize Calls initialize(_router: string, _usdg: string, _priceFeed: string, _liquidationFeeUsd: string, _fundingRateFactor: string, _stableFundingRateFactor: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_router` (string, required): address (Ethereum address, 0x-prefixed). - `_usdg` (string, required): address (Ethereum address, 0x-prefixed). - `_priceFeed` (string, required): address (Ethereum address, 0x-prefixed). - `_liquidationFeeUsd` (string, required): uint256 (uint256, pass as decimal string). - `_fundingRateFactor` (string, required): uint256 (uint256, pass as decimal string). - `_stableFundingRateFactor` (string, required): uint256 (uint256, pass as decimal string). ### liquidatePosition Calls liquidatePosition(_account: string, _collateralToken: string, _indexToken: string, _isLong: boolean, _feeReceiver: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_account` (string, required): address (Ethereum address, 0x-prefixed). - `_collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `_indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `_isLong` (boolean, required): bool. - `_feeReceiver` (string, required): address (Ethereum address, 0x-prefixed). ### removeRouter Calls removeRouter(_router: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_router` (string, required): address (Ethereum address, 0x-prefixed). ### sellUSDG Calls sellUSDG(_token: string, _receiver: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_receiver` (string, required): address (Ethereum address, 0x-prefixed). ### setBufferAmount Calls setBufferAmount(_token: string, _amount: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_amount` (string, required): uint256 (uint256, pass as decimal string). ### setError Calls setError(_errorCode: string, _error: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_errorCode` (string, required): uint256 (uint256, pass as decimal string). - `_error` (string, required): string. ### setErrorController Calls setErrorController(_errorController: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_errorController` (string, required): address (Ethereum address, 0x-prefixed). ### setFees Calls setFees(_taxBasisPoints: string, _stableTaxBasisPoints: string, _mintBurnFeeBasisPoints: string, _swapFeeBasisPoints: string, _stableSwapFeeBasisPoints: string, _marginFeeBasisPoints: string, _liquidationFeeUsd: string, _minProfitTime: string, _hasDynamicFees: boolean). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_taxBasisPoints` (string, required): uint256 (uint256, pass as decimal string). - `_stableTaxBasisPoints` (string, required): uint256 (uint256, pass as decimal string). - `_mintBurnFeeBasisPoints` (string, required): uint256 (uint256, pass as decimal string). - `_swapFeeBasisPoints` (string, required): uint256 (uint256, pass as decimal string). - `_stableSwapFeeBasisPoints` (string, required): uint256 (uint256, pass as decimal string). - `_marginFeeBasisPoints` (string, required): uint256 (uint256, pass as decimal string). - `_liquidationFeeUsd` (string, required): uint256 (uint256, pass as decimal string). - `_minProfitTime` (string, required): uint256 (uint256, pass as decimal string). - `_hasDynamicFees` (boolean, required): bool. ### setFundingRate Calls setFundingRate(_fundingInterval: string, _fundingRateFactor: string, _stableFundingRateFactor: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_fundingInterval` (string, required): uint256 (uint256, pass as decimal string). - `_fundingRateFactor` (string, required): uint256 (uint256, pass as decimal string). - `_stableFundingRateFactor` (string, required): uint256 (uint256, pass as decimal string). ### setGov Calls setGov(_gov: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_gov` (string, required): address (Ethereum address, 0x-prefixed). ### setInManagerMode Calls setInManagerMode(_inManagerMode: boolean). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_inManagerMode` (boolean, required): bool. ### setInPrivateLiquidationMode Calls setInPrivateLiquidationMode(_inPrivateLiquidationMode: boolean). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_inPrivateLiquidationMode` (boolean, required): bool. ### setIsLeverageEnabled Calls setIsLeverageEnabled(_isLeverageEnabled: boolean). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_isLeverageEnabled` (boolean, required): bool. ### setIsSwapEnabled Calls setIsSwapEnabled(_isSwapEnabled: boolean). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_isSwapEnabled` (boolean, required): bool. ### setLiquidator Calls setLiquidator(_liquidator: string, _isActive: boolean). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_liquidator` (string, required): address (Ethereum address, 0x-prefixed). - `_isActive` (boolean, required): bool. ### setManager Calls setManager(_manager: string, _isManager: boolean). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_manager` (string, required): address (Ethereum address, 0x-prefixed). - `_isManager` (boolean, required): bool. ### setMaxGasPrice Calls setMaxGasPrice(_maxGasPrice: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_maxGasPrice` (string, required): uint256 (uint256, pass as decimal string). ### setMaxLeverage Calls setMaxLeverage(_maxLeverage: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_maxLeverage` (string, required): uint256 (uint256, pass as decimal string). ### setPriceFeed Calls setPriceFeed(_priceFeed: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_priceFeed` (string, required): address (Ethereum address, 0x-prefixed). ### setTokenConfig Calls setTokenConfig(_token: string, _tokenDecimals: string, _tokenWeight: string, _minProfitBps: string, _maxUsdgAmount: string, _isStable: boolean, _isShortable: boolean). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_tokenDecimals` (string, required): uint256 (uint256, pass as decimal string). - `_tokenWeight` (string, required): uint256 (uint256, pass as decimal string). - `_minProfitBps` (string, required): uint256 (uint256, pass as decimal string). Value in basis points (e.g. 500 = 5%, 10000 = 100%). - `_maxUsdgAmount` (string, required): uint256 (uint256, pass as decimal string). - `_isStable` (boolean, required): bool. - `_isShortable` (boolean, required): bool. ### setUsdgAmount Calls setUsdgAmount(_token: string, _amount: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_amount` (string, required): uint256 (uint256, pass as decimal string). ### swap Calls swap(_tokenIn: string, _tokenOut: string, _receiver: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. Returns uint256. **Parameters:** - `_tokenIn` (string, required): address (Ethereum address, 0x-prefixed). - `_tokenOut` (string, required): address (Ethereum address, 0x-prefixed). - `_receiver` (string, required): address (Ethereum address, 0x-prefixed). ### updateCumulativeFundingRate Calls updateCumulativeFundingRate(_token: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). ### upgradeVault Calls upgradeVault(_newVault: string, _token: string, _amount: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. No return value. **Parameters:** - `_newVault` (string, required): address (Ethereum address, 0x-prefixed). - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_amount` (string, required): uint256 (uint256, pass as decimal string). ### withdrawFees Calls withdrawFees(_token: string, _receiver: string). Write function — may have access control restrictions (e.g. onlyOwner). Check contract source for modifier requirements before calling. Returns uint256. **Parameters:** - `_token` (string, required): address (Ethereum address, 0x-prefixed). - `_receiver` (string, required): address (Ethereum address, 0x-prefixed). ## Event ### BuyUSDG Event emitted by the contract. Subscribe via log filters. **Parameters:** - `account` (string, required): address (Ethereum address, 0x-prefixed). - `token` (string, required): address (Ethereum address, 0x-prefixed). - `tokenAmount` (string, required): uint256 (uint256, pass as decimal string). - `usdgAmount` (string, required): uint256 (uint256, pass as decimal string). - `feeBasisPoints` (string, required): uint256 (uint256, pass as decimal string). ### ClosePosition Event emitted by the contract. Subscribe via log filters. **Parameters:** - `key` (string, required): bytes32 (32-byte hex string, 0x-prefixed). - `size` (string, required): uint256 (uint256, pass as decimal string). - `collateral` (string, required): uint256 (uint256, pass as decimal string). - `averagePrice` (string, required): uint256 (uint256, pass as decimal string). - `entryFundingRate` (string, required): uint256 (uint256, pass as decimal string). - `reserveAmount` (string, required): uint256 (uint256, pass as decimal string). - `realisedPnl` (string, required): int256 (int256, pass as decimal string). ### CollectMarginFees Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `feeUsd` (string, required): uint256 (uint256, pass as decimal string). - `feeTokens` (string, required): uint256 (uint256, pass as decimal string). ### CollectSwapFees Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `feeUsd` (string, required): uint256 (uint256, pass as decimal string). - `feeTokens` (string, required): uint256 (uint256, pass as decimal string). ### DecreaseGuaranteedUsd Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `amount` (string, required): uint256 (uint256, pass as decimal string). ### DecreasePoolAmount Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `amount` (string, required): uint256 (uint256, pass as decimal string). ### DecreasePosition Event emitted by the contract. Subscribe via log filters. **Parameters:** - `key` (string, required): bytes32 (32-byte hex string, 0x-prefixed). - `account` (string, required): address (Ethereum address, 0x-prefixed). - `collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `collateralDelta` (string, required): uint256 (uint256, pass as decimal string). - `sizeDelta` (string, required): uint256 (uint256, pass as decimal string). - `isLong` (boolean, required): bool. - `price` (string, required): uint256 (uint256, pass as decimal string). - `fee` (string, required): uint256 (uint256, pass as decimal string). ### DecreaseReservedAmount Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `amount` (string, required): uint256 (uint256, pass as decimal string). ### DecreaseUsdgAmount Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `amount` (string, required): uint256 (uint256, pass as decimal string). ### DirectPoolDeposit Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `amount` (string, required): uint256 (uint256, pass as decimal string). ### IncreaseGuaranteedUsd Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `amount` (string, required): uint256 (uint256, pass as decimal string). ### IncreasePoolAmount Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `amount` (string, required): uint256 (uint256, pass as decimal string). ### IncreasePosition Event emitted by the contract. Subscribe via log filters. **Parameters:** - `key` (string, required): bytes32 (32-byte hex string, 0x-prefixed). - `account` (string, required): address (Ethereum address, 0x-prefixed). - `collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `collateralDelta` (string, required): uint256 (uint256, pass as decimal string). - `sizeDelta` (string, required): uint256 (uint256, pass as decimal string). - `isLong` (boolean, required): bool. - `price` (string, required): uint256 (uint256, pass as decimal string). - `fee` (string, required): uint256 (uint256, pass as decimal string). ### IncreaseReservedAmount Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `amount` (string, required): uint256 (uint256, pass as decimal string). ### IncreaseUsdgAmount Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `amount` (string, required): uint256 (uint256, pass as decimal string). ### LiquidatePosition Event emitted by the contract. Subscribe via log filters. **Parameters:** - `key` (string, required): bytes32 (32-byte hex string, 0x-prefixed). - `account` (string, required): address (Ethereum address, 0x-prefixed). - `collateralToken` (string, required): address (Ethereum address, 0x-prefixed). - `indexToken` (string, required): address (Ethereum address, 0x-prefixed). - `isLong` (boolean, required): bool. - `size` (string, required): uint256 (uint256, pass as decimal string). - `collateral` (string, required): uint256 (uint256, pass as decimal string). - `reserveAmount` (string, required): uint256 (uint256, pass as decimal string). - `realisedPnl` (string, required): int256 (int256, pass as decimal string). - `markPrice` (string, required): uint256 (uint256, pass as decimal string). ### SellUSDG Event emitted by the contract. Subscribe via log filters. **Parameters:** - `account` (string, required): address (Ethereum address, 0x-prefixed). - `token` (string, required): address (Ethereum address, 0x-prefixed). - `usdgAmount` (string, required): uint256 (uint256, pass as decimal string). - `tokenAmount` (string, required): uint256 (uint256, pass as decimal string). - `feeBasisPoints` (string, required): uint256 (uint256, pass as decimal string). ### Swap Event emitted by the contract. Subscribe via log filters. **Parameters:** - `account` (string, required): address (Ethereum address, 0x-prefixed). - `tokenIn` (string, required): address (Ethereum address, 0x-prefixed). - `tokenOut` (string, required): address (Ethereum address, 0x-prefixed). - `amountIn` (string, required): uint256 (uint256, pass as decimal string). - `amountOut` (string, required): uint256 (uint256, pass as decimal string). - `amountOutAfterFees` (string, required): uint256 (uint256, pass as decimal string). - `feeBasisPoints` (string, required): uint256 (uint256, pass as decimal string). ### UpdateFundingRate Event emitted by the contract. Subscribe via log filters. **Parameters:** - `token` (string, required): address (Ethereum address, 0x-prefixed). - `fundingRate` (string, required): uint256 (uint256, pass as decimal string). ### UpdatePnl Event emitted by the contract. Subscribe via log filters. **Parameters:** - `key` (string, required): bytes32 (32-byte hex string, 0x-prefixed). - `hasProfit` (boolean, required): bool. - `delta` (string, required): uint256 (uint256, pass as decimal string). ### UpdatePosition Event emitted by the contract. Subscribe via log filters. **Parameters:** - `key` (string, required): bytes32 (32-byte hex string, 0x-prefixed). - `size` (string, required): uint256 (uint256, pass as decimal string). - `collateral` (string, required): uint256 (uint256, pass as decimal string). - `averagePrice` (string, required): uint256 (uint256, pass as decimal string). - `entryFundingRate` (string, required): uint256 (uint256, pass as decimal string). - `reserveAmount` (string, required): uint256 (uint256, pass as decimal string). - `realisedPnl` (string, required): int256 (int256, pass as decimal string). ## Usage Connect to this MCP server at `https://gmx.mcp.junct.dev/mcp`. All tools are callable via the MCP protocol. Call `BASIS_POINTS_DIVISOR` first to query current state before any write operations. Write operations like `addRouter` return data or calldata for agent use.