diff --git a/README.md b/README.md index 075e73a0a90..e825d1687a4 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,6 @@ All the packages that make up [Aztec](https://docs.aztec.network). - [**`yarn-project`**](/yarn-project): Typescript code for client and backend - [**`docs`**](/docs): Documentation source for the docs site -## Getting Started - -Want to start quickly? Get started in minutes with a free Github Codespace. - -[![One-Click React Starter](.devcontainer/assets/react_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Freact%2Fdevcontainer.json) [![One-Click HTML/TS Starter](.devcontainer/assets/vanilla_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Fvanilla%2Fdevcontainer.json) [![One-Click Token Starter](.devcontainer/assets/token_cta_badge.svg)](https://codespaces.new/AztecProtocol/aztec-packages?devcontainer_path=.devcontainer%2Ftoken%2Fdevcontainer.json) - ## Popular packages - [Aztec.nr](./noir-projects/aztec-nr/): A [Noir](https://noir-lang.org) framework for smart contracts on Aztec. @@ -23,7 +17,7 @@ Want to start quickly? Get started in minutes with a free Github Codespace. ## Issues Board -All issues being worked on are tracked on the [Aztec Github Project](https://github.com/orgs/AztecProtocol/projects/22). For a higher-level roadmap, check the [milestones overview](https://docs.aztec.network/misc/roadmap/main) section of our docs. +All issues being worked on are tracked on the [Aztec Github Project](https://github.com/orgs/AztecProtocol/projects/22). For a higher-level roadmap, check the [milestones overview](https://docs.aztec.network/aztec/roadmap) section of our docs. ## Development Setup diff --git a/docs/docs/aztec/glossary/index.md b/docs/docs/aztec/glossary/index.md index e041e18bc55..8a4d155744a 100644 --- a/docs/docs/aztec/glossary/index.md +++ b/docs/docs/aztec/glossary/index.md @@ -64,7 +64,7 @@ Previously in [Aztec Connect](https://medium.com/aztec-protocol/sunsetting-aztec Programs that run on the Aztec network are called smart contracts, similar to [programs](https://ethereum.org/en/developers/docs/smart-contracts/) that run on Ethereum. -However, these will be written in the [Noir](https://noir-lang.org/index.html) programming language, and may optionally include [private state and private functions](https://docs.aztec.network/aztec/how-it-works/private-smart-contracts). +However, these will be written in the [Noir](https://noir-lang.org/index.html) programming language, and may optionally include [private state and private functions](../../aztec/core_components.md). ### Proving Key diff --git a/docs/docs/guides/local_env/versions-updating.md b/docs/docs/guides/local_env/versions-updating.md index 106225a6b29..708cc2b2c81 100644 --- a/docs/docs/guides/local_env/versions-updating.md +++ b/docs/docs/guides/local_env/versions-updating.md @@ -24,7 +24,7 @@ If you get an error like: `Cannot read file ~/nargo/github.com/AztecProtocol/azt Check the `git=` github url, tag, and directory. :::note -The folder structure changed at **0.24.0** from `yarn-project/aztec-nr` to `noir-projects/aztec-nr`. More details [here](https://docs.aztec.network/misc/migration_notes#aztecnr-aztec-nr-contracts-location-change-in-nargotoml) +The folder structure changed at **0.24.0** from `yarn-project/aztec-nr` to `noir-projects/aztec-nr`. More details [here](../../migration_notes.md#aztecnr-aztec-nr-contracts-location-change-in-nargotoml) ::: ### Example contract versions @@ -51,7 +51,7 @@ diff ~/nargo/github.com/AztecProtocol/aztec-packages-v0.23.0/yarn-project/noir-c ### Language server version (aztec-nargo) -The [Noir LSP](https://docs.aztec.network/developers/contracts/main.md#install-noir-lsp-recommended) uses your local version of `aztec-nargo`, and thus also `aztec-nargo compile`. +The [Noir LSP](../../getting_started.md#install-noir-lsp-recommended) uses your local version of `aztec-nargo`, and thus also `aztec-nargo compile`. The path of the former (once installed) can be seen by hovering over "Nargo" in the bottom status bar of VS Code, and the latter via the `which aztec-nargo` command. :::caution diff --git a/docs/docs/reference/debugging.md b/docs/docs/reference/debugging.md index fe688e8b220..e3d23b37404 100644 --- a/docs/docs/reference/debugging.md +++ b/docs/docs/reference/debugging.md @@ -3,20 +3,21 @@ title: Debugging sidebar_position: 2 --- -On this section you can learn how to debug your Aztec.nr smart contracts and common errors that you may run into. +## Logging in Aztec.nr -# Logging in Aztec.nr +On this section you can learn how to debug your Aztec.nr smart contracts and common errors that you may run into. You can log statements from Aztec.nr contracts that will show ups in the Sandbox. -**Import debug_log** +### Import `debug_log` + Import the [`debug_log`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/aztec-nr/aztec/src/oracle/debug_log.nr) dependency from Aztec oracles: ```rust use dep::aztec::oracle::debug_log::{ debug_log }; ``` -**Write log** +### Write log Write `debug_log()` in the appropriate place in your contract. @@ -44,7 +45,7 @@ debug_log_field(my_field); debug_log_array(my_array); ``` -**Start Sandbox in debug mode** +### Start Sandbox in debug mode Prepend the command to start the sandbox with `DEBUG=aztec:*` to log everything or `DEBUG=aztec:simulator:oracle` to only log your `debug_log()` statements. diff --git a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/0_setup.md b/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/0_setup.md index 00b0decab76..03307f46596 100644 --- a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/0_setup.md +++ b/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/0_setup.md @@ -17,7 +17,7 @@ We recommend going through this setup to fully understand where things live. - [node v18+](https://github.com/tj/n) - [docker](https://docs.docker.com/) -- [Aztec sandbox](https://docs.aztec.network/developers/getting_started/sandbox) - you should have this running before starting the tutorial +- [Aztec sandbox](../../../../getting_started.md) - you should have this running before starting the tutorial ```bash /bin/sh -c "$(curl -fsSL 'https://sandbox.aztec.network')" diff --git a/docs/docs/tutorials/contract_tutorials/crowdfunding_contract.md b/docs/docs/tutorials/contract_tutorials/crowdfunding_contract.md index ce858d65ef1..168be40d51c 100644 --- a/docs/docs/tutorials/contract_tutorials/crowdfunding_contract.md +++ b/docs/docs/tutorials/contract_tutorials/crowdfunding_contract.md @@ -26,9 +26,9 @@ Along the way you will: ### Install tools -Please ensure that the you already have [Installed the Sandbox](https://docs.aztec.network/developers/getting_started/quickstart#install-the-sandbox). +Please ensure that the you already have [Installed the Sandbox](../../getting_started.md). -And if using VSCode, see [here](https://docs.aztec.network/developers/contracts/main.md#install-noir-lsp-recommended) to install Noir LSP, where you'll benefit from syntax highlighting, profiling, and more. +And if using VSCode, see [here](../../getting_started.md#install-noir-lsp-recommended) to install Noir LSP, where you'll benefit from syntax highlighting, profiling, and more. ### Create an Aztec project @@ -95,10 +95,11 @@ aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_ ``` A word about versions: + - Choose the aztec packages version to match your aztec sandbox version - Check that your `compiler_version` in Nargo.toml is satisified by your aztec compiler - `aztec-nargo -V` -More about versions [here](https://docs.aztec.network/developers/versions-updating). +More about versions [here](../../guides/local_env/versions-updating.md). Inside the Crowdfunding contract definition, use the dependency that defines the address type `AztecAddress` (same syntax as Rust) @@ -108,7 +109,6 @@ use dep::aztec::protocol_types::address::AztecAddress; The `aztec::protocol_types` can be browsed [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-protocol-circuits/crates/types/src). And like rust dependencies, the relative path inside the dependency corresponds to `address::AztecAddress`. - #### Storage To retain the initializer parameters in the contract's Storage, we'll need to declare them in a preceding `Storage` struct: @@ -117,8 +117,6 @@ To retain the initializer parameters in the contract's Storage, we'll need to de The `ValueNote` type is in the top-level of the Aztec.nr framework, namely [noir-projects/aztec-nr](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/value-note/src/value_note.nr). Like before, you'll need to add the crate to Nargo.toml -(See [here](https://docs.aztec.network/developers/contracts/resources/dependencies) for common dependencies). - --- Back in main.nr, reference `use` of the type @@ -137,7 +135,7 @@ You can compile the code so far with `aztec-nargo compile`. #### Checking campaign duration against the timestamp -To check that the donation occurs before the campaign deadline, we must access the public `timestamp`. It is one of several [Public Global Variables](https://docs.aztec.network/developers/contracts/references/globals#public-global-variables). +To check that the donation occurs before the campaign deadline, we must access the public `timestamp`. It is one of several [Public Global Variables](../../reference/smart_contract_reference/globals). Declare an Aztec function that is public and internal @@ -153,7 +151,7 @@ Read the deadline from storage and assert that the `timestamp` from this context --- -Since donations are to be private, the donate function will have the user's private context which has these [Private Global Variables](https://docs.aztec.network/developers/contracts/references/globals#private-global-variables). So from the private context there is a little extra to call the (public internal) `_check_deadline` function. +Since donations are to be private, the donate function will have the user's private context which has these [Private Global Variables](../../reference/smart_contract_reference/globals.md). So from the private context there is a little extra to call the (public internal) `_check_deadline` function. ```rust #include_code call-check-deadline /noir-projects/noir-contracts/contracts/crowdfunding_contract/src/main.nr raw @@ -169,7 +167,6 @@ Now conclude adding all dependencies to the `Crowdfunding` contract: Like before, you can find these and other `aztec::protocol_types` [here](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-protocol-circuits/crates/types/src). - #### Interfacing with another contract The token being used for donations is stored simply as an `AztecAddress` (named `donation_token`). so to easily use it as a token, we let the compiler know that we want the address to have a Token interface. Here we will use a maintained example Token contract. @@ -180,7 +177,7 @@ Add this `Token` contract to Nargo.toml: token = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="noir-projects/noir-contracts/contracts/token_contract" } ``` -With the dependency already `use`d at the start of the contract, the token contract can be called to make the transfer from msg sender to this contract. +With the dependency already `use`d at the start of the contract, the token contract can be called to make the transfer from msg sender to this contract. :::note The user must have authorised this action (concept [here](../../aztec/concepts/accounts/index.md#authorizing-actions)), example use of `createAuthWit` in 'full donor flow' test [here](../../../../yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts). @@ -195,11 +192,12 @@ The last thing to do is create a new value note and add it to the `donation_rece ### 3. Operator withdrawals The remaining function to implement, `withdraw`, is reasonably straight-forward: + 1. make sure the address calling is the operator address 2. transfer tokens from the contract to the operator 3. reveal that an amount has been withdrawn to the operator -The last point is achieved by emitting an unencrypted event log, more [here](https://docs.aztec.network/developers/contracts/writing_contracts/events/emit_event#unencrypted-events). +The last point is achieved by emitting an unencrypted event log, more [here](../../guides/smart_contracts/writing_contracts/how_to_emit_event.md#unencrypted-events). Copy the last function into your Crowdfunding contract: diff --git a/yarn-project/aztec.js/README.md b/yarn-project/aztec.js/README.md index 40f51ec3234..8fdc97fa521 100644 --- a/yarn-project/aztec.js/README.md +++ b/yarn-project/aztec.js/README.md @@ -1,6 +1,6 @@ # Aztec.js -Aztec.js is a library that provides APIs for managing accounts and interacting with contracts on the Aztec network. It communicates with the [Private eXecution Environment (PXE)](https://docs.aztec.network/apis/pxe/interfaces/PXE) through a `PXE` implementation, allowing developers to easily register new accounts, deploy contracts, view functions, and send transactions. +Aztec.js is a library that provides APIs for managing accounts and interacting with contracts on the Aztec network. It communicates with the [Private eXecution Environment (PXE)](https://docs.aztec.network/reference/aztecjs/pxe) through a `PXE` implementation, allowing developers to easily register new accounts, deploy contracts, view functions, and send transactions. ## Installing @@ -17,7 +17,9 @@ Use the `@aztec/accounts` package in order to create and manage accounts, and ac ```typescript import { Contract } from '@aztec/aztec.js'; -const contract = await Contract.deploy(wallet, MyContractArtifact, [...constructorArgs]).send().deployed(); +const contract = await Contract.deploy(wallet, MyContractArtifact, [...constructorArgs]) + .send() + .deployed(); console.log(`Contract deployed at ${contract.address}`); ``` diff --git a/yarn-project/entrypoints/src/index.ts b/yarn-project/entrypoints/src/index.ts index dd22b64cc9f..75ba38e75d6 100644 --- a/yarn-project/entrypoints/src/index.ts +++ b/yarn-project/entrypoints/src/index.ts @@ -1,7 +1,7 @@ /** * The `@aztec/accounts/defaults` export provides the base class {@link DefaultAccountContract} for implementing account contracts that use the default entrypoint payload module. * - * Read more in {@link https://docs.aztec.network/developers/wallets/writing_an_account_contract | Writing an account contract}. + * Read more in {@link https://docs.aztec.network/tutorials/write_accounts_contract | Writing an account contract}. * * @packageDocumentation */ diff --git a/yarn-project/pxe/src/pxe_service/pxe_service.ts b/yarn-project/pxe/src/pxe_service/pxe_service.ts index 8179f4fbeb9..ba1541f68ab 100644 --- a/yarn-project/pxe/src/pxe_service/pxe_service.ts +++ b/yarn-project/pxe/src/pxe_service/pxe_service.ts @@ -590,7 +590,7 @@ export class PXEService implements PXE { const contract = await this.db.getContract(to); if (!contract) { throw new Error( - `Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/developers/debugging/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`, + `Unknown contract ${to}: add it to PXE Service by calling server.addContracts(...).\nSee docs for context: https://docs.aztec.network/reference/common_errors/aztecnr-errors#unknown-contract-0x0-add-it-to-pxe-by-calling-serveraddcontracts`, ); } diff --git a/yarn-project/pxe/src/simulator_oracle/index.ts b/yarn-project/pxe/src/simulator_oracle/index.ts index 02f6aa0859d..6d1dcee0588 100644 --- a/yarn-project/pxe/src/simulator_oracle/index.ts +++ b/yarn-project/pxe/src/simulator_oracle/index.ts @@ -47,7 +47,7 @@ export class SimulatorOracle implements DBOracle { if (!completeAddress) { throw new Error( `No public key registered for address ${account}. - Register it by calling pxe.registerRecipient(...) or pxe.registerAccount(...).\nSee docs for context: https://docs.aztec.network/developers/debugging/aztecnr-errors#simulation-error-No-public-key-registered-for-address-0x0-Register-it-by-calling-pxeregisterRecipient-or-pxeregisterAccount`, + Register it by calling pxe.registerRecipient(...) or pxe.registerAccount(...).\nSee docs for context: https://docs.aztec.network/reference/common_errors/aztecnr-errors#simulation-error-no-public-key-registered-for-address-0x0-register-it-by-calling-pxeregisterrecipient-or-pxeregisteraccount`, ); } return completeAddress;