mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Make createAndEndowD
payable in contract creation example
This commit is contained in:
parent
bf294253bb
commit
2b88eeb370
@ -237,16 +237,17 @@ creation-dependencies are not possible.
|
|||||||
D newD = new D(arg);
|
D newD = new D(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createAndEndowD(uint arg, uint amount) {
|
function createAndEndowD(uint arg, uint amount) payable {
|
||||||
// Send ether along with the creation
|
// Send ether along with the creation
|
||||||
D newD = (new D).value(amount)(arg);
|
D newD = (new D).value(amount)(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
As seen in the example, it is possible to forward Ether to the creation using the ``.value()`` option,
|
As seen in the example, it is possible to forward Ether while creating
|
||||||
but it is not possible to limit the amount of gas. If the creation fails
|
an instance of ``D`` using the ``.value()`` option, but it is not possible
|
||||||
(due to out-of-stack, not enough balance or other problems), an exception
|
to limit the amount of gas.
|
||||||
is thrown.
|
If the creation fails (due to out-of-stack, not enough balance or other problems),
|
||||||
|
an exception is thrown.
|
||||||
|
|
||||||
Order of Evaluation of Expressions
|
Order of Evaluation of Expressions
|
||||||
==================================
|
==================================
|
||||||
|
Loading…
Reference in New Issue
Block a user