Skip to content

Commit c23ea29

Browse files
committed
docs(SDK): add better docs for how to use args in queue scripts
1 parent 8028933 commit c23ea29

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

docs/userguides/production.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,21 @@ def cli():
4242
Once the simulation is complete, the decorator will collect all receipts it finds from the `safe`'s
4343
history during that session, and collect them into a single SafeTx to propose to a public network.
4444

45-
```{note}
45+
```{important}
4646
The name of the decorated function in your queue script **must** be `cli` for it to work.
4747
```
4848

49-
```{note}
5049
The decorated function may have `safe` or `submitter` args in it, in order to access their values.
50+
51+
```py
52+
@propose_from_simulation()
53+
# NOTE: Can also just use `def cli(safe):` if you don't need `submitter`
54+
def cli(safe, submitter):
55+
# You can use `safe` or `submitter` in your script to query values from the chain
56+
bal_before = token.balanceOf(submitter)
57+
amount = token.balanceOf(safe)
58+
token.transfer(submitter, amount)
59+
assert token.balanceOf(submitter) == bal_before + amount
5160
```
5261

5362
You can run the script directly using the following command, and it will dry-run the transaction:

0 commit comments

Comments
 (0)