Merge branch 'dev' of gitlab.com:ligolang/ligo into rinderknecht@contracts

This commit is contained in:
Christian Rinderknecht 2020-03-04 15:26:43 +01:00
commit d43209f1a1
134 changed files with 3909 additions and 1642 deletions

View File

@ -23,8 +23,8 @@ dont-merge-to-master:
only:
- master
.build_binary: &build_binary
# To run in sequence and save CPU usage, use stage: build_and_package_binaries
.build_binary:
&build_binary # To run in sequence and save CPU usage, use stage: build_and_package_binaries
stage: test
script:
- $build_binary_script "$target_os_family" "$target_os" "$target_os_version"
@ -71,8 +71,6 @@ dont-merge-to-master:
# move internal odoc documentation to the website folder
- mkdir -p build/ligo/
- mv ../../_build/default/_doc/_html/ build/ligo/odoc
- pwd # for debug
- ls build/ligo/ # for debug
after_script:
- cp -r gitlab-pages/website/build/ligo public
artifacts:
@ -84,7 +82,6 @@ dont-merge-to-master:
services:
- docker:19.03.5-dind
.before_script: &before_script
before_script:
# Install dependencies
@ -224,9 +221,10 @@ run-webide-unit-tests:
- cd tools/webide/packages/server
- npm ci
- npm run test
only:
changes:
rules:
- changes:
- tools/webide/**
when: always
build-publish-ide-image:
stage: build_and_deploy
@ -236,6 +234,7 @@ build-publish-ide-image:
- find dist/
- find dist/package/ -name '*ligo_*deb'
- mv $(realpath dist/package/debian-10/*.deb) tools/webide/ligo_deb10.deb
- cp -r src/test/examples tools/webide/packages/client/examples
- cd tools/webide
- echo "${CI_BUILD_TOKEN}" | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com
- >
@ -243,10 +242,12 @@ build-publish-ide-image:
-t "${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}"
--build-arg GIT_TAG="${CI_COMMIT_SHA}"
--build-arg GIT_COMMIT="${CI_COMMIT_SHORT_SHA}"
--build-arg EXAMPLES_DIR_SRC=packages/client/examples
.
- docker push "${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}"
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- changes:
- tools/webide/**
when: always
- if: '$CI_COMMIT_REF_NAME == "dev"'
when: always
@ -260,7 +261,8 @@ run-webide-e2e-tests:
- export WEBIDE_IMAGE="${WEBIDE_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}"
- docker-compose run e2e
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- changes:
- tools/webide/**
when: always
- if: '$CI_COMMIT_REF_NAME == "dev"'
when: always

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

@ -1,4 +1,4 @@
FROM node:8.11.4
FROM node:12.16
WORKDIR /app/website

View File

@ -8,15 +8,16 @@ services:
- 35729:35729
volumes:
- ./docs:/app/docs
- ./website/blog:/app/website/blog
# - ./website/blog:/app/website/blog
- ./website/core:/app/website/core
- ./website/i18n:/app/website/i18n
- ./website/pages:/app/website/pages
# - ./website/i18n:/app/website/i18n
- ./website/src:/app/website/src
- ./website/static:/app/website/static
- ./website/versioned_sidebars:/app/website/versioned_sidebars
- ./website/versioned_docs:/app/website/versioned_docs
# - ./website/versioned_sidebars:/app/website/versioned_sidebars
# - ./website/versioned_docs:/app/website/versioned_docs
- ./website/sidebars.json:/app/website/sidebars.json
- ./website/siteConfig.js:/app/website/siteConfig.js
- ./website/docusaurus.config.js:/app/website/docusaurus.config.js
- ./website/versions.json:/app/website/versions.json
- ./website/node_modules/reason-highlightjs:/app/website/node_modules/reason-highlightjs
# - ./website/core/AlgoliaSearch.js:/app/website/core/AlgoliaSearch.js
working_dir: /app/website

View File

@ -3,6 +3,8 @@ id: entrypoints-contracts
title: Main function and Entrypoints
---
import Syntax from '@theme/Syntax';
## Access Functions
A LIGO contract is made of a series of constant and function
@ -22,25 +24,33 @@ type of a main function is as follows, assuming that the type
`storage` has been defined elsewhere. (Note that you can use any type
with any name for the storage.)
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo skip
type storage is ... // Any name, any type
type return is list (operation) * storage
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo skip
type storage = ... // Any name, any type
type return = operation list * storage
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo skip
type storage = ...; // Any name, any type
type return = (list (operation), storage);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
The contract storage can only be modified by activating a main
function: given the state of the storage *on-chain*, a main function
@ -50,9 +60,9 @@ contract's parameter.
Here is an example where the storage is a single natural number that
is updated by the parameter.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=a
type parameter is nat
@ -62,8 +72,9 @@ type return is list (operation) * storage
function save (const action : parameter; const store : storage) : return is
((nil : list (operation)), store)
```
</Syntax>
<Syntax syntax="cameligo">
<!--CameLIGO-->
```cameligo group=a
type parameter = nat
type storage = nat
@ -73,7 +84,9 @@ let save (action, store: parameter * storage) : return =
(([] : operation list), store)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=a
type parameter = nat;
type storage = nat;
@ -82,7 +95,9 @@ type return = (list (operation), storage);
let main = ((action, store): (parameter, storage)) : return =>
(([] : list (operation)), store);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Entrypoints
@ -105,9 +120,10 @@ In the following example, the storage contains a counter of type `nat`
and a name of type `string`. Depending on the parameter of the
contract, either the counter or the name is updated.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=b
type parameter is
Action_A of nat
@ -133,7 +149,9 @@ function main (const action : parameter; const store : storage): return is
end
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=b
type parameter =
Action_A of nat
@ -158,7 +176,9 @@ let main (action, store: parameter * storage) : return =
| Action_B s -> entry_B (s, store)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=b
type parameter =
| Action_A (nat)
@ -183,7 +203,9 @@ let main = ((action, store): (parameter, storage)) : return =>
| Action_B (s) => entry_B ((s, store))
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Tezos-specific Built-ins
@ -198,8 +220,9 @@ This example shows how `Tezos.amount` and `failwith` can be used to
decline any transaction that sends more tez than `0tez`, that is, no
incoming tokens are accepted.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
type parameter is unit
type storage is unit
@ -213,7 +236,10 @@ function deny (const action : parameter; const store : storage) : return is
> Note that `amount` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
type parameter = unit
type storage = unit
@ -227,7 +253,9 @@ let deny (action, store : parameter * storage) : return =
> Note that `amount` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
type parameter = unit;
type storage = unit;
@ -242,15 +270,17 @@ let deny = ((action, store): (parameter, storage)) : return => {
> Note that `amount` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Access Control
This example shows how `Tezos.source` can be used to deny access to an
entrypoint.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
const owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address);
@ -261,7 +291,9 @@ function main (const action : parameter; const store : storage) : return is
> Note that `source` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address)
@ -272,7 +304,9 @@ let main (action, store: parameter * storage) : return =
> Note that `source` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let owner : address = ("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address);
@ -284,7 +318,8 @@ let main = ((action, store) : (parameter, storage)) : storage => {
> Note that `source` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Inter-Contract Invocations
@ -310,9 +345,10 @@ of type `parameter`, and we have a `proxy.ligo` contract that accepts
the same parameter type, and forwards the call to the deployed counter
contract.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo skip
// counter.ligo
type parameter is
@ -354,7 +390,9 @@ function proxy (const action : parameter; const store : storage): return is
} with (ops, store)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo skip
// counter.mligo
@ -395,7 +433,8 @@ let proxy (action, store : parameter * storage) : return =
> Note that `Operation.get_contract` and `Operation.transaction` are
> *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo skip
// counter.religo
@ -438,4 +477,5 @@ let proxy = ((action, store): (parameter, storage)) : return => {
> Note that `Operation.get_contract` and `Operation.transaction` are
> *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: first-contract
title: First contract
---
import Syntax from '@theme/Syntax';
So far so good, we have learned enough of the LIGO language, we are
confident enough to write out first smart contract.
@ -23,16 +25,15 @@ following:
Here is a full example:
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
```
```shell
ligo dry-run src/basic.ligo main Unit Unit
// Outputs:
// tuple[ list[]
// Unit
// ]
```
<!--END_DOCUSAURUS_CODE_TABS-->
Output of the `dry-run` is the return value of our main function, we
can see the operations emitted (in our case an empty list, and the new
@ -45,9 +46,9 @@ will accept an `action` variant in order to re-route our single `main`
function to two entrypoints for `add` (addition) and `sub`
(subtraction).
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
```
<Syntax syntax="pascaligo">
```pascaligo
type parameter is
Increment of int
| Decrement of int
@ -67,7 +68,9 @@ function main (const action : parameter; const store : storage) : return is
end)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
type parameter =
Increment of int
@ -87,7 +90,10 @@ let main (action, store : parameter * storage) : operation list * storage =
| Decrement n -> sub (n, store)))
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
type parameter =
Increment (int)
@ -109,21 +115,18 @@ let main = ((action, store) : (parameter, storage)) : return =>
}));
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
To dry-run the counter contract, we will provide the `main` function
with a variant parameter of value `Increment (5)` and an initial
storage value of `5`.
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
```
```shell
ligo dry-run src/counter.ligo main "Increment(5)" 5
// tuple[ list[]
// 10
// ]
```
<!--END_DOCUSAURUS_CODE_TABS-->
Our contract's storage has been successfuly incremented to `10`.
@ -134,19 +137,14 @@ In order to deploy the counter contract to a real Tezos network, we'd
have to compile it first, this can be done with the help of the
`compile-contract` CLI command:
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
```
```shell
ligo compile-contract src/counter.ligo main
```
<!--END_DOCUSAURUS_CODE_TABS-->
Command above will output the following Michelson code:
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
```
```michelson
{ parameter (or (int %decrement) (int %increment)) ;
storage int ;
code { DUP ;
@ -175,20 +173,16 @@ Command above will output the following Michelson code:
PAIR ;
DIP { DROP 2 } } }
```
<!--END_DOCUSAURUS_CODE_TABS-->
However in order to originate a Michelson contract on Tezos, we also
need to provide the initial storage value, we can use
`compile-storage` to compile the LIGO representation of the storage to
Michelson.
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
```
```shell
ligo compile-storage src/counter.ligo main 5
// Outputs: 5
```
<!--END_DOCUSAURUS_CODE_TABS-->
In our case the LIGO storage value maps 1:1 to its Michelson
representation, however this will not be the case once the parameter
@ -200,13 +194,11 @@ Same rules apply for parameters, as apply for translating LIGO storage
values to Michelson. We will need to use `compile-parameter` to
compile our `action` variant into Michelson, here's how:
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
```
```shell
ligo compile-parameter src/counter.ligo main 'Increment(5)'
// Outputs: (Right 5)
```
<!--END_DOCUSAURUS_CODE_TABS-->
Now we can use `(Right 5)` which is a Michelson value, to invoke our
contract - e.g., via `tezos-client`

View File

@ -3,6 +3,8 @@ id: include
title: Including Other Contracts
---
import Syntax from '@theme/Syntax';
Let us say that we have a contract that is getting a too large. If it
has a modular structure, you might find it useful to use the
`#include` statement to split the contract up over multiple files.
@ -10,9 +12,10 @@ has a modular structure, you might find it useful to use the
You take the code that you want to include and put it in a separate
file, for example `included.ligo`:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
// Demonstrate PascaLIGO inclusion statements, see includer.ligo
@ -20,46 +23,57 @@ file, for example `included.ligo`:
const foo : int = 144
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
// Demonstrate CameLIGO inclusion statements, see includer.mligo
let foo : int = 144
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
// Demonstrate ReasonLIGO inclusion statements, see includer.religo
let foo : int = 144;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
And then you can include this code using the `#include` statement like so:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
#include "included.ligo"
const bar : int = foo
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
#include "included.mligo"
let bar : int = foo
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
#include "included.religo"
let bar : int = foo;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: timestamps-addresses
title: Timestamps, Addresses
---
import Syntax from '@theme/Syntax';
## Timestamps
LIGO features timestamps, as Michelson does, while bakers baking the
@ -15,29 +17,35 @@ You can obtain the current time using the built-in syntax specific
expression, please be aware that it is up to the baker to set the
current timestamp value.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=a
const today : timestamp = Tezos.now
```
> Note that `now` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=a
let today : timestamp = Tezos.now
```
> Note that `Current.time` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=a
let today : timestamp = Tezos.now;
```
> Note that `Current.time` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
> When running code, the LIGO CLI option `--predecessor-timestamp`
> allows you to control what `Tezos.now` returns.
@ -49,8 +57,9 @@ constraints on your smart contracts. Consider the following scenarios.
#### In 24 hours
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=b
const today : timestamp = Tezos.now
const one_day : int = 86400
@ -61,7 +70,9 @@ const one_day_later : timestamp = some_date + one_day
> Note that `now` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=b
let today : timestamp = Tezos.now
let one_day : int = 86400
@ -72,7 +83,9 @@ let one_day_later : timestamp = some_date + one_day
> Note that `Current.time` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=b
let today : timestamp = Tezos.now;
let one_day : int = 86400;
@ -83,12 +96,14 @@ let one_day_later : timestamp = some_date + one_day;
> Note that `Current.time` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
#### 24 hours Ago
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
const today : timestamp = Tezos.now
const one_day : int = 86400
@ -97,7 +112,9 @@ const in_24_hrs : timestamp = today - one_day
> Note that `now` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let today : timestamp = Tezos.now
let one_day : int = 86400
@ -106,7 +123,9 @@ let in_24_hrs : timestamp = today - one_day
> Note that `Current.time` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let today : timestamp = Tezos.now;
let one_day : int = 86400;
@ -115,38 +134,43 @@ let in_24_hrs : timestamp = today - one_day;
> Note that `Current.time` is *deprecated*.
</Syntax>
<!--END_DOCUSAURUS_CODE_TABS-->
### Comparing Timestamps
You can compare timestamps using the same comparison operators
applying to numbers.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
const not_tommorow : bool = (Tezos.now = in_24_hrs)
```
> Note that `now` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let not_tomorrow : bool = (Tezos.now = in_24_hrs)
```
> Note that `Current.time` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let not_tomorrow : bool = (Tezos.now == in_24_hrs);
```
> Note that `Current.time` is *deprecated*.
</Syntax>
<!--END_DOCUSAURUS_CODE_TABS-->
## Addresses
@ -155,26 +179,32 @@ KT1, ...). Currently, addresses are created by casting a string to the
`address` type. Beware of failures if the address is invalid. Consider
the following examples.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=d
const my_account : address =
("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=d
let my_account : address =
("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=d
let my_account : address =
("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Signatures
@ -184,26 +214,35 @@ failure if the signature is invalid.
Here is how you can define a signature:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=e
const my_sig : signature =
("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7" :
signature)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=e
let my_sig : signature =
("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7" :
signature)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=e
let my_sig : signature =
("edsigthTzJ8X7MPmNeEwybRAvdxS1pupqcM5Mk4uCuyZAe7uEk68YpuGDeViW8wSXMrCi5CwoNgqs8V2w8ayB5dMJzrYCHhD8C7" :
signature);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Keys
@ -213,20 +252,29 @@ failure if the key is invalid.
Here is how you can define a key.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=f
const my_key : key =
("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav" : key)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=f
let my_key : key =
("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav" : key)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=f
let my_key : key =
("edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav" : key);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -2,14 +2,17 @@
id: cheat-sheet
title: Cheat Sheet
---
<div class="cheatsheet">
import Syntax from '@theme/Syntax';
<div className="cheatsheet">
<!--
Note that this table is not compiled before production and currently needs to be managed manually.
-->
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
|Primitive |Example|
|--- |---|
@ -33,7 +36,7 @@ Note that this table is not compiled before production and currently needs to be
| If Statement | <pre><code>if age < 16 <br/>then failwith ("Too young to drive."); <br/>else const new_id: int = prev_id + 1;</code></pre>|
|Options|<pre><code>type middleName is option(string);<br/>const middleName : middleName = Some("Foo");<br/>const middleName : middleName = None;</code></pre>|
|Assignment| ```const age: int = 5;```|
|Assignment on an existing variable <br/></br>*⚠️ This feature is not supported at the top-level scope, you can use it e.g. within functions. Works for Records and Maps as well.*| ```age := 18;```, ```p.age := 21``` |
|Assignment on an existing variable <br/>*⚠️ This feature is not supported at the top-level scope, you can use it e.g. within functions. Works for Records and Maps as well.*| ```age := 18;```, ```p.age := 21``` |
|Type Annotations| ```("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address)```|
|Variants|<pre><code>type action is<br/>&#124; Increment of int<br/>&#124; Decrement of int</code></pre>|
|Variant *(pattern)* matching|<pre><code>const a: action = Increment(5);<br/>case a of<br/>&#124; Increment(n) -> n + 1<br/>&#124; Decrement(n) -> n - 1<br/>end</code></pre>|
@ -43,7 +46,8 @@ Note that this table is not compiled before production and currently needs to be
|Transactions|<pre><code>const payment : operation = transaction(unit, amount, receiver);</code></pre>|
|Exception/Failure|`failwith ("Your descriptive error message for the user goes here.")`|
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
|Primitive |Example|
|--- |---|
@ -75,7 +79,8 @@ Note that this table is not compiled before production and currently needs to be
|Transactions|<pre><code>let payment : operation = <br/> Tezos.transaction unit amount receiver</code></pre>|
|Exception/Failure|`failwith ("Your descriptive error message for the user goes here.")`|
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
|Primitive |Example|
|--- |---|
@ -107,7 +112,8 @@ Note that this table is not compiled before production and currently needs to be
|Transactions|<pre><code>let payment : operation = <br/> Tezos.transaction (unit, amount, receiver);</code></pre>|
|Exception/Failure|`failwith ("Your descriptive error message for the user goes here.");`|
</Syntax>
<!--END_DOCUSAURUS_CODE_TABS-->
</div>

View File

@ -3,6 +3,8 @@ id: what-and-why
title: Michelson and LIGO
---
import Syntax from '@theme/Syntax';
Before we get into what LIGO is and why LIGO needs to exist, let us
take a look at what options the Tezos blockchain offers us out of the
box. If you want to implement smart contracts natively on Tezos, you
@ -161,8 +163,9 @@ Let us decline the same LIGO contract in the three flavours above. Do
not worry if it is a little confusing at first; we will explain all
the syntax in the upcoming sections of the documentation.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=a
type storage is int
@ -182,7 +185,9 @@ function main (const action : parameter; const store : storage) : return is
end)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=a
type storage = int
@ -201,7 +206,9 @@ let main (action, store : parameter * storage) : return =
| Reset -> 0)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=a
type storage = int;
@ -220,7 +227,9 @@ let main = ((action, store): (parameter, storage)) : return => {
| Reset => 0}));
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
<!--

View File

@ -3,28 +3,39 @@ id: boolean-if-else
title: Booleans and Conditionals
---
import Syntax from '@theme/Syntax';
## Booleans
The type of a boolean value is `bool`. Here is how to define a boolean
value:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=a
const a : bool = True // Also: true
const b : bool = False // Also: false
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=a
let a : bool = true
let b : bool = false
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=a
let a : bool = true;
let b : bool = false;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Comparing Values
@ -39,31 +50,41 @@ function.
### Comparing Strings
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=b
const a : string = "Alice"
const b : string = "Alice"
const c : bool = (a = b) // True
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=b
let a : string = "Alice"
let b : string = "Alice"
let c : bool = (a = b) // true
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=b
let a : string = "Alice";
let b : string = "Alice";
let c : bool = (a == b); // true
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Comparing numbers
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
const a : int = 5
const b : int = 4
@ -74,7 +95,10 @@ const f : bool = (a <= b)
const g : bool = (a >= b)
const h : bool = (a =/= b)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let a : int = 5
let b : int = 4
@ -86,7 +110,9 @@ let g : bool = (a >= b)
let h : bool = (a <> b)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let a : int = 5;
let b : int = 4;
@ -97,33 +123,43 @@ let f : bool = (a <= b);
let g : bool = (a >= b);
let h : bool = (a != b);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Comparing tez
> 💡 Comparing `tez` values is especially useful when dealing with an
> amount sent in a transaction.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=d
const a : tez = 5mutez
const b : tez = 10mutez
const c : bool = (a = b) // False
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=d
let a : tez = 5mutez
let b : tez = 10mutez
let c : bool = (a = b) // false
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=d
let a : tez = 5mutez;
let b : tez = 10mutez;
let c : bool = (a == b); // false
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Conditionals
@ -131,8 +167,9 @@ let c : bool = (a == b); // false
Conditional logic enables forking the control flow depending on the
state.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=e
type magnitude is Small | Large // See variant types.
@ -171,7 +208,9 @@ if x < y then {
else skip;
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=e
type magnitude = Small | Large // See variant types.
@ -192,8 +231,9 @@ gitlab-pages/docs/language-basics/boolean-if-else/cond.mligo compare 21n'
> *dangling else* problem is parsed by associating any `else` to the
> closest previous `then`.
</Syntax>
<Syntax syntax="reasonligo">
<!--ReasonLIGO-->
```reasonligo group=e
type magnitude = Small | Large; // See variant types.
@ -208,4 +248,6 @@ ligo run-function
gitlab-pages/docs/language-basics/boolean-if-else/cond.religo compare 21n'
# Outputs: Large
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: functions
title: Functions
---
import Syntax from '@theme/Syntax';
LIGO functions are the basic building block of contracts. For example,
entrypoints are functions and each smart contract needs a main
function that dispatches control to the entrypoints (it is not already
@ -16,8 +18,8 @@ mutations inside the functions will be.
## Declaring Functions
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
There are two ways in PascaLIGO to define functions: with or without a
*block*.
@ -91,7 +93,8 @@ ligo run-function gitlab-pages/docs/language-basics/src/functions/blockless.ligo
# Outputs: 3
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
Functions in CameLIGO are defined using the `let` keyword, like other
values. The difference is that a succession of parameters is provided
@ -145,7 +148,8 @@ ligo run-function gitlab-pages/docs/language-basics/src/functions/curry.mligo in
The function body is a single expression, whose value is returned.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
Functions in ReasonLIGO are defined using the `let` keyword, like
other values. The difference is that a tuple of parameters is provided
@ -176,7 +180,8 @@ let myFun = ((x, y) : (int, int)) : int => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Anonymous functions (a.k.a. lambdas)
@ -186,8 +191,9 @@ a key in a record or a map.
Here is how to define an anonymous function:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
function increment (const b : int) : int is
(function (const a : int) : int is a + 1) (b)
@ -201,7 +207,9 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/functions/anon.ligo a
# Outputs: 2
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let increment (b : int) : int = (fun (a : int) -> a + 1) b
let a : int = increment 1 // a = 2
@ -214,7 +222,9 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/functions/anon.mligo a
# Outputs: 2
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let increment = (b : int) : int => ((a : int) : int => a + 1) (b);
let a : int = increment (1); // a == 2
@ -227,15 +237,17 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/functions/anon.religo
# Outputs: 2
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
If the example above seems contrived, here is a more common design
pattern for lambdas: to be used as parameters to functions. Consider
the use case of having a list of integers and mapping the increment
function to all its elements.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
function incr_map (const l : list (int)) : list (int) is
List.map (function (const i : int) : int is i + 1, l)
@ -253,7 +265,9 @@ gitlab-pages/docs/language-basics/src/functions/incr_map.ligo incr_map
# Outputs: [ 2 ; 3 ; 4 ]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let incr_map (l : int list) : int list =
List.map (fun (i : int) -> i + 1) l
@ -267,7 +281,9 @@ gitlab-pages/docs/language-basics/src/functions/incr_map.mligo incr_map
# Outputs: [ 2 ; 3 ; 4 ]
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let incr_map = (l : list (int)) : list (int) =>
List.map ((i : int) => i + 1, l);
@ -281,4 +297,5 @@ gitlab-pages/docs/language-basics/src/functions/incr_map.religo incr_map
# Outputs: [ 2 ; 3 ; 4 ]
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,11 +3,13 @@ id: loops
title: Loops
---
import Syntax from '@theme/Syntax';
## General Iteration
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
General iteration in PascaLIGO takes the shape of general loops, which
should be familiar to programmers of imperative languages as "while
@ -47,7 +49,8 @@ gitlab-pages/docs/language-basics/src/loops/gcd.ligo gcd '(2n*2n*3n*11n, 2n*2n*2
# Outputs: +12
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
CameLIGO is a functional language where user-defined values are
constant, therefore it makes no sense in CameLIGO to feature loops,
@ -103,7 +106,8 @@ gitlab-pages/docs/language-basics/src/loops/gcd.mligo gcd (2n*2n*3n*11n, 2n*2n*2
# Outputs: +12
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
ReasonLIGO is a functional language where user-defined values are
constant, therefore it makes no sense in ReasonLIGO to feature loops,
@ -153,7 +157,8 @@ let gcd = ((x,y) : (nat, nat)) : nat => {
> Note that `stop` and `continue` (now `Loop.resume`) are
> *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Bounded Loops
@ -185,8 +190,8 @@ gitlab-pages/docs/language-basics/src/loops/sum.ligo sum 7n
PascaLIGO "for" loops can also iterate through the contents of a
collection, that is, a list, a set or a map. This is done with a loop
of the form `for <element var> in <collection type> <collection var>
<block>`, where `<collection type>` is any of the following keywords:
of the form `for <element var> in <collection type> <collection var> <block>`,
where `<collection type>` is any of the following keywords:
`list`, `set` or `map`.
Here is an example where the integers in a list are summed up.

View File

@ -3,6 +3,8 @@ id: maps-records
title: Records and Maps
---
import Syntax from '@theme/Syntax';
So far we have seen pretty basic data types. LIGO also offers more
complex built-in constructs, such as *records* and *maps*.
@ -16,9 +18,10 @@ special operator (`.`).
Let us first consider and example of record type declaration.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=records1
type user is
record [
@ -28,7 +31,9 @@ type user is
]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=records1
type user = {
id : nat;
@ -37,7 +42,9 @@ type user = {
}
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=records1
type user = {
id : nat,
@ -45,12 +52,15 @@ type user = {
name : string
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
And here is how a record value is defined:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=records1
const alice : user =
record [
@ -60,7 +70,9 @@ const alice : user =
]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=records1
let alice : user = {
id = 1n;
@ -69,7 +81,9 @@ let alice : user = {
}
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=records1
let alice : user = {
id : 1n,
@ -77,29 +91,38 @@ let alice : user = {
name : "Alice"
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Accessing Record Fields
If we want the contents of a given field, we use the (`.`) infix
operator, like so:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=records1
const alice_admin : bool = alice.is_admin
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=records1
let alice_admin : bool = alice.is_admin
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=records1
let alice_admin : bool = alice.is_admin;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Functional Updates
@ -115,12 +138,13 @@ updated record.
Let us consider defining a function that translates three-dimensional
points on a plane.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
In PascaLIGO, the shape of that expression is `<record variable> with
<record value>`. The record variable is the record to update and the
<Syntax syntax="pascaligo">
In PascaLIGO, the shape of that expression is
`<record variable> with <record value>`.
The record variable is the record to update and the
record value is the update itself.
```pascaligo group=records2
@ -146,7 +170,8 @@ You have to understand that `p` has not been changed by the functional
update: a namless new version of it has been created and returned by
the blockless function.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
The syntax for the functional updates of record in CameLIGO follows
that of OCaml:
@ -174,7 +199,8 @@ xy_translate "({x=2;y=3;z=1}, {dx=3;dy=4})"
> functional update: a nameless new version of it has been created and
> returned.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
The syntax for the functional updates of record in ReasonLIGO follows
that of ReasonML:
@ -188,7 +214,9 @@ let origin : point = {x : 0, y : 0, z : 0};
let xy_translate = ((p, vec) : (point, vector)) : point =>
{...p, x : p.x + vec.dx, y : p.y + vec.dy};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
You can call the function `xy_translate` defined above by running the
following command of the shell:
@ -303,55 +331,69 @@ sense.
Here is how a custom map from addresses to a pair of integers is
defined.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
type move is int * int
type register is map (address, move)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
type move = int * int
type register = (address, move) map
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
type move = (int, int);
type register = map (address, move);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Creating an Empty Map
Here is how to create an empty map.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
const empty : register = map []
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let empty : register = Map.empty
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let empty : register = Map.empty
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Creating a Non-empty Map
And here is how to create a non-empty map value:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
const moves : register =
@ -365,7 +407,9 @@ individual map entries. The annotated value `("<string value>" :
address)` means that we cast a string into an address. Also, `map` is
a keyword.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let moves : register =
Map.literal [
@ -378,7 +422,9 @@ key-value pair tuples, `(<key>, <value>)`. Note also the `;` to
separate individual map entries. `("<string value>": address)` means
that we type-cast a string into an address. -->
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let moves : register =
Map.literal ([
@ -391,12 +437,13 @@ key-value pair tuples, `(<key>, <value>)`. Note also the `;` to
separate individual map entries. `("<string value>": address)` means
that we type-cast a string into an address. -->
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Accessing Map Bindings
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
In PascaLIGO, we can use the postfix `[]` operator to read the `move`
value associated to a given key (`address` here) in the register. Here
@ -407,26 +454,33 @@ const my_balance : option (move) =
moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let my_balance : move option =
Map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let my_balance : option (move) =
Map.find_opt (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), moves);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
Notice how the value we read is an optional value: this is to force
the reader to account for a missing key in the map. This requires
*pattern matching*.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function force_access (const key : address; const moves : register) : move is
case moves[key] of
@ -435,7 +489,9 @@ function force_access (const key : address; const moves : register) : move is
end
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let force_access (key, moves : address * register) : move =
match Map.find_opt key moves with
@ -443,7 +499,9 @@ let force_access (key, moves : address * register) : move =
| None -> (failwith "No move." : move)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let force_access = ((key, moves) : (address, register)) : move => {
switch (Map.find_opt (key, moves)) {
@ -452,7 +510,9 @@ let force_access = ((key, moves) : (address, register)) : move => {
}
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Updating a Map
@ -461,9 +521,9 @@ Given a map, we may want to add a new binding, remove one, or modify
one by changing the value associated to an already existing key. All
those operations are called *updates*.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
The values of a PascaLIGO map can be updated using the usual
assignment syntax `<map variable>[<key>] := <new value>`. Let us
@ -491,7 +551,8 @@ function assignments (var m : register) : register is
See further for the removal of bindings.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
We can update a binding in a map in CameLIGO by means of the
`Map.update` built-in function:
@ -513,7 +574,8 @@ let add (m : register) : register =
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) (4,9) m
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
We can update a binding in a map in ReasonLIGO by means of the
`Map.update` built-in function:
@ -535,13 +597,14 @@ let add = (m : register) : register =>
(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), (4,9), m);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
To remove a binding from a map, we need its key.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
In PascaLIGO, there is a special instruction to remove a binding from
a map.
@ -552,7 +615,8 @@ function delete (const key : address; var moves : register) : register is
} with moves
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
In CameLIGO, we use the predefined function `Map.remove` as follows:
@ -561,7 +625,8 @@ let delete (key, moves : address * register) : register =
Map.remove key moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
In ReasonLIGO, we use the predefined function `Map.remove` as follows:
@ -570,7 +635,8 @@ let delete = ((key, moves) : (address, register)) : register =>
Map.remove (key, moves);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Functional Iteration over Maps
@ -596,9 +662,9 @@ over maps is called `Map.iter`. In the following example, the register
of moves is iterated to check that the start of each move is above
`3`.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function iter_op (const m : register) : unit is
@ -610,7 +676,8 @@ function iter_op (const m : register) : unit is
> Note that `map_iter` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let iter_op (m : register) : unit =
@ -618,7 +685,8 @@ let iter_op (m : register) : unit =
in Map.iter predicate m
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let iter_op = (m : register) : unit => {
@ -626,7 +694,9 @@ let iter_op = (m : register) : unit => {
Map.iter (predicate, m);
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
#### Map Operations over Maps
@ -637,9 +707,9 @@ implementing the map operation over maps is called `Map.map`. In the
following example, we add `1` to the ordinate of the moves in the
register.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function map_op (const m : register) : register is
@ -651,7 +721,8 @@ function map_op (const m : register) : register is
> Note that `map_map` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let map_op (m : register) : register =
@ -659,7 +730,8 @@ let map_op (m : register) : register =
in Map.map increment m
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let map_op = (m : register) : register => {
@ -667,7 +739,9 @@ let map_op = (m : register) : register => {
Map.map (increment, m);
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
#### Folded Operations over Maps
@ -680,9 +754,9 @@ traversal of the data structure is over.
The predefined functional iterator implementing the folded operation
over maps is called `Map.fold` and is used as follows.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function fold_op (const m : register) : int is
@ -694,7 +768,8 @@ function fold_op (const m : register) : int is
> Note that `map_fold` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let fold_op (m : register) : register =
@ -702,7 +777,8 @@ let fold_op (m : register) : register =
in Map.fold folded m 5
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let fold_op = (m : register) : register => {
@ -711,7 +787,8 @@ let fold_op = (m : register) : register => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Big Maps
@ -728,55 +805,69 @@ interface for big maps is analogous to the one used for ordinary maps.
Here is how we define a big map:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
type move is int * int
type register is big_map (address, move)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
type move = int * int
type register = (address, move) big_map
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
type move = (int, int);
type register = big_map (address, move);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Creating an Empty Big Map
Here is how to create an empty big map.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
const empty : register = big_map []
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
let empty : register = Big_map.empty
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
let empty : register = Big_map.empty
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Creating a Non-empty Map
And here is how to create a non-empty map value:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
const moves : register =
@ -790,7 +881,8 @@ semicolon separating individual map entries. The value annotation
`("<string value>" : address)` means that we cast a string into an
address. -->
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
let moves : register =
@ -804,7 +896,8 @@ list of key-value pairs `(<key>, <value>)`. Note also the semicolon
separating individual map entries. The annotated value `("<string>
value>" : address)` means that we cast a string into an address.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
let moves : register =
@ -818,8 +911,8 @@ list of key-value pairs `(<key>, <value>)`. Note also the semicolon
separating individual map entries. The annotated value `("<string>
value>" : address)` means that we cast a string into an address.
</Syntax>
<!--END_DOCUSAURUS_CODE_TABS-->
### Accessing Values
@ -828,35 +921,39 @@ postfix `[]` operator to read the associated `move` value. However,
the value we read is an optional value (in our case, of type `option
(move)`), to account for a missing key. Here is an example:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
const my_balance : option (move) =
moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
let my_balance : move option =
Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
let my_balance : option (move) =
Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, moves);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Updating Big Maps
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
The values of a PascaLIGO big map can be updated using the
assignment syntax for ordinary maps
@ -870,7 +967,8 @@ function add (var m : register) : register is
const updated_map : register = add (moves)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
We can update a big map in CameLIGO using the `Big_map.update`
built-in:
@ -881,7 +979,8 @@ let updated_map : register =
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) (Some (4,9)) moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
We can update a big map in ReasonLIGO using the `Big_map.update`
built-in:
@ -892,16 +991,17 @@ let updated_map : register =
(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), Some ((4,9)), moves);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Removing Bindings
Removing a binding in a map is done differently according to the LIGO
syntax.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
PascaLIGO features a special syntactic construct to remove bindings
from maps, of the form `remove <key> from map <map>`. For example,
@ -915,7 +1015,8 @@ function rem (var m : register) : register is
const updated_map : register = rem (moves)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
In CameLIGO, the predefined function which removes a binding in a map
is called `Map.remove` and is used as follows:
@ -925,7 +1026,8 @@ let updated_map : register =
Map.remove ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
In ReasonLIGO, the predefined function which removes a binding in a map
is called `Map.remove` and is used as follows:
@ -935,4 +1037,5 @@ let updated_map : register =
Map.remove (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), moves)
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: math-numbers-tez
title: Math, Numbers & Tez
---
import Syntax from '@theme/Syntax';
LIGO offers three built-in numerical types: `int`, `nat` and
`tez`. Values of type `int` are integers; values of type `nat` are
natural numbers (integral numbers greater than or equal to zero);
@ -38,8 +40,9 @@ remain in comments as they would otherwise not compile, for example,
adding a value of type `int` to a value of type `tez` is invalid. Note
that adding an integer to a natural number produces an integer.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=a
// int + int yields int
const a : int = 5 + 10
@ -69,7 +72,9 @@ const g : int = 1_000_000
> const sum : tez = 100_000mutez
>```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=a
// int + int yields int
let a : int = 5 + 10
@ -99,7 +104,9 @@ let g : int = 1_000_000
>let sum : tez = 100_000mutez
>```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=a
// int + int yields int
let a : int = 5 + 10;
@ -127,7 +134,9 @@ let g : int = 1_000_000;
>```reasonligo
>let sum : tex = 100_000mutez;
>```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Subtraction
@ -135,8 +144,9 @@ Subtraction looks as follows.
> ⚠️ Even when subtracting two `nats`, the result is an `int`
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=b
const a : int = 5 - 10
@ -149,7 +159,9 @@ const b : int = 5n - 2n
const d : tez = 5mutez - 1mutez
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=b
let a : int = 5 - 10
@ -162,7 +174,9 @@ let b : int = 5n - 2n
let d : tez = 5mutez - 1mutez
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=b
let a : int = 5 - 10;
@ -175,15 +189,16 @@ let b : int = 5n - 2n;
let d : tez = 5mutez - 1mutez;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Multiplication
You can multiply values of the same type, such as:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
const a : int = 5 * 5
@ -193,7 +208,9 @@ const b : nat = 5n * 5n
const c : tez = 5n * 5mutez
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let a : int = 5 * 5
let b : nat = 5n * 5n
@ -202,7 +219,9 @@ let b : nat = 5n * 5n
let c : tez = 5n * 5mutez
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let a : int = 5 * 5;
let b : nat = 5n * 5n;
@ -211,7 +230,8 @@ let b : nat = 5n * 5n;
let c : tez = 5n * 5mutez;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Euclidean Division
@ -219,35 +239,42 @@ In LIGO you can divide `int`, `nat`, and `tez`. Here is how:
> ⚠️ Division of two `tez` values results into a `nat`
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=d
const a : int = 10 / 3
const b : nat = 10n / 3n
const c : nat = 10mutez / 3mutez
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=d
let a : int = 10 / 3
let b : nat = 10n / 3n
let c : nat = 10mutez / 3mutez
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=d
let a : int = 10 / 3;
let b : nat = 10n / 3n;
let c : nat = 10mutez / 3mutez;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
LIGO also allows you to compute the remainder of the Euclidean
division. In LIGO, it is a natural number.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=d
const a : int = 120
const b : int = 9
@ -259,7 +286,9 @@ const rem3 : nat = c mod d // 3
const rem4 : nat = a mod d // 3
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=d
let a : int = 120
let b : int = 9
@ -271,7 +300,9 @@ let rem3 : nat = c mod d // 3
let rem4 : nat = a mod d // 3
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=d
let a : int = 120;
let b : int = 9;
@ -283,29 +314,39 @@ let rem3 : nat = c mod d; // 3
let rem4 : nat = a mod d; // 3
```
</Syntax>
## From `int` to `nat` and back
You can *cast* an `int` to a `nat` and vice versa. Here is how:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=e
const a : int = int (1n)
const b : nat = abs (1)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=e
let a : int = int (1n)
let b : nat = abs (1)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=e
let a : int = int (1n);
let b : nat = abs (1);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Checking a `nat`
@ -314,20 +355,26 @@ function which accepts an `int` and returns an optional `nat`: if the
result is not `None`, then the provided integer was indeed a natural
number, and not otherwise.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=e
const is_a_nat : option (nat) = is_nat (1)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=e
let is_a_nat : nat option = Michelson.is_nat (1)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=e
let is_a_nat : option (nat) = Michelson.is_nat (1);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: sets-lists-tuples
title: Tuples, Lists, Sets
---
import Syntax from '@theme/Syntax';
Apart from complex data types such as `maps` and `records`, LIGO also
features `tuples`, `lists` and `sets`.
@ -27,9 +29,9 @@ Unlike [a record](language-basics/maps-records.md), tuple types do not
have to be defined before they can be used. However below we will give
them names by *type aliasing*.
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
<Syntax syntax="pascaligo">
```pascaligo group=tuple
type full_name is string * string // Alias
@ -37,7 +39,8 @@ type full_name is string * string // Alias
const full_name : full_name = ("Alice", "Johnson")
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=tuple
type full_name = string * string // Alias
@ -45,7 +48,8 @@ type full_name = string * string // Alias
let full_name : full_name = ("Alice", "Johnson") // Optional parentheses
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=tuple
type full_name = (string, string); // Alias
@ -53,7 +57,8 @@ type full_name = (string, string); // Alias
let full_name : full_name = ("Alice", "Johnson");
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Accessing Components
@ -66,27 +71,30 @@ position in their tuple, which cannot be done in OCaml. *Tuple
components are zero-indexed*, that is, the first component has index
`0`.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=tuple
const first_name : string = full_name.0
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=tuple
let first_name : string = full_name.0
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=tuple
let first_name : string = full_name[0];
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Lists
@ -103,26 +111,32 @@ think of a list a *stack*, where the top is written on the left.
### Defining Lists
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=lists
const empty_list : list (int) = nil // Or list []
const my_list : list (int) = list [1; 2; 2] // The head is 1
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=lists
let empty_list : int list = []
let my_list : int list = [1; 2; 2] // The head is 1
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=lists
let empty_list : list (int) = [];
let my_list : list (int) = [1, 2, 2]; // The head is 1
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Adding to Lists
@ -130,9 +144,9 @@ Lists can be augmented by adding an element before the head (or, in
terms of stack, by *pushing an element on top*). This operation is
usually called *consing* in functional languages.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
In PascaLIGO, the *cons operator* is infix and noted `#`. It is not
symmetric: on the left lies the element to cons, and, on the right, a
@ -143,7 +157,8 @@ you of that.)
const larger_list : list (int) = 5 # my_list // [5;1;2;2]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
In CameLIGO, the *cons operator* is infix and noted `::`. It is not
symmetric: on the left lies the element to cons, and, on the right, a
@ -153,7 +168,8 @@ list on which to cons.
let larger_list : int list = 5 :: my_list // [5;1;2;2]
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
In ReasonLIGO, the *cons operator* is infix and noted `, ...`. It is
not symmetric: on the left lies the element to cons, and, on the
@ -162,7 +178,9 @@ right, a list on which to cons.
```reasonligo group=lists
let larger_list : list (int) = [5, ...my_list]; // [5,1,2,2]
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Functional Iteration over Lists
@ -189,9 +207,9 @@ called `List.iter`.
In the following example, a list is iterated to check that all its
elements (integers) are strictly greater than `3`.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=lists
function iter_op (const l : list (int)) : unit is
@ -203,7 +221,8 @@ function iter_op (const l : list (int)) : unit is
> Note that `list_iter` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=lists
let iter_op (l : int list) : unit =
@ -211,7 +230,8 @@ let iter_op (l : int list) : unit =
in List.iter predicate l
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=lists
let iter_op = (l : list (int)) : unit => {
@ -220,7 +240,8 @@ let iter_op = (l : list (int)) : unit => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
#### Mapped Operation over Lists
@ -231,9 +252,9 @@ with the map data structure. The predefined functional iterator
implementing the mapped operation over lists is called `List.map` and
is used as follows.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=lists
function increment (const i : int): int is i + 1
@ -244,7 +265,8 @@ const plus_one : list (int) = List.map (increment, larger_list)
> Note that `list_map` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=lists
let increment (i : int) : int = i + 1
@ -253,7 +275,8 @@ let increment (i : int) : int = i + 1
let plus_one : int list = List.map increment larger_list
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=lists
let increment = (i : int) : int => i + 1;
@ -261,7 +284,9 @@ let increment = (i : int) : int => i + 1;
// Creates a new list with all elements incremented by 1
let plus_one : list (int) = List.map (increment, larger_list);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
#### Folded Operation over Lists
@ -274,9 +299,9 @@ traversal of the data structure is over. The predefined functional
iterator implementing the folded operation over lists is called
`List.fold` and is used as follows.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=lists
function sum (const acc : int; const i : int): int is acc + i
@ -285,20 +310,24 @@ const sum_of_elements : int = List.fold (sum, my_list, 0)
> Note that `list_fold` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=lists
let sum (acc, i: int * int) : int = acc + i
let sum_of_elements : int = List.fold sum my_list 0
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=lists
let sum = ((result, i): (int, int)): int => result + i;
let sum_of_elements : int = List.fold (sum, my_list, 0);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Sets
@ -309,9 +338,9 @@ whereas they can be repeated in a *list*.
### Empty Sets
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
In PascaLIGO, the notation for sets is similar to that for lists,
except the keyword `set` is used before:
@ -319,7 +348,9 @@ except the keyword `set` is used before:
```pascaligo group=sets
const my_set : set (int) = set []
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
In CameLIGO, the empty set is denoted by the predefined value
`Set.empty`.
@ -328,7 +359,8 @@ In CameLIGO, the empty set is denoted by the predefined value
let my_set : int set = Set.empty
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
In ReasonLIGO, the empty set is denoted by the predefined value
`Set.empty`.
@ -336,13 +368,15 @@ In ReasonLIGO, the empty set is denoted by the predefined value
```reasonligo group=sets
let my_set : set (int) = Set.empty;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Non-empty Sets
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
In PascaLIGO, the notation for sets is similar to that for lists,
except the keyword `set` is used before:
@ -359,7 +393,8 @@ gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.ligo my_set
# Outputs: { 3 ; 2 ; 1 }
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
In CameLIGO, there is no predefined syntactic construct for sets: you
must build your set by adding to the empty set. (This is the way in
@ -379,7 +414,8 @@ gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.mligo my_set
# Outputs: { 3 ; 2 ; 1 }
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
In ReasonLIGO, there is no predefined syntactic construct for sets:
you must build your set by adding to the empty set. (This is the way
@ -399,13 +435,15 @@ ligo evaluate-value
gitlab-pages/docs/language-basics/src/sets-lists-tuples/sets.religo my_set
# Outputs: { 3 ; 2 ; 1 }
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Set Membership
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
PascaLIGO features a special keyword `contains` that operates like an
infix operator checking membership in a set.
@ -414,7 +452,8 @@ infix operator checking membership in a set.
const contains_3 : bool = my_set contains 3
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
In CameLIGO, the predefined predicate `Set.mem` tests for membership
in a set as follows:
@ -423,7 +462,8 @@ in a set as follows:
let contains_3 : bool = Set.mem 3 my_set
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
In ReasonLIGO, the predefined predicate `Set.mem` tests for membership
in a set as follows:
@ -432,7 +472,8 @@ in a set as follows:
let contains_3 : bool = Set.mem (3, my_set);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Cardinal of Sets
@ -440,9 +481,9 @@ let contains_3 : bool = Set.mem (3, my_set);
The predefined function `Set.size` returns the number of
elements in a given set as follows.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=sets
const cardinal : nat = Set.size (my_set)
@ -450,18 +491,22 @@ const cardinal : nat = Set.size (my_set)
> Note that `size` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let cardinal : nat = Set.size my_set
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let cardinal : nat = Set.size (my_set);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Updating Sets
@ -469,9 +514,9 @@ let cardinal : nat = Set.size (my_set);
There are two ways to update a set, that is to add or remove from
it.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
In PascaLIGO, either we create a new set from the given one, or we
modify it in-place. First, let us consider the former way:
@ -502,7 +547,8 @@ function update (var s : set (int)) : set (int) is block {
const new_set : set (int) = update (my_set)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
In CameLIGO, we can use the predefined functions `Set.add` and
`Set.remove`. We update a given set by creating another one, with or
@ -513,7 +559,8 @@ let larger_set : int set = Set.add 4 my_set
let smaller_set : int set = Set.remove 3 my_set
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
In ReasonLIGO, we can use the predefined functions `Set.add` and
`Set.remove`. We update a given set by creating another one, with or
@ -523,7 +570,9 @@ without some elements.
let larger_set : set (int) = Set.add (4, my_set);
let smaller_set : set (int) = Set.remove (3, my_set);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
### Functional Iteration over Sets
@ -549,9 +598,9 @@ over sets is called `Set.iter`. In the following example, a set is
iterated to check that all its elements (integers) are greater than
`3`.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=sets
function iter_op (const s : set (int)) : unit is
@ -563,7 +612,8 @@ function iter_op (const s : set (int)) : unit is
> Note that `set_iter` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let iter_op (s : int set) : unit =
@ -571,7 +621,8 @@ let iter_op (s : int set) : unit =
in Set.iter predicate s
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let iter_op = (s : set (int)) : unit => {
@ -580,7 +631,8 @@ let iter_op = (s : set (int)) : unit => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
<!-- #### Mapped Operation (NOT IMPLEMENTED YET) -->
@ -638,8 +690,9 @@ enables having a partial result that becomes complete when the
traversal of the data structure is over. The predefined fold over sets
is called `Set.fold`.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=sets
function sum (const acc : int; const i : int): int is acc + i
const sum_of_elements : int = Set.fold (sum, my_set, 0)
@ -658,15 +711,21 @@ function loop (const s : set (int)) : int is block {
} with sum
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let sum (acc, i : int * int) : int = acc + i
let sum_of_elements : int = Set.fold sum my_set 0
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let sum = ((acc, i) : (int, int)) : int => acc + i;
let sum_of_elements : int = Set.fold (sum, my_set, 0);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,28 +3,40 @@ id: strings
title: Strings
---
import Syntax from '@theme/Syntax';
Strings are defined using the built-in `string` type like this:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```
const a : string = "Hello Alice"
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```
let a : string = "Hello Alice"
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let a : string = "Hello Alice";
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Concatenating Strings
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
Strings can be concatenated using the `^` operator.
```pascaligo group=a
@ -32,7 +44,10 @@ const name : string = "Alice"
const greeting : string = "Hello"
const full_greeting : string = greeting ^ " " ^ name
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
Strings can be concatenated using the `^` operator.
```cameligo group=a
@ -40,7 +55,10 @@ let name : string = "Alice"
let greeting : string = "Hello"
let full_greeting : string = greeting ^ " " ^ name
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
Strings can be concatenated using the `++` operator.
```reasonligo group=a
@ -48,15 +66,18 @@ let name : string = "Alice";
let greeting : string = "Hello";
let full_greeting : string = greeting ++ " " ++ name;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Slicing Strings
Strings can be sliced using a built-in function:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=b
const name : string = "Alice"
const slice : string = String.slice (0n, 1n, name)
@ -64,19 +85,24 @@ const slice : string = String.slice (0n, 1n, name)
> Note that `string_slide` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=b
let name : string = "Alice"
let slice : string = String.slice 0n 1n name
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=b
let name : string = "Alice";
let slice : string = String.slice (0n, 1n, name);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
> ⚠️ Notice that the offset and length of the slice are natural
> numbers.
@ -85,8 +111,9 @@ let slice : string = String.slice (0n, 1n, name);
The length of a string can be found using a built-in function:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
const name : string = "Alice"
const length : nat = String.length (name) // length = 5
@ -94,15 +121,21 @@ const length : nat = String.length (name) // length = 5
> Note that `size` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let name : string = "Alice"
let length : nat = String.size name // length = 5
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let name : string = "Alice";
let length : nat = String.size (name); // length == 5
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: tezos-specific
title: Tezos Domain-Specific Operations
---
import Syntax from '@theme/Syntax';
LIGO is a programming language for writing Tezos smart contracts. It
would be a little odd if it did not have any Tezos specific
functions. This page will tell you about them.
@ -20,9 +22,10 @@ functionality can be accessed from within LIGO.
> untrusted source or casting the result to the wrong type. Do not use
> the corresponding LIGO functions without doing your homework first.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=a
function id_string (const p : string) : option (string) is block {
const packed : bytes = bytes_pack (p)
@ -31,14 +34,18 @@ function id_string (const p : string) : option (string) is block {
> Note that `bytes_unpack` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=a
let id_string (p : string) : string option =
let packed: bytes = Bytes.pack p in
(Bytes.unpack packed : string option)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=a
let id_string = (p : string) : option (string) => {
let packed : bytes = Bytes.pack (p);
@ -46,7 +53,8 @@ let id_string = (p : string) : option (string) => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Hashing Keys
@ -56,9 +64,10 @@ if this were not the case, hashes are much smaller than keys, and
storage on blockchains comes at a cost premium. You can hash keys with
a predefined functions returning a value of type `key_hash`.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=b
function check_hash_key (const kh1 : key_hash; const k2 : key) : bool * key_hash is
block {
@ -68,14 +77,18 @@ function check_hash_key (const kh1 : key_hash; const k2 : key) : bool * key_hash
} with (ret, kh2)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=b
let check_hash_key (kh1, k2 : key_hash * key) : bool * key_hash =
let kh2 : key_hash = Crypto.hash_key k2 in
if kh1 = kh2 then true, kh2 else false, kh2
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=b
let check_hash_key = ((kh1, k2) : (key_hash, key)) : (bool, key_hash) => {
let kh2 : key_hash = Crypto.hash_key (k2);
@ -83,7 +96,8 @@ let check_hash_key = ((kh1, k2) : (key_hash, key)) : (bool, key_hash) => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Checking Signatures
@ -97,9 +111,10 @@ asynchronously. You can do this in LIGO using the `key` and
> because that would require storing a private key on chain, at which
> point it is not... private anymore.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
function check_signature
(const pk : key;
@ -110,20 +125,25 @@ function check_signature
> Note that `crypto_check` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let check_signature (pk, signed, msg : key * signature * bytes) : bool =
Crypto.check pk signed msg
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let check_signature =
((pk, signed, msg) : (key, signature, bytes)) : bool =>
Crypto.check (pk, signed, msg);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Contract's Own Address
@ -136,21 +156,69 @@ can do it with `Tezos.self_address`.
> contract is only allowed at the top-level. Using it in an embedded
> function will cause an error.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=d
const current_addr : address = Tezos.self_address
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=d
let current_addr : address = Tezos.self_address
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=d
let current_addr : address = Tezos.self_address;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## 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
<Syntax syntax="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")
```
</Syntax>
<Syntax syntax="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"
```
</Syntax>
<Syntax syntax="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")
```
</Syntax>

View File

@ -3,6 +3,8 @@ id: types
title: Types
---
import Syntax from '@theme/Syntax';
*LIGO is strongly and statically typed.* This means that the compiler
checks how your contract processes data. If it passes the test, your
contract will not fail at run-time due to inconsistent assumptions on
@ -22,36 +24,41 @@ maintainability of your smart contracts. For example we can choose to
alias a string type as an animal breed - this will allow us to
comunicate our intent with added clarity.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=a
type breed is string
const dog_breed : breed = "Saluki"
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=a
type breed = string
let dog_breed : breed = "Saluki"
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=a
type breed = string;
let dog_breed : breed = "Saluki";
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
> The above type definitions are aliases, which means that `breed` and
> `string` are interchangable in all contexts.
## Simple types
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=b
// The type account_balances denotes maps from addresses to tez
@ -61,7 +68,9 @@ const ledger : account_balances =
map [("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address) -> 10mutez]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=b
// The type account_balances denotes maps from addresses to tez
@ -72,7 +81,9 @@ let ledger : account_balances =
[(("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address), 10mutez)]
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=b
// The type account_balances denotes maps from addresses to tez
@ -83,7 +94,8 @@ let ledger: account_balances =
([("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address, 10mutez)]);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Structured types
@ -96,8 +108,9 @@ types as *fields* and index them with a *field name*. In the example
below you can see the definition of data types for a ledger that keeps
the balance and number of previous transactions for a given account.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
// Type aliasing
@ -124,7 +137,9 @@ const my_ledger : ledger = map [
]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
// Type aliasing
@ -147,7 +162,9 @@ let my_ledger : ledger = Map.literal
{balance = 10mutez; transactions = 5n})]
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
// Type aliasing
@ -177,7 +194,8 @@ are dual because records are a product of types (types are bundled
into a record), whereas variant types are a sum of types (they are
exclusive to each other).
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Annotations
@ -185,9 +203,10 @@ In certain cases, the type of an expression cannot be properly
inferred by the compiler. In order to help the type checker, you can
annotate an expression with its desired type. Here is an example:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=d
type parameter is Back | Claim | Withdraw
@ -213,7 +232,9 @@ function back (var action : unit; var store : storage) : return is
end with ((nil : list (operation)), store) // Annotation
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=d
type parameter = Back | Claim | Withdraw
@ -239,7 +260,9 @@ let back (param, store : unit * storage) : return =
| Some (x) -> no_op, store
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=d
type parameter = | Back | Claim | Withdraw;
@ -269,4 +292,5 @@ let back = ((param, store) : (unit, storage)) : return => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,9 @@ id: unit-option-pattern-matching
title: Unit, Option, Pattern matching
---
import Syntax from '@theme/Syntax';
Optionals are a pervasive programing pattern in OCaml. Since Michelson
and LIGO are both inspired by OCaml, *optional types* are available in
LIGO as well. Similarly, OCaml features a *unit* type, and LIGO
@ -16,15 +19,16 @@ The `unit` type in Michelson or LIGO is a predefined type that
contains only one value that carries no information. It is used when
no relevant information is required or produced. Here is how it used.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
In PascaLIGO, the unique value of the `unit` type is `Unit`.
```pascaligo group=a
const n : unit = Unit // Note the capital letter
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
In CameLIGO, the unique value of the `unit` type is `()`, following
the OCaml convention.
@ -32,7 +36,8 @@ the OCaml convention.
let n : unit = ()
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
In ReasonLIGO, the unique value of the `unit` type is `()`, following
the OCaml convention.
@ -40,7 +45,8 @@ the OCaml convention.
let n : unit = ();
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Variant types
@ -52,28 +58,35 @@ the enumerated types found in Java, C++, JavaScript etc.
Here is how we define a coin as being either head or tail (and nothing
else):
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=b
type coin is Head | Tail
const head : coin = Head
const tail : coin = Tail
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=b
type coin = Head | Tail
let head : coin = Head
let tail : coin = Tail
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=b
type coin = Head | Tail;
let head : coin = Head;
let tail : coin = Tail;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
The names `Head` and `Tail` in the definition of the type `coin` are
called *data constructors*, or *variants*. In this particular, they
@ -84,9 +97,10 @@ In general, it is interesting for variants to carry some information,
and thus go beyond enumerated types. In the following, we show how to
define different kinds of users of a system.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=c
type id is nat
@ -99,7 +113,9 @@ const u : user = Admin (1000n)
const g : user = Guest
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
type id = nat
@ -112,7 +128,9 @@ let u : user = Admin 1000n
let g : user = Guest
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
type id = nat;
@ -125,7 +143,8 @@ let u : user = Admin (1000n);
let g : user = Guest;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
In LIGO, a constant constructor is equivalent to the same constructor
taking an argument of type `unit`, so, for example, `Guest` is the
@ -141,26 +160,32 @@ type would be `None`, otherwise `Some (v)`, where `v` is some
meaningful value *of any type*. An example in arithmetic is the
division operation:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=d
function div (const a : nat; const b : nat) : option (nat) is
if b = 0n then (None: option (nat)) else Some (a/b)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=d
let div (a, b : nat * nat) : nat option =
if b = 0n then (None: nat option) else Some (a/b)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=d
let div = ((a, b) : (nat, nat)) : option (nat) =>
if (b == 0n) { (None: option (nat)); } else { Some (a/b); };
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Pattern matching
@ -170,8 +195,9 @@ Javascript, and can be used to route the program's control flow based
on the value of a variant. Consider for example the definition of a
function `flip` that flips a coin.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=e
type coin is Head | Tail
@ -190,7 +216,9 @@ flip "Head"
# Outputs: Tail(Unit)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=e
type coin = Head | Tail
@ -208,7 +236,9 @@ flip Head
# Outputs: Tail(Unit)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=e
type coin = | Head | Tail;
@ -227,4 +257,5 @@ flip Head
# Outputs: Tail(Unit)
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,9 @@ id: constants-and-variables
title: Constants & Variables
---
import Syntax from '@theme/Syntax';
The next building block after types are *constants* and *variables*.
## Constants
@ -12,8 +15,9 @@ reassigned. Put in another way, they can be assigned once, at their
declaration. When defining a constant you need to provide a `name`,
`type` and a `value`:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=a
const age : int = 25
```
@ -24,7 +28,10 @@ command:
ligo evaluate-value gitlab-pages/docs/language-basics/src/variables-and-constants/const.ligo age
# Outputs: 25
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=a
let age : int = 25
```
@ -36,7 +43,9 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/variables-and-constant
# Outputs: 25
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=a
let age : int = 25;
```
@ -48,12 +57,13 @@ ligo evaluate-value gitlab-pages/docs/language-basics/src/variables-and-constant
# Outputs: 25
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Variables
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
Variables, unlike constants, are *mutable*. They cannot be declared in
a *global scope*, but they can be declared and used within functions,
@ -88,7 +98,8 @@ ligo run-function gitlab-pages/docs/language-basics/src/variables-and-constants/
# Outputs: 2
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
As expected in the pure subset of a functional language, CameLIGO only
features *constant values*: once they are declared, the value cannot
@ -105,7 +116,9 @@ like this:
ligo run-function gitlab-pages/docs/language-basics/src/variables-and-constants/add.mligo add '(1,1)'
# Outputs: 2
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
As expected in the pure subset of a functional language, ReasonLIGO
only features *constant values*: once they are declared, the value
@ -125,4 +138,5 @@ ligo run-function gitlab-pages/docs/language-basics/src/variables-and-constants/
# Outputs: 2
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: big-map-reference
title: Big Maps — Scalable Maps
---
import Syntax from '@theme/Syntax';
Ordinary maps are fine for contracts with a finite lifespan or a
bounded number of users. For many contracts however, the intention is
to have a map holding *many* entries, potentially millions of
@ -14,52 +16,67 @@ interface for big maps is analogous to the one used for ordinary maps.
# Declaring a Map
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
type move is int * int
type register is big_map (address, move)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
type move = int * int
type register = (address, move) big_map
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
type move = (int, int);
type register = big_map (address, move);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Creating an Empty Big Map
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
const empty : register = big_map []
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
let empty : register = Big_map.empty
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
let empty : register = Big_map.empty
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Creating a Non-empty Map
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
const moves : register =
big_map [
@ -67,7 +84,9 @@ const moves : register =
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) -> (0,3)]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
let moves : register =
Big_map.literal [
@ -75,42 +94,54 @@ let moves : register =
(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), (0,3))]
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
let moves : register =
Big_map.literal ([
("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address, (1,2)),
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, (0,3))]);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Accessing Values
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
const my_balance : option (move) =
moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
let my_balance : move option =
Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
let my_balance : option (move) =
Big_map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, moves);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Updating Big Maps
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
function add (var m : register) : register is
block {
@ -120,26 +151,33 @@ function add (var m : register) : register is
const updated_map : register = add (moves)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
let updated_map : register =
Big_map.update
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) (Some (4,9)) moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
let updated_map : register =
Big_map.update
(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), Some ((4,9)), moves);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Removing Bindings
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=big_maps
function rem (var m : register) : register is
block {
@ -149,16 +187,21 @@ function rem (var m : register) : register is
const updated_map : register = rem (moves)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=big_maps
let updated_map : register =
Map.remove ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=big_maps
let updated_map : register =
Map.remove (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), moves)
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,62 +3,67 @@ id: bytes-reference
title: Bytes — Manipulate bytes data
---
import Syntax from '@theme/Syntax';
## Bytes.concat(b1: bytes, b2: bytes) : bytes
Concatenate together two `bytes` arguments and return the result.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function concat_op (const s : bytes) : bytes is
begin skip end with bytes_concat(s , 0x7070)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let concat_op (s : bytes) : bytes =
Bytes.concat s 0x7070
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let concat_op = (s: bytes): bytes => Bytes.concat(s, 0x7070);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Bytes.slice(pos1: nat, pos2: nat, data: bytes) : bytes
Extract the bytes between `pos1` and `pos2`. **Positions are zero indexed and
inclusive**. For example if you gave the input "ff7a7aff" to the following:
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function slice_op (const s : bytes) : bytes is
begin skip end with bytes_slice(1n , 2n , s)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let slice_op (s : bytes) : bytes =
Bytes.slice 1n 2n s
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```
let slice_op = (s: bytes): bytes => Bytes.slice(1n, 2n, s);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
It would return "7a7a" rather than "ff7a" or "ff" or "7a".
@ -68,23 +73,28 @@ Converts Michelson data structures to a binary format for serialization.
> ⚠️ `PACK` and `UNPACK` are features of Michelson that are intended to be used by people that really know what they're doing. There are several failure cases (such as `UNPACK`ing a lambda from an untrusted source), most of which are beyond the scope of this document. Don't use these functions without doing your homework first.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function id_string (const p : string) : option(string) is block {
const packed : bytes = bytes_pack(p) ;
} with (bytes_unpack(packed): option(string))
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let id_string (p: string) : string option =
let packed: bytes = Bytes.pack p in
((Bytes.unpack packed): string option)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let id_string = (p: string) : option(string) => {
let packed : bytes = Bytes.pack(p);
@ -92,7 +102,8 @@ let id_string = (p: string) : option(string) => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Bytes.unpack(packed: bytes) : a'
@ -101,23 +112,28 @@ serialization format to the `option` type annotated on the call.
> ⚠️ `PACK` and `UNPACK` are features of Michelson that are intended to be used by people that really know what they're doing. There are several failure cases (such as `UNPACK`ing a lambda from an untrusted source), most of which are beyond the scope of this document. Don't use these functions without doing your homework first.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function id_string (const p : string) : option(string) is block {
const packed : bytes = bytes_pack(p) ;
} with (bytes_unpack(packed): option(string))
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let id_string (p: string) : string option =
let packed: bytes = Bytes.pack p in
((Bytes.unpack packed): string option)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let id_string = (p: string) : option(string) => {
let packed : bytes = Bytes.pack(p);
@ -125,4 +141,5 @@ let id_string = (p: string) : option(string) => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,93 +3,108 @@ id: crypto-reference
title: Crypto — Cryptographic functions
---
import Syntax from '@theme/Syntax';
## Crypto.blake2b(data: bytes): bytes
Runs the [blake2b hash algorithm](https://en.wikipedia.org/wiki/BLAKE_(hash_function)#BLAKE2)
over the given `bytes` data and returns a `bytes` representing the hash.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function hasherman_blake (const s: bytes) : bytes is blake2b(s)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let hasherman_blake (s: bytes) : bytes = Crypto.blake2b s
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let hasherman_blake = (s: bytes) => Crypto.blake2b(s);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Crypto.sha256(data: bytes) : bytes
Runs the [sha256 hash algorithm](https://en.wikipedia.org/wiki/SHA-2) over the given
`bytes` data and returns a `bytes` representing the hash.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function hasherman (const s : bytes) : bytes is
begin skip end with sha_256(s)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let hasherman (s : bytes) : bytes =
Crypto.sha256 s
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let hasherman = (s: bytes): bytes => Crypto.sha256(s);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Crypto.sha512(data: bytes) : bytes
Runs the [sha512 hash algorithm](https://en.wikipedia.org/wiki/SHA-2) over the given
`bytes` data and returns a `bytes` representing the hash.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function hasherman512 (const s: bytes) : bytes is sha_512(s)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let hasherman512 (s: bytes) : bytes = Crypto.sha512 s
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let hasherman512 = (s: bytes) => Crypto.sha512(s);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Crypto.hash_key(k: key) : key_hash
Hashes a key for easy comparison and storage.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function check_hash_key (const kh1 : key_hash; const k2 : key) : bool * key_hash is block {
var ret : bool := False ;
@ -98,7 +113,9 @@ function check_hash_key (const kh1 : key_hash; const k2 : key) : bool * key_hash
} with (ret, kh2)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let check_hash_key (kh1, k2: key_hash * key) : bool * key_hash =
let kh2 : key_hash = Crypto.hash_key k2 in
@ -107,7 +124,9 @@ let check_hash_key (kh1, k2: key_hash * key) : bool * key_hash =
else (false, kh2)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let check_hash_key = ((kh1, k2): (key_hash, key)) : (bool, key_hash) => {
let kh2 : key_hash = Crypto.hash_key(k2);
@ -120,7 +139,8 @@ let check_hash_key = ((kh1, k2): (key_hash, key)) : (bool, key_hash) => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Crypto.check(pk: key, signed: signature, data: bytes) : bool
@ -128,9 +148,10 @@ Check that a message has been signed by a particular key.
> ⚠️ There is no way to *generate* a signed message in LIGO. This is because that would require storing a private key on chain, at which point it isn't very private anymore.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function check_signature
(const pk: key;
@ -139,17 +160,22 @@ function check_signature
is crypto_check(pk, signed, msg)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let check_signature (pk, signed, msg: key * signature * bytes) : bool =
Crypto.check pk signed msg
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let check_signature = ((pk, signed, msg): (key, signature, bytes)) : bool => {
Crypto.check(pk, signed, msg);
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,13 +3,16 @@ id: current-reference
title: Tezos - Things relating to the current execution context
---
import Syntax from '@theme/Syntax';
# Tezos.balance
Get the balance for the contract.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function main (const p : unit; const s: tez) : list (operation) * tez is
((nil : list (operation)), Tezos.balance)
@ -17,14 +20,18 @@ function main (const p : unit; const s: tez) : list (operation) * tez is
> Note that `balance` and `Current.balance` are *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let main (p,s : unit * tez) = ([] : operation list), Tezos.balance
```
> Note that `balance` and `Current.balance` are *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let main = ((p,s) : (unit, tez)) =>
([]: list (operation), Tezos.balance);
@ -32,7 +39,8 @@ let main = ((p,s) : (unit, tez)) =>
> Note that `balance` and `Current.balance` are *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Tezos.now
@ -45,8 +53,9 @@ smart contracts like this:
### Examples
#### 24 hours from now
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
<Syntax syntax="pascaligo">
```pascaligo group=b
const today: timestamp = Tezos.now;
const one_day: int = 86_400;
@ -57,7 +66,9 @@ const one_day_later: timestamp = some_date + one_day;
> Note that `now` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=b
let today: timestamp = Tezos.now
let one_day: int = 86_400
@ -68,7 +79,9 @@ let one_day_later: timestamp = some_date + one_day
> Note that `Current.time` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=b
let today: timestamp = Tezos.now;
let one_day: int = 86_400;
@ -79,12 +92,14 @@ let one_day_later: timestamp = some_date + one_day;
> Note that `Current.time` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
#### 24 hours ago
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
<Syntax syntax="pascaligo">
```pascaligo group=c
const today: timestamp = Tezos.now;
const one_day: int = 86_400;
@ -93,7 +108,9 @@ const in_24_hrs: timestamp = today - one_day;
> Note that `now` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let today: timestamp = Tezos.now
let one_day: int = 86_400
@ -102,7 +119,9 @@ let in_24_hrs: timestamp = today - one_day
> Note that `Current.time` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let today: timestamp = Tezos.now;
let one_day: int = 86_400;
@ -111,36 +130,43 @@ let in_24_hrs: timestamp = today - one_day;
> Note that `Current.time` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
#### Comparing Timestamps
You can also compare timestamps using the same comparison operators as
for numbers
<!--DOCUSAURUS_CODE_TABS-->
<!--Pascaligo-->
<Syntax syntax="pascaligo">
```pascaligo group=c
const not_tommorow: bool = (Tezos.now = in_24_hrs)
```
> Note that `now` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=c
let not_tomorrow: bool = (Tezos.now = in_24_hrs)
```
> Note that `Current.time` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=c
let not_tomorrow: bool = (Tezos.now == in_24_hrs);
```
> Note that `Current.time` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Amount
@ -148,9 +174,10 @@ let not_tomorrow: bool = (Tezos.now == in_24_hrs);
Get the amount of tez provided by the sender to complete this
transaction.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function threshold (const p : unit) : int is
if Tezos.amount = 100tz then 42 else 0
@ -158,14 +185,18 @@ function threshold (const p : unit) : int is
> Note that `amount` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let threshold (p : unit) : int = if Tezos.amount = 100tz then 42 else 0
```
> Note that `Current.amount` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let threshold = (p : unit) : int =>
if (Tezos.amount == 100tz) { 42; } else { 0; };
@ -173,45 +204,53 @@ let threshold = (p : unit) : int =>
> Note that `Current.amount` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Sender
Get the address that initiated the current transaction.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function main (const p : unit) : address is Tezos.sender
```
> Note that `sender` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let main (p: unit) : address = Tezos.sender
```
> Note that `Current.sender` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let main = (p : unit) : address => Tezos.sender;
```
> Note that `Current.sender` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Address
Get the address associated with a value of type `contract`.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function main (const p : key_hash) : address is block {
const c : contract (unit) = Tezos.implicit_account (p)
@ -220,7 +259,9 @@ function main (const p : key_hash) : address is block {
> Note that `implicit_account` and `address` are *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let main (p : key_hash) =
let c : unit contract = Tezos.implicit_account p
@ -230,7 +271,9 @@ let main (p : key_hash) =
> Note that `Current.implicit_account` and `Current.address` are
> *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let main = (p : key_hash) : address => {
let c : contract (unit) = Tezos.implicit_account (p);
@ -241,36 +284,43 @@ let main = (p : key_hash) : address => {
> Note that `Current.implicit_account` and `Current.address` are
> *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Self Address
Get the address of the currently running contract.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function main (const p : unit) : address is Tezos.self_address
```
> Note that `self_address` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let main (p : unit) : address = Tezos.self_address
```
> Note that `Current.self_address` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let main = (p : unit) : address => Tezos.self_address;
```
> Note that `Current.self_address` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Implicit Account
@ -278,9 +328,10 @@ Get the default contract associated with an on-chain key-pair. This
contract does not execute code, instead it exists to receive tokens on
behalf of a key's owner.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function main (const kh: key_hash) : contract (unit) is
Tezos.implicit_account (kh)
@ -288,14 +339,18 @@ function main (const kh: key_hash) : contract (unit) is
> Note that `implicit_account` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let main (kh : key_hash) : unit contract = Tezos.implicit_account kh
```
> Note that `Current.implicit_account` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let main = (kh : key_hash): contract (unit) =>
Tezos.implicit_account (kh);
@ -303,7 +358,8 @@ let main = (kh : key_hash): contract (unit) =>
> Note that `Current.implicit_account` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Source
@ -331,29 +387,36 @@ current transaction.
> tezos-client to transfer to whatever KT1 delegates they had, even
> if those KT1 were malicious scripts.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function main (const p: unit) : address is Tezos.source
```
> Note that `source` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let main (p : unit) : address = Tezos.source
```
> Note that `Current.source` is *deprecated*.
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let main = (p : unit) : address => Tezos.source;
```
> Note that `Current.source` is *deprecated*.
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Failwith
@ -362,9 +425,10 @@ Cause the contract to fail with an error message.
> ⚠ Using this currently requires in general a type annotation on the
> `failwith` call.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function main (const p : int; const s : unit) : list (operation) * unit is
block {
@ -373,15 +437,20 @@ function main (const p : int; const s : unit) : list (operation) * unit is
with ((nil : list (operation)), s)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let main (p,s : int * unit) = if p > 10 then failwith "Failure."
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let main = ((p,s) : (int, unit)) =>
if (p > 10) { failwith ("Failure."); };
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: list-reference
title: Lists — Linear Collections
---
import Syntax from '@theme/Syntax';
Lists are linear collections of elements of the same type. Linear
means that, in order to reach an element in a list, we must visit all
the elements before (sequential access). Elements can be repeated, as
@ -13,52 +15,62 @@ think of a list a *stack*, where the top is written on the left.
# Defining Lists
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=lists
const empty_list : list (int) = nil // Or list []
const my_list : list (int) = list [1; 2; 2] // The head is 1
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=lists
let empty_list : int list = []
let my_list : int list = [1; 2; 2] // The head is 1
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=lists
let empty_list : list (int) = [];
let my_list : list (int) = [1, 2, 2]; // The head is 1
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Adding to Lists
Lists can be augmented by adding an element before the head (or, in
terms of stack, by *pushing an element on top*).
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=lists
const larger_list : list (int) = 5 # my_list // [5;1;2;2]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=lists
let larger_list : int list = 5 :: my_list // [5;1;2;2]
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=lists
let larger_list : list (int) = [5, ...my_list]; // [5,1,2,2]
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Functional Iteration over Lists
@ -78,9 +90,9 @@ The first, the *iterated operation*, is an iteration over the list
with a unit return value. It is useful to enforce certain invariants
on the element of a list, or fail.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=lists
function iter_op (const l : list (int)) : unit is
@ -92,8 +104,8 @@ function iter_op (const l : list (int)) : unit is
> Note that `list_iter` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=lists
let iter_op (l : int list) : unit =
@ -101,7 +113,8 @@ let iter_op (l : int list) : unit =
in List.iter predicate l
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=lists
let iter_op = (l : list (int)) : unit => {
@ -110,7 +123,8 @@ let iter_op = (l : list (int)) : unit => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Mapped Operation over Lists
@ -118,9 +132,9 @@ We may want to change all the elements of a given list by applying to
them a function. This is called a *map operation*, not to be confused
with the map data structure.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=lists
function increment (const i : int): int is i + 1
@ -131,7 +145,8 @@ const plus_one : list (int) = List.map (increment, larger_list)
> Note that `list_map` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=lists
let increment (i : int) : int = i + 1
@ -140,7 +155,8 @@ let increment (i : int) : int = i + 1
let plus_one : int list = List.map increment larger_list
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=lists
let increment = (i : int) : int => i + 1;
@ -148,7 +164,9 @@ let increment = (i : int) : int => i + 1;
// Creates a new list with all elements incremented by 1
let plus_one : list (int) = List.map (increment, larger_list);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Folded Operation over Lists
@ -159,9 +177,9 @@ function takes two arguments: an *accumulator* and the structure
enables having a partial result that becomes complete when the
traversal of the data structure is over.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=lists
function sum (const acc : int; const i : int): int is acc + i
@ -170,42 +188,52 @@ const sum_of_elements : int = List.fold (sum, my_list, 0)
> Note that `list_fold` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=lists
let sum (acc, i: int * int) : int = acc + i
let sum_of_elements : int = List.fold sum my_list 0
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=lists
let sum = ((result, i): (int, int)): int => result + i;
let sum_of_elements : int = List.fold (sum, my_list, 0);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# List Length
Get the number of elements in a list.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function size_of (const l : list (int)) : nat is List.length (l)
```
> Note that `size` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let size_of (l : int list) : nat = List.length l
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let size_of = (l : list (int)) : nat => List.length (l);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: map-reference
title: Maps
---
import Syntax from '@theme/Syntax';
*Maps* are a data structure which associate values of the same type to
values of the same type. The former are called *key* and the latter
*values*. Together they make up a *binding*. An additional requirement
@ -11,51 +13,66 @@ sense.
# Declaring a Map
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
type move is int * int
type register is map (address, move)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
type move = int * int
type register = (address, move) map
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
type move = (int, int);
type register = map (address, move);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Creating an Empty Map
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
const empty : register = map []
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let empty : register = Map.empty
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let empty : register = Map.empty
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Creating a Non-empty Map
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
const moves : register =
map [
@ -63,7 +80,9 @@ const moves : register =
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) -> (0,3)]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let moves : register =
Map.literal [
@ -71,44 +90,56 @@ let moves : register =
(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), (0,3))]
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let moves : register =
Map.literal ([
("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" : address, (1,2)),
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address, (0,3))]);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Accessing Map Bindings
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
const my_balance : option (move) =
moves [("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address)]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let my_balance : move option =
Map.find_opt ("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let my_balance : option (move) =
Map.find_opt (("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), moves);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
Notice how the value we read is an optional value: this is to force
the reader to account for a missing key in the map. This requires
*pattern matching*.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function force_access (const key : address; const moves : register) : move is
case moves[key] of
@ -117,7 +148,9 @@ function force_access (const key : address; const moves : register) : move is
end
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let force_access (key, moves : address * register) : move =
match Map.find_opt key moves with
@ -125,7 +158,9 @@ let force_access (key, moves : address * register) : move =
| None -> (failwith "No move." : move)
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let force_access = ((key, moves) : (address, register)) : move => {
switch (Map.find_opt (key, moves)) {
@ -134,7 +169,9 @@ let force_access = ((key, moves) : (address, register)) : move => {
}
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Updating a Map
@ -142,8 +179,9 @@ Given a map, we may want to add a new binding, remove one, or modify
one by changing the value associated to an already existing key. All
those operations are called *updates*.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function assign (var m : register) : register is
block {
@ -164,7 +202,9 @@ function assignments (var m : register) : register is
} with m
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let assign (m : register) : register =
Map.update
@ -181,7 +221,9 @@ let add (m : register) : register =
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address) (4,9) m
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let assign = (m : register) : register =>
Map.update
@ -199,13 +241,15 @@ let add = (m : register) : register =>
(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN" : address), (4,9), m);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
To remove a binding from a map, we need its key.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function delete (const key : address; var moves : register) : register is
block {
@ -213,19 +257,24 @@ function delete (const key : address; var moves : register) : register is
} with moves
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let delete (key, moves : address * register) : register =
Map.remove key moves
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let delete = ((key, moves) : (address, register)) : register =>
Map.remove (key, moves);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Functional Iteration over Maps
@ -246,9 +295,9 @@ no return value: its only use is to produce side-effects. This can be
useful if for example you would like to check that each value inside
of a map is within a certain range, and fail with an error otherwise.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function iter_op (const m : register) : unit is
@ -260,7 +309,8 @@ function iter_op (const m : register) : unit is
> Note that `map_iter` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let iter_op (m : register) : unit =
@ -268,7 +318,8 @@ let iter_op (m : register) : unit =
in Map.iter predicate m
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let iter_op = (m : register) : unit => {
@ -276,7 +327,9 @@ let iter_op = (m : register) : unit => {
Map.iter (predicate, m);
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Map Operations over Maps
@ -285,9 +338,9 @@ function. This is called a *map operation*, not to be confused with
the map data structure. The predefined functional iterator
implementing the map operation over maps is called `Map.map`.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function map_op (const m : register) : register is
@ -299,7 +352,8 @@ function map_op (const m : register) : register is
> Note that `map_map` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let map_op (m : register) : register =
@ -307,7 +361,8 @@ let map_op (m : register) : register =
in Map.map increment m
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let map_op = (m : register) : register => {
@ -315,7 +370,9 @@ let map_op = (m : register) : register => {
Map.map (increment, m);
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Folded Operations over Maps
@ -325,9 +382,9 @@ function takes two arguments: an *accumulator* and the structure
enables having a partial result that becomes complete when the
traversal of the data structure is over.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=maps
function fold_op (const m : register) : int is
@ -339,14 +396,18 @@ function fold_op (const m : register) : int is
> Note that `map_fold` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=maps
let fold_op (m : register) : register =
let folded = fun (i,j : int * (address * move)) -> i + j.1.1
in Map.fold folded m 5
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=maps
let fold_op = (m : register) : register => {
let folded = ((i,j): (int, (address, move))) => i + j[1][1];
@ -354,4 +415,5 @@ let fold_op = (m : register) : register => {
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,6 +3,8 @@ id: set-reference
title: Sets — Unordered unique collection of a type
---
import Syntax from '@theme/Syntax';
Sets are unordered collections of values of the same type, like lists
are ordered collections. Like the mathematical sets and lists, sets
can be empty and, if not, elements of sets in LIGO are *unique*,
@ -10,92 +12,122 @@ whereas they can be repeated in a *list*.
# Empty Sets
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=sets
const my_set : set (int) = set []
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let my_set : int set = Set.empty
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let my_set : set (int) = Set.empty;
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Non-empty Sets
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=sets
const my_set : set (int) = set [3; 2; 2; 1]
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let my_set : int set =
Set.add 3 (Set.add 2 (Set.add 2 (Set.add 1 (Set.empty : int set))))
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let my_set : set (int) =
Set.add (3, Set.add (2, Set.add (2, Set.add (1, Set.empty : set (int)))));
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Set Membership
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=sets
const contains_3 : bool = my_set contains 3
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let contains_3 : bool = Set.mem 3 my_set
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let contains_3 : bool = Set.mem (3, my_set);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Cardinal of Sets
The predefined function `Set.size` returns the number of
elements in a given set as follows.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=sets
const cardinal : nat = Set.size (my_set)
```
> Note that `size` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let cardinal : nat = Set.size my_set
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let cardinal : nat = Set.size (my_set);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Updating Sets
There are two ways to update a set, that is to add or remove from it.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
In PascaLIGO, either we create a new set from the given one, or we
modify it in-place. First, let us consider the former way:
```pascaligo group=sets
@ -118,18 +150,24 @@ function update (var s : set (int)) : set (int) is block {
const new_set : set (int) = update (my_set)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let larger_set : int set = Set.add 4 my_set
let smaller_set : int set = Set.remove 3 my_set
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let larger_set : set (int) = Set.add (4, my_set);
let smaller_set : set (int) = Set.remove (3, my_set);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
# Functional Iteration over Sets
@ -149,8 +187,9 @@ no return value: its only use is to produce side-effects. This can be
useful if for example you would like to check that each value inside
of a map is within a certain range, and fail with an error otherwise.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=sets
function iter_op (const s : set (int)) : unit is
block {
@ -161,21 +200,27 @@ function iter_op (const s : set (int)) : unit is
> Note that `set_iter` is *deprecated*.
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let iter_op (s : int set) : unit =
let predicate = fun (i : int) -> assert (i > 3)
in Set.iter predicate s
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let iter_op = (s : set (int)) : unit => {
let predicate = (i : int) => assert (i > 3);
Set.iter (predicate, s);
};
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## Folded Operation
@ -185,9 +230,10 @@ function takes two arguments: an *accumulator* and the structure
enables having a partial result that becomes complete when the
traversal of the data structure is over.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo group=sets
function sum (const acc : int; const i : int): int is acc + i
const sum_of_elements : int = Set.fold (sum, my_set, 0)
@ -206,15 +252,21 @@ function loop (const s : set (int)) : int is block {
} with sum
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo group=sets
let sum (acc, i : int * int) : int = acc + i
let sum_of_elements : int = Set.fold sum my_set 0
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo group=sets
let sum = ((acc, i) : (int, int)) : int => acc + i;
let sum_of_elements : int = Set.fold (sum, my_set, 0);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -3,29 +3,37 @@ id: string-reference
title: String — Manipulate string data
---
import Syntax from '@theme/Syntax';
## String.size(s: string) : nat
Get the size of a string. [Michelson only supports ASCII strings](http://tezos.gitlab.io/whitedoc/michelson.html#constants)
so for now you can assume that each character takes one byte of storage.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function string_size (const s: string) : nat is size(s)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let size_op (s: string) : nat = String.size s
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let size_op = (s: string): nat => String.size(s);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## String.length(s: string) : nat
@ -36,20 +44,29 @@ Alias for `String.size`.
Get the substring of `s` between `pos1` inclusive and `pos2` inclusive. For example
the string "tata" given to the function below would return "at".
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function slice_op (const s : string) : string is string_slice(1n , 2n , s)
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let slice_op (s: string) : string = String.slice 1n 2n s
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let slice_op = (s: string): string => String.slice(1n, 2n, s);
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>
## String.sub(pos1: nat, pos2: nat, s: string) : string
@ -59,21 +76,27 @@ Alias for `String.slice`.
Concatenate two strings and return the result.
<!--DOCUSAURUS_CODE_TABS-->
<!--PascaLIGO-->
<Syntax syntax="pascaligo">
```pascaligo
function concat_op (const s : string) : string is s ^ "toto"
```
<!--CameLIGO-->
</Syntax>
<Syntax syntax="cameligo">
```cameligo
let concat_syntax (s: string) = s ^ "test_literal"
```
<!--ReasonLIGO-->
</Syntax>
<Syntax syntax="reasonligo">
```reasonligo
let concat_syntax = (s: string) => s ++ "test_literal";
```
<!--END_DOCUSAURUS_CODE_TABS-->
</Syntax>

View File

@ -15,7 +15,7 @@ people have spent at his shop when buying tacos.
<br/>
<img src="/img/tutorials/get-started/tezos-taco-shop-payout/get-money.svg" width="50%" />
<div style="opacity: 0.7; text-align: center; font-size: 10px;">
<div style={{ opacity: 0.7, textAlign: 'center', fontSize: '10px' }}>
<div>Icons made by <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
</div>
@ -23,6 +23,7 @@ people have spent at his shop when buying tacos.
## Analyzing the Current Contract
### **`taco-shop.ligo`**
```pascaligo group=a
type taco_supply is record [
current_stock : nat;
@ -128,6 +129,7 @@ const operations : list (operation) = list [payoutOperation];
## Finalizing the Contract
### **`taco-shop.ligo`**
```pascaligo group=b
type taco_supply is record [
current_stock : nat;
@ -190,7 +192,7 @@ ligo dry-run taco-shop.ligo --syntax pascaligo --amount 1 buy_taco 1n "map [
```
<img src="/img/tutorials/get-started/tezos-taco-shop-payout/dry-run-1.png" />
<div style="opacity: 0.7; text-align: center; font-size: 12px; margin-top:-24px;">
<div style={{ opacity: 0.7, textAlign: 'center', fontSize: '12px', marginTop: '-24px' }}>
<b>Operation(...bytes)</b> included in the output
</div>

View File

@ -16,7 +16,7 @@ consumers.
<br/>
<img src="/img/tutorials/get-started/tezos-taco-shop-smart-contract/taco-stand.svg" width="50%" />
<div style="opacity: 0.7; text-align: center; font-size: 10px;">Made by <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
<div style={{ opacity: 0.7, textAlign: 'center', fontSize: '10px' }}>Made by <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
</div>
---
@ -74,7 +74,7 @@ executable** through the installation script, as shown in the
screenshot below:
<img src="/img/tutorials/get-started/tezos-taco-shop-smart-contract/install-ligo.png" />
<div style="opacity: 0.7; text-align: center; font-size: 12px; margin-top:-24px;">Installing the <b>next</b> version of LIGO's CLI</div>
<div style={{ opacity: 0.7, textAlign: 'center', fontSize: '12px', marginTop: '-24px' }}>Installing the <b>next</b> version of LIGO's CLI</div>
## Implementing our First `main` Function
@ -90,6 +90,7 @@ contract, but it is something to get us started and test our LIGO
installation as well.
### `taco-shop.ligo`
```pascaligo group=a
function main (const parameter : int; const contractStorage : int) :
list (operation) * int is
@ -150,7 +151,7 @@ ligo dry-run taco-shop.ligo --syntax pascaligo main 4 3
```
<img src="/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-1.png" />
<div style="opacity: 0.7; text-align: center; font-size: 12px; margin-top:-24px;">Simulating contract execution with the CLI</div>
<div style={{ opacity: 0.7, textAlign: 'center', fontSize: '12px', marginTop: '-24px' }}>Simulating contract execution with the CLI</div>
<br/>
@ -167,6 +168,7 @@ fields. Additionally, we will want to combine our `taco_supply` type
into a map, consisting of the entire offer of Pedro's shop.
**Taco shop's storage**
```pascaligo group=b
type taco_supply is record [
current_stock : nat;
@ -181,6 +183,7 @@ Next step is to update the `main` function to include
`parameter` to `unit` as well to clear things up.
**`taco-shop.ligo`**
```pascaligo group=b+
type taco_supply is record [
current_stock : nat;
@ -204,6 +207,7 @@ initial storage value. In our case the storage is type-checked as
our storage's value will be defined as follows:
**Storage value**
```zsh
map [
1n -> record [
@ -221,6 +225,7 @@ map [
> by their keys `1n` and `2n`.
**Dry run command with a multi-line storage value**
```zsh
ligo dry-run taco-shop.ligo --syntax pascaligo main unit "map [
1n -> record [
@ -235,7 +240,7 @@ ligo dry-run taco-shop.ligo --syntax pascaligo main unit "map [
```
<img src="/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-2.png" />
<div style="opacity: 0.7; text-align: center; font-size: 12px; margin-top:-24px;">Dry-run with a complex storage value</div>
<div style={{ opacity: 0.7, textAlign: 'center', fontSize: '12px', marginTop: '-24px' }}>Dry-run with a complex storage value</div>
<br/>
@ -264,6 +269,7 @@ Let is start by customizing our contract a bit, we will:
we will want to modify it
**`taco-shop.ligo`**
```pascaligo group=c
type taco_supply is record [
current_stock : nat;
@ -320,7 +326,7 @@ function buy_taco (const taco_kind_index : nat; var taco_shop_storage : taco_sho
```
<img src="/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-3.png" />
<div style="opacity: 0.7; text-align: center; font-size: 12px; margin-top:-24px;">Stock decreases after selling a taco</div>
<div style={{ opacity: 0.7, textAlign: 'center', fontSize: '12px', marginTop: '-24px' }}>Stock decreases after selling a taco</div>
<br/>
@ -341,6 +347,7 @@ To make sure we get paid, we will:
the payment accepted
**`taco-shop.ligo`**
```pascaligo group=e
type taco_supply is record [
current_stock : nat;
@ -394,14 +401,14 @@ ligo dry-run taco-shop.ligo --syntax pascaligo --amount 1 buy_taco 1n "map [
** Purchasing a Taco with 1tez **
<img src="/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-4.png" />
<div style="opacity: 0.7; text-align: center; font-size: 12px; margin-top:-24px;">Stock decreases after selling a taco, if the right amount of tezzies is provided</div>
<div style={{ opacity: 0.7, textAlign: 'center', fontSize: '12px', marginTop: '-24px' }}>Stock decreases after selling a taco, if the right amount of tezzies is provided</div>
<br/>
**Attempting to Purchase a Taco with 0.7tez**
<img src="/img/tutorials/get-started/tezos-taco-shop-smart-contract/dry-run-5.png" />
<div style="opacity: 0.7; text-align: center; font-size: 12px;
margin-top:-24px;">Stock does not decrease after a purchase attempt
<div style={{ opacity: 0.7, textAlign: 'center', fontSize: '12px',
marginTop: '-24px' }}>Stock does not decrease after a purchase attempt
with an insufficient payment.</div>
<br/>
@ -416,11 +423,13 @@ If you would like to accept tips in your contract, simply change the
following line, depending on your preference.
**Without tips**
```pascaligo skip
if amount =/= current_purchase_price then
```
**With tips**
```pascaligo skip
if amount >= current_purchase_price then
```

20
gitlab-pages/website/.gitignore vendored Normal file
View File

@ -0,0 +1,20 @@
# dependencies
/node_modules
# production
/build
# generated files
.docusaurus
.cache-loader
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@ -1,8 +1,12 @@
const React = require('react');
import React from 'react';
import Highlight, { defaultProps } from "prism-react-renderer";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import useThemeContext from '@theme/hooks/useThemeContext';
import defaultTheme from 'prism-react-renderer/themes/palenight';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
const pre = '```';
const PASCALIGO_EXAMPLE = `${pre}pascaligo
const PASCALIGO_EXAMPLE = `
type storage is int
type parameter is
@ -14,8 +18,11 @@ type return is list (operation) * storage
// Two entrypoints
function add (const store : storage; const delta : int) : storage is store + delta
function sub (const store : storage; const delta : int) : storage is store - delta
function add (const store : storage; const delta : int) : storage is
store + delta
function sub (const store : storage; const delta : int) : storage is
store - delta
(* Main access point that dispatches to the entrypoints according to
the smart contract parameter. *)
@ -27,9 +34,9 @@ function main (const action : parameter; const store : storage) : return is
| Decrement (n) -> sub (store, n)
| Reset -> 0
end)
${pre}`;
`;
const CAMELIGO_EXAMPLE = `${pre}ocaml
const CAMELIGO_EXAMPLE = `
type storage = int
type parameter =
@ -53,10 +60,10 @@ let main (action, store : parameter * storage) : return =
Increment (n) -> add (store, n)
| Decrement (n) -> sub (store, n)
| Reset -> 0)
${pre}`;
`;
const REASONLIGO_EXAMPLE = `${pre}reasonligo
const REASONLIGO_EXAMPLE = `
type storage = int;
type parameter =
@ -81,40 +88,82 @@ let main = ((action, store) : (parameter, storage)) : return => {
| Decrement (n) => sub ((store, n))
| Reset => 0}))
};
${pre}`;
`;
module.exports = props => {
const MarkdownBlock = props.MarkdownBlock;
function CodeExamples (props) {
const {
siteConfig: {
themeConfig: {prism = {}},
},
} = useDocusaurusContext();
const {isDarkTheme} = useThemeContext();
const lightModeTheme = prism.theme || defaultTheme;
const darkModeTheme = prism.darkTheme || lightModeTheme;
const prismTheme = isDarkTheme ? darkModeTheme : lightModeTheme;
return (
<div className="tabs">
<div className="nav-tabs">
<div
className="nav-link active"
data-group="examples"
data-tab="pascaligo"
>
PascaLIGO
</div>
<div className="nav-link" data-group="examples" data-tab="cameligo">
CameLIGO
</div>
<div className="nav-link" data-group="examples" data-tab="reasonligo">
ReasonLIGO
</div>
</div>
<div className="tab-content">
<div id="pascaligo" className="tab-pane active" data-group="examples">
<MarkdownBlock>{PASCALIGO_EXAMPLE}</MarkdownBlock>
</div>
<div id="cameligo" className="tab-pane" data-group="examples">
<MarkdownBlock>{CAMELIGO_EXAMPLE}</MarkdownBlock>
</div>
<div id="reasonligo" className="tab-pane" data-group="examples">
<MarkdownBlock>{REASONLIGO_EXAMPLE}</MarkdownBlock>
<Tabs
defaultValue="pascaligo"
values={[
{ label: 'PascaLIGO', value: 'pascaligo', },
{ label: 'CameLIGO', value: 'cameligo', },
{ label: 'ReasonLIGO', value: 'reasonligo', },
]
}>
<TabItem value="pascaligo">
<Highlight {...defaultProps} language="pascaligo" code={PASCALIGO_EXAMPLE} theme={prismTheme}>
{({ className, style, tokens, getLineProps, getTokenProps }) => (
<pre className={className} style={style}>
{tokens.map((line, i) => (
<div {...getLineProps({ line, key: i })}>
{line.map((token, key) => (
<span {...getTokenProps({ token, key })} />
))}
</div>
))}
</pre>
)}
</Highlight>
</TabItem>
<TabItem value="cameligo">
<Highlight {...defaultProps} language="cameligo" code={CAMELIGO_EXAMPLE} theme={prismTheme}>
{({ className, style, tokens, getLineProps, getTokenProps }) => (
<pre className={className} style={style}>
{tokens.map((line, i) => (
<div {...getLineProps({ line, key: i })}>
{line.map((token, key) => (
<span {...getTokenProps({ token, key })} />
))}
</div>
))}
</pre>
)}
</Highlight>
</TabItem>
<TabItem value="reasonligo">
<Highlight {...defaultProps} language="reasonligo" code={REASONLIGO_EXAMPLE} theme={prismTheme}>
{({ className, style, tokens, getLineProps, getTokenProps }) => (
<pre className={className} style={style}>
{tokens.map((line, i) => (
<div {...getLineProps({ line, key: i })}>
{line.map((token, key) => (
<span {...getTokenProps({ token, key })} />
))}
</div>
))}
</pre>
)}
</Highlight>
</TabItem>
</Tabs>
);
};
export default CodeExamples

View File

@ -1,3 +1,5 @@
// deprecated.
const React = require('react');
const docUrl = require(`${process.cwd()}/core/UrlUtils`).docUrl;

View File

@ -0,0 +1,226 @@
const repoUrl = 'https://gitlab.com/ligolang/ligo';
// let reasonHighlightJs = require('reason-highlightjs');
const siteConfig = {
title: 'LIGO', // Title for your website.
tagline: 'LIGO is a friendly smart contract language for Tezos',
// taglineSub: 'Michelson was never so easy',
url: 'https://ligolang.org', // Your website URL
baseUrl: '/', // Base URL for your project */
// For github.io type URLs, you would set the url and baseUrl like:
// url: 'https://facebook.github.io',
// baseUrl: '/test-site/',
// Used for publishing and more
projectName: 'ligo',
organizationName: 'TBN',
// For top-level user or org sites, the organization is still the same.
// e.g., for the https://JoelMarcey.github.io site, it would be set like...
// organizationName: 'JoelMarcey'
// For no header links in the top nav bar -> headerLinks: [],
// footerLinks: {
// docs: [
// { doc: 'intro/installation', label: 'Install' },
// { doc: 'api/cli-commands', label: 'CLI Commands' },
// { doc: 'contributors/origin', label: 'Contribute' },
// { href: '/odoc', label: 'API Documentation' }
// ],
// community: [
// {
// href: 'https://forum.tezosagora.org/tag/ligo',
// label: 'Tezos Agora Forum',
// blankTarget: true
// },
// {
// href: 'https://tezos.stackexchange.com/questions/tagged/ligo',
// label: 'Tezos Stack Exchange',
// blankTarget: true
// },
// {
// href: 'https://t.me/LigoLang',
// label: 'Telegram',
// blankTarget: true
// },
// {
// href: 'https://discord.gg/9rhYaEt',
// label: 'Discord',
// blankTarget: true
// }
// ],
// more: [
// {
// doc: 'tutorials/get-started/tezos-taco-shop-smart-contract',
// label: 'Tutorials'
// },
// { href: repoUrl, label: 'GitLab' }
// ]
// },
favicon: 'img/circle.svg',
/* highlight: {
// Highlight.js theme to use for syntax highlighting in code blocks.
theme: 'default',
hljs: function (hljs) {
hljs.registerLanguage('reasonligo', reasonHighlightJs);
hljs.registerLanguage('pascaligo', function (hljs) {
return {
// case_insensitive: true,
beginKeywords: '',
keywords: {
keyword:
'and attributes begin big_map block case const contains else'
+ ' end False for from function if in is list map mod nil'
+ ' not of or patch record remove set skip then to True type'
+ ' var while with',
literal: 'true false unit int string Some None bool nat list'
},
lexemes: '[a-zA-Z][a-zA-Z0-9_]*',
contains: [
hljs.C_LINE_COMMENT_MODE,
{
className: 'type',
begin: /[A-Z][a-z]+/
},
{
begin: /[*+-:;\(\)\{\}|\>\<]/
// className: 'ignore'
}
]
};
});
}
},*/
// Add custom scripts here that would be placed in <script> tags.
scripts: ['https://buttons.github.io/buttons.js'],
// On page navigation for the current documentation page.
// No .html extensions for paths.
// Show documentation's last contributor's name.
// enableUpdateBy: true,
// Show documentation's last update time.
// enableUpdateTime: true,
// You may provide arbitrary config keys to be used as needed by your
// template. For example, if you need your repo's URL...
// repoUrl: repoUrl,
stylesheets: [
'https://fonts.googleapis.com/css?family=DM+Sans:400,400i,500,500i,700,700i|Open+Sans:300,300i,400,600|Source+Code+Pro&display=swap'
],
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
// docs folder path relative to website dir.
path: '../docs',
// sidebars file relative to website dir.
sidebarPath: require.resolve('./sidebars.json'),
},
theme: {
customCss: require.resolve('./static/css/custom.css'),
}
}
]
],
themeConfig: {
googleAnalytics: {
trackingID: 'UA-153751765-1',
gtag: true
},
algolia: {
apiKey: '12be98d9fd4242a5f16b70a5cc6b0158',
indexName: 'ligolang',
algoliaOptions: {} // Optional, if provided by Algolia
},
navbar: {
logo: {
alt: 'LIGO Logo',
src: 'img/logo.svg',
srcDark: 'img/logo-night.svg'
},
links: [
{ href: 'https://ide.ligolang.org/', label: 'Try Online' },
{ to: 'docs/intro/installation', label: 'Install' },
{ to: 'docs/intro/what-and-why', label: 'Docs' },
{
to: 'docs/tutorials/get-started/tezos-taco-shop-smart-contract',
label: 'Tutorials'
},
{ href: 'https://forum.tezosagora.org/tag/ligo', label: 'Blog' },
// TODO: { href: "/odoc", label: "API" },
// { doc: 'contributors/origin', label: 'Contribute' },
{ to: '/contact', label: 'Ask Questions' }
],
},
footer: {
links: [
{
title: 'Docs',
items: [
{ to: 'docs/intro/installation', label: 'Install' },
{ to: 'docs/api/cli-commands', label: 'CLI Commands' },
{ to: 'docs/contributors/origin', label: 'Contribute' },
{ to: '/odoc', label: 'API Documentation' }
]
},
{
title: 'Community',
items: [
{
href: 'https://forum.tezosagora.org/tag/ligo',
label: 'Tezos Agora Forum'
},
{
href: 'https://tezos.stackexchange.com/questions/tagged/ligo',
label: 'Tezos Stack Exchange'
},
{
href: 'https://t.me/LigoLang',
label: 'Telegram'
},
{
href: 'https://discord.gg/9rhYaEt',
label: 'Discord'
}
]
},
{
title: 'More',
items: [
{
label: 'Tutorials',
to: 'docs/tutorials/get-started/tezos-taco-shop-smart-contract'
},
{
label: 'GitLab',
href: repoUrl
}
]
}
// { href: 'https://ide.ligolang.org/', title: 'Try Online' }
],
copyright: `© ${new Date().getFullYear()} LIGO. All rights reserved.`,
},
image: 'img/docusaurus.png',
sidebarCollapsible: true,
prism: {
theme: require('prism-react-renderer/themes/github'),
darkTheme: require('prism-react-renderer/themes/vsDark')
},
}
};
module.exports = siteConfig;

