Skip to content

Commit

Permalink
chore(docs): Updates to token contract (#9954)
Browse files Browse the repository at this point in the history
Updates to the docs around recent token contract changes
(#9606)

closes AztecProtocol/dev-rel#444

---------

Co-authored-by: esau <152162806+sklppy88@users.noreply.github.com>
  • Loading branch information
critesjosh and sklppy88 authored Nov 19, 2024
1 parent 603b9c2 commit 5c8c35d
Show file tree
Hide file tree
Showing 15 changed files with 441 additions and 202 deletions.
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

0 comments on commit 5c8c35d

Please sign in to comment.