doc & changelog

This commit is contained in:
Lesenechal Remi 2020-03-02 13:35:26 +01:00
parent cf383fe327
commit a4fece03d6
2 changed files with 43 additions and 0 deletions

View File

@ -2,6 +2,10 @@
## [Unreleased]
## [Add crypto reference page to docs](https://gitlab.com/ligolang/ligo/-/merge_requests/459)
### Added
- support for `Tezos.create_contract` origination
## [9164206ef1fcf3e577820442b5afbad92d03ffa4] - 2020-02-09
### Changed
- Mutation of variables inside lambdas passed to list_iter do not have effect anymore. Side-effects used to survive iterations of list_iter via a quirk in the Michelson list_iter. Now, either use a list_fold and explicitly pass through the updated variables (e.g. storage) to the next iteration, or use a `for` loop which automatically detects mutations within the loop body and lifts the affected variables to a record that is passed from iteration to iteration.

View File

@ -154,3 +154,42 @@ let current_addr : address = Tezos.self_address;
```
<!--END_DOCUSAURUS_CODE_TABS-->
## Origination of a contract
`Tezos.create_contract` allows you to originate a contract given its code, delegate (if any), initial balance and initial storage.
The return value is a pair of type `(operation * address)`.
> ⚠️ Due to limitations in Michelson, `Tezos.create_contract` first argument
> must be inlined and must not contain references to free variables
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
```pascaligo group=e
const origination : operation * address = Tezos.create_contract (
function (const p : nat; const s : string): list(operation) * string is ((nil : list(operation)), s),
(None : option(key_hash)),
3tz,
"initial_storage")
```
<!--CameLIGO-->
```cameligo group=e
let origination : operation * address = Tezos.create_contract
(fun (p, s : nat * string) -> (([] : operation list), s))
(None: key_hash option)
3tz
"initial_storage"
```
<!--ReasonLIGO-->
```reasonligo group=e
let origination : (operation, address) = Tezos.create_contract (
((p, s) : (nat,string)) : (list(operation),string) => (([] : list(operation)), s),
None: option(key_hash),
3tz,
"initial_storage")
```
<!--END_DOCUSAURUS_CODE_TABS-->