Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SPDX-License-Identifier: MIT
- pragma solidity ^0.8.7;
- import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
- import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
- contract USDHedge is ERC20 {
- AggregatorV3Interface internal priceFeed;
- constructor() ERC20ERC20, Permit, Ownable("USDHedge", "USDH") {
- _mint(msg.sender, 25000000); //The token supply
- priceFeed = AggregatorV3Interface(0x773616E4d11A78F511299002da57A0a94577F1f4);
- }
- /*
- * Returns the latest price
- */
- function getLatestPrice() public view returns (int) {
- (
- /*uint80 roundID*/,
- int price,
- /*uint startedAt*/,
- /*uint timeStamp*/,
- /*uint80 answeredInRound*/
- ) = priceFeed.latestRoundData();
- return price;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment