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

Commit

Permalink
More Natspec comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnaguib committed May 2, 2019
1 parent 9e14c67 commit 1a54af8
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions contracts/MedianOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,23 @@ contract MedianOracle is Ownable, IOracle {
// is usable.
uint256 public reportDelaySec;

// The minimum number of providers with valid reports needed to consider
// the aggregate report valid.
// The minimum number of providers with valid reports to consider the
// aggregate report valid.
uint256 public minimumProviders = 1;

// Timestamp of 1 is used to mark uninitialized and invalidated data.
// This is needed so that timestamp of 1 is always considered expired.
uint256 private constant MAX_REPORT_EXPIRATION_TIME = 10 years;

/**
* @param reportExpirationTimeSec_ The number of seconds after which the
* report is deemed expired.
* @param reportDelaySec_ The number of seconds since reporting that has to
* pass before a report is usable
* before a report is usable.
* @param minimumProviders_ The minimum number of providers with valid
* reports to consider the aggregate report valid.
*/
constructor(uint256 reportExpirationTimeSec_,
uint256 reportDelaySec_,
uint256 minimumProviders_)
Expand All @@ -65,7 +74,8 @@ contract MedianOracle is Ownable, IOracle {

/**
* @notice Sets the report expiration period.
* @param reportExpirationTimeSec_ The new report expiration period.
* @param reportExpirationTimeSec_ The number of seconds after which the
* report is deemed expired.
*/
function setReportExpirationTimeSec(uint256 reportExpirationTimeSec_)
external
Expand All @@ -75,13 +85,23 @@ contract MedianOracle is Ownable, IOracle {
reportExpirationTimeSec = reportExpirationTimeSec_;
}

/**
* @notice Sets the time period since reporting that has to pass before a
* report is usable.
* @param reportDelaySec_ The new delay period in seconds.
*/
function setReportDelaySec(uint256 reportDelaySec_)
external
onlyOwner
{
reportDelaySec = reportDelaySec_;
}

/**
* @notice Sets the minimum number of providers with valid reports to
* consider the aggregate report valid.
* @param minimumProviders_ The new minimum number of providers.
*/
function setMinimumProviders(uint256 minimumProviders_)
external
onlyOwner
Expand Down Expand Up @@ -125,7 +145,7 @@ contract MedianOracle is Ownable, IOracle {

/**
* @notice Computes median of provider reports whose timestamps are in the
* valid timestamp range.
* valid timestamp range.
* @return AggregatedValue: Median of providers reported values.
* valid: Boolean indicating an aggregated value was computed successfully.
*/
Expand Down

0 comments on commit 1a54af8

Please sign in to comment.