Skip to content

Commit f919113

Browse files
Fix dry-run command
1 parent ff4a87c commit f919113

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gitlab-pages/docs/tutorials/taco-shop/testing-contract.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,15 @@ For example, you can test the `buy_taco` entrypoint with this command:
476476
<Syntax syntax="jsligo">
477477

478478
```bash
479-
ligo run dry-run taco_shop.jsligo -m TacoShop --amount 1 "Buy_taco(1n)" \
479+
ligo run dry-run taco_shop.jsligo -m TacoShop --amount 1 '["Buy_taco" as "Buy_taco", 1 as nat]' \
480480
'{admin_address: "tz1QCVQinE8iVj1H2fckqx6oiM85CNJSK9Sx" as address, taco_data: TacoShop.default_taco_data}'
481481
```
482482

483+
The entrypoint and parameter in this command are formatted as a variant type.
484+
When the contract is compiled to Michelson, its parameter is a variant that has cases for each entrypoint, so you must pass the variant that corresponds to the entrypoint.
485+
For the purposes of the `ligo run dry-run` command, the variant type is the name of the entrypoint with the first letter in upper case.
486+
Note also that you can use variables from the contract (as in `TacoShop.default_taco_data`) in the command because the contract parameter and storage value are LIGO expressions.
487+
483488
</Syntax>
484489

485490
<Syntax syntax="cameligo">
@@ -489,11 +494,11 @@ ligo run dry-run taco_shop.mligo -m TacoShop --amount 1 "Buy_taco 1n" \
489494
'{admin_address = "tz1QCVQinE8iVj1H2fckqx6oiM85CNJSK9Sx" ; taco_data = TacoShop.default_taco_data}'
490495
```
491496

492-
</Syntax>
493-
494497
Note that the entrypoint name starts with a capital letter when you use it in a dry run.
495498
Note also that you can use variables from the contract (as in `TacoShop.default_taco_data`) in the command because the contract parameter and storage value are LIGO expressions.
496499

500+
</Syntax>
501+
497502
The address in the dry run command isn't stored beyond this run of the command; you just need to provide any address for the amin address in storage.
498503
However, you must use the `as address` declaration to specify that the string is a LIGO `address` type; without the type declaration, LIGO would assume that it was a string.
499504

0 commit comments

Comments
 (0)