Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not return ticker & supply without ex1 #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions contracts/Evaluator.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ func read_ticker{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr
player_address: felt
) -> (ticker: felt) {
let (rank) = assigned_rank(player_address);
with_attr_error_message("No rank assigned via ex1_assign_rank. Maybe the transaction is pending?") {
assert_not_zero(rank);
}
let (ticker) = random_attributes_storage.read(rank, 0);
return (ticker,);
}
Expand All @@ -103,6 +106,9 @@ func read_supply{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr
player_address: felt
) -> (supply: Uint256) {
let (rank) = assigned_rank(player_address);
with_attr_error_message("No rank assigned via ex1_assign_rank. Maybe the transaction is pending? ") {
assert_not_zero(rank);
}
let (supply_felt) = random_attributes_storage.read(rank, 1);
let supply: Uint256 = Uint256(supply_felt, 0);
return (supply,);
Expand All @@ -122,6 +128,7 @@ func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr
ex_initializer(_tuto_erc20_address, _players_registry, _workshop_id);
dummy_token_address_storage.write(_dummy_token_address);
teacher_accounts.write(_first_teacher, 1);
rank_storage.write(1); // 0 will be used to flag unassigned addresses
// Hard coded value for now
max_rank_storage.write(100);
return ();
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/ex00_base.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func assign_rank_to_player{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range

// Checking if we reach max_rank
if (new_next_rank == max_rank) {
next_rank_storage.write(0);
next_rank_storage.write(1);
} else {
next_rank_storage.write(new_next_rank);
}
Expand Down