From dbda9df3216cf6e21178a0fd3e301b4af622150e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20=C5=A0ima?= Date: Sat, 9 Nov 2019 14:40:53 +0000 Subject: [PATCH] Feature/fix docs --- .../{language-basics => api}/cheat-sheet.md | 0 .../cli-commands.md} | 2 +- .../docs/language-basics/boolean-if-else.md | 8 ++-- .../docs/language-basics/entrypoints.md | 46 ------------------- .../docs/language-basics/maps-records.md | 8 ++-- .../get-started/tezos-taco-shop-payout.md | 2 +- .../tezos-taco-shop-smart-contract.md | 4 +- .../blog/2019-06-13-public-launch-of-ligo.md | 2 +- gitlab-pages/website/core/Footer.js | 8 ++-- gitlab-pages/website/pages/en/index.js | 2 +- gitlab-pages/website/pages/en/versions.js | 6 +-- gitlab-pages/website/sidebars.json | 6 ++- 12 files changed, 25 insertions(+), 69 deletions(-) rename gitlab-pages/docs/{language-basics => api}/cheat-sheet.md (100%) rename gitlab-pages/docs/{api-cli-commands.md => api/cli-commands.md} (97%) delete mode 100644 gitlab-pages/docs/language-basics/entrypoints.md diff --git a/gitlab-pages/docs/language-basics/cheat-sheet.md b/gitlab-pages/docs/api/cheat-sheet.md similarity index 100% rename from gitlab-pages/docs/language-basics/cheat-sheet.md rename to gitlab-pages/docs/api/cheat-sheet.md diff --git a/gitlab-pages/docs/api-cli-commands.md b/gitlab-pages/docs/api/cli-commands.md similarity index 97% rename from gitlab-pages/docs/api-cli-commands.md rename to gitlab-pages/docs/api/cli-commands.md index aa75e3a0b..1e4a88fce 100644 --- a/gitlab-pages/docs/api-cli-commands.md +++ b/gitlab-pages/docs/api/cli-commands.md @@ -1,5 +1,5 @@ --- -id: api-cli-commands +id: cli-commands title: CLI Commands --- diff --git a/gitlab-pages/docs/language-basics/boolean-if-else.md b/gitlab-pages/docs/language-basics/boolean-if-else.md index fd4384c29..a2059b697 100644 --- a/gitlab-pages/docs/language-basics/boolean-if-else.md +++ b/gitlab-pages/docs/language-basics/boolean-if-else.md @@ -82,14 +82,14 @@ let h: bool = (a =/= b) ```pascaligo -const a: tez = 5mtz; -const b: tez = 10mtz; +const a: tez = 5mutez; +const b: tez = 10mutez; const c: bool = (a = b); ``` ```cameligo -let a: tez = 5mtz -let b: tez = 10mtz +let a: tez = 5mutez +let b: tez = 10mutez // false let c: bool = (a = b) ``` diff --git a/gitlab-pages/docs/language-basics/entrypoints.md b/gitlab-pages/docs/language-basics/entrypoints.md deleted file mode 100644 index fca89e7db..000000000 --- a/gitlab-pages/docs/language-basics/entrypoints.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -id: entrypoints -title: Entrypoints ---- - -Entrypoints are the gates to a smart contract. In LIGO each entrypoint is a function that accepts two arguments. The first is the parameter used to invoke the contract, and the second is the current storage of the contract. Each entrypoint must return a list of operations to apply as a result of the smart contract call, and a new storage value. - -> If you don't want to update the storage, don't worry, just re-cycle your last storage value. - -## Defining an entry point - -The contract below is effectively an empty contract. It takes a `unit` as a parameter, and returns a `unit`. - - - -```pascaligo -function main (const p : unit ; const s : unit) : (list(operation) * unit) is - block {skip} with ((nil : list(operation)), s) -``` - - -## Multiple entry points - -Multiple entrypoints are currently not supported in Michelson. But with Ligo you can work around that by using variants & pattern matching. - -In the example below we have a simple counter contract, that can be either `Increment(int)`-ed, or `Decrement(int)`-ed. - - - -```pascaligo -// variant defining pseudo multi-entrypoint actions -type action is -| Increment of int -| Decrement of int - -// real entrypoint that re-routes the flow based on the action (parameter) provided -function main (const action: action ; const counter: int) : (list(operation) * int) is - block {skip} with ((nil : list(operation)), - case action of - | Increment(number) -> counter + number - | Decrement(number) -> counter - number - end) -``` - - - diff --git a/gitlab-pages/docs/language-basics/maps-records.md b/gitlab-pages/docs/language-basics/maps-records.md index b81dfd8c7..96a5bca9b 100644 --- a/gitlab-pages/docs/language-basics/maps-records.md +++ b/gitlab-pages/docs/language-basics/maps-records.md @@ -31,8 +31,8 @@ And here's how a map value is populated: ```pascaligo const ledger: ledger = map - ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> 1000mtz; - ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> 2000mtz; + ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> 1000mutez; + ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> 2000mutez; end ``` > Notice the `->` between the key and its value and `;` to separate individual map entries. @@ -43,8 +43,8 @@ end ```cameligo let ledger: ledger = Map.literal - [ (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), 1000mtz) ; - (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), 2000mtz) ; + [ (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), 1000mutez) ; + (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), 2000mutez) ; ] ``` > Map.literal constructs the map from a list of key-value pair tuples, `(, )`. diff --git a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.md b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.md index ffc6e5687..9ca0346eb 100644 --- a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.md +++ b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-payout.md @@ -72,7 +72,7 @@ const ownerAddress : address = "tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV"; const receiver : contract(unit) = get_contract(ownerAddress); ``` -> Would you like to learn more about addresses, contracts and operations in LIGO? Check out the [LIGO cheat sheet](language-basics/cheat-sheet.md) +> Would you like to learn more about addresses, contracts and operations in LIGO? Check out the [LIGO cheat sheet](api/cheat-sheet.md) ### Adding the transaction to the list of output operations Now we can transfer the `amount` received by `buy_taco` to Pedro's `ownerAddress`. We will do so by forging a `transaction(unit, amount, receiver)` within a list of operations returned at the end of our contract. diff --git a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md index 59ea39198..5a48d0b08 100644 --- a/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md +++ b/gitlab-pages/docs/tutorials/get-started/tezos-taco-shop-smart-contract.md @@ -57,7 +57,7 @@ current_purchase_price = max_price / available_stock ## Installing LIGO -In this tutorial, we'll use LIGO's dockerized version for the sake of simplicity. You can find the installation instructions [here](setup/installation.md#dockerized-installation-recommended). +In this tutorial, we'll use LIGO's dockerized version for the sake of simplicity. You can find the installation instructions [here](intro/installation.md#dockerized-installation-recommended). The best way to install the dockerized LIGO is as a **global executable** through the installation script, as shown in the screenshot below: @@ -66,7 +66,7 @@ The best way to install the dockerized LIGO is as a **global executable** throug ## Implementing our first entry point -> From now on we'll get a bit more technical. If you run into something we have not covered yet - please try checking out the [LIGO cheat sheet](language-basics/cheat-sheet.md) for some extra tips & tricks. +> From now on we'll get a bit more technical. If you run into something we have not covered yet - please try checking out the [LIGO cheat sheet](api/cheat-sheet.md) for some extra tips & tricks. To begin implementing our smart contract, we need an entry point. We'll call it `main` and it'll specify our contract's storage (`int`) and input parameter (`int`). Of course this is not the final storage/parameter of our contract, but it's something to get us started and test our LIGO installation as well. diff --git a/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md b/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md index c59729ff7..fb6373d46 100644 --- a/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md +++ b/gitlab-pages/website/blog/2019-06-13-public-launch-of-ligo.md @@ -15,7 +15,7 @@ The core language is being developed by The Marigold Project. George Dupéron an Our previous Medium posts about LIGO can be found [here](https://medium.com/tezos/introducing-ligo-a-new-smart-contract-language-for-tezos-233fa17f21c7) and [here](https://medium.com/tezos/ligo-becomes-polyglot-a474e2cb0c24). ## The State of LIGO -Today, we are publicly releasing LIGO in beta\*. We've focused on making the onboarding process for LIGO as painless as possible and encourage you to check out our [tutorials](/docs/tutorials/get-started/tezos-taco-shop-smart-contract) and [documentation](https://ligolang.org/docs/next/setup/installation). +Today, we are publicly releasing LIGO in beta\*. We've focused on making the onboarding process for LIGO as painless as possible and encourage you to check out our [tutorials](/docs/tutorials/get-started/tezos-taco-shop-smart-contract) and [documentation](https://ligolang.org/docs/next/intro/installation). We are fixing bugs and adding features to LIGO (e.g. some Michelson primitives like iterators are missing) by the day. Please submit issues about bugs and missing features you need when you encounter them, and you just might find those solved in the following week. diff --git a/gitlab-pages/website/core/Footer.js b/gitlab-pages/website/core/Footer.js index d5f79c25b..561b47836 100644 --- a/gitlab-pages/website/core/Footer.js +++ b/gitlab-pages/website/core/Footer.js @@ -28,13 +28,13 @@ class Footer extends React.Component {
Docs
- + Installation - + CLI Commands - + Contribute @@ -59,7 +59,7 @@ class Footer extends React.Component {
diff --git a/gitlab-pages/website/pages/en/index.js b/gitlab-pages/website/pages/en/index.js index 7f2cf0fde..3cbc9da91 100644 --- a/gitlab-pages/website/pages/en/index.js +++ b/gitlab-pages/website/pages/en/index.js @@ -196,7 +196,7 @@ class HomeSplash extends React.Component { Try Online Get Started diff --git a/gitlab-pages/website/pages/en/versions.js b/gitlab-pages/website/pages/en/versions.js index 6abeaa02e..4ea4a4f4f 100644 --- a/gitlab-pages/website/pages/en/versions.js +++ b/gitlab-pages/website/pages/en/versions.js @@ -37,7 +37,7 @@ function Versions(props) { + }intro/installation`}> Documentation @@ -61,7 +61,7 @@ function Versions(props) { + }next/intro/installation`}> Documentation @@ -86,7 +86,7 @@ function Versions(props) { + }${version}/intro/installation`}> Documentation diff --git a/gitlab-pages/website/sidebars.json b/gitlab-pages/website/sidebars.json index 71827e978..13ce03e4e 100644 --- a/gitlab-pages/website/sidebars.json +++ b/gitlab-pages/website/sidebars.json @@ -2,7 +2,6 @@ "docs": { "Intro": ["intro/what-and-why", "intro/installation", "intro/editor-support"], "Language Basics": [ - "language-basics/cheat-sheet", "language-basics/types", "language-basics/constants-and-variables", "language-basics/math-numbers-tez", @@ -18,7 +17,10 @@ "advanced/entrypoints-contracts", "advanced/first-contract" ], - "API": ["api-cli-commands"] + "API": [ + "api/cli-commands", + "api/cheat-sheet" + ] }, "contributors-docs": { "Introduction": [