Skip to content

Commit

Permalink
Update registry.cairo
Browse files Browse the repository at this point in the history
  • Loading branch information
Manush-2005 committed Aug 31, 2024
1 parent 86b0bca commit bd347cd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/core/registry.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ struct Metadata {
#[starknet::interface]
pub trait IRegistry<TContractState> {
fn is_owner_of_profile(self: @TContractState, profile_id: u256, owner: ContractAddress) -> bool;
fn is_member_of_profile(self: @TContractState, profile_id: u256, member: ContractAddress) -> bool;
fn is_owner_or_member_of_profile(self: @TContractState, profile_id: u256, account: ContractAddress) -> bool;
fn update_profile_pending_owner(
ref self: TContractState, profile_id: u256, pending_owner: ContractAddress
);
Expand All @@ -39,7 +41,7 @@ pub trait IRegistry<TContractState> {
}
#[starknet::contract]
pub mod Registry {
use alexandria_encoding::sol_abi::encode::SolAbiEncodeTrait;
use alexandria_encoding::sol_abi::encode::SolAbiEncodeTrait;
use alexandria_bytes::{Bytes, BytesTrait};
use starknet::ContractAddress;
use core::poseidon::PoseidonTrait;
Expand Down Expand Up @@ -195,6 +197,13 @@ pub mod Registry {
// 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#L229

fn is_owner_or_member_of_profile(
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);
}


// Issue no. #3 Implement the functionality of isOwnerOfProfile
// 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#L245
Expand All @@ -208,6 +217,12 @@ pub mod Registry {
// 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#L245

fn is_member_of_profile(
self: @ContractState, profile_id:u256, member: ContractAddress
) -> bool {
return self.is_member_of_profile(profile_id, member);
}

// Issue no. #9 Implement the functionality of UpdateProfilePendingOwner
// 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#L253
Expand Down

0 comments on commit bd347cd

Please sign in to comment.