Skip to content

Commit 856290c

Browse files
authored
Clean code (#328)
* 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
1 parent 7125c64 commit 856290c

18 files changed

+82
-1305
lines changed

contracts/Oracle.sol

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,16 @@ contract Oracle is Ownable {
146146
* @return True if locking period is over, False if not
147147
*/
148148
function isLockingPeriodOver(address _asset, uint256 _expiryTimestamp) public view returns (bool) {
149-
address pricer = assetPricer[_asset];
150-
uint256 lockingPeriod = pricerLockingPeriod[pricer];
149+
uint256 price = stablePrice[_asset];
150+
151+
if (price == 0) {
152+
address pricer = assetPricer[_asset];
153+
uint256 lockingPeriod = pricerLockingPeriod[pricer];
154+
155+
return now > _expiryTimestamp.add(lockingPeriod);
156+
}
151157

152-
return now > _expiryTimestamp.add(lockingPeriod);
158+
return true;
153159
}
154160

155161
/**
@@ -159,15 +165,22 @@ contract Oracle is Ownable {
159165
* @return True if dispute period is over, False if not
160166
*/
161167
function isDisputePeriodOver(address _asset, uint256 _expiryTimestamp) public view returns (bool) {
162-
// check if the pricer has a price for this expiry timestamp
163-
Price memory price = storedPrice[_asset][_expiryTimestamp];
164-
if (price.timestamp == 0) {
165-
return false;
168+
uint256 price = stablePrice[_asset];
169+
170+
if (price == 0) {
171+
// check if the pricer has a price for this expiry timestamp
172+
Price memory price = storedPrice[_asset][_expiryTimestamp];
173+
if (price.timestamp == 0) {
174+
return false;
175+
}
176+
177+
address pricer = assetPricer[_asset];
178+
uint256 disputePeriod = pricerDisputePeriod[pricer];
179+
180+
return now > price.timestamp.add(disputePeriod);
166181
}
167182

168-
address pricer = assetPricer[_asset];
169-
uint256 disputePeriod = pricerDisputePeriod[pricer];
170-
return now > price.timestamp.add(disputePeriod);
183+
return true;
171184
}
172185

173186
/**

contracts/external/callees/Trade0x.sol

Lines changed: 0 additions & 115 deletions
This file was deleted.

contracts/external/proxies/CERC20Proxy.sol

Lines changed: 0 additions & 89 deletions
This file was deleted.

contracts/interfaces/CERC20Interface.sol

Lines changed: 0 additions & 15 deletions
This file was deleted.

contracts/interfaces/CETHInterface.sol

Lines changed: 0 additions & 15 deletions
This file was deleted.

contracts/interfaces/ZeroXExchangeInterface.sol

Lines changed: 0 additions & 48 deletions
This file was deleted.

contracts/mocks/Mock0xERC20Proxy.sol

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)