diff options
Diffstat (limited to 'docs/control-structures.rst')
-rw-r--r-- | docs/control-structures.rst | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 73b0131f..b3940f72 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -127,11 +127,11 @@ Those names will still be present on the stack, but they are inaccessible. .. _creating-contracts: -Creating Contracts via new -========================== +Creating Contracts via ``new`` +============================== A contract can create a new contract using the ``new`` keyword. The full -code of the contract to be created has to be known and thus recursive +code of the contract being created has to be known and, thus, recursive creation-dependencies are now possible. :: @@ -142,6 +142,8 @@ creation-dependencies are now possible. x = a; } } + + contract C { D d = new D(4); // will be executed as part of C's constructor @@ -503,9 +505,9 @@ The opcodes ``pushi`` and ``jumpdest`` cannot be used directly. +-------------------------+------+-----------------------------------------------------------------+ | callvalue | | wei sent together with the current call | +-------------------------+------+-----------------------------------------------------------------+ -| calldataload(p) | | call data starting from position p (32 bytes) | +| calldataload(p) | | calldata starting from position p (32 bytes) | +-------------------------+------+-----------------------------------------------------------------+ -| calldatasize | | size of call data in bytes | +| calldatasize | | size of calldata in bytes | +-------------------------+------+-----------------------------------------------------------------+ | calldatacopy(t, f, s) | `-` | copy s bytes from calldata at position f to mem at position t | +-------------------------+------+-----------------------------------------------------------------+ @@ -520,14 +522,14 @@ The opcodes ``pushi`` and ``jumpdest`` cannot be used directly. | create(v, p, s) | | create new contract with code mem[p..(p+s)) and send v wei | | | | and return the new address | +-------------------------+------+-----------------------------------------------------------------+ -| call(g, a, v, in, | | call contract at address a with input mem[in..(in+insize)] | +| call(g, a, v, in, | | call contract at address a with input mem[in..(in+insize)) | | insize, out, outsize) | | providing g gas and v wei and output area | -| | | mem[out..(out+outsize)] returting 1 on error (out of gas) | +| | | mem[out..(out+outsize)) returning 1 on error (out of gas) | +-------------------------+------+-----------------------------------------------------------------+ -| callcode(g, a, v, in, | | identical to call but only use the code from a and stay | +| callcode(g, a, v, in, | | identical to `call` but only use the code from a and stay | | insize, out, outsize) | | in the context of the current contract otherwise | +-------------------------+------+-----------------------------------------------------------------+ -| delegatecall(g, a, in, | | identical to callcode but also keep ``caller`` | +| delegatecall(g, a, in, | | identical to `callcode` but also keep ``caller`` | | insize, out, outsize) | | and ``callvalue`` | +-------------------------+------+-----------------------------------------------------------------+ | return(p, s) | `*` | end execution, return data mem[p..(p+s)) | |