1

In case we want to deploy a contract by web3.js we can easily determine the balance of the contract at time of deployment as follows:

const thisContract = new web3.eth.Contract(abi);
thisContract.deploy({  
        data: bytecode,
        arguments: [< parameters of the constructor>]
    }).send({
       from: "0x3455D7167A2EE2d660EE85F8e90C6b3B1cCB7163",
       gas: 5000000 ,
       gasPrice: '3000000000',
       value: 5000 // here we determine the balance of the contract 
    },
    function(error, transactionHash) {
        console.log(error);
        console.log(transactionHash);
        console.log('function exec');
    }).then(function(newContractInstance) {
    console.log('Contract Instance:' + newContractInstance.options.address);
});

In this example, the balance of the contract is value: 5000.

However, when we want to do this by remix, is there any option to determine the value of the balance of the contract at time of deployment ?

3

Make the constructor payable and set a non-zero value for the ether before hitting deploy (see image)

enter image description here

Hope this helps.

  • Thank you, in fact I asked this question, because I have a problem to make a settlement between payer and recipient using an Ethereum base blockchain (testnet) named Tobalaba (link) I explained the problem here (link) So, I decided to test this contract by remix to find what is the problem. I appreciate any idea to solve this problem. Thanks – Questioner Jul 12 '18 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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