Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Numerator/Denominator for fixidity in SortedOracles #1365

Closed
mcortesi opened this issue Oct 16, 2019 · 1 comment · Fixed by #2885
Closed

Replace Numerator/Denominator for fixidity in SortedOracles #1365

mcortesi opened this issue Oct 16, 2019 · 1 comment · Fixed by #2885
Assignees
Labels
audit Priority: P2 Major protocol All issues relating to protocol packages stake-off-bubble Issues under the Stake Off Engineering Bubble

Comments

@mcortesi
Copy link
Contributor

mcortesi commented Oct 16, 2019

Expected Behavior

  function report(
    address token,
    uint256 numerator,
    uint256 denominator,
    address lesserKey,
    address greaterKey
  )

should have only value which should be a fixidity value.

This also means we should change our oracles that use this API and contractkit

In Exchange, change:

  function getOracleExchangeRate() private view returns (FractionUtil.Fraction memory) {
    uint256 rateNumerator;
    uint256 rateDenominator;
    (rateNumerator, rateDenominator) =
      ISortedOracles(registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID)).medianRate(stable);
    return FractionUtil.Fraction(rateNumerator, rateDenominator);
  }

to use fixidity

In GasPriceMinimun; change

/**
   * @notice Retrieve the current gas price minimum for a currency.
   * @param tokenAddress The currency the gas price should be in (defaults to gold).
   * @return current gas price minimum in the requested currency
   */
  function getGasPriceMinimum(address tokenAddress) external view returns (uint256) {
    if (
      tokenAddress == address(0) ||
      tokenAddress == registry.getAddressForOrDie(GOLD_TOKEN_REGISTRY_ID)
    ) {
      return gasPriceMinimum;
    } else {

      ISortedOracles sortedOracles = ISortedOracles(
        registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID)
      );
      uint256 rateNumerator;
      uint256 rateDenominator;
      (rateNumerator, rateDenominator) = sortedOracles.medianRate(tokenAddress);
      return (gasPriceMinimum.mul(rateNumerator).div(rateDenominator));
    }
  }
@mcortesi mcortesi added the protocol All issues relating to protocol packages label Oct 16, 2019
@BatiGencho
Copy link
Contributor

reserved for evgeni@limechain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit Priority: P2 Major protocol All issues relating to protocol packages stake-off-bubble Issues under the Stake Off Engineering Bubble
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants