ChainlinkClientUtils

_Chainlink client refactored into library and all unused functions removed Uses price aggregator facet of multi collat diamond for storage.

Copy of https://github.com/smartcontractkit/chainlink/blob/contracts-v0.5.1/contracts/src/v0.8/ChainlinkClient.sol with only requestCount changed to unset so as to be inherited by a proxy implementation._

ChainlinkRequested

event ChainlinkRequested(bytes32 id)

ChainlinkFulfilled

event ChainlinkFulfilled(bytes32 id)

_getSlot

function _getSlot() internal pure returns (uint256)

Returns storage slot to use when fetching storage relevant to library

_getStorage

function _getStorage() internal pure returns (struct IPriceAggregator.PriceAggregatorStorage s)

Returns storage pointer for storage struct in diamond contract, at defined slot

buildChainlinkRequest

function buildChainlinkRequest(bytes32 specId, address callbackAddr, bytes4 callbackFunctionSignature) internal pure returns (struct Chainlink.Request)

Creates a request that can hold additional parameters

Parameters

Name
Type
Description

specId

bytes32

The Job Specification ID that the request will be created for

callbackAddr

address

address to operate the callback on

callbackFunctionSignature

bytes4

function signature to use for the callback

Return Values

Name
Type
Description

[0]

struct Chainlink.Request

A Chainlink Request struct in memory

sendChainlinkRequestTo

function sendChainlinkRequestTo(address oracleAddress, struct Chainlink.Request req, uint256 payment) internal returns (bytes32 requestId)

Creates a Chainlink request to the specified oracle address

Generates and stores a request ID, increments the local nonce, and uses transferAndCall to send LINK which creates a request on the target oracle contract. Emits ChainlinkRequested event.

Parameters

Name
Type
Description

oracleAddress

address

The address of the oracle for the request

req

struct Chainlink.Request

The initialized Chainlink Request

payment

uint256

The amount of LINK to send for the request

Return Values

Name
Type
Description

requestId

bytes32

The request ID

setChainlinkToken

function setChainlinkToken(address _linkErc677) internal

Sets the LINK token address

Parameters

Name
Type
Description

_linkErc677

address

The address of the LINK token contract

validateChainlinkCallback

function validateChainlinkCallback(bytes32 requestId) internal

Ensures that the fulfillment is valid for this contract

Use if the contract developer prefers methods instead of modifiers for validation

Parameters

Name
Type
Description

requestId

bytes32

The request ID for fulfillment

recordChainlinkFulfillment

modifier recordChainlinkFulfillment(bytes32 requestId)

Reverts if the sender is not the oracle of the request. Emits ChainlinkFulfilled event.

Parameters

Name
Type
Description

requestId

bytes32

The request ID for fulfillment