Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): Updates to token contract #9954

Merged
merged 13 commits into from
Nov 19, 2024
2 changes: 1 addition & 1 deletion docs/docs/aztec/concepts/accounts/authwit.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ In order for another user to be able to take actions on your behalf, they would

### Other use-cases

We don't need to limit ourselves to the `transfer` function, we can use the same scheme for any function that requires authentication. For example, for authenticating to burn or shield assets or to vote in a governance contract or perform an operation on a lending protocol.
We don't need to limit ourselves to the `transfer` function, we can use the same scheme for any function that requires authentication. For example, for authenticating to burn, transferring assets from public to private, or to vote in a governance contract or perform an operation on a lending protocol.

### Next Steps

Expand Down
43 changes: 5 additions & 38 deletions docs/docs/guides/developer_guides/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,25 +182,16 @@ Simulation result: 100n

## Playing with hybrid state and private functions

In the following steps, we'll shield a token (moving it from public to private state), and check our private and public balance.

First we need to generate a secret and secret hash with the alias `shield`:

```bash
aztec-wallet create-secret -a shield
```

Call the `shield` function like this:
In the following steps, we'll moving some tokens from public to private state, and check our private and public balance.

```bash
aztec-wallet send shield --from accounts:my-wallet --contract-address testtoken --args accounts:my-wallet 25 secrets:shield:hash 0
aztec-wallet send transfer_to_private --from accounts:my-wallet --contract-address testtoken --args accounts:my-wallet 25
```

This takes the same parameters as our previous `send` call, with the arguments for `shield` function which are:
The arguments for `transfer_to_private` function are:

- the number of tokens to shield (`25`)
- a `secret_hash` (`SECRET_HASH` which has been derived from a secret that you generated in the CLI)
- a `nonce` (`0` in this case).
- the account address to transfer to
- the amount of tokens to send to private

A successful call should print something similar to what you've seen before.

Expand All @@ -216,30 +207,6 @@ This should print
Simulation result: 75n
```

Now we will need to add these shielded tokens into our account's environment so that we have the correct information to claim them.

```bash
aztec-wallet add-note TransparentNote pending_shields --contract-address testtoken --transaction-hash last --address accounts:my-wallet --body 25 secrets:shield:hash
```

This takes

- the type of note you are claiming (`TransparentNote`)
- the name of the storage (`pending_shields`)
- the contract address
- the transaction hash the note was created in (automatically aliased as `last`)
- the address to claim the note into (`accounts:my-wallet`)

Don't worry if you don't understand what `TransparentNote` or `add-note` mean just yet. When you follow the tutorials, you'll learn more.

A successful result will not print anything.

Now you can redeem the shielded tokens:

```bash
aztec-wallet send redeem_shield --contract-address testtoken --args accounts:my-wallet 25 secrets:shield --from accounts:my-wallet
```

And then call `balance_of_private` to check that you have your tokens!

```bash
Expand Down
Loading