Contract Diff Checker

Contract Name:
TestChainlinkFeed

Contract Source Code:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

interface AggregatorV3Interface {
    /**
     * Returns the decimals to offset on the getLatestPrice call
     */
    function decimals() external view returns (uint8);

    /**
     * Returns the description of the underlying price feed aggregator
     */
    function description() external view returns (string memory);

    /**
     * Returns the version number representing the type of aggregator the proxy points to
     */
    function version() external view returns (uint256);

    /**
     * Returns price data about a specific round
     */
    function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

    /**
     * Returns price data from the latest round
     */
    function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./interfaces/AggregatorV3Interface.sol";

contract TestChainlinkFeed is AggregatorV3Interface {

  int256 private _answer;
  string private _description;
  
  constructor(int256 answer_, string memory description_) {
    _answer = answer_;
    _description = description_;
  }

  function setAnswer(int256 answer_) external {
    _answer = answer_;
  }
  
  function decimals() external view returns(uint8){
    return 8;
  }

  function description() external view returns(string memory){
    return _description;
  }

  function version() external view returns(uint256){
    return 1;
  }
  
  function getRoundData(uint80 _roundId) external view returns(
                                                               uint80 roundId,
                                                               int256 answer,
                                                               uint256 startedAt,
                                                               uint256 updatedAt,
                                                               uint80 answeredInRound
                                                               ){
    return (_roundId, _answer, block.timestamp, block.timestamp, 0);
  }

  function latestRoundData() external view returns(
                                                   uint80 roundId,
                                                   int256 answer,
                                                   uint256 startedAt,
                                                   uint256 updatedAt,
                                                   uint80 answeredInRound
                                                   ){
    return (0, _answer, block.timestamp, block.timestamp, 0);
  }
  
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):