View File

@ -1,17 +1,24 @@
{
"scripts": {
"examples": "docusaurus-examples",
"start": "docusaurus-start",
"build": "docusaurus-build",
"publish-gh-pages": "docusaurus-publish",
"write-translations": "docusaurus-write-translations",
"version": "docusaurus-version",
"preversion": "node preversion.js",
"postversion": "node postversion.js",
"rename-version": "docusaurus-rename-version"
"start": "docusaurus start --host 0.0.0.0 --port 3000",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy"
},
"devDependencies": {
"docusaurus": "^1.14.0",
"reason-highlightjs": "0.2.1"
"@docusaurus/core": "^2.0.0-alpha.43",
"@docusaurus/preset-classic": "^2.0.0-alpha.43",
"classnames": "^2.2.6",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"webpack": "4.41.2"
},
"browserslist": {
"production": [">0.2%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@ -1,100 +0,0 @@
const React = require('react');
const MarkdownBlock = require('../../core/CompLibrary').MarkdownBlock;
const CodeExamples = require(`${process.cwd()}/core/CodeExamples`);
const docUrl = require(`${process.cwd()}/core/UrlUtils`).docUrl;
const FEATURES = [
{
image: 'img/strong-type-system.svg',
title: 'Strong, Static Type System',
content: 'Write types, then code. Benefit from the safety of type systems.'
},
{
image: 'img/syntax-agnostic.svg',
title: 'Polyglot',
content:
'Code in your language. Write PascaLIGO, CameLIGO, ReasonLIGO or add your own syntax.'
},
{
image: 'img/easy-integration.svg',
title: 'Easy Integration',
content: 'You can use LIGO as a NodeJS library with Granary'
}
];
const PARTNERS = [
{
name: 'Nomadic Labs',
image: 'img/nomadic-logo.png',
link: 'https://www.nomadic-labs.com/',
pinned: true
},
{
name: 'Tocqueville Group',
image: 'img/tq-logo.svg',
link: 'https://tqgroup.io/',
pinned: true
},
{
name: 'Stove Labs',
image: 'img/stove-logo.png',
link: 'https://stove-labs.com',
pinned: true
}
];
const Feature = (config, props) => (
<div className="feature" key={props.title}>
<img src={`${config.baseUrl}${props.image}`} />
<h1>{props.title}</h1>
<p>{props.content}</p>
</div>
);
const Partner = (config, props) => (
<a
href={props.link}
title={props.name}
target="_blank"
rel="noopener noreferrer"
>
<img src={`${config.baseUrl}${props.image}`} />
</a>
);
module.exports = props => {
return (
<div id="homePage">
<div id="intro" className="centered">
<div id="callToAction">
<ul>
<li className="primary">
<a href="https://ide.ligolang.org">Try Online</a>
</li>
<li className="secondary">
<a href={docUrl(props.config, 'intro/installation')}>Install</a>
</li>
</ul>
</div>
<div id="preview">
<h1>A friendly Smart Contract Language for Tezos</h1>
<p>Michelson was never so easy</p>
<CodeExamples MarkdownBlock={MarkdownBlock}></CodeExamples>
</div>
</div>
<div id="features" className="centered">
{FEATURES.map(entry => Feature(props.config, entry))}
</div>
<div id="partners">
<div className="centered wrapper">
<span id="heading">Our Partners</span>
<div id="list">
{PARTNERS.filter(entry => entry.pinned).map(entry =>
Partner(props.config, entry)
)}
</div>
</div>
</div>
</div>
);
};

View File

@ -1,113 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const React = require('react');
const CompLibrary = require('../../core/CompLibrary');
const Container = CompLibrary.Container;
const CWD = process.cwd();
const versions = require(`${CWD}/versions.json`);
function Versions(props) {
const {config: siteConfig} = props;
const latestVersion = versions[0];
const repoUrl = `${siteConfig.repoUrl}`;
return (
<div className="docMainWrapper wrapper">
<Container className="mainContainer versionsContainer">
<div className="post">
<header className="postHeader">
<h1>{siteConfig.title} Versions </h1>
</header>
<h3 id="latest">Current version</h3>
<table className="versions">
<tbody>
<tr>
<th>{latestVersion}</th>
<td>
{/* You are supposed to change this href where appropriate
Example: href="<baseUrl>/docs(/:language)/:id" */}
<a
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
props.language ? props.language + '/' : ''
}intro/installation`}>
Documentation
</a>
</td>
<td>
<a href={repoUrl}>Source Code</a>
</td>
{/* <td>
<a href="">Release Notes</a>
</td> */}
</tr>
</tbody>
</table>
<h3 id="rc">Pre-release versions</h3>
<table className="versions">
<tbody>
<tr>
<th>next</th>
<td>
{/* You are supposed to change this href where appropriate
Example: href="<baseUrl>/docs(/:language)/next/:id" */}
<a
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
props.language ? props.language + '/' : ''
}next/intro/installation`}>
Documentation
</a>
</td>
<td>
<a href={repoUrl}>Source Code</a>
</td>
</tr>
</tbody>
</table>
<h3 id="archive">Past Versions</h3>
<p>Here you can find previous versions of the documentation.</p>
<table className="versions">
<tbody>
{versions.map(
version =>
version !== latestVersion && version !== "next" && (
<tr>
<th>{version}</th>
<td>
{/* You are supposed to change this href where appropriate
Example: href="<baseUrl>/docs(/:language)/:version/:id" */}
<a
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
props.language ? props.language + '/' : ''
}${version}/intro/installation`}>
Documentation
</a>
</td>
<td>
<a href={`${repoUrl}/releases/tag/v${version}`}>
Release Notes
</a>
</td>
</tr>
),
)}
</tbody>
</table>
<p>
You can find past versions of this project on{' '}
<a href={repoUrl}>GitLab</a>.
</p>
</div>
</Container>
</div>
);
}
module.exports = Versions;

View File

@ -1,158 +0,0 @@
const repoUrl = 'https://gitlab.com/ligolang/ligo';
let reasonHighlightJs = require('reason-highlightjs');
const siteConfig = {
title: 'LIGO', // Title for your website.
tagline: 'LIGO is a friendly smart contract language for Tezos',
taglineSub: 'Michelson was never so easy',
url: 'https://ligolang.org', // Your website URL
baseUrl: '/', // Base URL for your project */
// For github.io type URLs, you would set the url and baseUrl like:
// url: 'https://facebook.github.io',
// baseUrl: '/test-site/',
// Used for publishing and more
projectName: 'ligo',
organizationName: 'TBN',
// For top-level user or org sites, the organization is still the same.
// e.g., for the https://JoelMarcey.github.io site, it would be set like...
// organizationName: 'JoelMarcey'
// For no header links in the top nav bar -> headerLinks: [],
headerLinks: [
{ href: 'https://ide.ligolang.org/', label: 'Try Online' },
{ doc: 'intro/installation', label: 'Install' },
{ doc: 'intro/what-and-why', label: 'Docs' },
{
doc: 'tutorials/get-started/tezos-taco-shop-smart-contract',
label: 'Tutorials'
},
{ blog: true, label: 'Blog' },
// TODO: { href: "/odoc", label: "API" },
// { doc: 'contributors/origin', label: 'Contribute' },
{ href: '/contact', label: 'Ask Questions' },
{ search: true }
],
footerLinks: {
docs: [
{ doc: 'intro/installation', label: 'Install' },
{ doc: 'api/cli-commands', label: 'CLI Commands' },
{ doc: 'contributors/origin', label: 'Contribute' },
{ href: '/odoc', label: 'API Documentation' }
],
community: [
{
href: 'https://forum.tezosagora.org/tag/ligo',
label: 'Tezos Agora Forum',
blankTarget: true
},
{
href: 'https://tezos.stackexchange.com/questions/tagged/ligo',
label: 'Tezos Stack Exchange',
blankTarget: true
},
{
href: 'https://t.me/LigoLang',
label: 'Telegram',
blankTarget: true
},
{
href: 'https://discord.gg/9rhYaEt',
label: 'Discord',
blankTarget: true
}
],
more: [
{
doc: 'tutorials/get-started/tezos-taco-shop-smart-contract',
label: 'Tutorials'
},
{ href: repoUrl, label: 'GitLab' }
]
},
/* path to images for header/footer */
footerIcon: 'img/logo.svg',
favicon: 'img/logo.svg',
/* Colors for website */
colors: {
primaryColor: '#1A1A1A',
secondaryColor: '#1A1A1A'
},
// This copyright info is used in /core/Footer.js and blog RSS/Atom feeds.
copyright: `© ${new Date().getFullYear()} LIGO. All rights reserved.`,
highlight: {
// Highlight.js theme to use for syntax highlighting in code blocks.
theme: 'default',
hljs: function (hljs) {
hljs.registerLanguage('reasonligo', reasonHighlightJs);
hljs.registerLanguage('pascaligo', function (hljs) {
return {
// case_insensitive: true,
beginKeywords: '',
keywords: {
keyword:
'and attributes begin big_map block case const contains else'
+ ' end False for from function if in is list map mod nil'
+ ' not of or patch record remove set skip then to True type'
+ ' var while with',
literal: 'true false unit int string Some None bool nat list'
},
lexemes: '[a-zA-Z][a-zA-Z0-9_]*',
contains: [
hljs.C_LINE_COMMENT_MODE,
{
className: 'type',
begin: /[A-Z][a-z]+/
},
{
begin: /[*+-:;\(\)\{\}|\>\<]/
// className: 'ignore'
}
]
};
});
}
},
// Add custom scripts here that would be placed in <script> tags.
scripts: ['https://buttons.github.io/buttons.js'],
// On page navigation for the current documentation page.
onPageNav: 'separate',
// No .html extensions for paths.
cleanUrl: true,
// Open Graph and Twitter card images.
ogImage: 'img/logo.svg',
twitterImage: 'img/undraw_tweetstorm.svg',
// Show documentation's last contributor's name.
// enableUpdateBy: true,
// Show documentation's last update time.
// enableUpdateTime: true,
// You may provide arbitrary config keys to be used as needed by your
// template. For example, if you need your repo's URL...
repoUrl: repoUrl,
stylesheets: [
'https://fonts.googleapis.com/css?family=DM+Sans:400,400i,500,500i,700,700i|Open+Sans:300,300i,400,600|Source+Code+Pro&display=swap'
],
algolia: {
apiKey: '12be98d9fd4242a5f16b70a5cc6b0158',
indexName: 'ligolang',
algoliaOptions: {} // Optional, if provided by Algolia
},
docsSideNavCollapsible: true,
gaTrackingId: 'UA-153751765-1',
gaGtag: true
};
module.exports = siteConfig;

View File

@ -1,4 +1,6 @@
const React = require('react');
import React from 'react';
import Layout from '@theme/Layout';
import useBaseUrl from '@docusaurus/useBaseUrl';
const TEAM = [
{
@ -49,7 +51,7 @@ const COMMUNICATION_CHANNELS = [
{
link: 'https://t.me/LigoLang',
icon: 'img/telegram.svg',
description: "We're hear to help. Ask us anything"
description: "We're here to help. Ask us anything"
},
{
link: 'https://gitlab.com/ligolang/ligo/issues',
@ -72,7 +74,7 @@ const Portrait = (config, props) => {
target="_blank"
rel="noopener noreferrer"
>
<img className="portrait" src={`${config.baseUrl}${props.image}`} />
<img className="portrait" src={useBaseUrl(props.image)} />
<div className="overlay">
<span>{props.firstName}</span>
<span>{props.lastName}</span>
@ -89,20 +91,27 @@ const CommunicationChannel = (config, props) => {
target="_blank"
rel="noopener noreferrer"
>
<img className="icon" src={`${config.baseUrl}${props.icon}`} />
<img className="icon" src={useBaseUrl(props.icon)} />
{props.description}
</a>
);
};
module.exports = props => {
export default props => {
const pinnedMembers = TEAM.filter(member => member.pinned);
const membersCeilCount = Math.ceil(pinnedMembers.length / 2);
const membersInFistColumn = pinnedMembers.slice(0, membersCeilCount);
const membersInSecondColumn = pinnedMembers.slice(membersCeilCount);
return (
<div id="contactPage" className="centered">
return <Layout title="Contact">
<div
id="contactPage"
style={{
display: 'flex',
justifyContent: 'stretch',
alignItems: 'stretch',
fontSize: '20px',
flexDirection: 'row'
}}>
<div id="mural">
<div className="column">
{membersInFistColumn.map(entry => Portrait(props.config, entry))}
@ -120,5 +129,6 @@ module.exports = props => {
</div>
</div>
</div>
);
};
</Layout>
}

View File

@ -0,0 +1,184 @@
import React from 'react';
import Layout from '@theme/Layout';
import useBaseUrl from '@docusaurus/useBaseUrl';
import CodeExamples from '../../core/CodeExamples';
const {Prism} = require("prism-react-renderer");
Prism.languages = {
...Prism.languages,
pascaligo: {
'comment': [
/\(\*[\s\S]+?\*\)/,
// /\{[\s\S]+?\}/,
/\/\/.*/
],
'string': {
pattern: /(?:'(?:''|[^'\r\n])*'|#[&$%]?[a-f\d]+)+|\^[a-z]/i,
greedy: true
},
'keyword': [
{
// Turbo Pascal
pattern: /(^|[^&])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,
lookbehind: true
},
{
// Free Pascal
pattern: /(^|[^&])\b(?:dispose|exit|false|new|true)\b/i,
lookbehind: true
},
{
// Object Pascal
pattern: /(^|[^&])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,
lookbehind: true
},
{
// Modifiers
pattern: /(^|[^&])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,
lookbehind: true
}
],
'number': [
// Hexadecimal, octal and binary
/(?:[&%]\d+|\$[a-f\d]+)/i,
// Decimal
/\b\d+(?:\.\d+)?(?:e[+-]?\d+)?/i
],
'operator': [
/\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=]/i,
{
pattern: /(^|[^&])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,
lookbehind: true
}
],
'punctuation': /\(\.|\.\)|[()\[\]:;,.]/
},
reasonligo:
{...Prism.languages.reason,
'comment': [
/(^|[^\\])\/\*[\s\S]*?\*\//,
/\(\*[\s\S]*?\*\)/,
/\/\/.*/
]
},
cameligo: {
...Prism.languages.ocaml,
'comment': [
/(^|[^\\])\/\*[\s\S]*?\*\//,
/\(\*[\s\S]*?\*\)/,
/\/\/.*/
]}
};
const FEATURES = [
{
image: 'img/strong-type-system.svg',
title: 'Strong, Static Type System',
content: 'Write types, then code. Benefit from the safety of type systems.'
},
{
image: 'img/syntax-agnostic.svg',
title: 'Polyglot',
content:
'Code in your language. Write PascaLIGO, CameLIGO, ReasonLIGO or add your own syntax.'
},
{
image: 'img/easy-integration.svg',
title: 'Easy Integration',
content: 'You can use LIGO as a NodeJS library with Granary'
}
];
const PARTNERS = [
{
name: 'Nomadic Labs',
image: 'img/nomadic-logo.png',
link: 'https://www.nomadic-labs.com/',
pinned: true
},
{
name: 'Tocqueville Group',
image: 'img/tq-logo.svg',
link: 'https://tqgroup.io/',
pinned: true
},
{
name: 'Stove Labs',
image: 'img/stove-logo.png',
link: 'https://stove-labs.com',
pinned: true
}
];
const Feature = (props) => (
<div className="feature" key={props.title}>
<img src={useBaseUrl(props.image)} />
<h1>{props.title}</h1>
<p>{props.content}</p>
</div>
);
const Partner = (props) => (
<a
href={props.link}
title={props.name}
target="_blank"
rel="noopener noreferrer"
>
<img src={useBaseUrl(props.image)} />
</a>
);
function HomePage() {
return <Layout title="Homepage">
<div
id="homePage"
style={{
display: 'flex',
justifyContent: 'stretch',
alignItems: 'stretch',
fontSize: '20px',
flexDirection: 'column'
}}>
<div id="intro" className="centered">
<div id="callToAction">
<ul>
<li className="primary">
<a href="https://ide.ligolang.org">Try Online</a>
</li>
<li className="secondary">
<a href={useBaseUrl('/docs/intro/installation')}>Install</a>
</li>
</ul>
</div>
<div id="preview">
<h1>A friendly Smart Contract Language for Tezos</h1>
<p>Tezos was never so easy</p>
<CodeExamples />
</div>
</div>
<div id="features" className="centered">
{FEATURES.map(entry =>
<Feature key={entry.title} title={entry.title} content={entry.content} image={entry.image} />
)}
</div>
<div id="partners">
<div className="centered wrapper">
<span id="heading">Our Partners</span>
<div id="list">
{PARTNERS.filter(entry => entry.pinned).map(entry =>
<Partner key={entry.name} name={entry.name} image={entry.image} link={entry.link} />
)}
</div>
</div>
</div>
</div>
</Layout>
}
export default HomePage;

View File

@ -0,0 +1,113 @@
// /**
// * Copyright (c) 2017-present, Facebook, Inc.
// *
// * This source code is licensed under the MIT license found in the
// * LICENSE file in the root directory of this source tree.
// */
// const React = require('react');
// const CompLibrary = require('../../core/CompLibrary');
// const Container = CompLibrary.Container;
// const CWD = process.cwd();
// const versions = require(`${CWD}/versions.json`);
// function Versions(props) {
// const {config: siteConfig} = props;
// const latestVersion = versions[0];
// const repoUrl = `${siteConfig.repoUrl}`;
// return (
// <div className="docMainWrapper wrapper">
// <Container className="mainContainer versionsContainer">
// <div className="post">
// <header className="postHeader">
// <h1>{siteConfig.title} Versions </h1>
// </header>
// <h3 id="latest">Current version</h3>
// <table className="versions">
// <tbody>
// <tr>
// <th>{latestVersion}</th>
// <td>
// {/* You are supposed to change this href where appropriate
// Example: href="<baseUrl>/docs(/:language)/:id" */}
// <a
// href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
// props.language ? props.language + '/' : ''
// }intro/installation`}>
// Documentation
// </a>
// </td>
// <td>
// <a href={repoUrl}>Source Code</a>
// </td>
// {/* <td>
// <a href="">Release Notes</a>
// </td> */}
// </tr>
// </tbody>
// </table>
// <h3 id="rc">Pre-release versions</h3>
// <table className="versions">
// <tbody>
// <tr>
// <th>next</th>
// <td>
// {/* You are supposed to change this href where appropriate
// Example: href="<baseUrl>/docs(/:language)/next/:id" */}
// <a
// href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
// props.language ? props.language + '/' : ''
// }next/intro/installation`}>
// Documentation
// </a>
// </td>
// <td>
// <a href={repoUrl}>Source Code</a>
// </td>
// </tr>
// </tbody>
// </table>
// <h3 id="archive">Past Versions</h3>
// <p>Here you can find previous versions of the documentation.</p>
// <table className="versions">
// <tbody>
// {versions.map(
// version =>
// version !== latestVersion && version !== "next" && (
// <tr>
// <th>{version}</th>
// <td>
// {/* You are supposed to change this href where appropriate
// Example: href="<baseUrl>/docs(/:language)/:version/:id" */}
// <a
// href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
// props.language ? props.language + '/' : ''
// }${version}/intro/installation`}>
// Documentation
// </a>
// </td>
// <td>
// <a href={`${repoUrl}/releases/tag/v${version}`}>
// Release Notes
// </a>
// </td>
// </tr>
// ),
// )}
// </tbody>
// </table>
// <p>
// You can find past versions of this project on{' '}
// <a href={repoUrl}>GitLab</a>.
// </p>
// </div>
// </Container>
// </div>
// );
// }
// module.exports = Versions;

View File

@ -0,0 +1,194 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, {useEffect, useState, useRef} from 'react';
import classnames from 'classnames';
import Highlight, {defaultProps} from 'prism-react-renderer';
const {Prism} = require("prism-react-renderer");
Prism.languages = {
...Prism.languages,
pascaligo: {
'comment': [
/\(\*[\s\S]+?\*\)/,
// /\{[\s\S]+?\}/,
/\/\/.*/
],
'string': {
pattern: /(?:'(?:''|[^'\r\n])*'|#[&$%]?[a-f\d]+)+|\^[a-z]/i,
greedy: true
},
'keyword': [
{
// Turbo Pascal
pattern: /(^|[^&])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,
lookbehind: true
},
{
// Free Pascal
pattern: /(^|[^&])\b(?:dispose|exit|false|new|true)\b/i,
lookbehind: true
},
{
// Object Pascal
pattern: /(^|[^&])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,
lookbehind: true
},
{
// Modifiers
pattern: /(^|[^&])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,
lookbehind: true
}
],
'number': [
// Hexadecimal, octal and binary
/(?:[&%]\d+|\$[a-f\d]+)/i,
// Decimal
/\b\d+(?:\.\d+)?(?:e[+-]?\d+)?/i
],
'operator': [
/\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=]/i,
{
pattern: /(^|[^&])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,
lookbehind: true
}
],
'punctuation': /\(\.|\.\)|[()\[\]:;,.]/
},
reasonligo:
{...Prism.languages.reason,
'comment': [
/(^|[^\\])\/\*[\s\S]*?\*\//,
/\(\*[\s\S]*?\*\)/,
/\/\/.*/
]
},
cameligo: {...Prism.languages.ocaml,
'comment': [
/(^|[^\\])\/\*[\s\S]*?\*\//,
/\(\*[\s\S]*?\*\)/,
/\/\/.*/
]}
};
import defaultTheme from 'prism-react-renderer/themes/palenight';
import Clipboard from 'clipboard';
import rangeParser from 'parse-numeric-range';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useThemeContext from '@theme/hooks/useThemeContext';
import styles from './styles.module.css';
const highlightLinesRangeRegex = /{([\d,-]+)}/;
export default ({children, className: languageClassName, metastring}) => {
const {
siteConfig: {
themeConfig: {prism = {}},
},
} = useDocusaurusContext();
const [showCopied, setShowCopied] = useState(false);
const [mounted, setMounted] = useState(false);
// The Prism theme on SSR is always the default theme but the site theme
// can be in a different mode. React hydration doesn't update DOM styles
// that come from SSR. Hence force a re-render after mounting to apply the
// current relevant styles. There will be a flash seen of the original
// styles seen using this current approach but that's probably ok. Fixing
// the flash will require changing the theming approach and is not worth it
// at this point.
useEffect(() => {
setMounted(true);
}, []);
const target = useRef(null);
const button = useRef(null);
let highlightLines = [];
const {isDarkTheme} = useThemeContext();
const lightModeTheme = prism.theme || defaultTheme;
const darkModeTheme = prism.darkTheme || lightModeTheme;
const prismTheme = isDarkTheme ? darkModeTheme : lightModeTheme;
if (metastring && highlightLinesRangeRegex.test(metastring)) {
const highlightLinesRange = metastring.match(highlightLinesRangeRegex)[1];
highlightLines = rangeParser.parse(highlightLinesRange).filter(n => n > 0);
}
useEffect(() => {
let clipboard;
if (button.current) {
clipboard = new Clipboard(button.current, {
target: () => target.current,
});
}
return () => {
if (clipboard) {
clipboard.destroy();
}
};
}, [button.current, target.current]);
let language =
languageClassName && languageClassName.replace(/language-/, '');
if (!language && prism.defaultLanguage) {
language = prism.defaultLanguage;
}
const handleCopyCode = () => {
window.getSelection().empty();
setShowCopied(true);
setTimeout(() => setShowCopied(false), 2000);
};
return (
<Highlight
{...defaultProps}
key={mounted}
theme={prismTheme}
code={children.trim()}
language={language}>
{({className, style, tokens, getLineProps, getTokenProps}) => (
<pre className={classnames(className, styles.codeBlock)}>
<button
ref={button}
type="button"
aria-label="Copy code to clipboard"
className={styles.copyButton}
onClick={handleCopyCode}>
{showCopied ? 'Copied' : 'Copy'}
</button>
<code ref={target} className={styles.codeBlockLines} style={style}>
{tokens.map((line, i) => {
if (line.length === 1 && line[0].content === '') {
line[0].content = '\n'; // eslint-disable-line no-param-reassign
}
const lineProps = getLineProps({line, key: i});
if (highlightLines.includes(i + 1)) {
lineProps.className = `${lineProps.className} docusaurus-highlight-code-line`;
}
return (
<div key={i} {...lineProps}>
{line.map((token, key) => (
<span key={key} {...getTokenProps({token, key})} />
))}
</div>
);
})}
</code>
</pre>
)}
</Highlight>
);
};

View File

@ -0,0 +1,45 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.codeBlock {
overflow: auto;
display: block;
padding: 0;
margin: 0;
}
.copyButton {
background: rgb(1, 22, 39);
border: 1px solid rgb(214, 222, 235);
border-radius: var(--ifm-global-radius);
color: rgb(214, 222, 235);
cursor: pointer;
line-height: 12px;
opacity: 0;
outline: none;
padding: 4px 8px;
position: absolute;
right: var(--ifm-pre-padding);
top: var(--ifm-pre-padding);
visibility: hidden;
transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out,
bottom 200ms ease-in-out;
}
.codeBlock:hover > .copyButton {
visibility: visible;
opacity: 1;
}
.codeBlockLines {
background-color: transparent;
border-radius: 0;
margin-bottom: 0;
float: left;
min-width: 100%;
padding: var(--ifm-pre-padding);
}

View File

@ -0,0 +1,77 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useState } from 'react';
import {MDXProvider} from '@mdx-js/react';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import renderRoutes from '@docusaurus/renderRoutes';
import Layout from '@theme/Layout';
import DocSidebar from '@theme/DocSidebar';
import MDXComponents from '@theme/MDXComponents';
import NotFound from '@theme/NotFound';
import {matchPath} from '@docusaurus/router';
import styles from './styles.module.css';
import SyntaxContext from '@theme/Syntax/SyntaxContext';
function DocPage(props) {
const {route: baseRoute, docsMetadata, location} = props;
// case-sensitive route such as it is defined in the sidebar
const currentRoute =
baseRoute.routes.find(route => {
return matchPath(location.pathname, route);
}) || {};
const {permalinkToSidebar, docsSidebars, version} = docsMetadata;
const sidebar = permalinkToSidebar[currentRoute.path];
const {
siteConfig: {themeConfig = {}} = {},
isClient,
} = useDocusaurusContext();
const {sidebarCollapsible = true} = themeConfig;
let defaultSyntax = 'pascaligo';
if (isClient) {
defaultSyntax = localStorage.getItem('syntax') || defaultSyntax
}
const [syntax, setSyntax] = useState(defaultSyntax);
if (Object.keys(currentRoute).length === 0) {
return <NotFound {...props} />;
}
return (
<Layout version={version} key={isClient}>
<SyntaxContext.Provider value={syntax}>
<div className={styles.docPage}>
{sidebar && (
<div className={styles.docSidebarContainer}>
<DocSidebar
docsSidebars={docsSidebars}
path={currentRoute.path}
sidebar={sidebar}
sidebarCollapsible={sidebarCollapsible}
syntax={syntax}
onSyntaxChange={l => setSyntax(l)}
/>
</div>
)}
<main className={styles.docMainContainer}>
<MDXProvider components={MDXComponents}>
{renderRoutes(baseRoute.routes)}
</MDXProvider>
</main>
</div>
</SyntaxContext.Provider>
</Layout>
);
}
export default DocPage;

View File

@ -0,0 +1,28 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.docPage {
display: flex;
}
.docSidebarContainer {
border-right: 1px solid var(--ifm-contents-border-color);
box-sizing: border-box;
width: 300px;
position: relative;
top: calc(-1 * var(--ifm-navbar-height));
}
.docMainContainer {
flex-grow: 1;
}
@media (max-width: 996px) {
.docPage {
display: inherit;
}
}

View File

@ -0,0 +1,229 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, {useState, useCallback} from 'react';
import classnames from 'classnames';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
import Link from '@docusaurus/Link';
import isInternalUrl from '@docusaurus/utils'; // eslint-disable-line import/no-extraneous-dependencies
import styles from './styles.module.css';
import SyntaxSwitch from '../Syntax/SyntaxSwitch';
const MOBILE_TOGGLE_SIZE = 24;
function DocSidebarItem({item, onItemClick, collapsible}) {
const {items, href, label, type} = item;
const [collapsed, setCollapsed] = useState(item.collapsed);
const [prevCollapsedProp, setPreviousCollapsedProp] = useState(null);
// If the collapsing state from props changed, probably a navigation event
// occurred. Overwrite the component's collapsed state with the props'
// collapsed value.
if (item.collapsed !== prevCollapsedProp) {
setPreviousCollapsedProp(item.collapsed);
setCollapsed(item.collapsed);
}
const handleItemClick = useCallback(e => {
e.preventDefault();
setCollapsed(state => !state);
});
switch (type) {
case 'category':
return (
items.length > 0 && (
<li
className={classnames('menu__list-item', {
'menu__list-item--collapsed': collapsed,
})}
key={label}>
<a
className={classnames('menu__link', {
'menu__link--sublist': collapsible,
'menu__link--active': collapsible && !item.collapsed,
})}
href="#!"
onClick={collapsible ? handleItemClick : undefined}>
{label}
</a>
<ul className="menu__list">
{items.map(childItem => (
<DocSidebarItem
key={childItem.label}
item={childItem}
onItemClick={onItemClick}
collapsible={collapsible}
/>
))}
</ul>
</li>
)
);
case 'link':
default:
return (
<li className="menu__list-item" key={label}>
<Link
className="menu__link"
to={href}
{...(isInternalUrl(href)
? {
activeClassName: 'menu__link--active',
exact: true,
onClick: onItemClick,
}
: {
target: '_blank',
rel: 'noreferrer noopener',
})}>
{label}
</Link>
</li>
);
}
}
// Calculate the category collapsing state when a page navigation occurs.
// We want to automatically expand the categories which contains the current page.
function mutateSidebarCollapsingState(item, path) {
const {items, href, type} = item;
switch (type) {
case 'category': {
const anyChildItemsActive =
items
.map(childItem => mutateSidebarCollapsingState(childItem, path))
.filter(val => val).length > 0;
// eslint-disable-next-line no-param-reassign
item.collapsed = !anyChildItemsActive;
return anyChildItemsActive;
}
case 'link':
default:
return href === path;
}
}
function DocSidebar(props) {
const [showResponsiveSidebar, setShowResponsiveSidebar] = useState(false);
const {
siteConfig: {themeConfig: {navbar: {title, logo = {}} = {}}} = {}, isClient
} = useDocusaurusContext();
const logoUrl = useBaseUrl(logo.src);
const {
docsSidebars,
path,
sidebar: currentSidebar,
sidebarCollapsible,
} = props;
useLockBodyScroll(showResponsiveSidebar);
if (!currentSidebar) {
return null;
}
const sidebarData = docsSidebars[currentSidebar];
if (!sidebarData) {
throw new Error(
`Cannot find the sidebar "${currentSidebar}" in the sidebar config!`,
);
}
if (sidebarCollapsible) {
sidebarData.forEach(sidebarItem =>
mutateSidebarCollapsingState(sidebarItem, path),
);
}
return (
<div className={styles.sidebar}>
<div className={styles.sidebarLogo}>
{logo != null && <img src={logoUrl} alt={logo.alt} />}
{title != null && <strong>{title}</strong>}
</div>
{isClient && document.location.pathname.startsWith('/docs') && !showResponsiveSidebar ?
<div className={styles.switchContainer}>
Display syntax: <SyntaxSwitch syntax={props.syntax} onSyntaxChange={s => props.onSyntaxChange(s)} />
</div>
:
null
}
<div
className={classnames('menu', 'menu--responsive', styles.menu, {
'menu--show': showResponsiveSidebar,
})}>
{isClient && document.location.pathname.startsWith('/docs') && showResponsiveSidebar ?
<div className={styles.switchContainerResponsive}>
Display syntax:
<SyntaxSwitch syntax={props.syntax} onSyntaxChange={s => props.onSyntaxChange(s)} />
</div>
:
null
}
<button
aria-label={showResponsiveSidebar ? 'Close Menu' : 'Open Menu'}
className="button button--secondary button--sm menu__button"
type="button"
onClick={() => {
setShowResponsiveSidebar(!showResponsiveSidebar);
}}>
{showResponsiveSidebar ? (
<span
className={classnames(
styles.sidebarMenuIcon,
styles.sidebarMenuCloseIcon,
)}>
&times;
</span>
) : (
<svg
className={styles.sidebarMenuIcon}
xmlns="http://www.w3.org/2000/svg"
height={MOBILE_TOGGLE_SIZE}
width={MOBILE_TOGGLE_SIZE}
viewBox="0 0 32 32"
role="img"
focusable="false">
<title>Menu</title>
<path
stroke="currentColor"
strokeLinecap="round"
strokeMiterlimit="10"
strokeWidth="2"
d="M4 7h22M4 15h22M4 23h22"
/>
</svg>
)}
</button>
<ul className="menu__list">
{sidebarData.map(item => (
<DocSidebarItem
key={item.label}
item={item}
onItemClick={() => {
setShowResponsiveSidebar(false);
}}
collapsible={sidebarCollapsible}
/>
))}
</ul>
</div>
</div>
);
}
export default DocSidebar;

View File

@ -0,0 +1,90 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
@media (min-width: 997px) {
.sidebar {
height: 100vh;
overflow-y: auto;
position: sticky;
top: 0;
padding-top: var(--ifm-navbar-height);
}
.sidebar::-webkit-scrollbar {
width: 7px;
}
.sidebar::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb {
background: #888;
border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
background: #555;
}
.sidebarLogo {
display: flex !important;
align-items: center;
position: absolute;
top: 0;
margin: 0 var(--ifm-navbar-padding-horizontal);
height: var(--ifm-navbar-height);
}
.sidebarLogo img {
margin-right: 0.5rem;
height: 2rem;
}
.menu {
padding: 0.5rem;
}
.switchContainer {
flex: 1;
display: flex;
background-color: var(--ifm-pre-background);
align-items: center;
justify-content: center;
padding: 1rem 0;
border-bottom: 1px solid var(--ifm-contents-border-color);
}
}
.switchContainerResponsive {
background-color: var(--ifm-pre-background);
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.sidebarLogo {
display: none;
}
.sidebarMenuIcon {
vertical-align: middle;
}
.sidebarMenuCloseIcon {
display: inline-flex;
justify-content: center;
align-items: center;
height: 24px;
font-size: 1.5rem;
font-weight: var(--ifm-font-weight-bold);
line-height: 0.9;
width: 24px;
}

View File

@ -0,0 +1,201 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, {useCallback, useState} from 'react';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import SearchBar from '@theme/SearchBar';
import Toggle from '@theme/Toggle';
import classnames from 'classnames';
import useThemeContext from '@theme/hooks/useThemeContext';
import useHideableNavbar from '@theme/hooks/useHideableNavbar';
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
import styles from './styles.module.css';
function NavLink({to, href, label, position, ...props}) {
const toUrl = useBaseUrl(to);
return (
<Link
className="navbar__item navbar__link"
{...(href
? {
target: '_blank',
rel: 'noopener noreferrer',
href,
}
: {
activeClassName: 'navbar__link--active',
to: toUrl,
})}
{...props}>
{label}
</Link>
);
}
function Navbar(props) {
const context = useDocusaurusContext();
const {siteConfig = {}} = context;
const {baseUrl, themeConfig = {}} = siteConfig;
const {navbar = {}, disableDarkMode = false} = themeConfig;
const {title, logo = {}, links = [], hideOnScroll = false} = navbar;
const [sidebarShown, setSidebarShown] = useState(false);
const [isSearchBarExpanded, setIsSearchBarExpanded] = useState(false);
const {isDarkTheme, setLightTheme, setDarkTheme} = useThemeContext();
const {navbarRef, isNavbarVisible} = useHideableNavbar(hideOnScroll);
useLockBodyScroll(sidebarShown);
const showSidebar = useCallback(() => {
setSidebarShown(true);
}, [setSidebarShown]);
const hideSidebar = useCallback(() => {
setSidebarShown(false);
}, [setSidebarShown]);
const onToggleChange = useCallback(
e => (e.target.checked ? setDarkTheme() : setLightTheme()),
[setLightTheme, setDarkTheme],
);
const logoLink = logo.href || baseUrl;
const isExternalLogoLink = /http/.test(logoLink);
const logoLinkProps = isExternalLogoLink
? {
rel: 'noopener noreferrer',
target: '_blank',
}
: null;
const logoSrc = logo.srcDark && isDarkTheme ? logo.srcDark : logo.src;
const logoImageUrl = useBaseUrl(logoSrc);
return (
<nav
ref={navbarRef}
className={classnames('navbar', 'navbar--light', 'navbar--fixed-top', {
'navbar-sidebar--show': sidebarShown,
[styles.navbarHideable]: hideOnScroll,
[styles.navbarHidden]: !isNavbarVisible,
})}>
<div className="navbar__inner">
<div className="navbar__items">
<div
aria-label="Navigation bar toggle"
className="navbar__toggle"
role="button"
tabIndex={0}
onClick={showSidebar}
onKeyDown={showSidebar}>
<svg
xmlns="http://www.w3.org/2000/svg"
width="30"
height="30"
viewBox="0 0 30 30"
role="img"
focusable="false">
<title>Menu</title>
<path
stroke="currentColor"
strokeLinecap="round"
strokeMiterlimit="10"
strokeWidth="2"
d="M4 7h22M4 15h22M4 23h22"
/>
</svg>
</div>
<Link className="navbar__brand" to={logoLink} {...logoLinkProps}>
{logo != null && (
<img className="navbar__logo" src={logoImageUrl} alt={logo.alt} />
)}
{title != null && (
<strong
className={isSearchBarExpanded ? styles.hideLogoText : ''}>
{title}
</strong>
)}
</Link>
{links
.filter(linkItem => linkItem.position !== 'right')
.map((linkItem, i) => (
<NavLink {...linkItem} key={i} />
))}
</div>
<div className="navbar__items navbar__items--right">
{links
.filter(linkItem => linkItem.position === 'right')
.map((linkItem, i) => (
<NavLink {...linkItem} key={i} />
))}
{!disableDarkMode && (
<Toggle
className={styles.displayOnlyInLargeViewport}
aria-label="Dark mode toggle"
checked={isDarkTheme}
onChange={onToggleChange}
/>
)}
<SearchBar
handleSearchBarToggle={setIsSearchBarExpanded}
isSearchBarExpanded={isSearchBarExpanded}
/>
</div>
</div>
<div
role="presentation"
className="navbar-sidebar__backdrop"
onClick={hideSidebar}
/>
<div className="navbar-sidebar">
<div className="navbar-sidebar__brand">
<Link
className="navbar__brand"
onClick={hideSidebar}
to={logoLink}
{...logoLinkProps}>
{logo != null && (
<img className="navbar__logo" src={logoImageUrl} alt={logo.alt} />
)}
{title != null && <strong>{title}</strong>}
</Link>
{!disableDarkMode && sidebarShown && (
<Toggle
aria-label="Dark mode toggle in sidebar"
checked={isDarkTheme}
onChange={onToggleChange}
/>
)}
</div>
<div className="navbar-sidebar__items">
<div className="menu">
<ul className="menu__list">
{links.map((linkItem, i) => (
<li className="menu__list-item" key={i}>
<NavLink
className="menu__link"
{...linkItem}
onClick={hideSidebar}
/>
</li>
))}
</ul>
</div>
</div>
</div>
</nav>
);
}
export default Navbar;

View File

@ -0,0 +1,26 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
@media screen and (max-width: 997px) {
.displayOnlyInLargeViewport {
display: none !important;
}
}
@media (max-width: 360px) {
.hideLogoText {
display: none;
}
}
.navbarHideable {
transition: top 0.2s ease-in-out;
}
.navbarHidden {
top: calc(var(--ifm-navbar-height) * -1) !important;
}

View File

@ -0,0 +1,6 @@
import React from 'react';
const SyntaxContext = React.createContext('pascaligo');
export default SyntaxContext;

View File

@ -0,0 +1,15 @@
import React from 'react';
import styles from './styles.module.css';
function SyntaxSwitch (props) {
return (
<select className={styles.syntaxSwitch} defaultValue={props.syntax} onChange={e => props.onSyntaxChange(e.target.value)}>
<option value="pascaligo">PascaLIGO</option>
<option value="cameligo">CameLIGO</option>
<option value="reasonligo">ReasonLIGO</option>
</select>
)
}
export default SyntaxSwitch

View File

@ -0,0 +1,18 @@
import React from 'react';
import SyntaxContext from './SyntaxContext'
function Syntax(props) {
return (
<SyntaxContext.Consumer>
{(syntax => {
if (syntax === props.syntax) {
return props.children
} else {
return <></>
}
})}
</SyntaxContext.Consumer>
)
}
export default Syntax

View File

@ -0,0 +1,37 @@
.syntaxSwitch {
display: block;
font-size: 1rem;
font-weight: bold;
line-height: 1rem;
padding: .6em 1.4em .5em .8em;
box-sizing: border-box;
border: none;
color: var(--color-primary-text);
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
background-color: transparent;
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
background-repeat: no-repeat, repeat;
background-position: right .7em top 50%, 0 0;
background-size: .65em auto, 100%;
}
.syntaxSwitch::-ms-expand {
display: none;
}
.syntaxSwitch:hover {
border-color: #888;
}
.syntaxSwitch:focus {
border-color: #aaa;
box-shadow: 0 0 1px 3px rgba(59, 153, 252, .7);
box-shadow: 0 0 0 3px -moz-mac-focusring;
color: var(--color-primary-text);
outline: none;
}
.syntaxSwitch option {
color: var(--color-primary-text);
font-weight:normal;
}

View File

@ -1,5 +1,28 @@
@import url('/fonts/inter.css');
:root {
--ifm-color-primary: #0e74ff;
--ifm-color-primary-dark: rgb(33, 175, 144);
--ifm-color-primary-darker: rgb(31, 165, 136);
--ifm-color-primary-darkest: rgb(26, 136, 112);
--ifm-color-primary-light: rgb(70, 203, 174);
--ifm-color-primary-lighter: rgb(102, 212, 189);
--ifm-color-primary-lightest: #92e0d0;
--blockquote-color: #efefef;
--ifm-code-font-size: .9rem;
/* header */
--ifm-navbar-link-hover-color: #0e74ff;
/* footer */
--ifm-footer-title-color: #fff;
--ifm-footer-background-color: #0d0f33;
--ifm-footer-link-hover-color: hsla(0,0%,100%,.6);
--ifm-footer-color: #fff;
}
:root {
--primary-brand-color: #0e74ff;
--secondary-brand-color: #fc683a;
--blue: #3aa0ff;
--lighter-blue: #e1f1ff;
@ -24,12 +47,19 @@
--padding-level-6: 100px;
}
html[data-theme='dark'] {
--color-primary-text: white;
--blockquote-color: var(--ifm-navbar-background-color);
}
html {
font-size: 16px;
}
body {
font-family: 'Open Sans', sans-serif;
font-family: 'Inter var',SF Pro Text,Roboto,-apple-system,BlinkMacSystemFont,Helvetica Neue,Arial,sans-serif;
font-weight: 400;
font-size: 1rem;
color: var(--color-primary-text);
margin: 0 auto;
@ -39,8 +69,8 @@ body {
* Docusaurus overrides
*/
code {
font-family: 'Source Code Pro', monospace;
background: var(--light-blue);
/* font-family: 'Source Code Pro', monospace; */
font-family: Menlo,Roboto Mono,SFMono-Regular,Segoe UI,Courier,monospace;
margin-left: 2px;
margin-right: 2px;
border-radius: 2px;
@ -66,7 +96,6 @@ h1 {
}
h2 {
font-size: 2.25rem;
margin-bottom: 0.5rem;
margin-top: 1.5rem;
}
@ -182,7 +211,7 @@ p {
.navigationSlider .slidingNav ul li.siteNavItemActive > a,
.navigationSlider .slidingNav ul li.siteNavGroupActive > a {
background-color: white;
color: var(--primary-brand-color) !important;
color: var(--ifm-color-primary) !important;
}
.navSearchWrapper:before {
@ -249,7 +278,7 @@ p {
}
blockquote {
background-color: #efefef;
background-color: var(--blockquote-color);
border-left: 5px solid var(--color-primary-text);
color: var(--color-primary-text);
border-radius: 2px;
@ -257,12 +286,11 @@ blockquote {
blockquote code {
opacity: 1;
background: var(--light-blue);
}
a,
a:hover {
color: var(--primary-brand-color);
color: var(--ifm-color-primary);
}
.docMainWrapper a:hover {
@ -333,7 +361,7 @@ a:hover {
}
.navListItemActive a {
color: var(--primary-brand-color) !important;
color: var(--ifm-color-primary) !important;
}
.onPageNav > .toc-headings {
@ -366,7 +394,7 @@ a:hover {
.button:hover {
border-radius: 36px;
padding: 10px 20px;
background-color: var(--primary-brand-color);
background-color: var(--ifm-color-primary);
min-width: 130px;
color: var(--color-white);
}
@ -469,7 +497,7 @@ a:hover {
}
.primary {
color: var(--primary-brand-color);
color: var(--ifm-color-primary);
}
.secondary {
@ -509,10 +537,13 @@ a:hover {
#homePage #intro {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
#callToAction {
margin-top: 300px;
}
#homePage #intro #callToAction ul {
padding: 0;
margin: 0;
@ -536,8 +567,8 @@ a:hover {
}
#homePage #intro #callToAction ul li.primary:hover {
background-color: var(--primary-brand-color);
border-left: 4px solid var(--primary-brand-color);
background-color: var(--ifm-color-primary);
border-left: 4px solid var(--ifm-color-primary);
}
#homePage #intro #callToAction ul li.secondary:hover {
@ -547,11 +578,13 @@ a:hover {
#homePage #intro #callToAction ul li a {
color: inherit;
text-decoration: none;
}
#homePage #intro #preview .hljs {
#homePage #intro #preview {
min-width: 700px;
min-height: 450px;
max-width: 400px
}
#homePage #intro #preview p {
@ -559,13 +592,14 @@ a:hover {
font-size: 1.5em;
}
#homePage #features {
#features {
margin: 100px auto;
display: flex;
justify-content: space-between;
flex: 1;
}
#homePage #features .feature {
#features .feature {
flex: 1;
display: flex;
flex-direction: column;
@ -573,46 +607,47 @@ a:hover {
text-align: center;
}
#homePage #features .feature p {
#features .feature p {
text-align: center;
font-size: 1.25em;
font-size: 1.25rem;
}
#homePage #partners {
background-color: var(--primary-brand-color);
#partners {
background-color: var(--ifm-color-primary);
color: white;
font-size: 2.8125em;
font-size: 2.8rem;
font-weight: bold;
padding: 50px 0;
margin-top: auto;
flex: 1;
}
#homePage #partners .wrapper {
#partners .wrapper {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
#homePage #partners #heading {
#partners #heading {
word-wrap: break-word;
width: 200px;
line-height: 1em;
}
#homePage #partners #list {
#partners #list {
display: flex;
}
#homePage #partners a {
#partners a {
line-height: 0;
}
#homePage #partners a + a {
#partners a + a {
margin-left: 50px;
}
#homePage #partners img {
#partners img {
height: 80px;
}
@ -849,6 +884,11 @@ a:hover {
}
@media (min-width: 1024px) {
.row .col {
padding-left: 3rem;
padding-right: 3rem;
}
.nav-footer .footer-wrapper {
max-width: 1400px;
}
@ -904,20 +944,20 @@ a:hover {
margin-top: 0;
}
#homePage #partners #heading {
#partners #heading {
text-align: center;
word-wrap: normal;
width: auto;
margin-bottom: 50px;
}
#homePage #partners #list {
#partners #list {
display: flex;
flex-direction: column;
justify-content: center;
}
#homePage #partners a + a {
#partners a + a {
margin: 25px auto;
}
}
@ -962,3 +1002,6 @@ a:hover {
color: #a31515;
}
.badge {
display: none;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,16 @@
@font-face {
font-family: 'Inter var';
font-weight: 100 900;
font-display: swap;
font-style: normal;
font-named-instance: 'Regular';
src: url("./Inter-roman.var.woff2?v=3.12") format("woff2");
}
@font-face {
font-family: 'Inter var';
font-weight: 100 900;
font-display: swap;
font-style: italic;
font-named-instance: 'Italic';
src: url("./Inter-italic.var.woff2?v=3.12") format("woff2");
}

View File

@ -0,0 +1,27 @@
<svg width="180" height="180" viewBox="0 0 180 180" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="180" height="180">
<path d="M180 90C180 139.706 139.706 180 90 180C40.2944 180 0 139.706 0 90C0 40.2944 40.2944 0 90 0C139.706 0 180 40.2944 180 90Z" fill="#C4C4C4"/>
</mask>
<g mask="url(#mask0)">
<path d="M0 0H89.8213C139.625 0 179.998 40.3736 179.998 90.1769V180H0V0Z" fill="#3AA0FF"/>
<mask id="mask1" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="180" height="180">
<path d="M0 0H89.8213C139.625 0 179.998 40.3736 179.998 90.1769V180H0V0Z" fill="#C4C4C4"/>
</mask>
<g mask="url(#mask1)">
<path d="M-97.3224 277.21L218.678 -38.7931L358.935 101.465L42.934 417.468L-97.3224 277.21Z" fill="#2888FF"/>
</g>
<path d="M63.2759 116.724V0H0V116.724V180H63.2759H179.998V116.724H63.2759Z" fill="#0E74FF"/>
<mask id="mask2" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="180" height="180">
<path d="M63.2759 116.724V0H0V116.724V180H63.2759H179.998V116.724H63.2759Z" fill="black"/>
</mask>
<g mask="url(#mask2)">
<path d="M-77.562 257.039L238.438 -58.9644L378.695 81.2934L62.6944 397.297L-77.562 257.039Z" fill="#0540FF"/>
</g>
<mask id="mask3" mask-type="alpha" maskUnits="userSpaceOnUse" x="90" y="0" width="90" height="91">
<path d="M90.0007 0.000366211C139.706 0.000366211 180 40.2952 180 90.0004H90.0007V0.000366211Z" fill="#AAA4A4"/>
</mask>
<g mask="url(#mask3)">
<path d="M125.584 -44.9172H224.893V54.3931H125.584V-44.9172Z" fill="#B4DBFF"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,31 @@
<svg width="298" height="93" viewBox="0 0 298 93" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M197 0.0458624C195.572 1.53639 194.326 2.91226 193.011 4.24227C189.635 7.63609 186.236 11.007 182.904 14.4467C182.179 15.1805 181.477 15.5015 180.434 15.5015C170.757 15.4556 161.104 15.6391 151.427 15.4327C144.356 15.2493 138.374 17.7029 133.116 22.2891C127.972 26.7836 124.187 32.2413 122.578 39.006C121.377 44.0738 122.057 49.1186 123.371 54.0718C125.116 60.6072 128.244 66.3171 133.524 70.6052C139.507 75.4666 146.464 76.9113 153.92 76.5444C157.863 76.3609 161.738 75.8335 165.432 74.3659C165.772 74.2283 166.134 74.0678 166.474 73.9302C169.307 72.8524 170.757 71.2243 170.576 67.7388C170.214 61.1117 170.463 54.4387 170.463 47.7886C170.463 47.33 170.463 46.8943 170.463 46.344C175.086 46.344 179.596 46.344 184.241 46.344C184.264 46.7109 184.287 47.1236 184.287 47.5135C184.287 57.5344 184.309 67.5324 184.264 77.5533C184.264 78.1266 184.015 78.8375 183.629 79.2732C177.873 85.6939 170.758 89.7986 162.35 91.1745C151.268 92.986 140.345 92.0459 130.261 86.7488C117.91 80.2592 109.593 70.2153 106.715 56.2044C104.131 43.7298 105.695 31.7826 113.083 21.1884C120.425 10.663 130.374 3.76072 142.906 0.894317C145.24 0.366899 147.552 0.0458624 149.954 0.0458624C165.296 0.0687936 180.615 0.0229312 195.958 0C196.275 0.0458624 196.547 0.0458624 197 0.0458624Z" fill="white"/>
<path d="M75.2829 91.7477C75.2829 61.0658 75.2829 30.659 75.2829 0.137573C80.7897 0.137573 86.2512 0.137573 91.8487 0.137573C91.8714 0.481541 91.9167 0.894303 91.9167 1.28413C91.9167 25.4766 91.9167 49.669 91.9394 73.8614C91.9394 74.6411 91.7354 75.2143 91.1689 75.7647C86.1379 80.8325 81.107 85.9003 76.0987 90.991C75.8947 91.2203 75.6681 91.4038 75.2829 91.7477Z" fill="white"/>
<path d="M0.182086 0.0916748C5.349 0.0916748 10.4026 0.0916748 15.5695 0.0916748C15.5922 0.527368 15.6375 0.940129 15.6375 1.35289C15.6375 23.0917 15.6375 44.8534 15.6149 66.5922C15.6149 67.1425 15.4109 67.8305 15.0483 68.1973C10.2666 73.1046 5.43965 77.966 0.635324 82.8275C0.522014 82.9421 0.363381 83.0568 0.159424 83.2173C0.182086 55.4247 0.182086 27.7467 0.182086 0.0916748Z" fill="white"/>
<path d="M0 91.4267C0.362591 91.2432 0.815829 91.1286 1.11043 90.8534C6.11872 85.8315 11.1043 80.7637 16.1126 75.7418C16.4979 75.3519 17.1324 75.0309 17.631 75.0309C32.1346 75.008 46.6156 75.0309 61.1192 75.0309C61.3911 75.0309 61.6404 75.0538 62.0257 75.0767C62.0257 80.672 62.0257 86.2213 62.0257 91.8853C41.5166 91.8853 20.9396 91.8853 0.385253 91.8853C0.249281 91.7477 0.135971 91.5872 0 91.4267Z" fill="white"/>
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="210" y="0" width="88" height="88">
<circle cx="254" cy="44" r="44" fill="#C4C4C4"/>
</mask>
<g mask="url(#mask0)">
<path d="M209.984 0.000213623H253.985C278.285 0.000213623 297.985 19.6997 297.985 44.0002V88.0004H209.984V0.000213623Z" fill="white" fill-opacity="0.25"/>
<mask id="mask1" mask-type="alpha" maskUnits="userSpaceOnUse" x="209" y="0" width="89" height="89">
<path d="M209.984 0.000213623H253.985C278.285 0.000213623 297.985 19.6997 297.985 44.0002V88.0004H209.984V0.000213623Z" fill="#C4C4C4"/>
</mask>
<g mask="url(#mask1)">
<rect x="162.401" y="135.525" width="218.483" height="96.9736" transform="rotate(-45 162.401 135.525)" fill="white" fill-opacity="0.25"/>
</g>
<path d="M240.92 57.0652V0.000213623H209.984V57.0652V88.0004H240.92H297.985V57.0652H240.92Z" fill="white" fill-opacity="0.7"/>
<mask id="mask2" mask-type="alpha" maskUnits="userSpaceOnUse" x="209" y="0" width="89" height="89">
<path d="M240.92 57.0652V0.000213623H209.984V57.0652V88.0004H240.92H297.985V57.0652H240.92Z" fill="black"/>
</mask>
<g mask="url(#mask2)">
<rect x="172.059" y="125.664" width="218.483" height="96.9736" transform="rotate(-45 172.059 125.664)" fill="white"/>
</g>
<mask id="mask3" mask-type="alpha" maskUnits="userSpaceOnUse" x="253" y="0" width="45" height="45">
<path d="M253.983 0C278.284 0 297.983 19.6995 297.983 44.0001H253.983V0Z" fill="#AAA4A4"/>
</mask>
<g mask="url(#mask3)">
<rect x="271.376" y="-21.9596" width="48.5519" height="48.5519" fill="white"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,52 @@
<svg width="506" height="226" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style>.cls-1{isolation:isolate;}.cls-2{mix-blend-mode:screen;}.cls-3,.cls-4{fill:none;stroke-linecap:round;stroke-linejoin:round;}.cls-3{stroke:#b2210c;stroke-width:3px;}.cls-4{stroke:#fff;}.cls-5{fill:#fff;}.cls-6{opacity:0.56;mix-blend-mode:multiply;}.cls-7{fill:#333;}</style>
<image xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAABUCAYAAACRBleVAAAACXBIWXMAAAsSAAALEgHS3X78AAAGeElEQVRoQ+2ZwW7cyBGG/7+6Sc7II2m1gLLZAD4EMHyQ4ZMfYPcl/Dxev078EvsCOQX2ITA2Bx+ChRaQVxpL4nR3/TmQlCjOjOQggz0E+gGiOc3q+rqKTYrqoiT8kbKHDHat/39gfMgAAEgSADbdbfatvnIx3AskSeEW9PbW/400XO5n9RB4a0oHWA/hO8BOunMbjpO+HwDfAhRus7FN3DghkkM0JwCPAf4T4NGL9QjP3kPPAZ0C+tBH+wYQtkS6BhwiQzdr+74HffkCe5I74NzBK+ucf4nQkyfws/fQvwG9ARyAtqX3zj2cpNG+B/j0GWz5O+wvCXZdYBffgAsAKwD7n6HDAP89g0+fwfER/rZLsQsQSU6hdyPsU3kC8Aywp89g5RLBVwjtAQwrhKh9XgucEcq8EGqU5hxuNUrYQ/n0EX4E+Icu2rXUrgEB8GfA/vEM4a89bLmHeJD3gzcessuig9mgaHRrrZzHi7K4RLYa5V97KC8/ovzYp3YKvFmlw+p6B3Af4MsMXiXYcg/xqF5ED6WWeW30pjVvjN7IvPZQ6qN6EZd7iFcJ9jJ349/1i266au/cw+ERwAtwfgbDPsLB9X5IKlWMXuVWVVXXZgIjodyuPFZMqQUOyr6u9i98eQ0/fQH/8B7DSt8c4dD7A4BF20W3lw/NGw9WKWarK1lVJ3gDeJPgjayqs9WVVYreeNjLh3aVYIsW/GHid9CdCE/65+15BtO34PmFh+ge90wx0CsFVcyKjKAypIDM7ILkrXvJ7uXJt8jztvNzcl+Eg169Ak4z2CbYbC6rG9gqVrGYKqcqN1WpqPb+dzFVq1jFuuns2wQ7zeCrV1PPnSJw52HHL9fg3MHsoFF0KUAKgAKp6IwVKToo8wwJBVAQFQJFCowO/nJ9+1YaP483EY5fzGcFrPyQUWAQGAVDQFCIIUiBjhikoBADAkIUrLdj5Yc8K7e+pi/8jS/v7/o2SCzemFWgSRYcll3Bgiy7QnCYSWYVWLyxIHE8fpPWgIu2m9Gli62DDQBKLAJdMkZQgjF2v4tASmwAtA5eegcd/Ey19c/TQd+mWswCDRULQArsIGBB158FproDDeO26Q7wuM/379611qfI+v7YnxOgARyeqeH6YD+MH/yNZcDmT4epskTXXQcuMPeQ+zT2/+BHlPWQasv1od+0Hs0mfdVH1F1FdHMmgPKA7boejHDXegTuXI/AnesRuHM9AneuR+DO9QjcuR6BO9cjcOd6BO5cj8Cd6xG4cz0IrNjtCaSbnozuX+2Mcf9g95AM2LC3MVLbt5GUTZwaodhv0w12mzT2fyfC036H49DuOvbRzocDCoCmfWP7Yfwp1qPemtJzAE5qmHoAJECBkNi3PRwA0Hb259sc9loDfpz8dlIi5ExSD/EePu732x3QjX4GrQH/3EC/AtgzKhtUEbJMN3aHF7oXuJfbPsv0ilA2aM+oX3s/67gR8M0o30cBSkYVUslaN8K9wFFQYCgwdm1B8QI3wpO13tlTR+HW19gv0O9ESRIm2/3JPity4VH0InoBS2TJKoF2s+ddchZLAD2SLtKTPmu6vTWuzqxtfZ3NIBi0MKgYfeXwOVaZqLKSzEIBXVSgVJBjxRyxylfoihozh5YGnc2go6lzTO7ha0D4e1fAmjfwq0s6EosKc3YmVraiuDJ1LStbZWdSYUZiubqkzxv4l9j5ef3QY/EWwHNA30Xo029QFc99Xln2ijmWlLIzJedqOLIzxZKSV8zzynIVz/3Tb93454DeTmlj4HADTwEtG2hWwa1BWV5b8WSZDVeNUls3uVXdtY1Sy4YrT5aX11asQZlV8GXT1RPHfm8402LXO8DGlbWwh2jXB5GNR2UPqZEFB4tBVUtntKLWss/Oc7lEHlfYXgO+tdg16AOgI8D/dAhf1PBwgeKz85xSSHEeVsHD6lpdG+dhlVJIPjvP4QJlUXfjhnLe1DcwiXBcHf0ZsNMXsOMvsOUKtjiCXbWwysGlgwuDknWLa3nWTe70Cfz4PfzHe6qk6zXgUdHyGODpi654tbyGzR2sR0WQVYCuDFrMuvt2/B4+1ILfYL12uBkIrEGHgvOmWsSygaaF520wYAtwXIsawMDmssCwGm9A6Iy21vMlbT0AUAB/AuwnwNQffwPCcD66RvQB3HdsTulIQ0n1Pqsh7K1RjfQgcKpxTfdrAFP918D/VQ9+te1afzjwPzXf9EBEGP37AAAAAElFTkSuQmCC" height="84" width="28" id="image"/>
<image xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfkAAAAcCAYAAABiSMZhAAAACXBIWXMAAAsSAAALEgHS3X78AAAHBklEQVR4Xu3dy25b1xXG8f+39jmHuloRUKFpgAJGYXjgIKM8QJ7Cz+P4efISzQN4VNgDwwgKFEhTsICsiyWR5+y1OiBPJMikRKUetPH6AYIokdzU7NPal7UVEaSUUkrp98fue0FKKaWU/j81971gE5K06vc5R5BSSindbWWAAvEJptr10DHGQF/1rpfr/9aUUkopbeDFiogdw/Whwb9xyEvS+MoxzF8AP6wJ9qMM/JRSSmkj0zWT388hXi4fj+EvNg/7e0N+DPcx2J+B3oC+A96C+BYOr64D/ZcZerJusJRSSimt9A74cnId9sdbBK/gKcSPwDOIN8ugfwGxSdjfGfI3A/4Z6Aj0FnT4Ndqboe0BTQe07ei4oj/eeO+JZyWfUkopbeLArsP9X8BhIS6NOGqIy4Y4nxDHr4mnENNl2G8S9GtD/nbAH4Mdfo0+fMD+MMe6iq6+wNqKZgN24Qc6AC489GjliCmllFJa5xTYMcUJsGMnMWnwvhBb7/F5If7d4bu7+PFr4hB8k6BfX8lLuhnwf36CnV9hBz1W9yk+p8zrvm1th/U1rAlUIjRbVvAWkZV8SimltAFfbnubGFGlGES0RX51Ke/KmVtHLWfUkxbf28L/8Q6/GfQ8JOQl6fsbU/SXTyjnV9jRjPJ+lyb6/VI6bxiiRBel9bDqmMVEFqiPEJPFWBOgj5y6TymllG5qRczGH2bQSuEiXLMohvcm11yVRrXObVB7Vr/4wDCdUPe28O131HHq/vtFMf9RoK88J7+cpufNIujtaEDny4Bv5vuNdd705q1ZNBZd4xHFI8zaahEhAlVHLdCv+oCUUkrpM9fHoiNdD5SWZXoqvG9cIS+hGjYf3DRMWuTzfb3fPYMPsN0QU7A34MDaRfmPQn5ci19W8Vw+QecX2N4BdnW5X6zzxs27mHur0rWSNyIaEcUDcw8zWjVAv5yyb29/SEoppfSZG4vgZjlV30cfZvIGXKiGNKC2xHxu3iLrIPr92Ds48/MLbO8J8d07mC5P1UnS7Wp+ZSW/XIvnLagb0FcVXQwYW1F85kUWTVO61uWd99HKomnUFA+KFCJcApXlsTtf9SEppZTSZ6wsv2uxoB5SCQ+Fidoz1OhVrMia0qGhD3evbMlnA3Wnop8HNAcdLs7SixVn7e9sa/stcAZMHe04qgrRUao6U+8FRZFFI28at2jMKV7CAAVgGtfiP0n33JRSSul3ZADAl+EcIqziLkzeCBvA8Ygo3nZm0ZfiMRRHJ44eA/vAT+uGZ4P0nQ5oEujCEYa2BRZIgUIoQF4wHLOIxe8Da4DKGPJ3ntVPKaWUPlsFYgAErgg5siiYBRKMuSqAWSB8kcvTAe3fM/adIf8KeNoQUxE7RlQtvsQspDZisdgfqrgMD6RQhMArYL+GfG6uTymllFap41l3ESGFhFNxN0IQEhGaRWAxEVGMuNCiUc4r4PCOsT86QjduvPsB7Bise0z56pJysU07afbaelW7KNGFtV0j77xGWxUt0RSMIhbVvECeR+dSSimlO5kWBXOICBQ4FQ21hHor6oewubyfq2petsp8Npz3O5f0P29T53+nHoI/B1/VFOejSj4iAklvIL6DmO7i8zn2ocG3r6yeN1G74kPT97LSEk1E1HCilqLF7nrRKoBK7q5PKaWUVhl31y9WviGWu+tr4MiqGg3m6kvt+6HVMJfVR1dWP2zhTSF2d/HHED+Oa/qbnpMfTSH+8pr422P8qzPqye6pmtl+3wLqPBh6r3R1S1FmRLEeK21oiLoId2Uln1JKKa0yFsDjxrtWFtErXPhEqnNUS8wH6zS0gw3eW386Oa1HZ9Sft/FvXhM/3bPpbWXIL/fhB8BfWfy3cDIgzqjD/hk780dxUeQ74bVVP1wQpRUGE6lHLDveOdnxLqWUUlrldsc7SREiTLO4AN+WqsLqZVjdGWwYJqeVM+rJZNHD/gzi+SKrY+X5Oda0tV08c927/gg0/RrjhHLQY9N9yu6AbQ+P7HTLy0GgoYZdRajJ3vUppZTSg4y96wcjtqRoivxExKMrq5fNqX9o8KNl73oOqEev8Zu30T2odz1cb8C7HfR7MzReVDPeQtc6Ovcv1Hoob6FLKaWUHm68ha43xZ69j96I8Ra68WKa8wlxO+BXbbgbPeg++TegP7H6PnmAvFM+pZRSephVd8kDrLpP/p8QzzYMeLgn5OE66OE67AGOQG9BfAuHV9dh/ssMPVk5UkoppZTWeQd8ObkO/OMtglfwFGK6XHL/dXqe5f65e0L83pAf3Q57gBfAD6yv1o/ueC6llFJKi5Ns6557DvFy+fgh4T7aOORvuhn4N73MUE8ppZT+Ky9WhP5Dgv2m3xTyq0haGfCfZvSUUkrp92ddZfxbAn2VTxbyKaWUUvrf8h+PJeaRozTgTQAAAABJRU5ErkJggg==" height="28" width="505" id="image-2"/>
</defs>
<title>Plan de travail 2</title>
<g>
<title>background</title>
<rect fill="none" id="canvas_background" height="228" width="508" y="-1" x="-1"/>
</g>
<g>
<title>Layer 1</title>
<g stroke="null" id="svg_1" class="cls-1">
<g stroke="null" id="Calque_1">
<use stroke="null" id="svg_2" x="135" y="5" xlink:href="#image" class="cls-2"/>
<line stroke="null" id="svg_3" y2="75.18" x2="148.8" y1="19.19" x1="148.8" class="cls-3"/>
<use stroke="null" id="svg_4" x="135" y="5" xlink:href="#image" class="cls-2"/>
<line stroke="null" id="svg_5" y2="75.18" x2="148.8" y1="19.19" x1="148.8" class="cls-3"/>
<use stroke="null" id="svg_6" x="135" y="5" xlink:href="#image" class="cls-2"/>
<line stroke="null" id="svg_7" y2="75.18" x2="148.8" y1="19.19" x1="148.8" class="cls-3"/>
<line stroke="null" id="svg_8" y2="75.18" x2="148.8" y1="19.19" x1="148.8" class="cls-4"/>
<path stroke="null" id="svg_9" d="m157.89,171.21c-0.51,-19.43 0,-38.88 0,-58.33q0,-16.42 0,-32.86a9.31,9.31 0 0 0 -0.12,-1.75a8.8,8.8 0 0 0 -2.83,-5.16l-12.18,0a8.39,8.39 0 0 0 -2.95,6.56c-0.26,31.45 0.48,62.91 -0.37,94.36c-0.15,5.55 -0.06,11.12 0,16.68c0.1,10.35 0.25,20.69 0.39,31a6.46,6.46 0 0 0 0.11,0.84l17.66,0a3.71,3.71 0 0 0 0.13,-0.5c0.29,-5.92 -0.56,-11.88 0.51,-17.78c-0.3,-10.99 -0.06,-22.02 -0.35,-33.06zm-16.83,3.27q0,14.75 0,29.49a8,8 0 0 1 -0.08,0.84l-0.29,0.15c-0.17,-0.26 -0.46,-0.51 -0.48,-0.78c-0.06,-0.83 0,-1.67 0,-2.51l0,-27a3.59,3.59 0 0 1 0,-0.87a0.53,0.53 0 0 1 0.43,-0.32c0.13,0 0.32,0.2 0.38,0.35a1.82,1.82 0 0 1 0.04,0.65zm2.76,14.64l0,0c0,4.89 0,9.78 0,14.66a4,4 0 0 1 -0.41,1.13c-0.18,-0.39 -0.51,-0.78 -0.51,-1.17c0,-9.69 0,-19.38 0,-29.07a2.77,2.77 0 0 1 0.07,-0.87a0.56,0.56 0 0 1 0.45,-0.31a0.55,0.55 0 0 1 0.39,0.35a3.61,3.61 0 0 1 0,0.87l0.01,14.41zm2.69,15.14a2.77,2.77 0 0 1 -0.41,0.64a2.3,2.3 0 0 1 -0.46,-0.59a2.27,2.27 0 0 1 0,-0.74q0,-14.34 0,-28.69a5.41,5.41 0 0 1 0.41,-1.4a5.2,5.2 0 0 1 0.46,1.47c0,4.76 0,9.52 0,14.28l0,14.28a2.68,2.68 0 0 1 0,0.75zm1.82,0.6l0,-30.15a1.82,1.82 0 0 1 0,-0.62a3.14,3.14 0 0 1 0.43,-0.62a2.64,2.64 0 0 1 0.5,0.56a1.54,1.54 0 0 1 0,0.61q0,14.55 0,29.09c0.03,0.52 0.29,1.27 -0.93,1.13zm3.61,-0.5c-0.05,0.2 -0.26,0.36 -0.4,0.53a3.07,3.07 0 0 1 -0.43,-0.59a1.18,1.18 0 0 1 0,-0.5q0,-14.74 0,-29.48c0,-0.25 0,-0.49 0.05,-0.74l0.48,-0.18a4.65,4.65 0 0 1 0.32,1.11c0,2.42 0,4.85 0,7.27q0,10.86 0,21.71a3.6,3.6 0 0 1 -0.02,0.87zm-3.06,-80.62a3.59,3.59 0 0 1 -3.81,-3.86c0,-2.48 1.42,-4.19 3.61,-4.21s3.7,1.53 3.74,4s-1.34,4.03 -3.54,4.07zm5.87,51.09q0,14.41 0,28.84a4.83,4.83 0 0 1 -0.37,1.29l-0.47,-0.22l0,-31.52c0.41,0.36 0.71,0.51 0.82,0.74a2.29,2.29 0 0 1 0.02,0.87zm2.25,30.07a6.51,6.51 0 0 1 -0.44,-1.62c0,-4.72 0,-9.44 0,-14.16l0,0c0,-4.85 0,-9.7 0,-14.54a3.67,3.67 0 0 1 0.44,-1.11a3.33,3.33 0 0 1 0.44,1.09q0,14.35 0,28.71a6.59,6.59 0 0 1 -0.44,1.63z"/>
<path stroke="null" id="svg_10" d="m300.78,200.29c0,-5.58 0,-10.93 0,-16.28c0,-0.78 -0.39,-1 -1.1,-1c-0.5,0 -1,0 -1.5,0l-34.62,0c-1.33,0 -2.68,0.17 -3.75,-1a1.81,1.81 0 0 0 -1.19,-0.25c-1.1,0 -1.43,-0.53 -1.43,-1.56q0,-9.1 0,-18.2c0,-1 0.35,-1.38 1.4,-1.38q31.86,0 63.74,0c0.92,0 1.36,0.22 1.41,1.24a10.63,10.63 0 0 0 0.62,1.94a12.85,12.85 0 0 1 0.54,2.91q0,16.06 0,32.13q0,9.9 0,19.82c0,3.43 -0.51,3.94 -3.9,3.94l-44,0c-6,0 -12.05,0 -18.07,0a103.7,103.7 0 0 1 -21.33,-1.78a51.38,51.38 0 0 1 -6.67,-2.07c-2.43,-0.86 -4.85,-1.77 -7.24,-2.76a68.48,68.48 0 0 1 -16.37,-9.85a78.62,78.62 0 0 1 -21.08,-25c-6.06,-11.56 -8.49,-23.95 -8.15,-36.94c0.56,-21.44 9.08,-39.2 24.82,-53.61a70.56,70.56 0 0 1 41.19,-18.66c22.16,-2.32 41.76,3.7 58.68,18.3a71.67,71.67 0 0 1 14.15,16.48c2,3.25 3.64,6.75 5.36,10.18a23.89,23.89 0 0 1 1.56,4c0.52,1.83 0.05,2.39 -1.81,2.4c-5.52,0 -11,0.08 -16.56,-0.05a16.24,16.24 0 0 1 -4.27,-1.12c-0.26,-0.08 -0.46,-0.46 -0.61,-0.75a51.56,51.56 0 0 0 -14.2,-17a43.74,43.74 0 0 0 -14.31,-7.86c-5.47,-1.61 -11.05,-2.92 -16.81,-2.8c-6.07,0.13 -12.11,0.7 -17.85,2.91c-2.87,1.1 -5.89,2 -8.5,3.56a58.25,58.25 0 0 0 -9.51,6.65a75.66,75.66 0 0 0 -9.55,10.4a46.14,46.14 0 0 0 -5.07,9.16a51.88,51.88 0 0 0 -4.26,24.7a80.19,80.19 0 0 0 2.07,12.46c4,17.65 23.57,34.48 43,36.28c2.41,0.22 4.84,0.44 7.25,0.45c15.48,0 30.95,0 46.43,0l1.49,0.01zm21.35,-79.29c-0.2,-0.57 -0.33,-1 -0.49,-1.42a72.31,72.31 0 0 0 -35.14,-38.81c-18.54,-9.6 -37.94,-10.51 -57.7,-4.2c-10.83,3.46 -20,9.72 -28,17.75a72,72 0 0 0 -18.1,29.24a77.15,77.15 0 0 0 -2.79,32.87a68.53,68.53 0 0 0 8.25,25.48a76.63,76.63 0 0 0 13.65,17.54c13.84,13.45 30.42,20.43 49.69,20.59c23.13,0.18 46.26,0 69.39,0l1.44,0l0,-58.04l-63.78,0l0,18.46l1.69,0q20.14,0 40.28,0c1.18,0 1.61,0.31 1.58,1.55c-0.07,3.43 0,6.86 0,10.29c0,2.59 -0.06,5.19 0,7.78c0,1.24 -0.41,1.67 -1.59,1.53a8.34,8.34 0 0 0 -1,0q-23.52,0 -47.05,0c-10.68,0 -20.64,-2.66 -29.49,-8.73c-14.2,-9.71 -23.05,-22.83 -24.82,-40.21c-1.6,-15.78 2.29,-30 12.89,-42c14.33,-16.26 32.39,-22.2 53.46,-18c16.3,3.23 28.49,12.66 36.68,27.16a2.09,2.09 0 0 0 2.12,1.17c5.65,-0.07 11.29,0 16.94,0l1.89,0z"/>
<path stroke="null" id="svg_11" d="m414.43,71.41a74,74 0 0 1 32.77,7.29a75.65,75.65 0 0 1 18.74,13.07a79.13,79.13 0 0 1 13.88,17.23a55.39,55.39 0 0 1 4.16,8.11a135.48,135.48 0 0 1 4.65,13.56a62.43,62.43 0 0 1 1.88,14a76.21,76.21 0 0 1 -2.38,23.06a64.12,64.12 0 0 1 -5.81,15.15a62.78,62.78 0 0 1 -7.49,11.21c-2.39,2.67 -4.53,5.6 -7.17,8c-3.22,2.93 -6.37,6 -10.22,8.21c-2.17,1.23 -4.2,2.74 -6.41,3.9c-2.65,1.39 -5.4,2.58 -8.15,3.77c-6.85,3 -14.17,3.86 -21.49,4.48a84,84 0 0 1 -21.34,-1.4a65.91,65.91 0 0 1 -13.71,-4.43a70.43,70.43 0 0 1 -17.45,-10.23c-12.66,-10.12 -22.22,-22.5 -26.51,-38.31c-5.94,-21.91 -3.77,-42.94 8.76,-62.22c9.41,-14.47 22.27,-24.91 38.74,-30.58a74.65,74.65 0 0 1 24.55,-3.87zm73.57,74.92c0.62,-40.19 -33.55,-74 -74.14,-73.8c-40.06,0.19 -73.46,33.84 -73.41,74s34,74.53 75.53,73.65c38.53,-0.78 72.69,-33.27 72.02,-73.85z"/>
<path stroke="null" id="svg_12" d="m39.48,114.15c0,11.25 -0.13,22.51 0.06,33.75a89.79,89.79 0 0 0 1.46,12.3c1.52,9.67 6.63,17.41 13.35,24.26c10.42,10.63 23.08,15.79 37.9,15.83c6.2,0 12.39,0 18.58,0c1.19,0 2.1,0.11 2,1.63a1.11,1.11 0 0 0 0.15,0.73c1.38,1.62 0.94,3.56 1,5.4c0,3.93 0,7.87 0,11.8c0,1.93 -0.69,2.74 -2.64,2.72c-8.27,-0.08 -16.55,-0.1 -24.82,-0.46a62.2,62.2 0 0 1 -11.51,-1.69a68.29,68.29 0 0 1 -16.11,-6.34a78.65,78.65 0 0 1 -32.53,-31.59a67.67,67.67 0 0 1 -8.51,-28c-0.35,-4.25 -0.45,-8.52 -0.46,-12.78q-0.06,-33.94 0,-67.89c0,-2.4 0,-2.43 2.38,-2.43c5.69,0 11.38,0 17.07,0c1.12,0 1.78,0.24 1.66,1.51a1.21,1.21 0 0 0 0.17,0.84c1.17,1.25 1,2.81 1,4.27q0,18.08 0,36.14l-0.2,0zm-2.22,-41.47l-17.92,0c-0.93,0 -0.81,0.63 -0.81,1.21c0,24.84 0,49.68 0.13,74.52a68.76,68.76 0 0 0 6.72,29.47a75.53,75.53 0 0 0 19.7,25.19a68.33,68.33 0 0 0 41.82,16.77c7.88,0.39 15.8,0.18 23.7,0.23a4.11,4.11 0 0 0 0.7,-0.13l0,-18.39l-1.3,0c-5.9,0 -11.79,0 -17.69,0c-12.94,0 -24.53,-3.8 -34.55,-12.06c-13.08,-10.78 -20.41,-24.56 -20.57,-41.63c-0.22,-24.46 -0.07,-48.93 -0.08,-73.39l0.15,-1.79z"/>
<path stroke="null" id="svg_13" d="m152.83,119.62c0,2.47 -1.34,4.08 -3.55,4.12a3.59,3.59 0 0 1 -3.81,-3.86c0,-2.48 1.43,-4.19 3.61,-4.21s3.71,1.53 3.75,3.95z" class="cls-5"/>
<path stroke="null" id="svg_14" d="m146.93,189.23l0,14.28a2.35,2.35 0 0 1 0,0.75a2.77,2.77 0 0 1 -0.41,0.64a2.5,2.5 0 0 1 -0.45,-0.59a2.27,2.27 0 0 1 0,-0.74c0,-9.56 0,-19.13 0,-28.69a5,5 0 0 1 0.41,-1.4a5.55,5.55 0 0 1 0.46,1.47c0,4.76 -0.01,9.52 -0.01,14.28z" class="cls-5"/>
<path stroke="null" id="svg_15" d="m148.74,204.86l0,-30.15a1.82,1.82 0 0 1 0,-0.62a3.56,3.56 0 0 1 0.42,-0.62a2.44,2.44 0 0 1 0.51,0.56a1.54,1.54 0 0 1 0,0.61q0,14.55 0,29.09c0.03,0.52 0.33,1.27 -0.93,1.13z" class="cls-5"/>
<path stroke="null" id="svg_16" d="m144.23,189.12c0,4.89 0,9.78 0,14.66a3.65,3.65 0 0 1 -0.4,1.13c-0.18,-0.39 -0.52,-0.78 -0.52,-1.17q0,-14.53 0,-29.07a3.11,3.11 0 0 1 0.06,-0.87a0.59,0.59 0 0 1 0.45,-0.31a0.56,0.56 0 0 1 0.4,0.35a3.61,3.61 0 0 1 0,0.87c0,4.81 0,9.61 0,14.41l0.01,0z" class="cls-5"/>
<path stroke="null" id="svg_17" d="m154.31,204.74l0,-31.52c0.41,0.36 0.71,0.51 0.81,0.74a2.28,2.28 0 0 1 0,0.87q0,14.41 0,28.84a4.83,4.83 0 0 1 -0.37,1.29l-0.44,-0.22z" class="cls-5"/>
<path stroke="null" id="svg_18" d="m141.09,205c-0.17,-0.26 -0.47,-0.51 -0.49,-0.78c0,-0.83 0,-1.67 0,-2.51l0,-27a3.59,3.59 0 0 1 0,-0.87a0.53,0.53 0 0 1 0.42,-0.32c0.14,0 0.33,0.2 0.38,0.35a1.82,1.82 0 0 1 0,0.62l0,29.51a8,8 0 0 1 -0.08,0.84l-0.23,0.16z" class="cls-5"/>
<path stroke="null" id="svg_19" d="m152,173.4a4.65,4.65 0 0 1 0.32,1.11c0,2.42 0,4.85 0,7.27l0,21.71a3.59,3.59 0 0 1 0,0.87c-0.05,0.2 -0.26,0.36 -0.39,0.53a3.62,3.62 0 0 1 -0.44,-0.59a1.38,1.38 0 0 1 0,-0.5l0,-29.48c0,-0.25 0,-0.49 0.05,-0.74l0.46,-0.18z" class="cls-5"/>
<path stroke="null" id="svg_20" d="m157,189.12c0,-4.85 0,-9.7 0,-14.54a3.22,3.22 0 0 1 0.44,-1.11a3.57,3.57 0 0 1 0.44,1.09q0,14.35 0,28.71a6.21,6.21 0 0 1 -0.45,1.63a7,7 0 0 1 -0.44,-1.62c0,-4.72 0,-9.44 0,-14.16l0.01,0z" class="cls-5"/>
<path stroke="null" id="svg_21" d="m322.13,121l-1.89,0c-5.65,0 -11.29,0 -16.94,0a2.09,2.09 0 0 1 -2.12,-1.28c-8.19,-14.5 -20.38,-23.93 -36.68,-27.16c-21.07,-4.17 -39.13,1.77 -53.46,18c-10.6,12 -14.49,26.21 -12.89,42c1.77,17.38 10.62,30.5 24.82,40.21c8.85,6.07 18.81,8.71 29.49,8.73q23.52,0 47.05,0a8.34,8.34 0 0 1 1,0c1.18,0.14 1.63,-0.29 1.59,-1.53c-0.08,-2.59 0,-5.19 0,-7.78c0,-3.43 -0.05,-6.86 0,-10.29c0,-1.24 -0.4,-1.55 -1.58,-1.55q-20.14,0 -40.28,0l-1.69,0l0,-18.35l63.78,0l0,58.11l-1.44,0c-23.13,0 -46.26,0.14 -69.39,0c-19.27,-0.16 -35.85,-7.14 -49.69,-20.59a76.63,76.63 0 0 1 -13.65,-17.54a68.53,68.53 0 0 1 -8.25,-25.48a77.15,77.15 0 0 1 2.79,-32.87a72,72 0 0 1 18.1,-29.24c8,-8 17.17,-14.29 28,-17.75c19.76,-6.31 39.16,-5.4 57.7,4.2a72.31,72.31 0 0 1 35.14,38.81c0.16,0.35 0.29,0.77 0.49,1.35z" class="cls-5"/>
<path stroke="null" id="svg_22" d="m488,146.33c0.65,40.58 -33.51,73.07 -72,73.88c-41.54,0.88 -75.48,-33.46 -75.53,-73.65s33.35,-73.84 73.41,-74c40.59,-0.22 74.76,33.58 74.12,73.77zm-18.68,0c0.67,-29.77 -25.12,-55.42 -55.54,-55.17c-29.56,0.25 -55,25.15 -54.79,55.68c0.24,30.2 25.88,55.68 57.06,54.78c28.37,-0.77 53.89,-25.11 53.29,-55.24l-0.02,-0.05z" class="cls-5"/>
<path stroke="null" id="svg_23" d="m37.06,72.68l0,1.79c0,24.46 -0.14,48.93 0.08,73.39c0.16,17.07 7.49,30.85 20.57,41.63c10,8.26 21.61,12.1 34.55,12.06c5.9,0 11.79,0 17.69,0l1.35,0l0,18.38a4.11,4.11 0 0 1 -0.7,0.13c-7.9,-0.05 -15.82,0.16 -23.7,-0.23a68.33,68.33 0 0 1 -41.82,-16.77a75.53,75.53 0 0 1 -19.7,-25.19a68.76,68.76 0 0 1 -6.72,-29.47c-0.12,-24.84 -0.1,-49.68 -0.13,-74.52c0,-0.58 -0.12,-1.21 0.81,-1.21l17.72,0.01z" class="cls-5"/>
<path stroke="null" id="svg_24" d="m469.34,146.38c0.6,30.13 -24.92,54.47 -53.27,55.29c-31.18,0.9 -56.82,-24.58 -57.06,-54.78c-0.25,-30.53 25.23,-55.43 54.79,-55.68c30.42,-0.21 56.2,25.4 55.54,55.17zm-1,0c-0.42,-3.65 -0.64,-7.33 -1.31,-10.94a48.83,48.83 0 0 0 -11,-22.9a45.83,45.83 0 0 0 -28.97,-17.54a50.83,50.83 0 0 0 -9.66,-1.26a57.52,57.52 0 0 0 -20.64,3.43a49.8,49.8 0 0 0 -13.44,7.62a54,54 0 0 0 -14.51,16.39a47.87,47.87 0 0 0 -3.67,8.05a62,62 0 0 0 -2.95,11.22a74.21,74.21 0 0 0 -0.33,12.12a42.5,42.5 0 0 0 1.06,7.68c0.53,2.42 0.87,4.9 2.19,7.13c0.94,1.59 1.4,3.46 2.25,5.12a49.31,49.31 0 0 0 12.84,15.5c15.58,12.75 33.19,15.35 52,9.27c12.41,-4 21.66,-12.41 28.48,-23.41c5.21,-8.35 7.45,-17.61 7.65,-27.48l0.01,0z"/>
<use stroke="null" id="svg_26" y="5" xlink:href="#image-2" class="cls-2"/>
<line stroke="null" id="svg_27" y2="19.19" x2="490.59" y1="19.19" x1="14.32" class="cls-3"/>
<use stroke="null" id="svg_28" y="5" xlink:href="#image-2" class="cls-2"/>
<line stroke="null" id="svg_29" y2="19.19" x2="490.59" y1="19.19" x1="14.32" class="cls-3"/>
<use stroke="null" id="svg_30" y="5" xlink:href="#image-2" class="cls-2"/>
<line stroke="null" id="svg_31" y2="19.19" x2="490.59" y1="19.19" x1="14.32" class="cls-3"/>
<line stroke="null" id="svg_32" y2="19.19" x2="490.59" y1="19.19" x1="14.32" class="cls-4"/>
<image stroke="null" id="svg_33" x="111" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE0AAAAqCAYAAAD2+NZSAAAACXBIWXMAAAsSAAALEgHS3X78AAACMUlEQVRoQ+3ay2vVQBQH4G/a6xPxiSBYcena/x9x407EnZviqi2IRVQo9pZ6c1xMoqXa9j7ymHvjD4YJJIHwcc5kc1JEgJRSktPs//MnAVFjpYhowK7hRr1vXfz+6FLhFCc4jYiY1DcmuIuneIxbMtyYqy5ksGMc4gDfcTqpq2wb9/ACL7GD28ZdcRV+YB/vcYSjlNLPSURESmmGaf3QdTzHM+OFa8D28Lm+nmJ2tj1n+IZd3MfDM2tscA3YIT7KVbYr+8zIZ5mIqFJKU7lvt86tMVVcJVfUAd7hdb0fYBoRFTUaRMQspXQsl+T5jAHubEu+xat638NxRMyaB3+jMWq4ucE4h8Yo4RYC4x9ojApuYTAuQGMUcEuBcQkaGw23NBhXoLGRcCuBMQcaGwW3MhhzorERcK2AsQAaaw3XGhgLorGWcK2CsQQaawXXOhhLorEWcJ2AsQIaRcN1BsaKaBQJ1ykYLaBRFFznYLSERhFwvYDRIhqDwvUGRstoDALXKxgdoNErXO9gdIRGL3CDgNEhGp3CDQZGx2h0AjcoGD2g0Src4GD0hEYrcEWA0SMaK8EVA0bPaCwFVxQYA6AxF1wzH1fJ82HFgDEQGlfC7eCmPIyyryAwBkTjUrgKj/BFntopBoyB0bgQ7kSutn28URAYBaDxF1zIo5pP8AkfZLwiwKinu0tJSmlbPsse4I6M91UeqCsCjMLQIKW0JXdA8/f8GfUEYikpDq1JSilFoR/3C863g5yMml6iAAAAAElFTkSuQmCC" height="42" width="77" class="cls-6"/>
<polygon stroke="null" id="svg_34" points="114.08999633789062,2.1500015258789062 183.50999450683594,2.2399978637695312 148.75999450683594,36.900001525878906 114.08999633789062,2.1500015258789062 " class="cls-5"/>
<path stroke="null" id="svg_35" d="m114.4,2.28l68.81,0.08l-34.45,34.36l-34.36,-34.44m-0.61,-0.25l0.43,0.42l34.36,34.45l0.18,0.18l0.18,-0.18l34.44,-34.36l0.43,-0.43l-0.6,0l-68.81,-0.11l-0.61,0.03z" class="cls-7"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 18 KiB

Some files were not shown because too many files have changed in this diff Show More