Commit aeda5301 authored by Mark Grothe's avatar Mark Grothe Committed by GitHub

chore: Add jsdoc comments to functions in contract-defs (#2440)

Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent b2a3239b
import { ethers } from 'ethers'
/**
* Gets the hardhat artifact for the given contract name.
* Will throw an error if the contract artifact is not found.
*
* @param name Contract name.
* @returns The artifact for the given contract name.
*/
export const getContractDefinition = (name: string): any => {
// We import this using `require` because hardhat tries to build this file when compiling
// the contracts, but we need the contracts to be compiled before the contract-artifacts.ts
......@@ -13,11 +20,24 @@ export const getContractDefinition = (name: string): any => {
return artifact
}
/**
* Gets an ethers Interface instance for the given contract name.
*
* @param name Contract name.
* @returns The interface for the given contract name.
*/
export const getContractInterface = (name: string): ethers.utils.Interface => {
const definition = getContractDefinition(name)
return new ethers.utils.Interface(definition.abi)
}
/**
* Gets an ethers ContractFactory instance for the given contract name.
*
* @param name Contract name.
* @param signer The signer for the ContractFactory to use.
* @returns The contract factory for the given contract name.
*/
export const getContractFactory = (
name: string,
signer?: ethers.Signer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment