GMXOracle.sol#L280: function `getLpTokenAmount` icorrectly assumes that the returned price is in 18 decimal places. But it is 30 decimal places.
`GMXOracle` oracle has a function getLpTokenAmount which is in scope. This is Used in keeper script to calculate how much LP tokens for given USD value.\\nThis function returns the `lpTokenAmount` with 30 decimal places instead of 18 as the function assumes.\\nLets look at the function getLpTokenAmount\\n```\\n  /**\\n    * @notice Get token A and token B's LP token amount required for a given value\\n    * @param givenValue Given value needed, expressed in 1e30 -------------------------- refer this\\n    * @param marketToken LP token address\\n    * @param indexToken Index token address\\n    * @param longToken Long token address\\n    * @param shortToken Short token address\\n    * @param isDeposit Boolean for deposit or withdrawal\\n    * @param maximize Boolean for minimum or maximum price\\n    * @return lpTokenAmount Amount of LP tokens; expressed in 1e18 --------------> refer this\\n  */\\n  function getLpTokenAmount(\\n    uint256 givenValue,\\n    address marketToken,\\n    address indexToken,\\n    address longToken,\\n    address shortToken,\\n    bool isDeposit,\\n    bool maximize\\n  ) public view returns (uint256) {\\n    uint256 _lpTokenValue = getLpTokenValue(\\n      marketToken,\\n      indexToken,\\n      longToken,\\n      shortToken,\\n      isDeposit,\\n      maximize\\n    );\\n\\n\\n    return givenValue * SAFE_MULTIPLIER / _lpTokenValue;\\n  }\\n```\\n\\nSAFE_MULTIPLIER is in 18 decimal places.\\nThe values returned from the function `_lpTokenValue` is in 18 decimal places. Refer the line\\nSo the final returned value from the function `getLpTokenAmount` is (1e30 * 1e18) / 1e18 = 1e30
GMXOracle.sol#L280: function `getLpTokenAmount` icorrectly assumes that the returned price is in 18 decimal places. But it is 30 decimal places.\\nUpdate the function `getLpTokenAmount` as shown below.\\n```\\n  function getLpTokenAmount(\\n    uint256 givenValue,\\n    address marketToken,\\n    address indexToken,\\n    address longToken,\\n    address shortToken,\\n    bool isDeposit,\\n    bool maximize\\n  ) public view returns (uint256) {\\n    uint256 _lpTokenValue = getLpTokenValue(\\n      marketToken,\\n      indexToken,\\n      longToken,\\n      shortToken,\\n      isDeposit,\\n      maximize\\n    );\\n\\n    return givenValue * SAFE_MULTIPLIER / _lpTokenValue; ------ remove\\n\\n    return (givenValue * SAFE_MULTIPLIER) / (_lpTokenValue * 1e12); ---- add\\n   \\n  }\\n```\\n
Overestimating the lpToken amount for the given USD value.
```\\n  /**\\n    * @notice Get token A and token B's LP token amount required for a given value\\n    * @param givenValue Given value needed, expressed in 1e30 -------------------------- refer this\\n    * @param marketToken LP token address\\n    * @param indexToken Index token address\\n    * @param longToken Long token address\\n    * @param shortToken Short token address\\n    * @param isDeposit Boolean for deposit or withdrawal\\n    * @param maximize Boolean for minimum or maximum price\\n    * @return lpTokenAmount Amount of LP tokens; expressed in 1e18 --------------> refer this\\n  */\\n  function getLpTokenAmount(\\n    uint256 givenValue,\\n    address marketToken,\\n    address indexToken,\\n    address longToken,\\n    address shortToken,\\n    bool isDeposit,\\n    bool maximize\\n  ) public view returns (uint256) {\\n    uint256 _lpTokenValue = getLpTokenValue(\\n      marketToken,\\n      indexToken,\\n      longToken,\\n      shortToken,\\n      isDeposit,\\n      maximize\\n    );\\n\\n\\n    return givenValue * SAFE_MULTIPLIER / _lpTokenValue;\\n  }\\n```\\n