Skip to main content

BeaconOracleMock

BeaconOracleMock#

Unit tests should ensure that internal methods _requestPrice and _publishPrice emit the correct events and modify state as expected.

Functions#

constructor(address _finderAddress, uint8 _chainID) (public)
requestPrice(bytes32 identifier, uint256 time, bytes ancillaryData) (public)
encodePriceRequest(bytes32 identifier, uint256 time, bytes ancillaryData) โ†’ bytes32 (public)
publishPrice(bytes32 identifier, uint256 time, bytes ancillaryData, int256 price) (public)
getBridge() โ†’ contract IBridge (public)
_requestPrice(uint8 chainID, bytes32 identifier, uint256 time, bytes ancillaryData) (internal)

Enqueues a request (if a request isn't already present) for the given (chainID, identifier, time, ancillary data) combination. Will only emit an event if the request has never been requested.

_finalizeRequest(uint8 chainID, bytes32 identifier, uint256 time, bytes ancillaryData) (internal)

Derived contract needs call this method in order to advance state from PendingRequest --> Requested before _publishPrice can be called.

_publishPrice(uint8 chainID, bytes32 identifier, uint256 time, bytes ancillaryData, int256 price) (internal)

Publishes price for a requested query. Will revert if request hasn't been requested yet or has been resolved already.

_finalizePublish(uint8 chainID, bytes32 identifier, uint256 time, bytes ancillaryData) (internal)
_getBridge() โ†’ contract IBridge (internal)

Returns Bridge contract on network.

_encodePriceRequest(uint8 chainID, bytes32 identifier, uint256 time, bytes ancillaryData) โ†’ bytes32 (internal)

Returns the convenient way to store price requests, uniquely identified by {chainID, identifier, time, ancillaryData }.

Events#

PriceRequestAdded(uint8 chainID, bytes32 identifier, uint256 time, bytes ancillaryData)
PushedPrice(uint8 chainID, bytes32 identifier, uint256 time, bytes ancillaryData, int256 price)

Modifiers#

onlyGenericHandlerContract()