-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds some catch all redirects to avoid getting 404s. It also cleans up a few pages for when a user clicks a dropdown.
- Loading branch information
1 parent
f44d567
commit 432cec0
Showing
9 changed files
with
151 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
title: Portals | ||
title: Writing Contracts | ||
--- | ||
|
||
A portal is a point of contact between L1 and a contract on Aztec. For applications such as token bridges, this is the point where the tokens are held on L1 while used in L2. | ||
import DocCardList from "@theme/DocCardList"; | ||
|
||
As outlined in [Communication](/protocol-specs/l1-smart-contracts/index.md), an Aztec L2 contract does not have to be linked to a portal contract, but can specify an intended portal in storage. Note, that a portal doesn't actually need to be a contract, it could be any address on L1. | ||
<DocCardList /> |
2 changes: 1 addition & 1 deletion
2
docs/docs/guides/smart_contracts/writing_contracts/storage/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
docs/docs/reference/smart_contract_reference/contract_artifact.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
title: "Contract Artifact Reference" | ||
--- | ||
|
||
After compiling a contract you'll get a Contract Artifact file, that contains the data needed to interact with a specific contract, including its name, functions that can be executed, and the interface and code of those functions. Since private functions are not published in the Aztec network, you'll need this artifact file to be able to call private functions of contracts. | ||
|
||
The artifact file can be used with `aztec.js` to instantiate contract objects and interact with them. | ||
|
||
## Contract Artifact Structure | ||
|
||
The structure of a contract artifact is as follows: | ||
```json | ||
{ | ||
"name": "CardGame", | ||
"functions": [ | ||
{ | ||
"name": "constructor", | ||
"functionType": "private", | ||
"isInternal": false, | ||
"parameters": [], | ||
"returnTypes": [], | ||
"bytecode": "...", | ||
"verificationKey": "..." | ||
}, | ||
{ | ||
"name": "on_card_played", | ||
"functionType": "public", | ||
"isInternal": true, | ||
"parameters": [ | ||
{ | ||
"name": "game", | ||
"type": { | ||
"kind": "integer", | ||
"sign": "unsigned", | ||
"width": 32 | ||
}, | ||
"visibility": "private" | ||
}, | ||
{ | ||
"name": "player", | ||
"type": { | ||
"kind": "field" | ||
}, | ||
"visibility": "private" | ||
}, | ||
{ | ||
"name": "card_as_field", | ||
"type": { | ||
"kind": "field" | ||
}, | ||
"visibility": "private" | ||
} | ||
], | ||
"returnTypes": [ | ||
... | ||
], | ||
"bytecode": "...", | ||
"verificationKey": "..." | ||
}, | ||
... | ||
] | ||
} | ||
|
||
``` | ||
|
||
### `name` | ||
It is a simple string that matches the name that the contract developer used for this contract in noir. It's used for logs and errors. | ||
|
||
### `functions` | ||
A contract is a collection of several functions that can be called. Each function has the following properties: | ||
|
||
#### `function.name` | ||
A simple string that matches the name that the contract developer used for this function in noir. For logging and debugging purposes. | ||
|
||
#### `function.functionType` | ||
The function type can have one of the following values: | ||
|
||
- Private: The function is ran and proved locally by the clients, and its bytecode not published to the network. | ||
- Public: The function is ran and proved by the sequencer, and its bytecode is published to the network. | ||
- Unconstrained: The function is ran locally by the clients to generate digested information useful for the user. It's not meant to be transacted against. | ||
|
||
#### `function.isInternal` | ||
The is internal property is a boolean that indicates whether the function is internal to the contract and cannot be called from outside. | ||
|
||
#### `function.parameters` | ||
Each function can have multiple parameters that are arguments to execute the function. Parameters have a name, and type (like integers, strings, or complex types like arrays and structures). | ||
|
||
#### `function.returnTypes` | ||
The return types property defines the types of values that the function returns after execution. | ||
|
||
#### `function.bytecode` | ||
The bytecode is a string representing the compiled ACIR of the function, ready for execution on the network. | ||
|
||
#### `function.verificationKey` | ||
The verification key is an optional property that contains the verification key of the function. This key is used to verify the proof of the function execution. | ||
|
||
### `debug` (Optional) | ||
Although not significant for non-developer users, it is worth mentioning that there is a debug section in the contract artifact which helps contract developers to debug and test their contracts. This section mainly contains debug symbols and file maps that link back to the original source code. | ||
|
||
## Understanding Parameter and Return Types | ||
To make the most of the functions, it's essential to understand the types of parameters and return values. Here are some common types you might encounter: | ||
|
||
- `field`: A basic type representing a field element in the finite field of the curve used in the Aztec protocol. | ||
- `boolean`: A simple true/false value. | ||
- `integer`: Represents whole numbers. It has attributes defining its sign (positive or negative) and width (the number of bits representing the integer). | ||
- `array`: Represents a collection of elements, all of the same type. It has attributes defining its length and the type of elements it holds. | ||
- `string`: Represents a sequence of characters with a specified length. | ||
- `struct`: A complex type representing a structure with various fields, each having a specific type and name. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,7 @@ | ||
--- | ||
title: "Contract Artifact Reference" | ||
title: Smart Contract Reference | ||
--- | ||
|
||
After compiling a contract you'll get a Contract Artifact file, that contains the data needed to interact with a specific contract, including its name, functions that can be executed, and the interface and code of those functions. Since private functions are not published in the Aztec network, you'll need this artifact file to be able to call private functions of contracts. | ||
|
||
The artifact file can be used with `aztec.js` to instantiate contract objects and interact with them. | ||
|
||
## Contract Artifact Structure | ||
|
||
The structure of a contract artifact is as follows: | ||
```json | ||
{ | ||
"name": "CardGame", | ||
"functions": [ | ||
{ | ||
"name": "constructor", | ||
"functionType": "private", | ||
"isInternal": false, | ||
"parameters": [], | ||
"returnTypes": [], | ||
"bytecode": "...", | ||
"verificationKey": "..." | ||
}, | ||
{ | ||
"name": "on_card_played", | ||
"functionType": "public", | ||
"isInternal": true, | ||
"parameters": [ | ||
{ | ||
"name": "game", | ||
"type": { | ||
"kind": "integer", | ||
"sign": "unsigned", | ||
"width": 32 | ||
}, | ||
"visibility": "private" | ||
}, | ||
{ | ||
"name": "player", | ||
"type": { | ||
"kind": "field" | ||
}, | ||
"visibility": "private" | ||
}, | ||
{ | ||
"name": "card_as_field", | ||
"type": { | ||
"kind": "field" | ||
}, | ||
"visibility": "private" | ||
} | ||
], | ||
"returnTypes": [ | ||
... | ||
], | ||
"bytecode": "...", | ||
"verificationKey": "..." | ||
}, | ||
... | ||
] | ||
} | ||
|
||
``` | ||
|
||
### `name` | ||
It is a simple string that matches the name that the contract developer used for this contract in noir. It's used for logs and errors. | ||
|
||
### `functions` | ||
A contract is a collection of several functions that can be called. Each function has the following properties: | ||
|
||
#### `function.name` | ||
A simple string that matches the name that the contract developer used for this function in noir. For logging and debugging purposes. | ||
|
||
#### `function.functionType` | ||
The function type can have one of the following values: | ||
|
||
- Private: The function is ran and proved locally by the clients, and its bytecode not published to the network. | ||
- Public: The function is ran and proved by the sequencer, and its bytecode is published to the network. | ||
- Unconstrained: The function is ran locally by the clients to generate digested information useful for the user. It's not meant to be transacted against. | ||
|
||
#### `function.isInternal` | ||
The is internal property is a boolean that indicates whether the function is internal to the contract and cannot be called from outside. | ||
|
||
#### `function.parameters` | ||
Each function can have multiple parameters that are arguments to execute the function. Parameters have a name, and type (like integers, strings, or complex types like arrays and structures). | ||
|
||
#### `function.returnTypes` | ||
The return types property defines the types of values that the function returns after execution. | ||
|
||
#### `function.bytecode` | ||
The bytecode is a string representing the compiled ACIR of the function, ready for execution on the network. | ||
|
||
#### `function.verificationKey` | ||
The verification key is an optional property that contains the verification key of the function. This key is used to verify the proof of the function execution. | ||
|
||
### `debug` (Optional) | ||
Although not significant for non-developer users, it is worth mentioning that there is a debug section in the contract artifact which helps contract developers to debug and test their contracts. This section mainly contains debug symbols and file maps that link back to the original source code. | ||
|
||
## Understanding Parameter and Return Types | ||
To make the most of the functions, it's essential to understand the types of parameters and return values. Here are some common types you might encounter: | ||
|
||
- `field`: A basic type representing a field element in the finite field of the curve used in the Aztec protocol. | ||
- `boolean`: A simple true/false value. | ||
- `integer`: Represents whole numbers. It has attributes defining its sign (positive or negative) and width (the number of bits representing the integer). | ||
- `array`: Represents a collection of elements, all of the same type. It has attributes defining its length and the type of elements it holds. | ||
- `string`: Represents a sequence of characters with a specified length. | ||
- `struct`: A complex type representing a structure with various fields, each having a specific type and name. | ||
import DocCardList from "@theme/DocCardList"; | ||
|
||
<DocCardList /> |
8 changes: 4 additions & 4 deletions
8
docs/docs/reference/smart_contract_reference/storage/_category_.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"position": 0, | ||
"collapsible": true, | ||
"collapsed": true, | ||
"label": "Smart Contract Reference" | ||
"position": 0, | ||
"collapsible": true, | ||
"collapsed": true, | ||
"label": "Storage" | ||
} |
Oops, something went wrong.