Build Your Own DAO - Helping Each Other

excellent, will try it out without the plugins

is it possible to share the hardhat.config.js file?

I don’t have it, I didn’t do that particular tutorial

i was able to deploy it on hardhat network, are you guys sure moralis mumbai network is running?

Mumbai is working fine. It should work for you too provided you’re using the proper configuration.

1 Like

would you be able to help out with it, i know where the issue is, its in the hardhat configuration file. I am using windows maybe that also has an effect on it. The error i keep getting Error HH100: Network mumbai doesn’t exist

This is what i have:

module.exports = {
solidity: “0.8.7”,
networks: {
mumbai: {
url: process.env.POLYGON_MUMBAI,
accounts: [process.env.PRIVATE_KEY]
},
},
etherscan: {
apiKey: process.env.API_KEY,
}

And this is what worked for hardhat network

module.exports = {
defaultNetwork: “hardhat”,
networks: {
localhost: {
url: “http://127.0.0.1:8545”,
},
hardhat: {
},
},
solidity: “0.8.7”
}

This should work for mumbai provided you have your your speedy nodes uri as POLYGON_MUMBAI and also your wallet private key as PRIVATE_KEY in your .env file.

Calling mumbai on the second configuration while mumbai is not present may cause that.

Nonetheless, you can have your config together rather such like

module.exports = {
  solidity: "0.8.7",
  networks: {
    localhost: {
      url: "http://127.0.0.1:8545",
    },
    mumbai: {
      url: process.env.POLYGON_MUMBAI,
      accounts: [process.env.PRIVATE_KEY],
    },
  },
  etherscan: {
    apiKey: process.env.API_KEY,
  },
};
1 Like

I know im the one doing something wrong here, getting the same error on both options provided, i ran show stack traces got this:

Error: Cannot find module ‘C:\Users\tsaka\Desktop\DecanectDAO\smartcontracts\Hardhat’
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: ‘MODULE_NOT_FOUND’,
requireStack: []

Maybe this can help answer what i have done wrong?

Seemed like hardhat is missing in your dependencies, you need to make sure it’s installed and it’s dependencies too

1 Like

I ran these initially

mkdir smartcontracts

cd smartcontracts

npm i -D hardhat

npx hardhat

npm install --save-dev “hardhat@^2.9.9” “@nomiclabs/hardhat-waffle@^2.0.0” “ethereum-waffle@^3.0.0” “chai@^4.2.0” “@nomiclabs/hardhat-ethers@^2.0.0” “ethers@^5.0.0”

npm i -D dotenv

npm i -D @nomiclabs/hardhat-etherscan

I just ran them once more, done it from the start once again, and still the same thing. The options you provided me with do they show up as string for you? For me its showing as undefined, could the issue be there somewhere?

It compiles successfully, but for some reason in the video shows 1 contract being compiled for me it compiles 2

You should have dotenv installed and import the package in your hardhat config using require("dotenv").config() so you can read from environmental variables, this won’t make the process.env values undefined.

In the video, the Greeter.sol file was changed , but probably you forgot to remove it

That makes perfect sense with dotenv, but i do have them installed and in config file

require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-etherscan");
const dotenv = require(“dotenv”)

dotenv.config();

And the solidity file as well, i have it changed to Dao.sol and the greeter contract was replaced by Moralis DAO

Could it be since im using windows hardhat is not reading the code right and need to add parentheses somewhere, commas …

when i enter it like this, it shows all of them as string and removes undefined

  • @type import(hardhat/config).‘HardhatUserConfig’

*/

module.exports = {

solidity: “0.8.7”,

network: {

mumbai: {

  url: 'process.env.POLYGON_MUMBAI',

  accounts: ['process.env.PRIVATE_KEY'],

},

},

etherscan: {

apiKey: 'process.env.API_KEY',

},

};

But still get the same error

It shouldn’t be related to windows. Maybe you can try in a new terminal and make sure your files are saved. Maybe you can also share a shot of the error as it might be more helpful

1 Like

of course, will do so now, thank you so much for taking the time and sorry if i came off rude, going back to my message it could have been interpreted wrong

Here is the original one

You shouldn’t have your 'process.env.POLYGON_MUBAI' wrapped in string like this, rather it should should be like this process.env.POLYGON_MUBAI, also the account too should be process.env.PRIVATE_KEY, not wrapped in single or double quote. Also you haven't saved your files yet, so you need to save your files maybe by CTRL + S` or any other means you wish to use before running the command

1 Like

Here is the .env file, i just removed parts of the keys

Your files are not saved. You should have them saved and make the fixes as mentioned above

1 Like