Getting this error while deploying mock contract

ReferenceError: MockV3Aggregator is not defined

Imported MockV3Aggregator from chainlink's github and now it's in my node modules also. This is my deploy script

const { network } = require("hardhat")
const { developmentChains, DECIMALS, INITIAL_ANSWER } = require("../helper-hardhat-config")

module.exports = async ({ getNamedAccounts, deployments}) => {
    const { deploy, log } = deployments
    const {deployer} = await getNamedAccounts()

    if (developmentChains.includes(network.name)) {
        log("Local network detected! Deploying mocks...")
        await deploy("MockV3Aggregator", {
            contract: MockV3Aggregator,
            from: deployer,
            log: true,
            args: [DECIMALS, INITIAL_ANSWER],
        log("Mocks deployed!!")

module.exports.tags = ["all", "mocks"]

and this is my helper-hardhat-config.js

const developmentChains = [ "hardhat", "localhost" ]
const DECIMALS = 8
const INITIAL_ANSWER = 200000000000

module.exports = {

and command used to deploy is

yarn hardhat deploy --tags mocks

Thanks for help!!!

2 Answers 2


Ok i got it, After removing this line from deploy script, it is perfectly deployed

contract: MockV3Aggregator,

Your solution can solve the problem, but that's not the key point. MockV3Aggregator should be "MockV3Aggregator"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.