Skip to content

Commit

Permalink
Pending changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Manush-2005 committed Sep 8, 2024
1 parent 3334b9f commit f100e38
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/core/registry.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ struct Metadata {
pointer: ByteArray,
}


// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⢿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣗⠀⠀⠀⢸⣿⣿⣿⡯⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Expand Down Expand Up @@ -82,6 +81,7 @@ pub mod Registry {
metadata: Metadata,
}


#[derive(Drop, Serde, starknet::Store)]
pub struct Profile {
id: u256,
Expand All @@ -92,6 +92,7 @@ pub mod Registry {
anchor: ContractAddress,
}


#[derive(Drop, starknet::Event)]
struct ProfilePendingOwnerUpdated {
#[key]
Expand Down Expand Up @@ -206,7 +207,7 @@ pub mod Registry {
self: @ContractState, profile_id: u256, account: ContractAddress
) -> bool {
return self._is_owner_of_profile(profile_id, account)
|| self.is_member_of_profile(profile_id, account);
|| self._is_member_of_profile(profile_id, account);
}


Expand All @@ -226,7 +227,7 @@ pub mod Registry {
fn is_member_of_profile(
self: @ContractState, profile_id: u256, member: ContractAddress
) -> bool {
return self.is_member_of_profile(profile_id, member);
return self._is_member_of_profile(profile_id, member);
}

// Issue no. #9 Implement the functionality of UpdateProfilePendingOwner
Expand Down Expand Up @@ -318,8 +319,14 @@ pub mod Registry {
return self.profiles_by_id.read(_profile_id).owner == _owner;
}
// Issue n. #5 Implement the functionality of _isMemberOfProfile
// 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#L384C14-L384C32

// 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#L384C14-L384C32
fn _is_member_of_profile(
self: @ContractState, _profile_id: u256, _owner: ContractAddress
) -> bool {
let _profile_id: felt252 = _profile_id.try_into().unwrap();
return self.accessControl.has_role(_profile_id, _owner);
}
}
}

0 comments on commit f100e38

Please sign in to comment.