wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.17k stars 283 forks source link

fail to deploy #526

Closed ben46 closed 3 months ago

ben46 commented 3 months ago

Describe the bug

fail to deploy

To Reproduce

Steps to reproduce the behavior:

  1. execute yarn deploy fantom_test
  2. See error

yarn run v1.22.19 warning ../../../package.json: No license field $ node ./_scripts.js deploy fantom_test Nothing to compile No need to generate any newer typings. An unexpected error occurred:

Error: ERROR processing /Users/nobbyheell/Documents/workspace/template-ethereum-contracts/deploy/001_deploy_simple_erc20.ts: Error: invalid address (argument="address", value=undefined, code=INVALID_ARGUMENT, version=address/5.7.0) (argument="to", value=undefined, code=INVALID_ARGUMENT, version=abi/5.7.0) at Logger.makeError (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/@ethersproject/logger/src.ts/index.ts:269:28) at Logger.throwError (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/@ethersproject/logger/src.ts/index.ts:281:20) at Logger.throwArgumentError (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/@ethersproject/logger/src.ts/index.ts:285:21) at AddressCoder.Coder._throwError (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/@ethersproject/abi/src.ts/coders/abstract-coder.ts:68:16) at AddressCoder.encode (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/@ethersproject/abi/src.ts/coders/address.ts:22:18) at /Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/@ethersproject/abi/src.ts/coders/array.ts:71:19 at Array.forEach () at pack (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/@ethersproject/abi/src.ts/coders/array.ts:54:12) at TupleCoder.encode (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/@ethersproject/abi/src.ts/coders/tuple.ts:54:20) at AbiCoder.encode (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/@ethersproject/abi/src.ts/abi-coder.ts:111:15) at DeploymentsManager.executeDeployScripts (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1214:19) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async DeploymentsManager.runDeploy (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1060:5) at async SimpleTaskDefinition.action (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/hardhat-deploy/src/index.ts:450:5) at async Environment._runTaskDefinition (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:359:14) at async Environment.run (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:192:14) at async SimpleTaskDefinition.action (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/hardhat-deploy/src/index.ts:601:32) at async Environment._runTaskDefinition (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:359:14) at async Environment.run (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:192:14) at async SimpleTaskDefinition.action (/Users/nobbyheell/Documents/workspace/template-ethereum-contracts/node_modules/hardhat-deploy/src/index.ts:690:5) node:internal/process/promises:289 triggerUncaughtException(err, true / fromPromise /); ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "1".] { code: 'ERR_UNHANDLED_REJECTION' }

Node.js v20.11.1 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior

deploy suceess

versions

nodejs: v20.11.1

pacakge.json{ "@nomicfoundation/hardhat-chai-matchers": "^2.0.1", "@nomicfoundation/hardhat-ethers": "^3.0.2", "@openzeppelin/contracts": "^4.9.2", "@typechain/hardhat": "^8.0.0", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.3.1", "chai": "^4.3.7", "cross-env": "^7.0.2", "dotenv": "^16.3.1", "ethers": "^6.6.1", "fs-extra": "^11.1.1", "hardhat": "^2.16.0", "hardhat-deploy": "^0.12.2", "hardhat-gas-reporter": "^1.0.9", "mocha": "^10.2.0", "prettier": "^2.8.8", "prettier-plugin-solidity": "^1.1.3", "solidity-coverage": "^0.8.3", "ts-node": "^10.9.1", "typescript": "^5.4.3" }

Additional context

hardhat.config.ts

import 'dotenv/config'
import { HardhatUserConfig } from 'hardhat/types'

import '@nomicfoundation/hardhat-chai-matchers'
import '@nomicfoundation/hardhat-ethers'
import '@typechain/hardhat'
import 'hardhat-gas-reporter'
import 'solidity-coverage'

import 'hardhat-deploy'

import { node_url, accounts, addForkConfiguration } from './utils/network'

const config: HardhatUserConfig = {
    solidity: {
        compilers: [
            {
                version: '0.8.17',
                settings: {
                    optimizer: {
                        enabled: true,
                        runs: 2000,
                    },
                },
            },
        ],
    },
    namedAccounts: {
        deployer: 0,
        simpleERC20Beneficiary: 1,
    },
    networks: addForkConfiguration({
        production: {
            url: "https://public.stackup.sh/api/v1/node/base-sepolia",
            accounts: [process.env.PRIVATE_KEY as string],
        },
        base_sepolia: {
            url: "https://base-sepolia.blockpi.network/v1/rpc/public",
            chainId: 84532,
            accounts: [process.env.PRIVATE_KEY as string],
            gas: 8000000
        },
        fantom_test: {
            url: "https://rpc.testnet.fantom.network",
            accounts: [process.env.PRIVATE_KEY as string],
        }
    }),
    paths: {
        sources: 'src',
    },
    gasReporter: {
        currency: 'USD',
        gasPrice: 100,
        enabled: process.env.REPORT_GAS ? true : false,
        coinmarketcap: process.env.COINMARKETCAP_API_KEY,
        maxMethodDiff: 10,
    },
    mocha: {
        timeout: 0,
    },
    external: process.env.HARDHAT_FORK
        ? {
            deployments: {
                // process.env.HARDHAT_FORK will specify the network that the fork is made from.
                // these lines allow it to fetch the deployments from the network being forked from both for node and deploy task
                hardhat: ['deployments/' + process.env.HARDHAT_FORK],
                localhost: ['deployments/' + process.env.HARDHAT_FORK],
            },
        }
        : undefined,
}

export default config