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

Accesscontrol getminters and minor naming changes #155

Merged
merged 2 commits into from
Feb 19, 2023
Merged
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
10 changes: 9 additions & 1 deletion src/utils/access/library.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func CarbonableAccessControl_role_members_index(role: felt, index: felt) -> (mem
}

@storage_var
func CarbonableAccessControl_role_members(role: felt, index: felt) -> (member: felt) {
func CarbonableAccessControl_role_members(role: felt, member: felt) -> (index: felt) {
bal7hazar marked this conversation as resolved.
Show resolved Hide resolved
}

@storage_var
Expand Down Expand Up @@ -204,6 +204,14 @@ namespace CarbonableAccessControl {
AccessControl._revoke_role(role, user);
let (old_size) = CarbonableAccessControl_role_members_len.read(role);
let (user_index) = CarbonableAccessControl_role_members.read(role, user);

// Case where user has been registered by an older mechanism
// Access control storage must be left unchanged
let (stored_user) = CarbonableAccessControl_role_members_index.read(role, user_index);
if (user != stored_user) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our case, I suppose we should revoke the role before upgrading, right?

return ();
}

let (last_user) = CarbonableAccessControl_role_members_index.read(role, old_size - 1);
CarbonableAccessControl_role_members_len.write(role, old_size - 1);
CarbonableAccessControl_role_members_index.write(role, user_index, last_user);
Expand Down
2 changes: 1 addition & 1 deletion src/vesting/vester.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func addVester{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}(
}

@view
func getVester{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() -> (
func getVesters{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() -> (
bal7hazar marked this conversation as resolved.
Show resolved Hide resolved
vesters_len: felt, vesters: felt*
) {
// Desc:
Expand Down