Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #59

Merged
merged 2 commits into from
Oct 15, 2024
Merged

test #59

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]

Loading