Someone could help me. Despite the similar questions i read, i don't see what is wrong. Thanks in advance, Claude
Here is detailed information about error
imac-de-claude:TransactionContract claudevannier$ npx hardhat run ./scripts/deploy.js --network localhost
Error: incorrect number of arguments to constructor
at ContractFactory.getDeployTransaction (/Users/claudevannier/TransactionContract/node_modules/ethers/src.ts/contract/factory.ts:87:19)
at ContractFactory.deploy (/Users/claudevannier/TransactionContract/node_modules/ethers/src.ts/contract/factory.ts:105:31)
at main (/Users/claudevannier/TransactionContract/scripts/deploy.js:11:34)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
imac-de-claude:TransactionContract claudevannier$
Here is my solidity contract.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract TransactionContract {
address public accountX;
address public accountY;
address public owner;
event TransactionEvent(address indexed sender, address indexed receiver, uint amount, string eventTrigger);
constructor(address _accountX, address _accountY) {
accountX = _accountX;
accountY = _accountY;
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "Only contract owner can call this function");
_;
}
function triggerTransaction(uint _amount, string memory _eventTrigger) public {
require(msg.sender == accountX, "Only account X can trigger this transaction");
require(_amount > 0, "Amount must be greater than zero");
// Transfer funds from accountX to accountY
(bool success, ) = accountY.call{value: _amount}("");
require(success, "Transfer failed");
emit TransactionEvent(accountX, accountY, _amount, _eventTrigger);
}
// Fallback function to receive ETH
receive() external payable {}
}
here is my script for deploy the contract
const hre = require("hardhat");
async function main() {
const transac = await hre.ethers.getContractFactory("TransactionContract");
const contract = await transac.deploy();
await contract.deployed();
console.log("contract deployed to:", contract.address);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});