Here is the script in my deploy.js
:
const main = async () => {
// We get the contract to deploy
const Transactions = await hre.ethers.getContractFactory("Transactions");
const transactions = await Transactions.deploy();
}
const runMain = async() => {
try {
await main();
Process.exit(0);
} catch (error) {
console.error(error);
process.exit(1);
}
}
runMain();
Here is the script in my hardhat.config.js
:
// This is a sample Hardhat task.
// https://eth-ropsten.alchemyapi.io/v2/Bn5tm9fX90ET1hKwb76lKJB0rzU3JBi2
require("@nomiclabs/hardhat-waffle");
module.exports = {
solidity: '0.8.0',
networks: {
ropsten: {
url: "https://eth-ropsten.alchemyapi.io/v2/Bn5tm9fX90ET1hKwb76lKJB0rzU3JBi2",
accounts: ["63b598044c3cce8d656............b7c64beb17eb1687aebbefc5cac8a"]
}
}
}
This is my solidity contract script:
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity >=0.6.0 <0.9.0;
contract Transactions {
uint256 transactionCount;
event Transfer(
address from,
address reciever,
uint256 amount,
string message,
uint256 timestamp,
string keyword
);
struct TransferStruct {
address sender;
address reciever;
uint256 amount;
string message;
uint256 timestamp;
string keyword;
}
TransferStruct[] transactions;
function addToBlockchain(
address payable reciever,
uint256 amount,
string memory message,
string memory keyword
) public {
transactionCount += 1;
transactions.push(
TransferStruct(
msg.sender,
reciever,
amount,
message,
block.timestamp,
keyword
)
);
emit Transfer(
msg.sender,
reciever,
amount,
message,
block.timestamp,
keyword
);
}
function getAllTransactions()
public
view
returns (TransferStruct[] memory)
{
return transactions;
}
function getTransactionCount() public view returns (uint256) {
return transactionCount;
}
}
And below is the error message I get anytime I try to compile it:
PS C:\Users\Temitope\Desktop\kredar\smart_contract> npx hardhat run scripts/deploy.js --network ropsten
ReferenceError: Process is not defined
at runMain (C:\Users\Temitope\Desktop\kredar\smart_contract\scripts\deploy.js:13:5)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Please kindly let me know what I'm doing wrong and how to solve it.