Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
NatSpec for MedianOracle
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnaguib committed May 2, 2019
1 parent 7630865 commit 2adc411
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions contracts/MedianOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ contract MedianOracle is Ownable, IOracle {
providerReports[providerAddress][0].timestamp=1;
providerReports[providerAddress][1].timestamp=1;
}

/**
* @notice Computes median of provider reports that their timestamps are in
* the valid timestamp range.
* @notice Computes median of provider reports whose timestamps are in the
* valid timestamp range.
* @return AggregatedValue: Median of providers reported values.
* valid: Boolean indicating an aggregated value was computed successfully.
*/
Expand Down
11 changes: 10 additions & 1 deletion contracts/lib/Select.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";

/**
* @title Select
* @dev Median Selection Library
*/
library Select {
using SafeMath for uint256;

// Sorts the input array up to the denoted size, and returns the median.
/**
* @dev Sorts the input array up to the denoted size, and returns the median.
* @param array Input array to compute its median.
* @param size Number of elements in array to compute the median for.
* @return Median of array.
*/
function computeMedian(uint256[] array, uint256 size)
internal
pure
Expand Down
2 changes: 0 additions & 2 deletions test/unit/select.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO(naguib): Fail tests if gas utilization changes
// TODO(naguib): Consider Adding more test scenarios
const SelectMock = artifacts.require('SelectMock');

const BigNumber = web3.BigNumber;
Expand Down

0 comments on commit 2adc411

Please sign in to comment.