займ на карту онлайн кредит банк

Solidity: Send a new contract ether in constructor

0

I tried doing

address NewContract = new SomeTest.value(1 ether)(); 

But this yields a syntax error.

I try to call the payable constructor of a new contract with ether. What is the syntax for this?

Try using the below syntax (ensure that the SomeTest constructor is marked payable):

pragma solidity ^0.4.24;  contract SomeTest  {     constructor() public payable {} }  contract A  {     address newContract;      function test() public      {       //construct a new SomeTest with 1 ether       newContract = (new SomeTest).value(1 ether)();      } } 

Source: http://solidity.readthedocs.io/en/develop/frequently-asked-questions.html#how-do-i-initialize-a-contract-with-only-a-specific-amount-of-wei

TLDR: encapsulate in parentheses like this (new SomeTest).value(1 ether) .