Skip to content

Commit

Permalink
Merge pull request #64 from usmfum/feat/twap
Browse files Browse the repository at this point in the history
Trim unused code
  • Loading branch information
jacob-eliosoff authored Dec 2, 2020
2 parents 8a3a47c + 97440c8 commit 77f45a7
Show file tree
Hide file tree
Showing 20 changed files with 75 additions and 696 deletions.
9 changes: 0 additions & 9 deletions contracts/mocks/GasMeasuredChainlinkOracle.sol

This file was deleted.

9 changes: 0 additions & 9 deletions contracts/mocks/GasMeasuredCompoundOpenOracle.sol

This file was deleted.

9 changes: 0 additions & 9 deletions contracts/mocks/GasMeasuredMakerOracle.sol

This file was deleted.

21 changes: 0 additions & 21 deletions contracts/mocks/GasMeasuredMedianOracle.sol

This file was deleted.

23 changes: 0 additions & 23 deletions contracts/mocks/GasMeasuredOracle.sol

This file was deleted.

32 changes: 32 additions & 0 deletions contracts/mocks/GasMeasuredOracleWrapper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.6.6;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "../oracles/Oracle.sol";
import "@nomiclabs/buidler/console.sol";

contract GasMeasuredOracleWrapper is Oracle {
using SafeMath for uint;

Oracle internal immutable measuredOracle;
string internal oracleName;

constructor(Oracle oracle, string memory name) public {
measuredOracle = oracle;
oracleName = name;
}

function latestPrice() public virtual override view returns (uint price) {
uint gasStart = gasleft();
price = measuredOracle.latestPrice();
uint gasEnd = gasleft();
console.log(" ", oracleName, "oracle.latestPrice() cost: ", gasStart.sub(gasEnd));
}

function cacheLatestPrice() public virtual override returns (uint price) {
uint gasStart = gasleft();
price = measuredOracle.cacheLatestPrice();
uint gasEnd = gasleft();
console.log(" ", oracleName, "oracle.cacheLatestPrice() cost: ", gasStart.sub(gasEnd));
}
}
10 changes: 0 additions & 10 deletions contracts/mocks/GasMeasuredOurUniswapV2SpotOracle.sol

This file was deleted.

14 changes: 0 additions & 14 deletions contracts/mocks/GasMeasuredOurUniswapV2TWAPOracle.sol

This file was deleted.

15 changes: 0 additions & 15 deletions contracts/mocks/GasMeasuredUniswapMedianSpotOracle.sol

This file was deleted.

21 changes: 0 additions & 21 deletions contracts/mocks/GasMeasuredUniswapMedianTWAPOracle.sol

This file was deleted.

10 changes: 0 additions & 10 deletions contracts/mocks/MockMakerMedianizer.sol

This file was deleted.

3 changes: 1 addition & 2 deletions contracts/mocks/TestOracle.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.6.6;

import "./GasMeasuredOracle.sol";
import "./SettableOracle.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract TestOracle is GasMeasuredOracle("test"), SettableOracle, Ownable {
contract TestOracle is SettableOracle, Ownable {
uint internal savedPrice;

constructor(uint p) public {
Expand Down
32 changes: 0 additions & 32 deletions contracts/oracles/MakerOracle.sol

This file was deleted.

32 changes: 0 additions & 32 deletions contracts/oracles/OurUniswapV2SpotOracle.sol

This file was deleted.

5 changes: 4 additions & 1 deletion contracts/oracles/OurUniswapV2TWAPOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ contract OurUniswapV2TWAPOracle is Oracle {
CumulativePrice private storedPriceB;

/**
* See OurUniswapV2SpotOracle for example pairs to pass in.
* Example pairs to pass in:
* ETH/USDT: 0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852, false, 18, 6 (WETH reserve is stored w/ 18 dec places, USDT w/ 18)
* USDC/ETH: 0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc, true, 6, 18 (USDC reserve is stored w/ 6 dec places, WETH w/ 18)
* DAI/ETH: 0xa478c2975ab1ea89e8196811f51a7b7ade33eb11, true, 18, 18 (DAI reserve is stored w/ 18 dec places, WETH w/ 18)
*/
constructor(IUniswapV2Pair uniswapPair, uint token0Decimals, uint token1Decimals, bool tokensInReverseOrder) public {
pair = OurUniswap.createPair(uniswapPair, token0Decimals, token1Decimals, tokensInReverseOrder);
Expand Down
52 changes: 0 additions & 52 deletions contracts/oracles/UniswapMedianSpotOracle.sol

This file was deleted.

Loading

0 comments on commit 77f45a7

Please sign in to comment.