Build Your Own DAO - Helping Each Other

Hey i deployed the contract but now the transactions on metamask are not going through its showing there maybe some errors in the smart contract , and i compared it with the final-dao . its correct . PLEASE HELP

What are the actual errors you are getting, can you post screenshots? Or do the transactions just stay pending?

Can you compare your code with the final project repo.

Hi there,

First of all thank you for the tutorial.

I’ve successfully created the contract and the frontend of the application. Everything is working except the “Eligible Voters” count.

It seems the problem is in this piece of code below. I’ve added some console logs to give you an idea about what is returning.

const fetchTokenIdOwners = async () => {
        const options = {
          chain: "mumbai",
          address: "0x2953399124F0cBB46d2CbACD8A89cF0599974963",
          token_id: "25728302300340710840009110488704070426692454999641235838747022717354889969665",                        
        };
        const tokenIdOwners = await Web3Api.token.getTokenIdOwners(options);
        console.log(tokenIdOwners);
        // this console is returning => Object { total: 0, page: 0, page_size: 100, cursor: "", result: [], status: "SYNCED" }
        
        const addresses = tokenIdOwners.result.map((e) => e.owner_of);
        
        console.log("addresses ===> " + addresses);
        // this console log is returning => ""

        setVoters(addresses);
      };

  • I’ve compared my code with the one in the repo and they seem to be equal.

  • I’ve double check and the Open Sea store front address is right ‘0x2953399124F0cBB46d2CbACD8A89cF0599974963’

  • I’ve also double checked the token id on open sea and it seems to be right too. Please see the attached image for reference.

Thank you for your help.

It looks like that tokenId you are using is only lazy minted, so it doesn’t actually exist on-chain yet. This means the Moralis API won’t return any data.

Yours:

Another tokenId from the same contract:

Got it.

Does that mean I will need to make an offer and purchase the NFT in order to mint it in the blockchain?

Is there any other alternative for test purpose where I would not need to spend money?

Thanks,

I think you can just transfer it to another address within OpenSea like the second NFT example. This should be free to do.

1 Like

Yep, you were right, as soon as I transferred the NFT it was really minted in the blockchain. One important note though, I had to transfer to another account on my Metamask wallet. I tried to transfer to another account in another Metamask wallet and it did not work.

I’m also adding an image attache that says that the NFT on open sea will be minted only when you transfer or purchase it.

Thanks,

Hi, i am on minute 30 of the youtube video, all is going very smooth, you guys are amazing at teaching.

I received this error when entering npx hardhat clean

An unexpected error occurred:

Error: Cannot find module ‘@nomiclabs/hardhat-waffle’

I have everything as shown in the video, followed every second of it, must have missed something.

Now a bit of a different issue i have, im just a beginner so most likely this is a very simple fix, would appreciate the help

  • Invalid value undefined for HardhatConfig.networks.mumbai.url - Expected a value of type string.
  • Invalid account: #0 for network: mumbai - Expected string, received undefined
    *(property) EtherscanUserConfig.apiKey?: string | Record<string, string> | undefined
    *Error HH100: Network mumbai doesn’t exist

Good find, thanks for clarifying that. Not sure what happened with the transfer there but at least it’s all working now.

1 Like

Hi, maybe you can help me with this?

(property) EtherscanUserConfig.apiKey?: string | Record<string, string> | undefined

and

Error HH100: Network mumbai doesn’t exist

Im sure its a very simple fix, but just cant seem to get it right myself. Followed the video all the way through, recreated the whole process 3 times and still the same thing, i must be missing something very basic that is not even worth mentioning in the video. As he pastes this section:

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

For him comes out as string, i wrote it exactly the same and shows undefined.

(property) EtherscanUserConfig.apiKey?: string | Record<string, string> | undefined
and Error HH100: Network mumbai doesn’t exist

What commands are you running (or what are you doing) to get these errors? Your command for Mumbai should be something in the same structure as npx hardhat run .\scripts\deploy.js --network mumbai.

Make sure your env variables in .env are correct and that you have dotenv installed with require('dotenv').config(); at the top of your hardhat.config.js.

Hi, thank you for your response,

The commands i ran are exactly as you wrote, dotenv is installed just like in the video and requirements are as follows

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

dotenv.config();

Is this correct for requirements? if yes, here is how i have eht .env file variables entered:

API_KEY = ‘S24GXNZ9G3WGWVRBS63P5IZ31P4ISWHBBT’

POLYGON_MUMBAI = ‘https://speedy-nodes-nyc.moralis.io/9113a86e1b991e5fd234c331/polygon/mumbai

PRIVATE_KEY = ‘xxxx’
(Private key i have entered, just deleted it when posting here.)

What i noticed on the video is that he pastes this part:

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

For one second he hovers over “mumbai” and for him it shows url and accounts as string but for me it shows as undefined. Im sure i have done something wrong in this part as i wrote it directly into the hardhatconfig file itself.

you can deploy the contract directly with remix too, after you wrote it, you paste it in remix, build it, enable injected web3, select account, and deploy

Will try on remix, but do you have any idea of why im getting an undefined url and account?

I have changed it to this now and under mumbai its not showing undefined anymore

mumbai: {
  url: 'process.env.POLYGON_MUMBAI',
  accounts: ['process.env.PRIVATE_KEY'],

when i scroll over accounts its also not showing undefined but url still does

I don’t know exactly what happens, I would expect it to show a string now instead of the value based on the code that you pasted now

ok, i went ahead and ran npx hardhat clean, received this

Error HH12: Trying to use a non-local installation of Hardhat, which is not supported.
Please install Hardhat locally using npm or Yarn, and try again.

I have installed hardhat just as shown in the video, followed all of these steps. Is there something i am missing here?

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

you can try to install it again in a new directory

i have done all of this already, i have went over the process for the 4th time, tried everything i can think of and still the same thing is happening. Under the outline there is an unknown variable and inside it are solidity, networks, mumbai and etherscan. Does this mean anything in regards to all variable being undefined ?