Lesson 5: ReferenceError: Process is not defined #801
Answered
by
alymurtazamemon
Longmao1211
asked this question in
Q&A
-
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
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;
}
}
const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
const provider = new ethers.providers.JsonRpcProvider(
"HTTP://192.168.176.1:7545"
);
const wallet = new ethers.Wallet(
"acec179c15eefa9a7f32f4b32e4e299459eac0003c3fde18d86611e91070848b",
provider
);
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
const bin = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.bin", "utf8");
const contrantFactory = new ethers.ContractFactory(abi, bin, wallet);
console.log("Deploying,please wait...");
const contract = await contrantFactory.deploy();
await contract.deployTransaction.wait(1);
const currentFavoritNumber = contract.retrieve();
console.log(currentFavoritNumber);
}
main()
.then(() => Process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
|
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Jul 7, 2022
Replies: 1 comment 4 replies
-
@Longmao1211 |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Longmao1211
Process.exit(0)
. p should be small.