Error when trying to deploy a contract in ethers@6.4.0 #4426
-
Hi, i'm trying to deploy the contract, and this is my deploy script: const { ethers } = require("hardhat");
const hre = require("hardhat");
async function main() {
const currentTimestampInSeconds = Math.round(Date.now() / 1000);
const unlockTime = currentTimestampInSeconds + 60;
const lockedAmount = hre.ethers.parseEther("0.001");
const lock = await hre.ethers.deployContract("Lock", [unlockTime], {
value: lockedAmount,
});
await lock.waitForDeployment();
console.log(
`Lock with ${ethers.formatEther(
lockedAmount
)}ETH and unlock timestamp ${unlockTime} deployed to ${lock.target}`
);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
}); Error:
package.json: {
"name": "react-dapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^3.0.0",
"@nomicfoundation/hardhat-verify": "^1.0.0",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"@typechain/ethers-v6": "^0.4.0",
"@typechain/hardhat": "^8.0.0",
"chai": "^4.2.0",
"ethereum-waffle": "^4.0.10",
"ethers": "^6.4.0",
"hardhat": "^2.14.0",
"hardhat-gas-reporter": "^1.0.8",
"solidity-coverage": "^0.8.0",
"typechain": "^8.1.0"
}
}
Can someone help me out with this error? |
Beta Was this translation helpful? Give feedback.
Answered by
sanju50201
Oct 16, 2023
Replies: 1 comment
-
Apparently changing to ethers@6.8.0 worked |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sanju50201
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Apparently changing to ethers@6.8.0 worked