Last active
September 4, 2020 16:38
-
-
Save PatrickAlphaC/0dc6a3113a1bfea0b1e8c9bef77d87f7 to your computer and use it in GitHub Desktop.
Kovan LTC/USD Price feed for Chainlink. Deploy using: https://remix.ethereum.org/#version=soljson-v0.6.7+commit.b8d736ae.js&optimize=false&evmVersion=null&gist=0dc6a3113a1bfea0b1e8c9bef77d87f7
This file contains hidden or 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 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