medium

Setter functions for core GMX contracts

Contest
Reward

Total

285.84 USDC

52.93 USDC
Selected
74.11 USDC
52.93 USDC
52.93 USDC
Selected Submission

Setter functions for core GMX contracts

Severity

Medium Risk

Relevant GitHub Links

https://github.com/gmx-io/gmx-synthetics#known-issues

Summary

GMX docs state that their ExchangeRouter and GMXOracle contracts will change as new logic is added. Therefore setter functions should be added to GMXVault.sol to be able to update the state variables storing those addressed when the need arises.

Vulnerability Details

From the GMX docs:

If using contracts such as the ExchangeRouter, Oracle or Reader do note that their addresses will change as new logic is added

Impact

Not being able to use the ExchangeRouter and GMXOracle contracts the protocol would effectively be unusable given their importance.

Tools Used

Manual Review

Recommendations

Create setter functions in GMXVault.sol as below:

  function updateExchangeRouter(address exchangeRouter) external onlyOwner {
    _store.exchangeRouter = exchangeRouter;
    emit ExchangeRouterUpdated(exchangeRouter);
  }

  function updateGMXOracle(address gmxOracle) external onlyOwner {
    _store.gmxOracle = gmxOracle;
    emit GMXOracleUpdated(gmxOracle);
  }