0
votes

I want to deploy my contract which contain a constructor (2 account address and a value P), in Remix, I put manually the address of both account and P value, but in truffle, I edited manually the 2_deploy_contracts.js file as follow:

Contract:

constructor(address payable _account1, address payable _account2, uint _P) public {account1 = _account1;account2 = _account2; P = _P;}

2_deploy_contracts.js:

var contract = artifacts.require("contract");
module.exports = function(deployer)  {
deployer.deploy(contract, account1, account2, P);};

Thanks in advance for help.

1
Can you clarify a little bit more your issue plz.Emmanuel Collin
The contract should deployed with a 3 constructors: the address of account1, the address of account2, and the value of P. In Remix, I put these value manually before deploying the contract. But in Truffle, as I know I have to setup the 2_deploy_contracts.js file, and my issue is here. How I can config this file before deploying the contract because Truffle show me an error in the migration phase.Vincent
Thanks @EmmanuelCollin. I've declare them as "var" and the deployment is done succesfuly.Vincent

1 Answers

0
votes

You have to declare and initialize these parameters :
var account1='0x...';
var account2='0x...';
var P=...;
deployer.deploy(contract, account1, account2, P);