PatrickAlphaC / hardhat-fund-me-fcc

82 stars 183 forks source link

Can't deploy FundMe, invalid bytecode #54

Closed Sanchez7599 closed 2 years ago

Sanchez7599 commented 2 years ago

This is my deploy script:

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

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

    let ethUsdPriceFeedAddress
    if (developmentChains.includes(network.name)) {
        const ethUsdAggregator = await deployments.get("MockV3Aggregator")
        ethUsdPriceFeedAddress = ethUsdAggregator.address
    } else {
        ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
    }

    const fundMe = await deploy("FundMe", {
        from: deployer,
        args: [ethUsdPriceFeedAddress],
        log: true,
    })
    log("_____________________________________________________________")
}

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

After typing yarn hardhat deploy Mocks are being deployed and then I get this error:

Nothing to compile
Local network detected! Deploying mocks...
deploying "MockV3Aggregator" (tx: 0x48bdfdd64644a5dd70bcefa793bec388fd55ccc9e6c6b6e4988db8d5cafde888)...: deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3 with 569635 gas
Mocks deployed!
______________________________________________
An unexpected error occurred:

Error: ERROR processing /home/codebind/local_development/hardhat-fund-me/deploy/01-deploy-fund-me.js:
Error: invalid bytecode (argument="bytecode", value="0x60806040526802b5e3af16b188000060005534801561001d57600080fd5b50604051610cd2380380610cd2833981810160405281019061003f919061012a565b33600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610157565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100f7826100cc565b9050919050565b610107816100ec565b811461011257600080fd5b50565b600081519050610124816100fe565b92915050565b6000602082840312156101405761013f6100c7565b5b600061014e84828501610115565b91505092915050565b610b6c806101666000396000f3fe6080604052600436106100555760003560e01c80633ccfd60b1461005a5780633e47d6f314610071578063741bef1a146100ae5780638da5cb5b146100d9578063b6a324e014610104578063dc0d3dff1461010e575b600080fd5b34801561006657600080fd5b5061006f61014b565b005b34801561007d57600080fd5b50610098600480360381019061009391906106de565b610397565b6040516100a59190610724565b60405180910390f35b3480156100ba57600080fd5b506100c36103af565b6040516100d0919061079e565b60405180910390f35b3480156100e557600080fd5b506100ee6103d5565b6040516100fb91906107c8565b60405180910390f35b61010c6103fb565b005b34801561011a57600080fd5b506101356004803603810190610130919061080f565b610595565b60405161014291906107c8565b60405180910390f35b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101d290610899565b60405180910390fd5b60005b60018054905081101561028757600060018281548110610201576102006108b9565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050808061027f90610917565b9150506101de565b50600067ffffffffffffffff8111156102a3576102a2610960565b5b6040519080825280602002602001820160405280156102d15781602001602082028036833780820191505090505b50600190805190602001906102e79291906105d4565b5060003373ffffffffffffffffffffffffffffffffffffffff164760405161030e906109c0565b60006040518083038185875af1925050503d806000811461034b576040519150601f19603f3d011682016040523d82523d6000602084013e610350565b606091505b5050905080610394576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161038b90610a21565b60405180910390fd5b50565b60036020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000543473__$970d497a1df28a900e3dd97e15a13b1bae$__6321061cc69091600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b815260040161045b929190610a5f565b60206040518083038186803b15801561047357600080fd5b505af4158015610487573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ab9190610a9d565b10156104ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e390610b16565b60405180910390fd5b6001339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550565b600181815481106105a557600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b82805482825590600052602060002090810192821561064d579160200282015b8281111561064c5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906105f4565b5b50905061065a919061065e565b5090565b5b8082111561067757600081600090555060010161065f565b5090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006106ab82610680565b9050919050565b6106bb816106a0565b81146106c657600080fd5b50565b6000813590506106d8816106b2565b92915050565b6000602082840312156106f4576106f361067b565b5b6000610702848285016106c9565b91505092915050565b6000819050919050565b61071e8161070b565b82525050565b60006020820190506107396000830184610715565b92915050565b6000819050919050565b600061076461075f61075a84610680565b61073f565b610680565b9050919050565b600061077682610749565b9050919050565b60006107888261076b565b9050919050565b6107988161077d565b82525050565b60006020820190506107b3600083018461078f565b92915050565b6107c2816106a0565b82525050565b60006020820190506107dd60008301846107b9565b92915050565b6107ec8161070b565b81146107f757600080fd5b50565b600081359050610809816107e3565b92915050565b6000602082840312156108255761082461067b565b5b6000610833848285016107fa565b91505092915050565b600082825260208201905092915050565b7f4e6f74206f776e65720000000000000000000000000000000000000000000000600082015250565b600061088360098361083c565b915061088e8261084d565b602082019050919050565b600060208201905081810360008301526108b281610876565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006109228261070b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610955576109546108e8565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600081905092915050565b50565b60006109aa60008361098f565b91506109b58261099a565b600082019050919050565b60006109cb8261099d565b9150819050919050565b7f5472616e73616374696f6e206661696c65640000000000000000000000000000600082015250565b6000610a0b60128361083c565b9150610a16826109d5565b602082019050919050565b60006020820190508181036000830152610a3a816109fe565b9050919050565b610a4a8161070b565b82525050565b610a598161077d565b82525050565b6000604082019050610a746000830185610a41565b610a816020830184610a50565b9392505050565b600081519050610a97816107e3565b92915050565b600060208284031215610ab357610ab261067b565b5b6000610ac184828501610a88565b91505092915050565b7f4e65656420746f2073656e64206d6f7265204554480000000000000000000000600082015250565b6000610b0060158361083c565b9150610b0b82610aca565b602082019050919050565b60006020820190508181036000830152610b2f81610af3565b905091905056fea2646970667358221220921d062d0a2af6d171d9c57876aaee50ebf02e5ffc5f17c14beffa75240d0c7364736f6c63430008080033", code=INVALID_ARGUMENT, version=contracts/5.6.2)
    at Logger.makeError (/home/codebind/local_development/hardhat-fund-me/node_modules/@ethersproject/logger/src.ts/index.ts:261:28)
    at Logger.throwError (/home/codebind/local_development/hardhat-fund-me/node_modules/@ethersproject/logger/src.ts/index.ts:273:20)
    at Logger.throwArgumentError (/home/codebind/local_development/hardhat-fund-me/node_modules/@ethersproject/logger/src.ts/index.ts:277:21)
    at new ContractFactory (/home/codebind/local_development/hardhat-fund-me/node_modules/@ethersproject/contracts/src.ts/index.ts:1172:20)
    at _deploy (/home/codebind/local_development/hardhat-fund-me/node_modules/hardhat-deploy/src/helpers.ts:568:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at listOnTimeout (node:internal/timers:528:9)
    at processTimers (node:internal/timers:502:7)
    at _deployOne (/home/codebind/local_development/hardhat-fund-me/node_modules/hardhat-deploy/src/helpers.ts:1004:16)
    at DeploymentsManager.executeDeployScripts (/home/codebind/local_development/hardhat-fund-me/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1222:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at listOnTimeout (node:internal/timers:528:9)
    at processTimers (node:internal/timers:502:7)
    at DeploymentsManager.runDeploy (/home/codebind/local_development/hardhat-fund-me/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1052:5)
    at SimpleTaskDefinition.action (/home/codebind/local_development/hardhat-fund-me/node_modules/hardhat-deploy/src/index.ts:438:5)
    at Environment._runTaskDefinition (/home/codebind/local_development/hardhat-fund-me/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
    at Environment.run (/home/codebind/local_development/hardhat-fund-me/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
    at SimpleTaskDefinition.action (/home/codebind/local_development/hardhat-fund-me/node_modules/hardhat-deploy/src/index.ts:584:32)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Does anyone have the same issue?

Sanchez7599 commented 2 years ago

I just realized that this issue was already loged and solved.

RyanPaulGannon commented 1 year ago

Yo, how did you fix this? I've looked through the issues and can't find anything? Getting the same error, using TypeScript.

RyanPaulGannon commented 1 year ago

All sorted, my PriceConverter.sol had functions set to public rather than internal!