Code Monkey home page Code Monkey logo

Comments (5)

daalmana avatar daalmana commented on May 18, 2024

Did you check if ganache is running on local host 8545 and not at 7545?
Maybe also change HTTP into http (no caps)

You can see the local host in the ganache app on the top!

from full-blockchain-solidity-course-js.

DorianDaSilva avatar DorianDaSilva commented on May 18, 2024

@daalmana Yes, I have tested all of this. It still doesn't resolve the issue with the compiler.

This is the deploy.js code

const ethers = require("ethers");
const fs = require("fs-extra");

async function main() {
  const provider = new ethers.provider.JsonRpcProvider("HTTP://0.0.0.0:8545");
  const wallet = new ethers.Wallet(
    "c893d45f...................................................fdef96c9a13081",
    provider
  );
  const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
  const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
  );
  const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
  console.log("Deploying, please wait...");
  const contract = await contractFactory.deploy(); //STOP here! wait for contract to deploy
  console.log(contract);
}

main()
  .then(() => ProcessingInstruction.exit(0))
  .catch((error) => {
    console.error(error);
    ProcessingInstruction.exit(1);
  });

This is the error I am getting running this code:

ReferenceError: ProcessingInstruction is not defined

And this the same simple storage contract I had on remix

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;

contract SimpleStorage {
    uint256 favoriteNumber;

    mapping(string => uint256) public nameToFavoriteNumber;

    struct People {
        uint256 favoriteNumber;
        string name;
    }

    People[] public people;

    function store(uint256 _favoriteNumber) public virtual {
        favoriteNumber = _favoriteNumber;
    }

    function retrieve() public view returns (uint256) {
        return favoriteNumber;
    }

    function addPerson(string memory _name, uint256 _favoriteNumber) public {
        people.push(People(_favoriteNumber, _name));
        nameToFavoriteNumber[_name] = _favoriteNumber;
    }
}

Do you know whta could be the issue? What package maybe causing the issue?

from full-blockchain-solidity-course-js.

DorianDaSilva avatar DorianDaSilva commented on May 18, 2024

Maybe it's a bug in json settings?

{
    "editor.defaultFormatter": "NomicFoundation.hardhat-solidity",
    "workbench.colorTheme": "Abyss",
    "html.format.unformatted": "esbenp.prettier-vscode",
    "eslint.format.enable": true,
    "editor.formatOnSave": true,
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "files.autoSave": "afterDelay",
    "solang.target": "ewasm",
}
{
  "dependencies": {
    "ethers": "^5.6.8",
    "fs-extra": "^10.1.0",
    "solc": "^0.8.14-fixed"
  },
  "scripts": {
    "compile": "yarn solcjs --bin --abi --include-path node_modules/ --base-path . -o . SimpleStorage.sol"
  }
}

from full-blockchain-solidity-course-js.

daalmana avatar daalmana commented on May 18, 2024

Look at your main function at the bottom! It's should be procces not processingInstructions

image

from full-blockchain-solidity-course-js.

DorianDaSilva avatar DorianDaSilva commented on May 18, 2024

@daalmana Thank you for the info. I modified it but now it returns

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

When running node deploy.js, I am assuming it is related to Ganache UI (I always run into issues using Ganache UI)

from full-blockchain-solidity-course-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.