PatrickAlphaC / hardhat-nft-fcc

100 stars 139 forks source link

Error: overflow [ See: https://links.ethers.org/v5-errors-NUMERIC_FAULT-overflow ] (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.7.0) #99

Open krishnadude98 opened 1 year ago

krishnadude98 commented 1 year ago

const { networkConfig, developmentChains } = require("../helper-hardhat-config");
const { verify } = require("../utils/verify");
const fs = require("fs");

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

    let ethUsdPriceFeedAddress;
    const chainId = network.config.chainId;
    if (developmentChains.includes(network.name)) {
        const ethUsdAggregator = await ethers.getContract("MockV3Aggregator");
        ethUsdPriceFeedAddress = ethUsdAggregator.address;
    } else {
        ethUsdPriceFeedAddress = networkConfig[chainId].ethUsdPrice;
    }
    const lowSvg = fs.readFileSync("./images/dynamicNft/sad.svg", { encoding: "utf8" });
    const highSvg = fs.readFileSync("./images/dynamicNft/smiley.svg", { encoding: "utf8" });

    const args = [ethUsdPriceFeedAddress, lowSvg, highSvg];
    const dynamicSvgNft = await deploy("DynamicNft", {
        from: deployer,
        args: args,
        log: true,
        waitConfirmations: network.config.blockConfirmations || 1,
    });

    if (!developmentChains.includes(network.name) && process.env.POLYGON_API_KEY) {
        log("Verifying..........");
        await verify(dynamicSvgNft.address, args);
    }
};

module.exports.tags = ["all", "dynamicnft", "main"];``` 

in this deploy script for dynamic nft getting this error
```Error: overflow [ See: https://links.ethers.org/v5-errors-NUMERIC_FAULT-overflow ] (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.7.0)```
gbr5 commented 1 year ago

If its the same error as I had, which looks like, you have to add n at the end of the INITIAL_PRICE value in helper-hardhat-config, like so

    INITIAL_PRICE: 200000000000000000000n,