From 49dc38bac02580a5082d4519b67a1336ff0aa6e2 Mon Sep 17 00:00:00 2001 From: RJ Date: Wed, 23 Mar 2016 16:42:01 -0500 Subject: [PATCH 1/2] Update frequently-asked-questions.rst --- docs/frequently-asked-questions.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index db37a272b..94fc9344c 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -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 to contain its own code) - at least not in a general way. + How do you create 2-dimensional arrays? ======================================= @@ -647,6 +648,20 @@ gas and return your 20 Wei). 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. +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. +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? ======================================================= From 927a9710d5ce37c86ffc642b6cc39eeaed0e1efb Mon Sep 17 00:00:00 2001 From: RJ Date: Fri, 25 Mar 2016 11:25:14 -0500 Subject: [PATCH 2/2] Update frequently-asked-questions.rst --- docs/frequently-asked-questions.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index 94fc9344c..f960a0d6e 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -652,6 +652,8 @@ 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 {}