Contract factories and bytecode introspection #796

Merged
zxq9 merged 34 commits from factories into master 2021-05-18 19:21:57 +09:00
Showing only changes of commit 166b56a7a8 - Show all commits

View File

@ -770,10 +770,10 @@ The gas limit of the current block.
Chain.bytecode_hash : 'c => option(hash) Chain.bytecode_hash : 'c => option(hash)
``` ```
Returns the hash of the contract's bytecode (or `None` if it is nonexistent or Returns the hash of the contract's bytecode (or `None` if it is
deployed before FATE2). The type `'c` must be instantiated with a contract. The nonexistent or deployed before FATE2). The type `'c` must be
charged gas is affine to the size of the serialized bytecode of the deployed instantiated with a contract. The charged gas increases linearly to
contract. the size of the serialized bytecode of the deployed contract.
#### create #### create
@ -781,11 +781,11 @@ contract.
Chain.create(value : int, ...) => 'c Chain.create(value : int, ...) => 'c
``` ```
Creates and deploys a new instance of a contract `'c`. All of the unnamed Creates and deploys a new instance of a contract `'c`. All of the
arguments will be passed to the `init` function. The charged gas is affine to unnamed arguments will be passed to the `init` function. The charged
the size of the compiled child contract's bytecode. The `source_hash` on-chain gas increases linearly with the size of the compiled child contract's
entry of the newly created contract will be the SHA256 hash over concatenation bytecode. The `source_hash` on-chain entry of the newly created
of contract will be the SHA256 hash over concatenation of
- whole contract source code - whole contract source code
- single null byte - single null byte