-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from usmfum/feat/twap
Trim unused code
- Loading branch information
Showing
20 changed files
with
75 additions
and
696 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.