This document provides detailed information about each service module and its related methods available in the Hardhat Chainlink plugin.
- Hardhat Chainlink Plugin Documentation
- Data Feed Services
- VRF Service
- Service alias:
vrf
- Methods
- Create Subscription
- Fund Subscription
- Cancel Subscription
- Add Consumer
- Remove Consumer
- Get Subscription Details
- Request Random Words
- Check Pending Request
- Request Subscription Owner Transfer
- Accept Subscription Owner Transfer
- Get Maximum Consumers
- Get Maximum Number of Words
- Get Maximum Request Confirmations
- Get Minimum Request Confirmations
- Get Maximum Request Gas Limit
- Get Commitment
- Get Configuration
- Get Type and Version
- Service alias:
- Automation Services
- Utilities
- Sandbox
sandbox
Chainlink Data Feeds are decentralized oracles that provide reliable off-chain data to smart contracts on the blockchain. Using this service, developers can access the latest round answer and other relevant information from the Data Feeds, enabling them to fetch real-world data in their web3 projects.
This section provides methods and functionalities designed to interact with the OffchainAggregator smart contract, which serves as the core component of Chainlink Data Feeds.
- Method: getLatestRoundAnswer
- Description: Get the latest round answer for a data feed
- Arguments:
dataFeedAddress
: Address of Data Feed
- Method: getRoundAnswer
- Description: Get the round answer for a data feed
- Arguments:
dataFeedAddress
: Address of Data FeedroundId
: Round ID of Data Feed
- Method: getLatestRoundData
- Description: Get the latest round data for a data feed
- Arguments:
dataFeedAddress
: Address of Data Feed
- Method: getRoundData
- Description: Get the round data for a data feed
- Arguments:
dataFeedAddress
: Address of Data FeedroundId
: Round ID of Data Feed
- Method: getLatestRoundId
- Description: Get the latest round ID
- Arguments:
dataFeedAddress
: Address of Data FeedroundId
: Round ID of Data Feed
- Method: getDecimals
- Description: Get the decimals for a data feed
- Arguments:
dataFeedAddress
: Address of Data Feed
- Method: getDescription
- Description: Get the description for a data feed
- Arguments:
dataFeedAddress
: Address of Data Feed
- Method: getAggregatorVersion
- Description: Get the version for a data feed
- Arguments:
dataFeedAddress
: Address of Data Feed
This section provides methods and functionalities designed to interact with the EACAggregatorProxy smart contract, which acts as a proxy for Chainlink Data Feeds.
- Method: getLatestRoundAnswer
- Description: Get the latest round answer for a current data feed via proxy
- Arguments:
dataFeedProxyAddress
: Address of Data Feed Proxy
- Method: getRoundAnswer
- Description: Get round answer for a current data feed via proxy
- Arguments:
dataFeedProxyAddress
: Address of Data Feed ProxyroundId
: Round ID of Data Feed Proxy
- Method: getLatestRoundData
- Description: Get the latest round data for a current data feed via proxy
- Arguments:
dataFeedProxyAddress
: Address of Data Feed Proxy
- Method: getRoundData
- Description: Get round data for a current data feed via proxy
- Arguments:
dataFeedProxyAddress
: Address of Data FeedroundId
: Round ID of Data Feed Proxy
- Method: getLatestRoundId
- Description: Get the latest round ID of a proxy
- Arguments:
dataFeedProxyAddress
: Address of Data Feed ProxyroundId
: Round ID of Data Feed Proxy
- Method: getDecimals
- Description: Get decimals for a data feed
- Arguments:
dataFeedProxyAddress
: Address of Data Feed Proxy
- Method: getDescription
- Description: Get description for a current data feed via proxy
- Arguments:
dataFeedProxyAddress
: Address of Data Feed Proxy
- Method: getVersion
- Description: Get version for a current data feed via proxy
- Arguments:
dataFeedProxyAddress
: Address of Data Feed Proxy
- Method: getAggregator
- Description: Get current data feed address via proxy
- Arguments:
dataFeedProxyAddress
: Address of Data Feed Proxy
- Method: getPhaseId
- Description: Get current phase ID of a proxy
- Arguments:
dataFeedProxyAddress
: Address of Data Feed Proxy
- Method: getPhaseAggregators
- Description: Get data feed address related to a phase ID of a proxy
- Arguments:
dataFeedProxyAddress
: Address of Data Feed ProxyphaseId
: Phase ID of Data Feed Proxy
This section provides methods and functionalities designed to interact with the Feed Registry smart contracts, which acts is an on-chain mapping of assets to Data Feeds.
Note Chainlink Feed Registry is exclusively available on the Ethereum mainnet.
- Method:
getLatestRoundData
- Description: Get the latest round data for a specific data feed from the Feed Registry
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pair
- Method:
getRoundData
- Description: Get the round data for a specific data feed from the Feed Registry based on the provided round ID
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pairroundId
: Feed Registry Round ID
- Method:
proposedGetLatestRoundData
- Description: Get the latest round data (proposed) for a specific data feed from the Feed Registry
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pair
- Method:
proposedGetRoundData
- Description: Get the round data (proposed) for a specific data feed from the Feed Registry based on the provided round ID
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pairroundId
: Data Feed Round ID
- Method:
getRoundFeed
- Description: Get the data feed address for a specific data feed from the Feed Registry based on the provided round ID
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pairroundId
: Feed Registry Round ID
- Method:
getFeed
- Description: Get current data feed address for a specific token pair from the Feed Registry
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pair
- Method:
getProposedFeed
- Description: Get the proposed data feed address for a specific token pair from the Feed Registry
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pair
- Method:
isFeedEnabled
- Description: Check if a specific data feed is enabled in the Feed Registry
- Arguments:
feedRegistryAddress
: Address of Feed RegistryaggregatorAddress
: Address of a Data Feed Offchain Aggregator
- Method:
getPreviousRoundId
- Description: Get previous round ID for a specific data feed from the Feed Registry based on the provided round ID
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pairroundId
: Feed Registry Round ID
- Method:
getNextRoundId
- Description: Get next round ID for a specific data feed from the Feed Registry based on the provided round ID
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pairroundId
: Feed Registry Round ID
- Method:
getDecimals
- Description: Get the decimals of a specific data feed from the Feed Registry
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pair
- Method:
getDescription
- Description: Get the description of a specific data feed from the Feed Registry
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pair
- Method:
getVersion
- Description: Get the version of a specific data feed from the Feed Registry
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pair
- Method:
getPhase
- Description: Get phase data for a specific data feed from the Feed Registry based on the provided phase ID
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pairphaseId
: Feed Registry Phase ID
- Method:
getPhaseFeed
- Description: Get data feed address for a specific token pair from the Feed Registry based on the provided phase ID
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pairphaseId
: Feed Registry Phase ID
- Method:
getPhaseRange
- Description: Get the phase range data for a specific data feed from the Feed Registry based on the provided phase ID
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pairphaseId
: Feed Registry Phase ID
- Method:
getCurrentPhaseId
- Description: Get current phase ID for a specific data feed from the Feed Registry
- Arguments:
feedRegistryAddress
: Address of Feed RegistryfeedRegistryBaseTick
: Address or denomination of the base tick in a token pairfeedRegistryQuoteTick
: Address or denomination of the quote tick in a token pair
This section provides methods and functionalities designed to interact with the L2 Sequencer Uptime Feeds, which acts as data feeds that track the availability status of the sequencer in Layer 2 (L2) networks, specifically in optimistic rollup protocols.
Note L2 Sequencer Uptime Feeds are available only on specific networks, including Arbitrum mainnet, Arbitrum Goerli testnet, Optimism mainnet, Optimism Goerli testnet, and Metis mainnet (Andromeda)
- Method:
isL2SequencerUp
- Description: Checks the availability status of the Layer 2 (L2) Sequencer using the provided address of the Layer 2 Sequencer Uptime Status Feed
- Arguments:
l2SequencerAddress
: Address of the Layer 2 Sequencer Uptime Status Feed
- Method:
getTimeSinceL2SequencerIsUp
- Description: Retrieves the time elapsed since the Layer 2 (L2) Sequencer has been up and operational, based on the provided address of the Layer 2 Sequencer Uptime Status Feed
- Arguments:
l2SequencerAddress
: Address of the Layer 2 Sequencer Uptime Status FeedgracePeriodTime
: Grace period duration in which the Sequencer is allowed to not return results
This section provides methods and functionalities designed to interact with the Chainlink ENS Resolver.
Note Chainlink ENS is exclusively available on the Ethereum mainnet.
- Method:
resolveAggregatorAddress
- Description: Resolve Data Feed address for a token pair using the Chainlink ENS Resolver
- Arguments:
baseTick
: Base tick of the token pairquoteTick
: Quote tick of the token pair
- Method:
resolveAggregatorAddressWithSubdomains
- Description: Resolve Data Feed address for a token pair using the Chainlink ENS Resolver with subdomains
- Arguments:
baseTick
: Base tick of the token pair.quoteTick
: Quote tick of the token pair.
Chainlink VRF (Verifiable Random Function) service is a critical component provided by Chainlink that enables smart contracts on the blockchain to securely and transparently access cryptographically secure and unpredictable randomness.
This section provides methods and functionalities designed to interact with the VRFCoordinator smart contract, which serves as the intermediary between smart contracts on the blockchain and the VRF service.
- Method: createSubscription
- Description: Create a new subscription to the VRF service
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contract
- Method: fundSubscription
- Description: Fund a subscription to the VRF service with LINK tokens
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractlinkTokenAddress
: Address of the LINK token contractamountInJuels
: Amount of LINK tokens to be sent (in Juels)subscriptionId
: VRF Subscription ID
- Method: cancelSubscription
- Description: Cancel a subscription to the VRF service and receive the remaining balance
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractsubscriptionId
: VRF Subscription IDreceivingAddress
: Address to receive the balance of the subscription
- Method: addConsumer
- Description: Add a new consumer to an existing VRF subscription
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractconsumerAddress
: Address of the consumersubscriptionId
: VRF Subscription ID
- Method: removeConsumer
- Description: Remove a consumer from an existing VRF subscription
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractconsumerAddress
: Address of the consumersubscriptionId
: VRF Subscription ID
- Method: getSubscriptionDetails
- Description: Get details of an existing VRF subscription
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractsubscriptionId
: VRF Subscription ID
- Method: requestRandomWords
- Description: Request random words from the VRF service
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractkeyHash
: Key hash related to maxGasPrice of a VRF. Different keyHashes have different gas pricessubscriptionId
: VRF Subscription ID. Must be funded with the minimum subscription balance required for the selected keyHashrequestConfirmations
: How many blocks you'd like the oracle to wait before responding to the requestcallbackGasLimit
: How much gas you allow for fulfillRandomWords callbacknumWords
: The number of random values you'd like to receive in fulfillRandomWords callback
- Method: isPendingRequestExists
- Description: Check if there is a pending request for an existing VRF subscription
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractsubscriptionId
: VRF Subscription ID
- Method: requestSubscriptionOwnerTransfer
- Description: Request to transfer ownership of a VRF subscription to a new owner
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractsubscriptionId
: VRF Subscription IDnewOwnerAddress
: Address of the new subscription owner
- Method: acceptSubscriptionOwnerTransfer
- Description: Accept the transfer of ownership of a VRF subscription
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractsubscriptionId
: VRF Subscription ID
- Method: getMaxConsumers
- Description: Get the maximum number of consumers that can be added to a VRF subscription
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contract
- Method: getMaxNumberOfWords
- Description: Get the maximum number of random words that can be requested from the VRF service
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contract
- Method: getMaxRequestConfirmations
- Description: Get the maximum number of block confirmations allowed for a VRF request
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contract
- Method: getMinRequestConfirmations
- Description: Get the minimum number of block confirmations required for a VRF request
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contract
- Method: getMaxRequestGasLimit
- Description: Get the maximum gas limit for a VRF request
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contract
- Method: getCommitment
- Description: Get the commitment data for a VRF request
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contractrequestId
: Request ID
- Method: getConfig
- Description: Get the configuration details of VRF Coordinator
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contract
- Method: getTypeAndVersion
- Description: Get the type and version details of VRF Coordinator
- Arguments:
vrfCoordinatorAddress
: Address of VRF Coordinator contract
Chainlink Automation service that enables conditional execution of your smart contracts functions through a hyper-reliable and decentralized automation platform.
This section provides methods and functionalities designed to interact with the KeeperRegistrar smart contract, which accepts requests for upkeep registrations.
- Method: registerUpkeep
- Description: Register an upkeep task for Chainlink Keepers to perform on a specified contract
- Arguments:
keeperRegistrarAddress
: Address of Keeper RegistrarlinkTokenAddress
: Address of Link TokenamountInJuels
: Amount of LINK in juels to fund the upkeepupkeepName
: Upkeep name to be registeredencryptedEmail
: Encrypted email address of upkeep contactupkeepContract
: Upkeep contract address to perform task ongasLimit
: Limit of gas to provide the target contract when performing upkeepadminAddress
: Address to cancel upkeep and withdraw remaining fundscheckData
: Data passed to the contract when checking upkeepocrConfig
: OffchainConfig for upkeep in bytes [Keeper Registrar v2_0 ONLY], default value: "0x"source
: ID of the application sending this request [Keeper Registrar v1_1 ONLY], default value: "0"sender
: Address of the sender making the request
- Method: getPendingRequest
- Description: Get information about a pending registration request for an upkeep task
- Arguments:
keeperRegistrarAddress
: Address of Keeper RegistrarrequestHash
: Hash of the registration request
- Method: cancelRequest
- Description: Cancel a pending registration request for an upkeep task
- Arguments:
keeperRegistrarAddress
: Address of Keeper RegistrarrequestHash
: Hash of the registration request
- Method: getRegistrationConfig
- Description: Get the registration configuration for upkeep tasks from the Keeper Registrar
- Arguments:
keeperRegistrarAddress
: Address of Keeper Registrar
- Method: getTypeAndVersion
- Description: Get the type and version for the Keeper Registrar
- Arguments:
keeperRegistrarAddress
: Address of Keeper Registrar
This section provides methods and functionalities designed to interact with the KeeperRegistry smart contract, which serves to add tasks for Chainlink Keepers to perform on client contracts.
- Method: getState
- Description: Get the current state of Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper Registry
- Method: getActiveUpkeepIDs
- Description: Get a list of active upkeep IDs from Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper RegistrystartIndex
: Starting index of Upkeeps to getmaxCount
: Quantity of Upkeeps to get
- Method: getMaxPaymentForGas
- Description: Get maximum payment for the gas limit, calculated using the Keeper Registry parameters
- Arguments:
keeperRegistryAddress
: Address of Keeper RegistrygasLimit
: Gas limit
- Method: isPaused
- Description: Check if the Keeper Registry is currently paused
- Arguments:
keeperRegistryAddress
: Address of Keeper Registry
- Method: getUpkeep
- Description: Get information about a specific upkeep from the Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper RegistryupkeepId
: Upkeep ID
- Method: getMinBalanceForUpkeep
- Description: Get the minimum required balance for upkeep from the Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper RegistryupkeepId
: Upkeep ID
- Method: fundUpkeep
- Description: Fund an upkeep task with a specified amount of LINK in Juels
- Arguments:
keeperRegistryAddress
: Address of Keeper RegistryupkeepId
: Upkeep IDamountInJuels
: Amount of LINK in Juels to fund upkeep
- Method: cancelUpkeep
- Description: Cancel an upkeep task in Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper RegistryupkeepId
: Upkeep ID
- Method: withdrawFunds
- Description: Withdraw funds from an upkeep task in Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper RegistryupkeepId
: Upkeep IDreceivingAddress
: Address to withdraw funds
- Method: migrateUpkeeps
- Description: Migrate multiple upkeep tasks to another Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper RegistryupkeepIds
: Upkeep IDs to migratedestination
: Address of destination Keeper Registry
- Method: getKeeperInfo
- Description: Get information about a specific keeper from Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper RegistrykeeperAddress
: Keeper address
- Method: getTypeAndVersion
- Description: Get the type and version for Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper Registry
- Method: getUpkeepTranscoderVersion
- Description: Get the upkeep transcoder version from Keeper Registry
- Arguments:
keeperRegistryAddress
: Address of Keeper Registry
The plugin utility methods.
- Method: getRoundId
- Description: Obtain the Data Feed Proxy/Registry round ID using the provided phase ID and aggregator round ID
- Arguments:
phaseId
: Data Feed Proxy/Registry phase IDaggregatorRoundId
: Data Feed round ID
- Method: parseRoundId
- Description: Parse the given Data Feed Proxy/Registry round ID to extract relevant information
- Arguments:
roundId
: Data Feed Proxy/Registry round ID
- Method: transferETH
- Description: Transfer ETH to recipient
- Arguments:
recipient
: Recipient addressamount
: Amount of ETH in wei
This module contains a group of services for starting and managing a Chainlink node and setting up Chainlink jobs.
This section provides methods and functionalities designed to spin up and manage Chainlink node.
- Method: run
- Description: Run local Chainlink node
- Method: restart
- Description: Restart local Chainlink node
- Method: stop
- Description: Stop local Chainlink node
- Method: getETHKeys
- Description: Get list of Chainlink node's ETH keys
- Method: getP2PKeys
- Description: Get list of Chainlink node's P2P keys
- Method: getOCRKeys
- Description: Get list of Chainlink node's OCR keys
- Method: getJobs
- Description: Get list of Chainlink node's jobs
- Method: createDirectRequestJob
- Description: Set up Direct Request job for local Chainlink node
- Arguments:
operatorAddress
: Operator contract address
Check Direct Request job configuration template: direct-request-job_template.toml.
This section provides methods and functionalities designed to interact with the Link Token.
- Method: deploy
- Description: Deploy Link Token contract
- Method: transfer
- Description: Transfer Link Tokens to recipient
- Arguments:
linkTokenAddress
: Link Token addressrecipient
: Account to which Link Tokens will be transferredamount
: Amount of Link Tokens to be transferred
- Method: getAllowance
- Description: Get Link Token allowance
- Arguments:
linkTokenAddress
: Link Token addressowner
: Link Tokens ownerspender
: Owner's Link Tokens spender
- Method: increaseApproval
- Description: Increase Link Token approval
- Arguments:
linkTokenAddress
: Link Token addressspender
: Account for which Link Token approval will be increasedaddedValue
: Amount of Link Tokens to be added
- Method: decreaseApproval
- Description: Decrease Link Token approval
- Arguments:
linkTokenAddress
: Link Token addressspender
: Account for which Link Token approval will be decreasedsubtractedValue
: Amount of Link Tokens to be decreased
This section provides methods and functionalities designed to interact with the Operator.
- Method: deploy
- Description: Deploy Operator contract
- Arguments:
linkTokenAddress
: Link Token address
- Method: setAuthorizedSender
- Description: Set authorized sender
- Arguments:
operatorAddress
: Operator addresssender
: Address to be authorized
This section provides methods and functionalities designed to interact with the Direct Request Consumer.
- Method: deploy
- Description: Deploy Direct Request Consumer contract
- Arguments:
linkTokenAddress
: Link Token address
- Method: requestData
- Description: Request data to be fulfilled with Direct Request job
- Arguments:
directRequestConsumerAddress
: Direct Request Consumer addressoperatorAddress
: Operator addressexternalJobID
: Direct Request External Job IDobservationURL
: URL to retrieve datapathToData
: JSON path to data in observation URL response, e.g. "ethereum,usd"multiplyTimes
: Multiplier for the received answer
- Method: getLatestAnswer
- Description: Get latest answer
- Arguments:
directRequestConsumerAddress
: Direct Request Consumer address