Feature/fix docs
This commit is contained in:
parent
c177a60077
commit
dbda9df321
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
id: api-cli-commands
|
id: cli-commands
|
||||||
title: CLI Commands
|
title: CLI Commands
|
||||||
---
|
---
|
||||||
|
|
@ -82,14 +82,14 @@ let h: bool = (a =/= b)
|
|||||||
<!--DOCUSAURUS_CODE_TABS-->
|
<!--DOCUSAURUS_CODE_TABS-->
|
||||||
<!--Pascaligo-->
|
<!--Pascaligo-->
|
||||||
```pascaligo
|
```pascaligo
|
||||||
const a: tez = 5mtz;
|
const a: tez = 5mutez;
|
||||||
const b: tez = 10mtz;
|
const b: tez = 10mutez;
|
||||||
const c: bool = (a = b);
|
const c: bool = (a = b);
|
||||||
```
|
```
|
||||||
<!--Cameligo-->
|
<!--Cameligo-->
|
||||||
```cameligo
|
```cameligo
|
||||||
let a: tez = 5mtz
|
let a: tez = 5mutez
|
||||||
let b: tez = 10mtz
|
let b: tez = 10mutez
|
||||||
// false
|
// false
|
||||||
let c: bool = (a = b)
|
let c: bool = (a = b)
|
||||||
```
|
```
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
---
|
|
||||||
id: entrypoints
|
|
||||||
title: Entrypoints
|
|
||||||
---
|
|
||||||
|
|
||||||
Entrypoints are the gates to a smart contract. In LIGO each entrypoint is a function that accepts two arguments. The first is the parameter used to invoke the contract, and the second is the current storage of the contract. Each entrypoint must return a list of operations to apply as a result of the smart contract call, and a new storage value.
|
|
||||||
|
|
||||||
> If you don't want to update the storage, don't worry, just re-cycle your last storage value.
|
|
||||||
|
|
||||||
## Defining an entry point
|
|
||||||
|
|
||||||
The contract below is effectively an empty contract. It takes a `unit` as a parameter, and returns a `unit`.
|
|
||||||
|
|
||||||
<!--DOCUSAURUS_CODE_TABS-->
|
|
||||||
<!--Pascaligo-->
|
|
||||||
```pascaligo
|
|
||||||
function main (const p : unit ; const s : unit) : (list(operation) * unit) is
|
|
||||||
block {skip} with ((nil : list(operation)), s)
|
|
||||||
```
|
|
||||||
<!--END_DOCUSAURUS_CODE_TABS-->
|
|
||||||
|
|
||||||
## Multiple entry points
|
|
||||||
|
|
||||||
Multiple entrypoints are currently not supported in Michelson. But with Ligo you can work around that by using variants & pattern matching.
|
|
||||||
|
|
||||||
In the example below we have a simple counter contract, that can be either `Increment(int)`-ed, or `Decrement(int)`-ed.
|
|
||||||
|
|
||||||
<!--DOCUSAURUS_CODE_TABS-->
|
|
||||||
<!--Pascaligo-->
|
|
||||||
```pascaligo
|
|
||||||
// variant defining pseudo multi-entrypoint actions
|
|
||||||
type action is
|
|
||||||
| Increment of int
|
|
||||||
| Decrement of int
|
|
||||||
|
|
||||||
// real entrypoint that re-routes the flow based on the action (parameter) provided
|
|
||||||
function main (const action: action ; const counter: int) : (list(operation) * int) is
|
|
||||||
block {skip} with ((nil : list(operation)),
|
|
||||||
case action of
|
|
||||||
| Increment(number) -> counter + number
|
|
||||||
| Decrement(number) -> counter - number
|
|
||||||
end)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
<!--END_DOCUSAURUS_CODE_TABS-->
|
|
@ -31,8 +31,8 @@ And here's how a map value is populated:
|
|||||||
|
|
||||||
```pascaligo
|
```pascaligo
|
||||||
const ledger: ledger = map
|
const ledger: ledger = map
|
||||||
("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> 1000mtz;
|
("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address) -> 1000mutez;
|
||||||
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> 2000mtz;
|
("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address) -> 2000mutez;
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
> Notice the `->` between the key and its value and `;` to separate individual map entries.
|
> Notice the `->` between the key and its value and `;` to separate individual map entries.
|
||||||
@ -43,8 +43,8 @@ end
|
|||||||
|
|
||||||
```cameligo
|
```cameligo
|
||||||
let ledger: ledger = Map.literal
|
let ledger: ledger = Map.literal
|
||||||
[ (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), 1000mtz) ;
|
[ (("tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx": address), 1000mutez) ;
|
||||||
(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), 2000mtz) ;
|
(("tz1gjaF81ZRRvdzjobyfVNsAeSC6PScjfQwN": address), 2000mutez) ;
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
> Map.literal constructs the map from a list of key-value pair tuples, `(<key>, <value>)`.
|
> Map.literal constructs the map from a list of key-value pair tuples, `(<key>, <value>)`.
|
||||||
|
@ -72,7 +72,7 @@ const ownerAddress : address = "tz1TGu6TN5GSez2ndXXeDX6LgUDvLzPLqgYV";
|
|||||||
const receiver : contract(unit) = get_contract(ownerAddress);
|
const receiver : contract(unit) = get_contract(ownerAddress);
|
||||||
```
|
```
|
||||||
|
|
||||||
> Would you like to learn more about addresses, contracts and operations in LIGO? Check out the [LIGO cheat sheet](language-basics/cheat-sheet.md)
|
> Would you like to learn more about addresses, contracts and operations in LIGO? Check out the [LIGO cheat sheet](api/cheat-sheet.md)
|
||||||
|
|
||||||
### Adding the transaction to the list of output operations
|
### Adding the transaction to the list of output operations
|
||||||
Now we can transfer the `amount` received by `buy_taco` to Pedro's `ownerAddress`. We will do so by forging a `transaction(unit, amount, receiver)` within a list of operations returned at the end of our contract.
|
Now we can transfer the `amount` received by `buy_taco` to Pedro's `ownerAddress`. We will do so by forging a `transaction(unit, amount, receiver)` within a list of operations returned at the end of our contract.
|
||||||
|
@ -57,7 +57,7 @@ current_purchase_price = max_price / available_stock
|
|||||||
|
|
||||||
## Installing LIGO
|
## Installing LIGO
|
||||||
|
|
||||||
In this tutorial, we'll use LIGO's dockerized version for the sake of simplicity. You can find the installation instructions [here](setup/installation.md#dockerized-installation-recommended).
|
In this tutorial, we'll use LIGO's dockerized version for the sake of simplicity. You can find the installation instructions [here](intro/installation.md#dockerized-installation-recommended).
|
||||||
|
|
||||||
The best way to install the dockerized LIGO is as a **global executable** through the installation script, as shown in the screenshot below:
|
The best way to install the dockerized LIGO is as a **global executable** through the installation script, as shown in the screenshot below:
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ The best way to install the dockerized LIGO is as a **global executable** throug
|
|||||||
|
|
||||||
## Implementing our first entry point
|
## Implementing our first entry point
|
||||||
|
|
||||||
> From now on we'll get a bit more technical. If you run into something we have not covered yet - please try checking out the [LIGO cheat sheet](language-basics/cheat-sheet.md) for some extra tips & tricks.
|
> From now on we'll get a bit more technical. If you run into something we have not covered yet - please try checking out the [LIGO cheat sheet](api/cheat-sheet.md) for some extra tips & tricks.
|
||||||
|
|
||||||
To begin implementing our smart contract, we need an entry point. We'll call it `main` and it'll specify our contract's storage (`int`) and input parameter (`int`). Of course this is not the final storage/parameter of our contract, but it's something to get us started and test our LIGO installation as well.
|
To begin implementing our smart contract, we need an entry point. We'll call it `main` and it'll specify our contract's storage (`int`) and input parameter (`int`). Of course this is not the final storage/parameter of our contract, but it's something to get us started and test our LIGO installation as well.
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ The core language is being developed by The Marigold Project. George Dupéron an
|
|||||||
Our previous Medium posts about LIGO can be found [here](https://medium.com/tezos/introducing-ligo-a-new-smart-contract-language-for-tezos-233fa17f21c7) and [here](https://medium.com/tezos/ligo-becomes-polyglot-a474e2cb0c24).
|
Our previous Medium posts about LIGO can be found [here](https://medium.com/tezos/introducing-ligo-a-new-smart-contract-language-for-tezos-233fa17f21c7) and [here](https://medium.com/tezos/ligo-becomes-polyglot-a474e2cb0c24).
|
||||||
|
|
||||||
## The State of LIGO
|
## The State of LIGO
|
||||||
Today, we are publicly releasing LIGO in beta\*. We've focused on making the onboarding process for LIGO as painless as possible and encourage you to check out our [tutorials](/docs/tutorials/get-started/tezos-taco-shop-smart-contract) and [documentation](https://ligolang.org/docs/next/setup/installation).
|
Today, we are publicly releasing LIGO in beta\*. We've focused on making the onboarding process for LIGO as painless as possible and encourage you to check out our [tutorials](/docs/tutorials/get-started/tezos-taco-shop-smart-contract) and [documentation](https://ligolang.org/docs/next/intro/installation).
|
||||||
|
|
||||||
We are fixing bugs and adding features to LIGO (e.g. some Michelson primitives like iterators are missing) by the day. Please submit issues about bugs and missing features you need when you encounter them, and you just might find those solved in the following week.
|
We are fixing bugs and adding features to LIGO (e.g. some Michelson primitives like iterators are missing) by the day. Please submit issues about bugs and missing features you need when you encounter them, and you just might find those solved in the following week.
|
||||||
|
|
||||||
|
@ -28,13 +28,13 @@ class Footer extends React.Component {
|
|||||||
<div className="sitemap">
|
<div className="sitemap">
|
||||||
<div>
|
<div>
|
||||||
<h5>Docs</h5>
|
<h5>Docs</h5>
|
||||||
<a href={this.docUrl('setup/installation/', this.props.language)}>
|
<a href={this.docUrl('next/intro/installation')}>
|
||||||
Installation
|
Installation
|
||||||
</a>
|
</a>
|
||||||
<a href={this.docUrl('api-cli-commands.html', this.props.language)}>
|
<a href={this.docUrl('next/api/cli-commands.html')}>
|
||||||
CLI Commands
|
CLI Commands
|
||||||
</a>
|
</a>
|
||||||
<a href={this.docUrl('contributors/origin.html', this.props.language)}>
|
<a href={this.docUrl('next/contributors/origin.html')}>
|
||||||
Contribute
|
Contribute
|
||||||
</a>
|
</a>
|
||||||
<a href="/odoc">
|
<a href="/odoc">
|
||||||
@ -59,7 +59,7 @@ class Footer extends React.Component {
|
|||||||
<div>
|
<div>
|
||||||
<h5>More</h5>
|
<h5>More</h5>
|
||||||
<a href={`${this.props.config.baseUrl}blog`}>Blog</a>
|
<a href={`${this.props.config.baseUrl}blog`}>Blog</a>
|
||||||
<a href={this.docUrl('tutorials/get-started/tezos-taco-shop-smart-contract.html', this.props.language)}>Tutorials</a>
|
<a href={this.docUrl('tutorials/get-started/tezos-taco-shop-smart-contract.html')}>Tutorials</a>
|
||||||
<a href={`${this.props.config.repoUrl}`}>Gitlab</a>
|
<a href={`${this.props.config.repoUrl}`}>Gitlab</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -196,7 +196,7 @@ class HomeSplash extends React.Component {
|
|||||||
Try Online
|
Try Online
|
||||||
</LinkButton>
|
</LinkButton>
|
||||||
<LinkButton
|
<LinkButton
|
||||||
href={docUrl("setup/installation.html")}
|
href={docUrl("intro/what-and-why.html")}
|
||||||
className="large-secondary-button"
|
className="large-secondary-button"
|
||||||
>
|
>
|
||||||
Get Started
|
Get Started
|
||||||
|
@ -37,7 +37,7 @@ function Versions(props) {
|
|||||||
<a
|
<a
|
||||||
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
|
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
|
||||||
props.language ? props.language + '/' : ''
|
props.language ? props.language + '/' : ''
|
||||||
}setup/installation`}>
|
}intro/installation`}>
|
||||||
Documentation
|
Documentation
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@ -61,7 +61,7 @@ function Versions(props) {
|
|||||||
<a
|
<a
|
||||||
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
|
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
|
||||||
props.language ? props.language + '/' : ''
|
props.language ? props.language + '/' : ''
|
||||||
}next/setup/installation`}>
|
}next/intro/installation`}>
|
||||||
Documentation
|
Documentation
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@ -86,7 +86,7 @@ function Versions(props) {
|
|||||||
<a
|
<a
|
||||||
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
|
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
|
||||||
props.language ? props.language + '/' : ''
|
props.language ? props.language + '/' : ''
|
||||||
}${version}/setup/installation`}>
|
}${version}/intro/installation`}>
|
||||||
Documentation
|
Documentation
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
"docs": {
|
"docs": {
|
||||||
"Intro": ["intro/what-and-why", "intro/installation", "intro/editor-support"],
|
"Intro": ["intro/what-and-why", "intro/installation", "intro/editor-support"],
|
||||||
"Language Basics": [
|
"Language Basics": [
|
||||||
"language-basics/cheat-sheet",
|
|
||||||
"language-basics/types",
|
"language-basics/types",
|
||||||
"language-basics/constants-and-variables",
|
"language-basics/constants-and-variables",
|
||||||
"language-basics/math-numbers-tez",
|
"language-basics/math-numbers-tez",
|
||||||
@ -18,7 +17,10 @@
|
|||||||
"advanced/entrypoints-contracts",
|
"advanced/entrypoints-contracts",
|
||||||
"advanced/first-contract"
|
"advanced/first-contract"
|
||||||
],
|
],
|
||||||
"API": ["api-cli-commands"]
|
"API": [
|
||||||
|
"api/cli-commands",
|
||||||
|
"api/cheat-sheet"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"contributors-docs": {
|
"contributors-docs": {
|
||||||
"Introduction": [
|
"Introduction": [
|
||||||
|
Loading…
Reference in New Issue
Block a user