[SOLVED] Running addEvents.js returns false

I’ve let the server run for a while in case it was a problem of sync, hence the huge number (or so I thought)

I killed it now and restarted it, and it goes pretty fast indeed, already 240.

My last resort was to do it through the interface as you suggested, I’ll try it now, as well as checking the hardhar settings.

you will have to reset the local devchain, or create a new server, after you fix the settings for hardhat

1 Like

That’s my hardhat-config :

    hardhat: {
      // // If you want to do some forking, uncomment this
      // forking: {
      //   url: MAINNET_RPC_URL
      // }
      chainId: 31337,
    },
    localhost: {
      chainId: 31337,
    },
    rinkeby: {
      url: RINKEBY_RPC_URL,
      accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [],
      saveDeployments: true,
      chainId: 4,
      blockConfirmations: 8,
    },
    // mainnet: {
    //   url: MAINNET_RPC_URL,
    //   accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [],
    //   saveDeployments: true,
    //   chainId: 1,
    // },

how does it have so many block numbers then?

I have no idea, I’m pretty new to this…

could this have to do with the fact it it says subdomain not found ? :

/FrontEndMarsKetplace$ yarn moralis:sync
yarn run v1.22.15
$ moralis-admin-cli connect-local-devchain --chain hardhat --moralisSubdomain lkei3yi1kglb.usemoralis.com --frpcPath ./frp/frpc
Subdomain not found!
Following servers were found:
(0) MarsKetplace
What server do you want to connect to?: 0
Starting connection to Hardhat

I don’t know, I didn’t see that before

I’ve noticed that I made a mistake, from me re-writting the command to sync to the server, it does not match the frpc.ini.

I changed it, now I do not have the error message about the subdomain missing, but the command node addEventsMoralis.js still fails

are you still having a lot of block numbers synced?

yes, still running wild :confused: I’ve been googling the problem but so far, no luck

is there anything else in that hardhat config?
maybe it is not running with latest config version?

I have this in the hardhat.config.js :

require("@nomiclabs/hardhat-waffle")
require("@nomiclabs/hardhat-etherscan")
require("hardhat-deploy")
require("solidity-coverage")
require("hardhat-gas-reporter")
require("hardhat-contract-sizer")
require("dotenv").config()

/**
 * @type import('hardhat/config').HardhatUserConfig
 */

const RINKEBY_RPC_URL = process.env.RINKEBY_RPC_URL

const PRIVATE_KEY = process.env.PRIVATE_KEY

const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY
const REPORT_GAS = process.env.REPORT_GAS || false

module.exports = {
  defaultNetwork: "hardhat",
  networks: {
    hardhat: {
      chainId: 31337,
    },
    localhost: {
      chainId: 31337,
    },
    rinkeby: {
      url: RINKEBY_RPC_URL,
      accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [],
      saveDeployments: true,
      chainId: 4,
      blockConfirmations: 8,
    },
  },
  etherscan: {
    // npx hardhat verify --network <NETWORK> <CONTRACT_ADDRESS> <CONSTRUCTOR_PARAMETERS>
    apiKey: {
      rinkeby: ETHERSCAN_API_KEY,
    },
  },
  gasReporter: {
    enabled: REPORT_GAS,
    currency: "USD",
    outputFile: "gas-report.txt",
    noColors: true,
    // coinmarketcap: process.env.COINMARKETCAP_API_KEY,
  },
  contractSizer: {
    runOnCompile: false,
    only: ["Raffle"],
  },
  namedAccounts: {
    deployer: {
      default: 0, 
      1: 0,
    },
    player: {
      default: 1,
    },
  },
  solidity: {
    compilers: [
      {
        version: "0.8.7",
      },
      {
        version: "0.4.24",
      },
    ],
  },
  mocha: {
    timeout: 200000, // 200 seconds max for running tests
  },
}

and this in a file called helper-hardhat-config.js:

const networkConfig = {
  1337: {
    name: 'localhost',
    gasLane:
      '0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc', // 30 gwei
    mintFee: '1000000000000000000', // 1 ETH
    callbackGasLimit: '500000', // 500,000 gas
    subscriptionId: 'xxxx', // our own ID
  },

  4: {
    name: 'rinkeby',
    vrfCoordinatorV2: '0x6168499c0cFfCaCD319c818142124B7A15E857ab',
    gasLane:
      '0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc',
    callbackGasLimit: '500000', // 500,000 gas
    mintFee: '100000000000000000', // 0.1 ETH
    subscriptionId: 'xxxx', // our own ID
  },
}

const developmentChains = ['hardhat', 'localhost']

module.exports = {
  networkConfig,
  developmentChains,
}

then where from could it have so many block numbers?

I really don’t understand either. Would it help if I copy past my contract here? maybe there’s something wrong with it ? (tests are passing successfully with more than 90% coverage)

I don’t think that it help to paste the contract code, that is only a contract

how do you know how many block numbers are?

I’m not sure I understand your question ? Do you mean how do I know the number of block requests are made?

I mean, how did you get this number:

because I’m running yarn hardhat node on the back-end, and it updates in real time the requests made, deploying my contracts on hardhat localhost network

there are only 2 block numbers synced on that server now