Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version = 1

[[package]]
name = "class_character"
name = "class_character_v2"
version = "0.1.0"
dependencies = [
"snforge_std",
Expand Down
12 changes: 7 additions & 5 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "class_character"
name = "class_character_v2"
version = "0.1.0"
edition = "2023_10"

Expand All @@ -12,7 +12,9 @@ starknet = "2.4.0"
[[target.starknet-contract]]
sierra = true
casm = true
[tool.sncast.cohort_test_deploy]
account = "cohort_test_deploy"
accounts-file = "your_accounts_file_goes_here" # add the path to account file path (the json file)
url = "your_rpc_url"

[tool.sncast.test_1]
account = "test_1"
accounts-file = "/Users/mac/.starknet_accounts/starknet_open_zeppelin_accounts.json"
url = "https://starknet-goerli.infura.io/v3/14d4909928f148238ba1da4db2886e77"

5 changes: 5 additions & 0 deletions src/class_character_v2.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[starknet::contract]
mod ClassCharacterV2 {
use core::zeroable::Zeroable;
use core::starknet::event::EventEmitter;
use starknet::{ContractAddress, get_caller_address};

Expand Down Expand Up @@ -54,9 +55,13 @@ mod ClassCharacterV2 {
) {
let owner = self.owner.read();
let caller = get_caller_address();

assert(owner == caller, 'caller not owner');

assert(!student_account.is_zero(), 'is zero address');
assert(_name != '', 'name cannot be empty');
assert(_age != 0, 'age cannot be zero');
assert(student_account != owner, 'not owner');
let student_instance = Student {
name: _name,
age: _age,
Expand Down