@taqueria/plugin-ligo 0.42.3 → 0.42.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/package.json +3 -3
- package/_readme.eta +0 -172
package/README.md
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# Taqueria LIGO Plugin
|
|
2
2
|
|
|
3
|
+
> ### :warning: PLEASE NOTE
|
|
4
|
+
> This documentation is for our LIGO Plugin distributed as `@taqueria/plugin-ligo` NPM package with support for LIGO v1.0 and later.
|
|
5
|
+
> If you're looking to use earlier versions of LIGO, please use our LIGO Legacy Plugin which is distributed as `@taqueria/plugin-ligo-legacy`. Documentation is available [here](https://taqueria.io/docs/plugins/plugin-ligo-legacy/).
|
|
6
|
+
|
|
3
7
|
The LIGO plugin provides tasks to work with LIGO smart contracts such as compiling and testing
|
|
4
8
|
|
|
5
9
|
## Requirements
|
|
6
10
|
|
|
7
|
-
- Taqueria v0.
|
|
8
|
-
- Node.js v18 or later
|
|
11
|
+
- Taqueria v0.42.0 or later
|
|
12
|
+
- Node.js v18.18.0 or later
|
|
9
13
|
- Docker v20.10.12 or later
|
|
10
14
|
|
|
11
15
|
## Installation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-ligo",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.6",
|
|
4
4
|
"description": "A taqueria plugin for compiling LIGO smart contracts",
|
|
5
5
|
"targets": {
|
|
6
6
|
"default": {
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://github.com/pinnacle-labs/taqueria#readme",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@taqueria/lib-ligo": "^0.42.
|
|
45
|
-
"@taqueria/node-sdk": "^0.42.
|
|
44
|
+
"@taqueria/lib-ligo": "^0.42.6",
|
|
45
|
+
"@taqueria/node-sdk": "^0.42.6",
|
|
46
46
|
"fast-glob": "^3.3.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
package/_readme.eta
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
<% if (it.output == "github") { %>
|
|
2
|
-
# Taqueria LIGO Plugin
|
|
3
|
-
<% } %>
|
|
4
|
-
|
|
5
|
-
The LIGO plugin provides tasks to work with LIGO smart contracts such as compiling and testing
|
|
6
|
-
|
|
7
|
-
## Requirements
|
|
8
|
-
|
|
9
|
-
- Taqueria v0.40.0 or later
|
|
10
|
-
- Node.js v18 or later
|
|
11
|
-
- Docker v20.10.12 or later
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
To install the LIGO plugin on a Taqueria project, navigate to the project folder and run:
|
|
16
|
-
|
|
17
|
-
```shell
|
|
18
|
-
taq install @taqueria/plugin-ligo
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
<%~ it.noteOpenAdmonition %>
|
|
22
|
-
You can override the Ligo version used by the plugin by creating the environment variable `TAQ_LIGO_IMAGE` and setting it to your desired Ligo Docker image
|
|
23
|
-
<%= it.closeAdmonition %>
|
|
24
|
-
|
|
25
|
-
## The `taq compile` Task
|
|
26
|
-
|
|
27
|
-
Basic usage is:
|
|
28
|
-
|
|
29
|
-
```shell
|
|
30
|
-
taq compile <contractName>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
<%~ it.cautionOpenAdmonition %>
|
|
34
|
-
The `compile` task is implemented by more than one compiler plugin (LIGO, Archetype, SmartPy). If more than one of these plugins are installed on a project, you need to use the `--plugin ligo` flag to specify a particular compiler
|
|
35
|
-
<%= it.closeAdmonition %>
|
|
36
|
-
|
|
37
|
-
### Basic description
|
|
38
|
-
The LIGO plugin exposes a `compile` task in Taqueria which can target one LIGO contract in the `contracts` folder and compile them to a Michelson `.tz` file output to the `artifacts` folder
|
|
39
|
-
|
|
40
|
-
### A frictionless smart contract development workflow
|
|
41
|
-
Our LIGO plugin introduces a smart contract development workflow by means of two simple file naming formats
|
|
42
|
-
|
|
43
|
-
Suppose you have a contract named `hello.mligo` and you create a file in the same directory as the contract with the naming format of `CONTRACT.storageList.EXT`, where `CONTRACT` is the name of the contract this storage list file is associated with and `EXT` must match the extension of the associated contract. In our case, the former is `hello` and the latter is `mligo`, so it'd be named `hello.storageList.mligo`
|
|
44
|
-
|
|
45
|
-
You can define a list of LIGO variables in `hello.storageList.mligo` in the form of `let VARIABLE_NAME: STORAGE_TYPE = EXPRESSION` (explicit typing is optional but recommended) and the expressions will be treated as initial storage values for `hello.mligo`
|
|
46
|
-
|
|
47
|
-
<%~ it.noteOpenAdmonition %>
|
|
48
|
-
Note that the form is actually mligo code. Variable definitions in other syntax variants will differ.
|
|
49
|
-
<%= it.closeAdmonition %>
|
|
50
|
-
|
|
51
|
-
Similarly with `hello.parameterList.mligo` but in the form of `let VARIABLE_NAME: PARAMETER_TYPE = EXPRESSION`
|
|
52
|
-
|
|
53
|
-
`taq compile hello.storageList.mligo` will compile each definition in `hello.storageList.mligo` and will produce a Michelson `.tz` file that contains the storage value, as a Michelson expression, for each of them. If the name of a variable is `storage1`, then its emitted Michelson file will be named `hello.storage.storage1.tz`. For `taq compile hello.parameterList.mligo`, the name will be `hello.parameter.param1.tz` if there's a variable named `param1` defined in `hello.parameterList.mligo`
|
|
54
|
-
|
|
55
|
-
Furthermore, the first variable definition in `hello.storageList.mligo` will be treated as the default storage and will produce a Michelson file named `hello.default_storage.tz` instead. The `deploy` task from the Taquito plugin will take advantage of this. Go to that plugin documentation to learn how
|
|
56
|
-
|
|
57
|
-
Lastly, `taq compile hello.mligo` will compile `hello.mligo` and emit `hello.tz`. Then it'll look for `hello.storageList.mligo` and `hello.parameterList.mligo` and compile them too if they are found
|
|
58
|
-
|
|
59
|
-
### Options
|
|
60
|
-
|
|
61
|
-
The `--json` flag will make the task emit JSON-encoded Michelson instead of pure Michelson `.tz`
|
|
62
|
-
|
|
63
|
-
## The `taq compile-all` Task
|
|
64
|
-
|
|
65
|
-
Basic usage is:
|
|
66
|
-
|
|
67
|
-
```shell
|
|
68
|
-
taq compile-all
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
It works just like the `compile` task but it compiles all main contracts, a.k.a contracts with a `main` function.
|
|
72
|
-
|
|
73
|
-
## The `taq test` Task
|
|
74
|
-
|
|
75
|
-
Basic usage is:
|
|
76
|
-
|
|
77
|
-
```shell
|
|
78
|
-
taq test <fileName>
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Basic description
|
|
82
|
-
This task tests the LIGO source code and reports either a failure or success. Normally you'd have a contract file and a separate test file that includes the contract's code, both within the `contracts` directory
|
|
83
|
-
|
|
84
|
-
For example, refer to the following snippets:
|
|
85
|
-
```ligo title="IncDec.jsligo"
|
|
86
|
-
export namespace IncDec {
|
|
87
|
-
export type storage = int;
|
|
88
|
-
type ret = [list<operation>, storage];
|
|
89
|
-
// Three entrypoints
|
|
90
|
-
|
|
91
|
-
@entry
|
|
92
|
-
const increment = (delta: int, store: storage): ret =>
|
|
93
|
-
[list([]), store + delta];
|
|
94
|
-
@entry
|
|
95
|
-
const decrement = (delta: int, store: storage): ret =>
|
|
96
|
-
[list([]), store - delta];
|
|
97
|
-
@entry
|
|
98
|
-
const reset = (_p: unit, _s: storage): ret => [list([]), 0]
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
```ligo title="testIncDec.jsligo"
|
|
104
|
-
#import "IncDec.jsligo" "Contract"
|
|
105
|
-
|
|
106
|
-
/* Tests for main access point */
|
|
107
|
-
|
|
108
|
-
const test_initial_storage =
|
|
109
|
-
(
|
|
110
|
-
() => {
|
|
111
|
-
let initial_storage = 42;
|
|
112
|
-
let contract = Test.originate(contract_of (Contract.IncDec), initial_storage, 0 as tez);
|
|
113
|
-
return assert(Test.get_storage(contract.addr) == initial_storage)
|
|
114
|
-
}
|
|
115
|
-
)();
|
|
116
|
-
|
|
117
|
-
const test_increment =
|
|
118
|
-
(
|
|
119
|
-
() => {
|
|
120
|
-
let initial_storage = 42;
|
|
121
|
-
let contract = Test.originate(contract_of (Contract.IncDec), initial_storage, 0 as tez);
|
|
122
|
-
let _ = Test.transfer_exn(contract.addr, (Increment (1)), 1mutez);
|
|
123
|
-
return assert(Test.get_storage(contract.addr) == initial_storage + 1)
|
|
124
|
-
}
|
|
125
|
-
)();
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
By running `taq test testCounter.mligo`, you should get the following:
|
|
129
|
-
```
|
|
130
|
-
┌───────────────────┬──────────────────────────────────────────────┐
|
|
131
|
-
│ Contract │ Test Results │
|
|
132
|
-
├───────────────────┼──────────────────────────────────────────────┤
|
|
133
|
-
│ testIncDec.jsligo │ Everything at the top-level was executed. │
|
|
134
|
-
│ │ - test_initial_storage exited with value (). │
|
|
135
|
-
│ │ - test_increment exited with value (). │
|
|
136
|
-
│ │ │
|
|
137
|
-
│ │ 🎉 All tests passed 🎉 │
|
|
138
|
-
└───────────────────┴──────────────────────────────────────────────┘
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## The `taq ligo` task
|
|
142
|
-
|
|
143
|
-
Basic usage is:
|
|
144
|
-
|
|
145
|
-
```shell
|
|
146
|
-
taq ligo --command <command to pass to the underlying LIGO binary>
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Wrap the value for the `--command` flag with quotes.
|
|
150
|
-
|
|
151
|
-
<%~ it.noteOpenAdmonition %>
|
|
152
|
-
This task allows you to run arbitrary LIGO native commands, but they might not benefit from the abstractions provided by Taqueria
|
|
153
|
-
<%= it.closeAdmonition %>
|
|
154
|
-
|
|
155
|
-
## Template creation
|
|
156
|
-
The LIGO plugin also exposes a contract template via the `taq create contract <contractName>` task. This task will create a new LIGO contract in the `contracts` directory and insert some boilerplate LIGO contract code
|
|
157
|
-
|
|
158
|
-
### The `create contract` Template
|
|
159
|
-
|
|
160
|
-
The `create contract` task is used to create a new LIGO contract from a template. Running this task will create a new LIGO smart contract in the `contracts` directory and insert boilerplate contract code
|
|
161
|
-
|
|
162
|
-
```shell
|
|
163
|
-
taq create contract <contractName>
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
The `create contract` task takes a filename a required positional argument. The filename must end with a LIGO extension (`.jsligo`, `.mligo`, etc)
|
|
167
|
-
|
|
168
|
-
## Plugin Architecture
|
|
169
|
-
|
|
170
|
-
This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK and distributed via NPM
|
|
171
|
-
|
|
172
|
-
Docker is used under the hood to provide a self contained environment for LIGO to prevent the need for it to be installed on the user's local machine
|