Search code examples
solidityweb3jsethers.jshardhat

Documentation for ethers.getContractAt()


Can somebody please point me to the documentation (official or otherwise ) that explains the function ethers.getContractAt():

the original context of this is as follows:

vrfCoordinator = await ethers.getContractAt('VRFCoordinatorMock', VRFCoordinatorMock.address, signer)

and the full code can be found here... https://github.com/PatrickAlphaC/all-on-chain-generated-nft/blob/main/deploy/02_Deploy_RandomSVG.js

In the absence of such documentation, an explanation would be much appreciated. Thank you!


Solution

  • The getContractAt() function is part of the hardhat-ethers plugin for Hardhat, expanding the ethers object.

    It's not a part of the core Ethers package, so it's not included in their documentation.

    Hardhat docs mentioning the plugin: https://hardhat.org/plugins/nomiclabs-hardhat-ethers.html#helpers