From bd347cd2412a1dfc7c1006dd04e6fd7b9c8c2479 Mon Sep 17 00:00:00 2001 From: Manush Sanchela Date: Sat, 31 Aug 2024 09:59:19 +0530 Subject: [PATCH] Update registry.cairo --- src/core/registry.cairo | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/core/registry.cairo b/src/core/registry.cairo index c96217d..2463915 100644 --- a/src/core/registry.cairo +++ b/src/core/registry.cairo @@ -30,6 +30,8 @@ struct Metadata { #[starknet::interface] pub trait IRegistry { 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 ); @@ -39,7 +41,7 @@ pub trait IRegistry { } #[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; @@ -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 @@ -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