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

[feat] Implement the functionality of removeMembers #36

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
23 changes: 19 additions & 4 deletions src/core/registry.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub trait IRegistry<TContractState> {
ref self: TContractState, profile_id: u256, pending_owner: ContractAddress
);
fn add_members(ref self: TContractState, profile_Id: u256, members: Array<ContractAddress>);
fn remove_members(ref self: TContractState, profile_Id: u256, members: Array<ContractAddress>);
fn update_profile_metadata(ref self: TContractState, profile_id: u256, metadata: Metadata);
fn get_profile_by_id(self: @TContractState, profile_id: u256) -> Registry::Profile;
}
Expand Down Expand Up @@ -243,10 +244,24 @@ pub mod Registry {
i += 1;
}
}
// Issue no. #6 Implement the functionality of removeMembers
// Use u256 instead of bytes32
// Down below is the function that is to be implemented in the contract but in cairo.
// https://github.com/allo-protocol/allo-v2/blob/4dd0ea34a504a16ac90e80f49a5570b8be9b30e9/contracts/core/Registry.sol#L311
// Issue no. #6 Implement the functionality of removeMembers
// Use u256 instead of bytes32
// Down below is the function that is to be implemented in the contract but in cairo.
// https://github.com/allo-protocol/allo-v2/blob/4dd0ea34a504a16ac90e80f49a5570b8be9b30e9/contracts/core/Registry.sol#L311
fn remove_members(ref self: ContractState, profile_Id: u256, members: Array<ContractAddress>){
let profile_id: felt252 = profile_Id.try_into().unwrap();
self.member_length.write(members.len().into());
let mut i = 0;
loop{
if(i >= members.len().into()){
break;
}
let member: ContractAddress = *members.at(i);
self.accessControl._revoke_role(profile_id, member);
i += 1;

}
}

// Issue no. #16 Implement the functionality of recoverFunds
// Down below is the function that is to be implemented in the contract but in cairo.
Expand Down
Loading