I am currently working on a smart contract using Solidity (version 0.8.0) at my buildspace project. Below is a snippet of my code written in TypeScript (4.5.x)/JavaScript and Node.js 16.13.x:
...
const waveContractFactory = await hre.ethers.getContractFactory("WavePortal");
const waveContract = await waveContractFactory.deploy({
value: hre.ethers.utils.parseEther("0.1"),
});
...
The code above is saved in a file named run.ts
. To run this code, I use the command:
npx hardhat run scripts/run.ts
Upon execution, I encountered an error displayed as follows with part of the tail end truncated:
error TS2345: Argument of type '{ value: BigNumber; }' is not assignable to parameter of type 'Overrides & { from?: string | Promise<string> | undefined; }'.
Object literal may only specify known properties, and 'value' does not exist in type 'Overrides & { from?: string | Promise<string> | undefined; }'.
7 value: hre.ethers.utils.parseEther("0.1"),
....
The "7" reference points to the line where the error occurred. I'm unsure about the source of this error, causing failures in the execution of run.ts/js
.
In this code snippet, I am attempting to add 0.1 ether to fund my smart contract.
Here is an excerpt from my smart contract:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract WavePortal {
...
constructor() {
console.log("Hello, Multiverse... I am Smart Contract WavePortal");
}
...
}