mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #447 from ethereum/Initialize_Contract_with_Wei_call
Update frequently-asked-questions.rst
This commit is contained in:
commit
14d6b0b2d6
@ -613,6 +613,7 @@ Note that the full code of the created contract has to be included in the creato
|
|||||||
This also means that cyclic creations are not possible (because the contract would have
|
This also means that cyclic creations are not possible (because the contract would have
|
||||||
to contain its own code) - at least not in a general way.
|
to contain its own code) - at least not in a general way.
|
||||||
|
|
||||||
|
|
||||||
How do you create 2-dimensional arrays?
|
How do you create 2-dimensional arrays?
|
||||||
=======================================
|
=======================================
|
||||||
|
|
||||||
@ -647,6 +648,22 @@ gas and return your 20 Wei).
|
|||||||
In the above example, the low-level function `call` is used to invoke another
|
In the above example, the low-level function `call` is used to invoke another
|
||||||
contract with `p.data` as payload and `p.amount` Wei is sent with that call.
|
contract with `p.data` as payload and `p.amount` Wei is sent with that call.
|
||||||
|
|
||||||
|
How do I initialize a contract with only a specific amount of wei?
|
||||||
|
==================================================================
|
||||||
|
|
||||||
|
Currently the approach is a little ugly, but there is little that can be done to improve it.
|
||||||
|
In the case of a `contract A` calling a new instance of `contract B`, parentheses have to be used around
|
||||||
|
`new B` because `B.value` would refer to a member of `B` called `value`.
|
||||||
|
You will need to make sure that you have both contracts aware of each other's presence.
|
||||||
|
In this example::
|
||||||
|
contract B {}
|
||||||
|
contract A {
|
||||||
|
address child;
|
||||||
|
function test() {
|
||||||
|
child = (new B).value(10)(); //construct a new B with 10 wei
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Can a contract function accept a two-dimensional array?
|
Can a contract function accept a two-dimensional array?
|
||||||
=======================================================
|
=======================================================
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user