Skip to content

Commit

Permalink
Merge pull request #28 from rajeshkumarrobert/feat/generateProfileID
Browse files Browse the repository at this point in the history
Implement generateprofileID
  • Loading branch information
Akashneelesh authored Aug 5, 2024
2 parents 135a327 + 182f0da commit 492ffb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2023_11"
[dependencies]
starknet = "2.6.3"
alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git" }
alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git" }
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.13.0" }

[dev-dependencies]
Expand Down
10 changes: 9 additions & 1 deletion src/core/registry.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub trait IRegistry<TContractState> {
}
#[starknet::contract]
pub mod Registry {
use alexandria_encoding::sol_abi::encode::SolAbiEncodeTrait;
use alexandria_bytes::{Bytes, BytesTrait};
use starknet::ContractAddress;
use core::poseidon::PoseidonTrait;
use core::hash::HashStateTrait;
Expand Down Expand Up @@ -212,7 +214,13 @@ pub mod Registry {
// Issue no. #18 Implement the functionality of _generateAnchor
// Internal function to create a _generateAnchor
// https://github.com/allo-protocol/allo-v2/blob/4dd0ea34a504a16ac90e80f49a5570b8be9b30e9/contracts/core/Registry.sol#L340

fn _generateProfileId(_nonce: u256, owner: ContractAddress) -> u256 {
let profileId = BytesTrait::new_empty()
.encode_packed(_nonce)
.encode_packed(owner)
.keccak();
return profileId;
}
// Issue no. #17 Implement the functionality of _checkOnlyProfileOwner
// 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#L331
Expand Down

0 comments on commit 492ffb3

Please sign in to comment.