This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from starknet-edu/cairo1-chapter1
Cairo1 chapter1 - chapters 1.5 and 1.5
- Loading branch information
Showing
12 changed files
with
627 additions
and
29 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 +1,8 @@ | ||
* xref:index.adoc[Chapter 1: Getting Started] | ||
** xref:environment_setup.adoc[1.1 Setting up Your Environment] | ||
** xref:cairo_basics_1.adoc[1.2 Cairo Basics I] | ||
** xref:cairo_basics_2.adoc[1.3 Cairo Basics II] | ||
** xref:starknet_contracts.adoc[1.4 Starknet Smart Contracts] | ||
** xref:deploying_contracts.adoc[1.5 Deploying Smart Contracts] | ||
** xref:recursion.adoc[1.6 Recursion] | ||
** 1.7 Industry Standards | ||
*** xref:openzeppelin.adoc[1.7.1 Open Zeppelin] | ||
*** xref:erc20.adoc[1.7.2 Deploying an ERC20] | ||
*** xref:erc721.adoc[1.7.3 Deploying an ERC721] | ||
*** xref:erc1155.adoc[1.7.4 Deploying an ERC1155] | ||
*** xref:proxy.adoc[1.7.5 Deploying a Proxy] | ||
** xref:transpiling.adoc[1.8 Transpiling Solitidy Code into Cairo] | ||
** xref:what_is_starknet.adoc[1.1 What is StarkNet] | ||
** xref:why_starknet.adoc[1.2 Why StarkNet] | ||
** xref:what_is_cairo.adoc[1.3 What is Cairo] | ||
** xref:why_cairo.adoc[1.4 Why Cairo] | ||
** xref:environment_setup.adoc[1.5 Setting up Your Environment] | ||
** xref:deploying_contracts.adoc[1.6 Deploying Smart Contracts] | ||
** xref:writing_first_contract.adoc[1.7 Writing your first StarkNet contract] |
21 changes: 21 additions & 0 deletions
21
chapters/modules/chapter_1/pages/contracts/cairo/simple_storage.cairo
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,21 @@ | ||
#[contract] | ||
mod SimpleStorage { | ||
struct Storage { | ||
balance: felt252 | ||
} | ||
|
||
#[event] | ||
fn BalanceIncreased(balance: felt252) {} | ||
|
||
#[external] | ||
fn increase_balance(amount: felt252) { | ||
let new_balance = balance::read() + amount; | ||
balance::write(new_balance); | ||
BalanceIncreased(new_balance); | ||
} | ||
|
||
#[view] | ||
fn get_balance() -> felt252 { | ||
balance::read() | ||
} | ||
} |
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.