Skip to content

Commit

Permalink
Merge branch 'master' into palla/contract-deploy-12
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilWindle authored Feb 27, 2024
2 parents 26f3b60 + 4667c27 commit 73b70e5
Show file tree
Hide file tree
Showing 71 changed files with 470 additions and 403 deletions.
4 changes: 2 additions & 2 deletions barretenberg/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/AztecProtocol/barretenberg
branch = master
commit = e68cec277e733e01f19b3fa61a307b4b8c49f6fa
parent = 842ba7a720d075632ad2c4b948f874a12cfa3ecd
commit = b0e822f0e1e7dfbb51033e2e8a15a6c18661015a
parent = d44d9f11be2a2d2652b70b1d333322440c6ef06c
method = merge
cmdver = 0.4.6
13 changes: 4 additions & 9 deletions boxes/react/src/contracts/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
contract BoxReact {
use dep::aztec::{
protocol_types::address::AztecAddress,
state_vars::{singleton::Singleton, map::Map},
note::{
utils as note_utils,
note_interface::NoteInterface,
note_header::NoteHeader,
},
protocol_types::address::AztecAddress, state_vars::{PrivateMutable, Map},
note::{utils as note_utils, note_interface::NoteInterface, note_header::NoteHeader}
};

use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN};

struct Storage {
numbers: Map<AztecAddress, Singleton<ValueNote>>,
numbers: Map<AztecAddress, PrivateMutable<ValueNote>>,
}

#[aztec(private)]
fn constructor(number: Field, owner: AztecAddress) {
let numbers = storage.numbers;
Expand Down
13 changes: 4 additions & 9 deletions boxes/vanilla-js/src/contracts/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
contract Vanilla {
use dep::aztec::{
protocol_types::address::AztecAddress,
state_vars::{singleton::Singleton, map::Map},
note::{
utils as note_utils,
note_interface::NoteInterface,
note_header::NoteHeader,
},
protocol_types::address::AztecAddress, state_vars::{PrivateMutable, Map},
note::{utils as note_utils, note_interface::NoteInterface, note_header::NoteHeader}
};

use dep::value_note::value_note::{ValueNote, VALUE_NOTE_LEN};

struct Storage {
numbers: Map<AztecAddress, Singleton<ValueNote>>,
numbers: Map<AztecAddress, PrivateMutable<ValueNote>>,
}

#[aztec(private)]
fn constructor(number: Field, owner: AztecAddress) {
let numbers = storage.numbers;
Expand Down
8 changes: 4 additions & 4 deletions docs/HOW_WE_WRITE_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ To keep docs consistent and easily-searchable, follow these grammar guidelines:

* Write with American English
* When talking about ZK, use:
** `zero knowledge` as the noun
** `zero-knowledge` as the adjective
** `ZK` for subsequent mentions of zero knowledge and zero-knowledge on the same page
* Do not end bullet points with any punctuation, such as bullet points or semi-colons (most of the time)
* `zero knowledge` as the noun
* `zero-knowledge` as the adjective
* `ZK` for subsequent mentions of zero knowledge and zero-knowledge on the same page
* Do not end bullet points with any punctuation, such as periods or semi-colons (most of the time)
* Use numbered bullets when the order is important, such as steps in a guide or hierarchies of dependencies
* Write with [active voice](https://www.grammarly.com/blog/active-vs-passive-voice/) in tutorials and how-tos, and passive voice in explanations
* Use the [Oxford comma](https://www.grammarly.com/blog/what-is-the-oxford-comma-and-why-do-people-care-so-much-about-it/)
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/developers/contracts/references/storage/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ Reading through the storage variables:

- `admin` a single Field value stored in public state. A `Field` is basically an unsigned integer with a maximum value determined by the underlying cryptographic curve.
- `minters` is a mapping of Fields in public state. This will store whether an account is an approved minter on the contract.
- `balances` is a mapping of private balances. Private balances are stored in a `Set` of `ValueNote`s. The balance is the sum of all of an account's `ValueNote`s.
- `balances` is a mapping of private balances. Private balances are stored in a `PrivateSet` of `ValueNote`s. The balance is the sum of all of an account's `ValueNote`s.
- `total_supply` is a Field value stored in public state and represents the total number of tokens minted.
- `pending_shields` is a `Set` of `TransparentNote`s stored in private state. What is stored publicly is a set of commitments to `TransparentNote`s.
- `pending_shields` is a `PrivateSet` of `TransparentNote`s stored in private state. What is stored publicly is a set of commitments to `TransparentNote`s.
- `public_balances` is a mapping field elements in public state and represents the publicly viewable balances of accounts.

You can read more about it [here](../storage/main.md).
Expand Down Expand Up @@ -288,7 +288,7 @@ The function returns 1 to indicate successful execution.

This public function allows an account approved in the public `minters` mapping to create new private tokens that can be claimed by anyone that has the pre-image to the `secret_hash`.

First, public storage is initialized. Then it checks that the `msg_sender` is an approved minter. Then a new `TransparentNote` is created with the specified `amount` and `secret_hash`. You can read the details of the `TransparentNote` in the `types.nr` file [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/token_contract/src/types.nr#L61). The `amount` is added to the existing public `total_supply` and the storage value is updated. Then the new `TransparentNote` is added to the `pending_shields` using the `insert_from_public` function, which is accessible on the `Set` type. Then it's ready to be claimed by anyone with the `secret_hash` pre-image using the `redeem_shield` function. It returns `1` to indicate successful execution.
First, public storage is initialized. Then it checks that the `msg_sender` is an approved minter. Then a new `TransparentNote` is created with the specified `amount` and `secret_hash`. You can read the details of the `TransparentNote` in the `types.nr` file [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/token_contract/src/types.nr#L61). The `amount` is added to the existing public `total_supply` and the storage value is updated. Then the new `TransparentNote` is added to the `pending_shields` using the `insert_from_public` function, which is accessible on the `PrivateSet` type. Then it's ready to be claimed by anyone with the `secret_hash` pre-image using the `redeem_shield` function. It returns `1` to indicate successful execution.

#include_code mint_private /noir-projects/noir-contracts/contracts/token_contract/src/main.nr rust

Expand Down
Loading

0 comments on commit 73b70e5

Please sign in to comment.