Skip to content

Commit

Permalink
feat: cairo 1 bool
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Apr 12, 2023
1 parent c1acd29 commit 52fed30
Show file tree
Hide file tree
Showing 9 changed files with 6,715 additions and 2,244 deletions.
26 changes: 19 additions & 7 deletions __mocks__/cairo/helloSierra/hello.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,36 @@
mod HelloStarknet {
struct Storage {
balance: felt252,
balance_u8: u8
balance_u8: u8,
status: bool,
}

// Increases the balance by the given amount.
// Felt252 test.
#[external]
fn increase_balance(amount: felt252) {
balance::write(balance::read() + amount);
}

#[view]
fn get_balance() -> felt252 {
balance::read()
}

// Bool Test
#[external]
fn increase_balance_u8(amount: u8) {
balance_u8::write(balance_u8::read() + amount);
fn set_status(new_status: bool) {
status::write(new_status);
}

// Returns the current balance.
#[view]
fn get_balance() -> felt252 {
balance::read()
fn get_status() -> bool {
status::read()
}

// u8 Test.
#[external]
fn increase_balance_u8(amount: u8) {
balance_u8::write(balance_u8::read() + amount);
}

#[view]
Expand Down
Loading

0 comments on commit 52fed30

Please sign in to comment.