Skip to content

Instantly share code, notes, and snippets.

@aesedepece
Last active December 20, 2021 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aesedepece/d5c27c0ae2312937472274738bcd96f1 to your computer and use it in GitHub Desktop.
Save aesedepece/d5c27c0ae2312937472274738bcd96f1 to your computer and use it in GitHub Desktop.
Witnet example: read Bitcoin price from Witnet price feed on Ethereum Rinkeby
// 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