Last active
December 20, 2021 14:12
-
-
Save aesedepece/d5c27c0ae2312937472274738bcd96f1 to your computer and use it in GitHub Desktop.
Witnet example: read Bitcoin price from Witnet price feed on Ethereum Rinkeby
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.5.0 <0.9.0; | |
import "witnet-solidity-bridge/contracts/interfaces/IWitnetPriceFeed.sol"; | |
contract MyContract { | |
function readBitcoinPriceFromWitnetPriceFeed() external view returns(int256) { | |
// The address below shall be different for each price feed and blockchain | |
IWitnetPriceFeed IWitnetPriceFeed = IERC2362(address("0xccAe308C9b91a3e3De8E0Dd4136Ce0Bb608e6ea4")); | |
int256 value = priceFeed.lastPrice(); | |
return value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment