-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate listings and book to vocs
- Loading branch information
Showing
98 changed files
with
509 additions
and
851 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
2 changes: 1 addition & 1 deletion
2
...ced-concepts/account_abstraction/index.md → ...ced-concepts/account_abstraction/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
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
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
File renamed without changes.
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
12 changes: 0 additions & 12 deletions
12
src/advanced-concepts/struct-mapping-key.md → ...s/advanced-concepts/struct-mapping-key.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 |
---|---|---|
@@ -1,22 +1,10 @@ | ||
--- | ||
content: | ||
horizontalPadding: 50px | ||
width: 100% | ||
verticalPadding: 30px | ||
--- | ||
|
||
# Structs as mapping keys | ||
|
||
In order to use structs as mapping keys, you can use `#[derive(Hash)]` on the struct definition. This will automatically generate a hash function for the struct that can be used to represent the struct as a key in a `Map`. | ||
|
||
Consider the following example in which we would like to use an object of | ||
type `Pet` as a key in a `Map`. The `Pet` struct has three fields: `name`, `age` and `owner`. We consider that the combination of these three fields uniquely identifies a pet. | ||
|
||
<<<<<<<< HEAD:src/advanced-concepts/struct-mapping-key.md | ||
```cairo | ||
{{#include ../../listings/advanced-concepts/struct_as_mapping_key/src/contract.cairo}} | ||
======== | ||
```rust | ||
// [!include ~/listings/advanced-concepts/struct_as_mapping_key/src/contract.cairo] | ||
>>>>>>>> 261b110 (feat: migrate frontend framework from mdbook to vocs (#185)):pages/ch02/struct-mapping-key.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
6 changes: 3 additions & 3 deletions
6
src/applications/advanced_factory.md → pages/applications/advanced_factory.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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# AdvancedFactory: Crowdfunding | ||
|
||
This is an example of an advanced factory contract that manages crowdfunding Campaign contracts created in the ["Crowdfunding" chapter](./crowdfunding.md). The advanced factory allows for a centralized creation and management of `Campaign` contracts on the Starknet blockchain, ensuring that they adhere to a standard interface and can be easily upgraded. | ||
This is an example of an advanced factory contract that manages crowdfunding Campaign contracts created in the ["Crowdfunding" chapter](/applications/crowdfunding). The advanced factory allows for a centralized creation and management of `Campaign` contracts on the Starknet blockchain, ensuring that they adhere to a standard interface and can be easily upgraded. | ||
|
||
Key Features | ||
1. **Campaign Creation**: Users can create new crowdfunding campaigns with specific details such as title, description, goal, and duration. | ||
2. **Campaign Management**: The factory contract stores and manages the campaigns, allowing for upgrades and tracking. | ||
3. **Upgrade Mechanism**: The factory owner can update the implementation of the campaign contract, ensuring that all campaigns benefit from improvements and bug fixes. | ||
- the factory only updates it's `Campaign` class hash and emits an event to notify any listeners, but the `Campaign` creators are in the end responsible for actually upgrading their contracts. | ||
|
||
```cairo | ||
{{#include ../../listings/applications/advanced_factory/src/contract.cairo:contract}} | ||
```rust | ||
// [!include ~/listings/applications/advanced_factory/src/contract.cairo:contract] | ||
``` |
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,37 +1,20 @@ | ||
--- | ||
content: | ||
horizontalPadding: 50px | ||
width: 100% | ||
verticalPadding: 30px | ||
--- | ||
|
||
# ERC20 Token | ||
|
||
Contracts that follow the [ERC20 Standard](https://eips.ethereum.org/EIPS/eip-20) are called ERC20 tokens. They are used to represent fungible assets. | ||
|
||
To create an ERC20 contract, it must implement the following interface: | ||
|
||
<<<<<<<< HEAD:src/applications/erc20.md | ||
```cairo | ||
{{#include ../../listings/applications/erc20/src/token.cairo:interface}} | ||
======== | ||
```rust | ||
// [!include ~/listings/applications/erc20/src/token.cairo:interface] | ||
>>>>>>>> 261b110 (feat: migrate frontend framework from mdbook to vocs (#185)):pages/ch01/erc20.md | ||
``` | ||
|
||
In Starknet, function names should be written in _snake_case_. This is not the case in Solidity, where function names are written in _camelCase_. | ||
The Starknet ERC20 interface is therefore slightly different from the Solidity ERC20 interface. | ||
|
||
Here's an implementation of the ERC20 interface in Cairo: | ||
|
||
<<<<<<<< HEAD:src/applications/erc20.md | ||
```cairo | ||
{{#include ../../listings/applications/erc20/src/token.cairo:erc20}} | ||
======== | ||
```rust | ||
// [!include ~/listings/applications/erc20/src/token.cairo:erc20] | ||
>>>>>>>> 261b110 (feat: migrate frontend framework from mdbook to vocs (#185)):pages/ch01/erc20.md | ||
``` | ||
|
||
There's several other implementations, such as the [Open Zeppelin](https://docs.openzeppelin.com/contracts-cairo/0.7.0/erc20) or the [Cairo By Example](https://cairo-by-example.com/examples/erc20/) ones. |
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
Oops, something went wrong.