0

I am trying to execute the following smart contract using Truffle:

pragma solidity 0.5.16;
 
 contract Phishable {
     address public owner;
     constructor (address _owner) public{
         owner = _owner;
     }
     function () external payable {} 
     function withdrawAll(address payable _recipient) public {
         require(tx.origin == owner);
         _recipient.transfer(address(this).balance);
     } }

== Following is my script:

const vic= artifacts.require("Phishable");
 console.log("Point1 ###1")
 const att= artifacts.require("PhishableAtt");
 console.log("Point2 ###2")
 const vicobj = await vic.new();
 console.log("Point3 ###1")

When I execute the script, I am getting the following output:

$ truffle exec toolreent3.js
Using network 'development'.

Point1 ###1
Point2 ###2
{ Error: Invalid number of parameters for "undefined". Got 0 expected 1!
    at module.exports (/home/zulfi/Truffle_programs/txorigin_assertion_TechyTech_tool/toolreent3.js:400:42)

My 2_deploy_contracts.js is:

const Phishable  = artifacts.require("Phishable");
module.exports = function(deployer) {

deployer.deploy(Phisable);
}

Somebody please guide me.

Zulfi.

1 Answer 1

0

The problem is this line const vicobj = await vic.new();. The function new() requires a parameter such as {from: accounts[0]} .

1
  • @Yonjian, please tell me about the arguments for the migration file also i.e. 2_deploy_contracts.js
    – zak100
    Sep 14, 2022 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.