Skip to main content
_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

NameTypeDescription
specIdbytes32The Job Specification ID that the request will be created for
callbackAddraddressaddress to operate the callback on
callbackFunctionSignaturebytes4function signature to use for the callback

Return Values

NameTypeDescription
[0]struct Chainlink.RequestA 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

NameTypeDescription
oracleAddressaddressThe address of the oracle for the request
reqstruct Chainlink.RequestThe initialized Chainlink Request
paymentuint256The amount of LINK to send for the request

Return Values

NameTypeDescription
requestIdbytes32The request ID

setChainlinkToken

function setChainlinkToken(address _linkErc677) internal
Sets the LINK token address

Parameters

NameTypeDescription
_linkErc677addressThe 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

NameTypeDescription
requestIdbytes32The request ID for fulfillment

recordChainlinkFulfillment

modifier recordChainlinkFulfillment(bytes32 requestId)
Reverts if the sender is not the oracle of the request. Emits ChainlinkFulfilled event.

Parameters

NameTypeDescription
requestIdbytes32The request ID for fulfillment