Skip to content

Commit

Permalink
modifying the rest of the links, they should be all relative now
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed May 20, 2024
1 parent 34efdb1 commit 34088a8
Show file tree
Hide file tree
Showing 48 changed files with 162 additions and 153 deletions.
8 changes: 4 additions & 4 deletions docs/docs/getting_started/aztecjs-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ The sandbox is preloaded with multiple accounts so you don't have to sit and cre

#include_code load_accounts /yarn-project/end-to-end/src/composed/e2e_sandbox_example.test.ts typescript

An explanation on accounts on Aztec can be found [here](/aztec/concepts/index.md).
An explanation on accounts on Aztec can be found [here](../aztec/concepts/index.md).

If you want more accounts, you can find instructions in the [Account creation section](/guides/local_env/creating_schnorr_accounts).
If you want more accounts, you can find instructions in the [Account creation section](../guides/local_env/creating_schnorr_accounts.md).

## Deploy a contract

Expand Down Expand Up @@ -256,7 +256,7 @@ Now lets transfer some funds from Alice to Bob by calling the `transfer` functio
1. The sender.
2. The recipient.
3. The quantity of tokens to be transferred.
4. The nonce for the [authentication witness](/aztec/concepts/index.md#authorizing-actions), or 0 if msg.sender equal sender.
4. The nonce for the [authentication witness](../aztec/concepts/index.md#authorizing-actions), or 0 if msg.sender equal sender.

Here is the Typescript code to call the `transfer` function, add this to your `index.ts` at the bottom of the `main` function:

Expand Down Expand Up @@ -353,7 +353,7 @@ Our complete output should now be something like:
token Bob's balance 10543 +43ms
```

That's it! We have successfully deployed a token contract to an instance of the Aztec network and mined private state-transitioning transactions. We have also queried the resulting state all via the interfaces provided by the contract. To see exactly what has happened here, you can learn about the transaction flow [here](/aztec/concepts/transactions).
That's it! We have successfully deployed a token contract to an instance of the Aztec network and mined private state-transitioning transactions. We have also queried the resulting state all via the interfaces provided by the contract. To see exactly what has happened here, you can learn about the transaction flow [here](../aztec/concepts/transactions.md).

## Next Steps

Expand Down
8 changes: 4 additions & 4 deletions docs/docs/getting_started/aztecnr-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_position: 2

In this guide, we will create our first Aztec.nr smart contract. We will build a simple private counter. This contract will get you started with the basic setup and syntax of Aztec.nr, but doesn't showcase the awesome stuff Aztec is capable of.

If you already have some experience with Noir and want to build a cooler contract that utilizes both private and public state, you might want to check out the [token contract tutorial instead](/tutorials/contract_tutorials/token_contract.md).
If you already have some experience with Noir and want to build a cooler contract that utilizes both private and public state, you might want to check out the [token contract tutorial instead](../tutorials/contract_tutorials/token_contract.md).

## Prerequisites

Expand Down Expand Up @@ -116,7 +116,7 @@ Let’s create a constructor method to run on deployment that assigns an initial

This function accesses the counts from storage. Then it assigns the passed initial counter to the `owner`'s counter privately using `at().add()`.

We have annotated this and other functions with `#[aztec(private)]` which are ABI macros so the compiler understands it will handle private inputs. Learn more about functions and annotations [here](/aztec/concepts/smart_contracts/functions).
We have annotated this and other functions with `#[aztec(private)]` which are ABI macros so the compiler understands it will handle private inputs. Learn more about functions and annotations [here](../aztec/concepts/smart_contracts/functions/index.md).

## Incrementing our counter

Expand Down Expand Up @@ -181,7 +181,7 @@ Update the `Noir: Nargo Path` field to point to your desired `aztec-nargo` execu

The next recommmended steps are follow the tutorials in order. They will teach you more about contracts, Aztec.js, and how Aztec works in general.

To follow the series of tutorials, start with the private voting contract [here](/tutorials/contract_tutorials/private_voting_contract.md).
To follow the series of tutorials, start with the private voting contract [here](../tutorials/contract_tutorials/private_voting_contract.md).

Alternatively, you can read about the high level architecture on the [Core Components page](/aztec/concepts/state_model/index.md) and [the lifecycle of a transaction](/aztec/concepts/transactions).
Alternatively, you can read about the high level architecture on the [Core Components page](../aztec/concepts/state_model/index.md) and [the lifecycle of a transaction](../aztec/concepts/transactions.md).

4 changes: 2 additions & 2 deletions docs/docs/guides/js_apps/deploy_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ You should have a wallet to act as the deployer, and a contract artifact ready t

You can learn how to create wallets from [this guide](./create_account.md).

You can read about contract artifacts [here](/aztec/concepts/smart_contracts/contract_structure.md).
You can read about contract artifacts [here](../../aztec/concepts/smart_contracts/contract_structure.md).

## Import the contract artifact

In this guide we are using a Token contract artifact. This comes from the [token contract tutorial](/tutorials/contract_tutorials/token_contract.md).
In this guide we are using a Token contract artifact. This comes from the [token contract tutorial](../../tutorials/contract_tutorials/token_contract.md).

#include_code import_token_contract yarn-project/end-to-end/src/composed/docs_examples.test.ts typescript

Expand Down
16 changes: 8 additions & 8 deletions docs/docs/guides/js_apps/test_contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We will be using typescript to write our tests, and rely on the [`aztec.js`](htt

## A simple example

Let's start with a simple example for a test using the [Sandbox](/reference/sandbox_reference/index.md). We will create two accounts and deploy a token contract in a setup step, and then issue a transfer from one user to another.
Let's start with a simple example for a test using the [Sandbox](../../reference/sandbox_reference/index.md). We will create two accounts and deploy a token contract in a setup step, and then issue a transfer from one user to another.

#include_code sandbox-example /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript

Expand All @@ -17,7 +17,7 @@ This test sets up the environment by creating a client to the Private Execution
Once we have this setup, the test itself is simple. We check the balance of the `recipient` user to ensure it has no tokens, send and await a deployment transaction, and then check the balance again to ensure it was increased. Note that all numeric values are represented as [native bigints](https://developer.mozilla.org/en-US/docs/Web/JavaScript//reference/Global_Objects/BigInt) to avoid loss of precision.

:::info
We are using the `Token` contract's typescript interface. Follow the [typescript interface section](/guides/smart_contracts/how_to_compile_contract.md#typescript-interfaces) to get type-safe methods for deploying and interacting with the token contract.
We are using the `Token` contract's typescript interface. Follow the [typescript interface section](../smart_contracts/how_to_compile_contract.md#typescript-interfaces) to get type-safe methods for deploying and interacting with the token contract.
:::

To run the test, first make sure the Sandbox is running on port 8080, and then [run your tests using jest](https://jestjs.io/docs/getting-started#running-from-command-line). Your test should pass, and you should see the following output in the Sandbox logs, where each chunk corresponds to a transaction. Note how this test run has a total of four transactions: two for deploying the account contracts for the `owner` and `recipient`, another for deploying the token contract, and a last one for actually executing the transfer.
Expand Down Expand Up @@ -92,7 +92,7 @@ If a note doesn't appear when you expect it to, check the visible notes returned

If the note appears in the visible notes and it contains the expected values there is probably an issue with how you fetch the notes. Check that the note getter (or note viewer) parameters are set correctly. If the note doesn't appear, ensure that you have emitted the corresponding encrypted log (usually by passing in a `broadcast = true` param to the `create_note` function). You can also check the Sandbox logs to see if the `emitEncryptedLog` was emitted. Run `export DEBUG="aztec:\*" before spinning up sandbox to see all the logs.

For debugging and logging in Aztec contracts, see [this page](/reference/debugging.md).
For debugging and logging in Aztec contracts, see [this page](../../reference/debugging.md).

## Assertions

Expand Down Expand Up @@ -142,13 +142,13 @@ WARN Error processing tx 06dc87c4d64462916ea58426ffcfaf20017880b353c9ec3e0f0ee5f

We can check private or public state directly rather than going through view-only methods, as we did in the initial example by calling `token.methods.balance().simulate()`. Bear in mind that directly accessing contract storage will break any kind of encapsulation.

To query storage directly, you'll need to know the slot you want to access. This can be checked in the [contract's `Storage` definition](/aztec/concepts/storage/index.md) directly for most data types. However, when it comes to mapping types, as in most EVM languages, we'll need to calculate the slot for a given key. To do this, we'll use the [`CheatCodes`](/reference/sandbox_reference/cheat_codes.md) utility class:
To query storage directly, you'll need to know the slot you want to access. This can be checked in the [contract's `Storage` definition](../../aztec/concepts/storage/index.md) directly for most data types. However, when it comes to mapping types, as in most EVM languages, we'll need to calculate the slot for a given key. To do this, we'll use the [`CheatCodes`](../../reference/sandbox_reference/cheat_codes.md) utility class:

#include_code calc-slot /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript

#### Querying private state

Private state in the Aztec Network is represented via sets of [private notes](/aztec/concepts/state_model/index.md#private-state). In our token contract example, the balance of a user is represented as a set of unspent value notes, each with their own corresponding numeric value.
Private state in the Aztec Network is represented via sets of [private notes](../../aztec/concepts/state_model/index.md#private-state). In our token contract example, the balance of a user is represented as a set of unspent value notes, each with their own corresponding numeric value.

#include_code value-note-def noir-projects/aztec-nr/value-note/src/value_note.nr rust

Expand All @@ -158,13 +158,13 @@ We can query the Private eXecution Environment (PXE) for all notes encrypted for

#### Querying public state

[Public state](/aztec/concepts/state_model/index.md#public-state) behaves as a key-value store, much like in the EVM. This scenario is much more straightforward, in that we can directly query the target slot and get the result back as a buffer. Note that we use the [`TokenContract`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) in this example, which defines a mapping of public balances on slot 6.
[Public state](../../aztec/concepts/state_model/index.md#public-state) behaves as a key-value store, much like in the EVM. This scenario is much more straightforward, in that we can directly query the target slot and get the result back as a buffer. Note that we use the [`TokenContract`](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) in this example, which defines a mapping of public balances on slot 6.

#include_code public-storage /yarn-project/end-to-end/src/guides/dapp_testing.test.ts typescript

### Logs

Last but not least, we can check the logs of [events](/guides/smart_contracts/writing_contracts/how_to_emit_event) emitted by our contracts. Contracts in Aztec can emit both [encrypted](/guides/smart_contracts/writing_contracts/how_to_emit_event.md#encrypted-events) and [unencrypted](/guides/smart_contracts/writing_contracts/how_to_emit_event.md#unencrypted-events) events.
Last but not least, we can check the logs of [events](../smart_contracts/writing_contracts/how_to_emit_event.md) emitted by our contracts. Contracts in Aztec can emit both [encrypted](../smart_contracts/writing_contracts/how_to_emit_event.md#encrypted-events) and [unencrypted](../smart_contracts/writing_contracts/how_to_emit_event.md#unencrypted-events) events.

:::info
At the time of this writing, only unencrypted events can be queried directly. Encrypted events are always assumed to be encrypted notes.
Expand All @@ -178,7 +178,7 @@ We can query the PXE for the unencrypted logs emitted in the block where our tra

## Cheats

The [`CheatCodes`](/reference/sandbox_reference/cheat_codes.md) class, which we used for [calculating the storage slot above](#state), also includes a set of cheat methods for modifying the chain state that can be handy for testing.
The [`CheatCodes`](../../reference/sandbox_reference/cheat_codes.md) class, which we used for [calculating the storage slot above](#state), also includes a set of cheat methods for modifying the chain state that can be handy for testing.

### Set next block timestamp

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/guides/local_env/creating_schnorr_accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ sidebar_position: 1

This section shows how to create schnorr account wallets on the Aztec Sandbox.

An in-depth explaining about accounts on aztec can be found [here](/aztec/concepts/index.md). But creating an account on the Sandbox does 2 things:
An in-depth explaining about accounts on aztec can be found [here](../../aztec/concepts/index.md). But creating an account on the Sandbox does 2 things:

1. Deploys an account contract -- representing you -- allowing you to perform actions on the network (deploy contracts, call functions etc).
2. Adds your encryption keys to the Private eXecution Environment (PXE) allowing it to decrypt and manage your private state.

## Pre-requisites

Have a running Sandbox and a repository that interacts with it as explained [here](/getting_started).
Have a running Sandbox and a repository that interacts with it as explained [here](../../getting_started.md).

Let's assume you have a file `src/index.ts` from the example used in the Sandbox page.

Expand Down Expand Up @@ -61,4 +61,4 @@ Once this has completed, the L2 block is retrieved and pulled down to the PXE so

## Next Steps

Check out our section on [Writing your own Account Contract](/tutorials/write_accounts_contract.md) leveraging our account abstraction
Check out our section on [Writing your own Account Contract](../../tutorials/write_accounts_contract.md) leveraging our account abstraction
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ You should see something like this:
Aztec Server listening on port 8080
```

You can learn more about custom commands in the [sandbox reference](/reference/sandbox_reference/index.md).
You can learn more about custom commands in the [sandbox reference](../../reference/sandbox_reference/index.md).


4 changes: 2 additions & 2 deletions docs/docs/guides/local_env/versions-updating.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ cd your/aztec/project
aztec-builder update . --contract src/contract1 --contract src/contract2
```

The sandbox must be running for the update command to work. Make sure it is [installed and running](/reference/sandbox_reference/index.md).
The sandbox must be running for the update command to work. Make sure it is [installed and running](../../reference/sandbox_reference/index.md).

Follow [updating Aztec.nr packages](#updating-aztecnr-packages) and [updating JavaScript packages](#updating-aztecjs-packages) guides.

3. Refer to [Migration Notes](/migration_notes.md) on any breaking changes that might affect your dapp
3. Refer to [Migration Notes](../../migration_notes.md) on any breaking changes that might affect your dapp

---

Expand Down
10 changes: 5 additions & 5 deletions docs/docs/guides/smart_contracts/how_to_compile_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_position: 3

import Disclaimer from "@site/src/components/Disclaimers/\_wip_disclaimer.mdx";

Once you have written a contract in Aztec.nr, you will need to compile it into an [artifact](/aztec/concepts/smart_contracts/contract_structure.md) in order to use it.
Once you have written a contract in Aztec.nr, you will need to compile it into an [artifact](../../aztec/concepts/smart_contracts/contract_structure.md) in order to use it.

In this guide we will cover how to do so, both using the `aztec-nargo` command and programmatically.

Expand All @@ -21,7 +21,7 @@ Run the `aztec-nargo compile` command within your contract project folder (the o
aztec-nargo compile
```

This will output a JSON [artifact](/aztec/concepts/smart_contracts/contract_structure.md) for each contract in the project to a `target` folder containing the Noir ABI artifacts.
This will output a JSON [artifact](../../aztec/concepts/smart_contracts/contract_structure.md) for each contract in the project to a `target` folder containing the Noir ABI artifacts.

:::note
This command looks for `Nargo.toml` files by ascending up the parent directories, and will compile the top-most Nargo.toml file it finds.
Expand Down Expand Up @@ -222,11 +222,11 @@ export class TokenContract extends ContractBase {
}
```

Read more about interacting with contracts using `aztec.js` [here](/getting_started/aztecjs-getting-started.md).
Read more about interacting with contracts using `aztec.js` [here](../../getting_started/aztecjs-getting-started.md).

### Aztec.nr interfaces

An Aztec.nr contract can [call a function](/guides/smart_contracts/writing_contracts/call_functions.md) in another contract via `context.call_private_function` or `context.call_public_function`. However, this requires manually assembling the function selector and manually serializing the arguments, which is not type-safe.
An Aztec.nr contract can [call a function](writing_contracts/call_functions.md) in another contract via `context.call_private_function` or `context.call_public_function`. However, this requires manually assembling the function selector and manually serializing the arguments, which is not type-safe.

To make this easier, the compiler automatically generates interface structs that expose a convenience method for each function listed in a given contract artifact. These structs are intended to be used from another contract project that calls into the current one.

Expand Down Expand Up @@ -260,7 +260,7 @@ contract FPC {
}
```

Read more about how to use the Aztec.nr interfaces [here](/aztec/concepts/smart_contracts/functions).
Read more about how to use the Aztec.nr interfaces [here](../../aztec/concepts/smart_contracts/functions/index.md).

:::info
At the moment, the compiler generates these interfaces from already compiled ABIs, and not from source code. This means that you should not import a generated interface from within the same project as its source contract, or you risk circular references.
Expand Down
Loading

0 comments on commit 34088a8

Please sign in to comment.