Skip to content
Verified contractPartialMIT

EnergyPriceConsumer

Address0x67fa9ec72fde1eb383defdc738ca1f75499cff91
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.7.4

 

Same code

Only this contract

 

Details

Compiler
solc 0.7.4+commit.3f05b770
Language
solidity
Optimization
No
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
11,700,952
Creation transaction
0xcd67d60e5c…ca1276bfc1

EnergyPriceConsumer.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.4;


interface AggregatorV3Interface {

  function decimals() external view returns (uint8);
  function description() external view returns (string memory);
  function version() external view returns (uint256);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

}


contract EnergyPriceConsumer {
    AggregatorV3Interface internal priceFeed;

    /**
     * Network: Mainnet
     * Aggregator: Energy
     * Address: 0x5F7C321bea2C79882eeC6fdB72F03873d3aEdF12
     */
    constructor() {
        priceFeed = AggregatorV3Interface(0x5F7C321bea2C79882eeC6fdB72F03873d3aEdF12);
    }

    /**
     * Returns the latest price
     */
    function getLatestPrice() public view returns (int) {
        (
            uint80 roundID, 
            int price,
            uint startedAt,
            uint timeStamp,
            uint80 answeredInRound
        ) = priceFeed.latestRoundData();
        return price;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 0,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.