Skip to content

Instantly share code, notes, and snippets.

@DavideSilva
Created March 7, 2023 12:44
Show Gist options
  • Save DavideSilva/534b244e5abbbd26f380c8a746908aba to your computer and use it in GitHub Desktop.
Save DavideSilva/534b244e5abbbd26f380c8a746908aba to your computer and use it in GitHub Desktop.
#[contract]
mod HelloStarknet {
struct Storage {
balance: felt,
}
#[external]
fn increase_balance(amount: felt) {
let new_balance = balance::read() + amount;
balance::write(new_balance);
}
#[view]
fn get_balance() -> felt {
balance::read()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment