Skip to content

Commit

Permalink
Merge pull request #59 from NoshonNetworks/registry
Browse files Browse the repository at this point in the history
test
  • Loading branch information
fishonamos authored Oct 15, 2024
2 parents b87736a + 9e4e593 commit 78afa9e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion land_registry/src/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct LandApprovalDetails {
timestamp: u64,
}

#[derive(Drop, Copy, Clone, Serde, starknet::Store, PartialEq)]
#[derive(Debug, Drop, Copy, Clone, Serde, starknet::Store, PartialEq)]
pub enum LandUse {
Residential,
Commercial,
Expand Down
47 changes: 39 additions & 8 deletions land_registry/src/land_register.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@ pub mod LandRegistryContract {
use core::array::SpanTrait;
use starknet::storage::{Map, StorageMapWriteAccess};


#[storage]
struct Storage {
lands: Map::<u256, Land>,
owner_lands: Map::<ContractAddress, Span<u256>>,
owner_lands: Map::<ContractAddress, u256>,
land_count: u256,
}


//lands

//What are we storing?

//lands, owners?

#[event]
#[derive(Drop, starknet::Event)]
enum Event {
Expand Down Expand Up @@ -76,6 +70,10 @@ pub mod LandRegistryContract {
self.lands.write(land_id, new_land);
self.land_count.write(land_id);

self.owner_lands.write(caller, land_id);

//Write new land to a specific owner..

self
.emit(
LandRegistered {
Expand Down Expand Up @@ -106,3 +104,36 @@ pub mod LandRegistryContract {
}
}
}

// #[cfg(test)]
// mod tests {
// use starknet::{get_caller_address, get_block_timestamp, ContractAddress};

// // Import the interface and dispatcher to be able to interact with the contract.
// use super::{SimpleContract, IContractDispatcher, ISimpleContractDispatcherTrait};

// // Import the deploy syscall to be able to deploy the contract.
// use starknet::{SyscallResultTrait, syscalls::deploy_syscall};
// use starknet::{get_contract_address, contract_address_const};

// // Use starknet test utils to fake the contract_address
// use starknet::testing::set_contract_address;

// // Deploy the contract and return its dispatcher.
// fn deploy(initial_value: u32) -> ISimpleContractDispatcher {
// // Declare and deploy
// let (contract_address, _) = deploy_syscall(
// SimpleContract::TEST_CLASS_HASH.try_into().unwrap(),
// 0,
// array![initial_value.into()].span(),
// false
// )
// .unwrap_syscall();

// // Return the dispatcher.
// // The dispatcher allows to interact with the contract based on its interface.
// ISimpleContractDispatcher { contract_address }
// }


// }
1 change: 1 addition & 0 deletions land_registry/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod interface;
pub mod land_register;
pub mod utils;
pub mod tests;
1 change: 0 additions & 1 deletion land_registry/src/tests/test_land_register.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ use starknet::ContractAddress;
// TESTS
// *************************************************************************

//#[test]

0 comments on commit 78afa9e

Please sign in to comment.