@taqueria/plugin-ligo 0.41.0 → 0.41.5
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 +43 -42
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ The LIGO plugin provides tasks to work with LIGO smart contracts such as compili
|
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
7
|
-
- Taqueria v0.
|
|
8
|
-
- Node.js
|
|
7
|
+
- Taqueria v0.40.0 or later
|
|
8
|
+
- Node.js v18 or later
|
|
9
9
|
- Docker v20.10.12 or later
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
@@ -76,47 +76,48 @@ taq test <fileName>
|
|
|
76
76
|
### Basic description
|
|
77
77
|
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
|
|
78
78
|
|
|
79
|
-
For example, refer to the following
|
|
80
|
-
```ligo title="
|
|
81
|
-
|
|
79
|
+
For example, refer to the following snippets:
|
|
80
|
+
```ligo title="IncDec.jsligo"
|
|
81
|
+
export namespace IncDec {
|
|
82
|
+
export type storage = int;
|
|
83
|
+
type ret = [list<operation>, storage];
|
|
84
|
+
// Three entrypoints
|
|
85
|
+
|
|
86
|
+
@entry
|
|
87
|
+
const increment = (delta: int, store: storage): ret =>
|
|
88
|
+
[list([]), store + delta];
|
|
89
|
+
@entry
|
|
90
|
+
const decrement = (delta: int, store: storage): ret =>
|
|
91
|
+
[list([]), store - delta];
|
|
92
|
+
@entry
|
|
93
|
+
const reset = (_p: unit, _s: storage): ret => [list([]), 0]
|
|
94
|
+
};
|
|
82
95
|
|
|
83
|
-
type parameter =
|
|
84
|
-
Increment of int
|
|
85
|
-
| Decrement of int
|
|
86
|
-
| Reset
|
|
87
|
-
|
|
88
|
-
type return = operation list * storage
|
|
89
|
-
|
|
90
|
-
// Two entrypoints
|
|
91
|
-
|
|
92
|
-
let add (store, delta : storage * int) : storage = store + delta
|
|
93
|
-
let sub (store, delta : storage * int) : storage = store - delta
|
|
94
|
-
|
|
95
|
-
(* Main access point that dispatches to the entrypoints according to
|
|
96
|
-
the smart contract parameter. *)
|
|
97
|
-
|
|
98
|
-
let main (action, store : parameter * storage) : return =
|
|
99
|
-
([] : operation list), // No operations
|
|
100
|
-
(match action with
|
|
101
|
-
Increment (n) -> add (store, n)
|
|
102
|
-
| Decrement (n) -> sub (store, n)
|
|
103
|
-
| Reset -> 0)
|
|
104
96
|
```
|
|
105
97
|
|
|
106
|
-
```ligo title="
|
|
107
|
-
#
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
let
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
98
|
+
```ligo title="testIncDec.jsligo"
|
|
99
|
+
#import "IncDec.jsligo" "Contract"
|
|
100
|
+
|
|
101
|
+
/* Tests for main access point */
|
|
102
|
+
|
|
103
|
+
const test_initial_storage =
|
|
104
|
+
(
|
|
105
|
+
() => {
|
|
106
|
+
let initial_storage = 42;
|
|
107
|
+
let contract = Test.originate(contract_of (Contract.IncDec), initial_storage, 0 as tez);
|
|
108
|
+
return assert(Test.get_storage(contract.addr) == initial_storage)
|
|
109
|
+
}
|
|
110
|
+
)();
|
|
111
|
+
|
|
112
|
+
const test_increment =
|
|
113
|
+
(
|
|
114
|
+
() => {
|
|
115
|
+
let initial_storage = 42;
|
|
116
|
+
let contract = Test.originate(contract_of (Contract.IncDec), initial_storage, 0 as tez);
|
|
117
|
+
let _ = Test.transfer_exn(contract.addr, (Increment (1)), 1mutez);
|
|
118
|
+
return assert(Test.get_storage(contract.addr) == initial_storage + 1)
|
|
119
|
+
}
|
|
120
|
+
)();
|
|
120
121
|
```
|
|
121
122
|
|
|
122
123
|
By running `taq test testCounter.mligo`, you should get the following:
|
|
@@ -124,11 +125,11 @@ By running `taq test testCounter.mligo`, you should get the following:
|
|
|
124
125
|
┌───────────────────┬──────────────────────────────────────────────┐
|
|
125
126
|
│ Contract │ Test Results │
|
|
126
127
|
├───────────────────┼──────────────────────────────────────────────┤
|
|
127
|
-
│
|
|
128
|
+
│ testIncDec.jsligo │ Everything at the top-level was executed. │
|
|
128
129
|
│ │ - test_initial_storage exited with value (). │
|
|
129
130
|
│ │ - test_increment exited with value (). │
|
|
130
131
|
│ │ │
|
|
131
|
-
│ │ 🎉 All tests passed 🎉
|
|
132
|
+
│ │ 🎉 All tests passed 🎉 │
|
|
132
133
|
└───────────────────┴──────────────────────────────────────────────┘
|
|
133
134
|
```
|
|
134
135
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-ligo",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.5",
|
|
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.41.
|
|
45
|
-
"@taqueria/node-sdk": "^0.41.
|
|
44
|
+
"@taqueria/lib-ligo": "^0.41.5",
|
|
45
|
+
"@taqueria/node-sdk": "^0.41.5",
|
|
46
46
|
"fast-glob": "^3.3.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|