Skip to content

Instantly share code, notes, and snippets.

@PatrickAlphaC
Last active September 4, 2020 16:38
Show Gist options
  • Save PatrickAlphaC/0dc6a3113a1bfea0b1e8c9bef77d87f7 to your computer and use it in GitHub Desktop.
Save PatrickAlphaC/0dc6a3113a1bfea0b1e8c9bef77d87f7 to your computer and use it in GitHub Desktop.
/** This example code is designed to quickly deploy an example contract using Remix.
* If you have never used Remix, try our example walkthrough: https://docs.chain.link/docs/example-walkthrough
* You will need testnet ETH and LINK.
* - Kovan ETH faucet: https://faucet.kovan.network/
* - Kovan LINK faucet: https://kovan.chain.link/
*/
pragma solidity ^0.6.7;
import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
contract PriceConsumerV3 {
AggregatorV3Interface internal priceFeed;
/**
* Network: Kovan
* Aggregator: LTC/USD
* Address: 0xCeE03CF92C7fFC1Bad8EAA572d69a4b61b6D4640
*/
constructor() public {
priceFeed = AggregatorV3Interface(0xCeE03CF92C7fFC1Bad8EAA572d69a4b61b6D4640);
}
/**
* Returns the latest price
*/
function getLatestPrice() public view returns (int) {
(
uint80 roundID,
int price,
uint startedAt,
uint timeStamp,
uint80 answeredInRound
) = priceFeed.latestRoundData();
return price;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment