Skip to content

Latest commit

 

History

History
332 lines (291 loc) · 10.3 KB

BProPriceFeed.md

File metadata and controls

332 lines (291 loc) · 10.3 KB

The BPro Price Feed contract.

  • This contract gets/sets the MoC (Money on Chain) address of its state contract and queries its method bproUsdPrice to get bPro/USD valuation. (BProPriceFeed.sol)

View Source: contracts/feeds/BProPriceFeed.sol

↗ Extends: IPriceFeedsExt, Ownable

BProPriceFeed contract

Contract Members

Constants & Variables

address public mocStateAddress;

Events

event SetMoCStateAddress(address indexed mocStateAddress, address  changerAddress);

Functions


constructor

Initializes a new MoC state. *

function (address _mocStateAddress) public nonpayable

Arguments

Name Type Description
_mocStateAddress address MoC state address
Source Code
constructor(address _mocStateAddress) public {
        setMoCStateAddress(_mocStateAddress);
    }

latestAnswer

undefined

Get BPro USD price. *

function latestAnswer() external view
returns(uint256)
Source Code
function latestAnswer() external view returns (uint256) {
        IMoCState _mocState = IMoCState(mocStateAddress);
        return _mocState.bproUsdPrice();
    }

latestTimestamp

Supposed to get the MoC update time, but instead get the current timestamp. *

function latestTimestamp() external view
returns(uint256)
Source Code
function latestTimestamp() external view returns (uint256) {
        return now; /// MoC state doesn't return update timestamp.
    }

setMoCStateAddress

Set MoC state address. *

function setMoCStateAddress(address _mocStateAddress) public nonpayable onlyOwner 

Arguments

Name Type Description
_mocStateAddress address The MoC state address.
Source Code
function setMoCStateAddress(address _mocStateAddress) public onlyOwner {
        require(Address.isContract(_mocStateAddress), "_mocStateAddress not a contract");
        mocStateAddress = _mocStateAddress;
        emit SetMoCStateAddress(mocStateAddress, msg.sender);
    }

Contracts