Guest User

USD Hedge Token Template

a guest
Sep 27th, 2022
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.7;
  3.  
  4. import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
  5. import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
  6.  
  7.  
  8. contract USDHedge is ERC20 {
  9.  
  10. AggregatorV3Interface internal priceFeed;
  11.  
  12. constructor() ERC20ERC20, Permit, Ownable("USDHedge", "USDH") {
  13. _mint(msg.sender, 25000000); //The token supply
  14. priceFeed = AggregatorV3Interface(0x773616E4d11A78F511299002da57A0a94577F1f4);
  15. }
  16. /*
  17. * Returns the latest price
  18. */
  19. function getLatestPrice() public view returns (int) {
  20. (
  21. /*uint80 roundID*/,
  22. int price,
  23. /*uint startedAt*/,
  24. /*uint timeStamp*/,
  25. /*uint80 answeredInRound*/
  26. ) = priceFeed.latestRoundData();
  27. return price;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment