-
-
Save andrecronje/962932e2301f0b217c13f1ed0b7ca594 to your computer and use it in GitHub Desktop.
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
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.6; | |
interface v3oracle { | |
function assetToAsset(address, uint, address, uint) external view returns (uint); | |
} | |
contract ContractThatUsesOracle { | |
v3oracle constant oracle = v3oracle(0x0F1f5A87f99f0918e6C81F16E59F3518698221Ff); | |
function functionThatUsesOracle() external returns (uint) { | |
uint _twap = oracle.assetToAsset(TOKEN_FROM, TOKEN_FROM_AMOUNT, TOKEN_TO, TWAP_PERIOD); | |
//uint _twap = oracle.assetToAsset(ETH, 1e18, DAI, 3600); ~ 1 ETH to DAI over last 30 minutes | |
return _twap; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment