Skip to content

Commit

Permalink
Clean code (#328)
Browse files Browse the repository at this point in the history
* Oracle updates from #310 (#324)

* push oracle updates from #310

* update tests

* manually revert #279 (#325)

* apply needed changes from 279 (#326)

* revert 312 (#327)

* apply more changes from 310

* add missing file
  • Loading branch information
haythem96 authored Dec 28, 2020
1 parent 7125c64 commit 856290c
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 1,305 deletions.
33 changes: 23 additions & 10 deletions contracts/Oracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,16 @@ contract Oracle is Ownable {
* @return True if locking period is over, False if not
*/
function isLockingPeriodOver(address _asset, uint256 _expiryTimestamp) public view returns (bool) {
address pricer = assetPricer[_asset];
uint256 lockingPeriod = pricerLockingPeriod[pricer];
uint256 price = stablePrice[_asset];

if (price == 0) {
address pricer = assetPricer[_asset];
uint256 lockingPeriod = pricerLockingPeriod[pricer];

return now > _expiryTimestamp.add(lockingPeriod);
}

return now > _expiryTimestamp.add(lockingPeriod);
return true;
}

/**
Expand All @@ -159,15 +165,22 @@ contract Oracle is Ownable {
* @return True if dispute period is over, False if not
*/
function isDisputePeriodOver(address _asset, uint256 _expiryTimestamp) public view returns (bool) {
// check if the pricer has a price for this expiry timestamp
Price memory price = storedPrice[_asset][_expiryTimestamp];
if (price.timestamp == 0) {
return false;
uint256 price = stablePrice[_asset];

if (price == 0) {
// check if the pricer has a price for this expiry timestamp
Price memory price = storedPrice[_asset][_expiryTimestamp];
if (price.timestamp == 0) {
return false;
}

address pricer = assetPricer[_asset];
uint256 disputePeriod = pricerDisputePeriod[pricer];

return now > price.timestamp.add(disputePeriod);
}

address pricer = assetPricer[_asset];
uint256 disputePeriod = pricerDisputePeriod[pricer];
return now > price.timestamp.add(disputePeriod);
return true;
}

/**
Expand Down
115 changes: 0 additions & 115 deletions contracts/external/callees/Trade0x.sol

This file was deleted.

89 changes: 0 additions & 89 deletions contracts/external/proxies/CERC20Proxy.sol

This file was deleted.

15 changes: 0 additions & 15 deletions contracts/interfaces/CERC20Interface.sol

This file was deleted.

15 changes: 0 additions & 15 deletions contracts/interfaces/CETHInterface.sol

This file was deleted.

48 changes: 0 additions & 48 deletions contracts/interfaces/ZeroXExchangeInterface.sol

This file was deleted.

25 changes: 0 additions & 25 deletions contracts/mocks/Mock0xERC20Proxy.sol

This file was deleted.

Loading

0 comments on commit 856290c

Please sign in to comment.