Skip to content

Commit

Permalink
chore:remove chain_id from create profile interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mubarak23 committed Oct 20, 2024
1 parent f9ba427 commit e01e07e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 21 deletions.
3 changes: 1 addition & 2 deletions src/interfaces/IHub.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ pub trait IHub<TState> {
karstnft_contract_address: ContractAddress,
registry_hash: felt252,
implementation_hash: felt252,
salt: felt252,
chain_id: felt252
salt: felt252
) -> ContractAddress;

fn set_profile_metadata_uri(
Expand Down
3 changes: 1 addition & 2 deletions src/interfaces/IProfile.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ pub trait IProfile<TState> {
karstnft_contract_address: ContractAddress,
registry_hash: felt252,
implementation_hash: felt252,
salt: felt252,
chain_id: felt252
salt: felt252
) -> ContractAddress;
fn set_profile_metadata_uri(
ref self: TState, profile_address: ContractAddress, metadata_uri: ByteArray
Expand Down
3 changes: 1 addition & 2 deletions src/mocks/interfaces/IComposable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ pub trait IComposable<TState> {
karstnft_contract_address: ContractAddress,
registry_hash: felt252,
implementation_hash: felt252,
salt: felt252,
chain_id: felt252,
salt: felt252
) -> ContractAddress;
fn set_profile_metadata_uri(
ref self: TState, profile_address: ContractAddress, metadata_uri: ByteArray
Expand Down
7 changes: 4 additions & 3 deletions src/profile/profile.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub mod ProfileComponent {
// *************************************************************************
use core::{traits::TryInto};
use starknet::{
ContractAddress, get_caller_address, get_block_timestamp, ClassHash,
get_tx_info, ContractAddress, get_caller_address, get_block_timestamp, ClassHash,
syscalls::deploy_syscall, SyscallResultTrait,
storage::{
StoragePointerWriteAccess, StoragePointerReadAccess, Map, StorageMapReadAccess,
Expand Down Expand Up @@ -65,8 +65,7 @@ pub mod ProfileComponent {
karstnft_contract_address: ContractAddress,
registry_hash: felt252,
implementation_hash: felt252,
salt: felt252,
chain_id: felt252,
salt: felt252
) -> ContractAddress {
// mint karst nft
let recipient = get_caller_address();
Expand All @@ -78,6 +77,8 @@ pub mod ProfileComponent {
}
let token_id = IKarstNFTDispatcher { contract_address: karstnft_contract_address }
.get_user_token_id(recipient);
let tx_info = get_tx_info().unbox();
let chain_id = tx_info.chain_id;
// create tokenbound account
let profile_address = IRegistryLibraryDispatcher {
class_hash: registry_hash.try_into().unwrap()
Expand Down
3 changes: 0 additions & 3 deletions tests/test_hub.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ fn __setup__() -> (ContractAddress, ContractAddress, ContractAddress, ContractAd
nft_contract_address,
(*registry_class_hash.class_hash).into(),
(*account_class_hash.class_hash).into(),
2478,
2478
);
stop_cheat_caller_address(hub_contract_address);
Expand All @@ -80,7 +79,6 @@ fn __setup__() -> (ContractAddress, ContractAddress, ContractAddress, ContractAd
nft_contract_address,
(*registry_class_hash.class_hash).into(),
(*account_class_hash.class_hash).into(),
2478,
2478
);

Expand All @@ -92,7 +90,6 @@ fn __setup__() -> (ContractAddress, ContractAddress, ContractAddress, ContractAd
nft_contract_address,
(*registry_class_hash.class_hash).into(),
(*account_class_hash.class_hash).into(),
2478,
2478
);
stop_cheat_caller_address(hub_contract_address);
Expand Down
6 changes: 3 additions & 3 deletions tests/test_profile.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn test_profile_creation() {
start_cheat_caller_address(profile_contract_address, USER.try_into().unwrap());
start_cheat_caller_address(nft_contract_address, USER.try_into().unwrap());
let profile_address = profileDispatcher
.create_profile(nft_contract_address, registry_class_hash, account_class_hash, 2456, 2456);
.create_profile(nft_contract_address, registry_class_hash, account_class_hash, 2456);

// test a new karst nft is minted
let last_minted_id = karstNFTDispatcher.get_last_minted_id();
Expand Down Expand Up @@ -103,7 +103,7 @@ fn test_profile_metadata() {
start_cheat_caller_address(profile_contract_address, USER.try_into().unwrap());
start_cheat_caller_address(nft_contract_address, USER.try_into().unwrap());
let profile_address = profileDispatcher
.create_profile(nft_contract_address, registry_class_hash, account_class_hash, 2456, 2456);
.create_profile(nft_contract_address, registry_class_hash, account_class_hash, 2456);

profileDispatcher
.set_profile_metadata_uri(
Expand Down Expand Up @@ -137,7 +137,7 @@ fn test_profile_creation_event() {
start_cheat_caller_address(nft_contract_address, USER.try_into().unwrap());

let profile_address = profileDispatcher
.create_profile(nft_contract_address, registry_class_hash, account_class_hash, 2456, 2456);
.create_profile(nft_contract_address, registry_class_hash, account_class_hash, 2456);

let token_id = karstNFTDispatcher.get_user_token_id(USER.try_into().unwrap());

Expand Down
9 changes: 3 additions & 6 deletions tests/test_publication.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ fn __setup__() -> (
nft_contract_address,
(*registry_class_hash.class_hash).into(),
(*account_class_hash.class_hash).into(),
2478,
2479
2478
);
let content_URI: ByteArray = "ipfs://helloworld";
let mut spy = spy_events();
Expand All @@ -100,8 +99,7 @@ fn __setup__() -> (
nft_contract_address,
(*registry_class_hash.class_hash).into(),
(*account_class_hash.class_hash).into(),
2479,
2482
2479
);
let content_URI: ByteArray = "ipfs://helloworld";
dispatcher
Expand All @@ -120,8 +118,7 @@ fn __setup__() -> (
nft_contract_address,
(*registry_class_hash.class_hash).into(),
(*account_class_hash.class_hash).into(),
2480,
2481
2480
);
let content_URI: ByteArray = "ipfs://helloworld";
dispatcher
Expand Down

0 comments on commit e01e07e

Please sign in to comment.