Skip to content

Commit

Permalink
land approver
Browse files Browse the repository at this point in the history
  • Loading branch information
fishonamos committed Oct 14, 2024
1 parent 538e65a commit f58c90d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
13 changes: 12 additions & 1 deletion land_registry/src/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ pub struct Land {
last_transaction_timestamp: u64,
}

struct LandApprovalDetails {
ApprovedBy: felt252,
Agency: felt252,
land: Land,
land_id: u256,
timestamp: u64,
}

#[derive(Drop, Copy, Clone, Serde, starknet::Store, PartialEq)]
pub enum LandUse {
Residential,
Expand All @@ -33,10 +41,13 @@ pub trait ILandRegistry<TContractState> {
fn register_land(
ref self: TContractState, location: felt252, area: u256, land_use: LandUse,
) -> u256;
//fn transfer_land(ref self: TContractState, land_id: u256, new_owner: ContractAddress);
fn transfer_land(ref self: TContractState, land_id: u256, new_owner: ContractAddress);
fn get_land(self: @TContractState, land_id: u256) -> Land;
//fn get_owner_lands(self: @TContractState, owner_lands: ContractAddress) -> Array<u256>;
//fn get_lands(self: @TContractState, owner: ContractAddress, location: felt252, land_use:
//felt252) -> Array<u256>;

fn update_land(ref self: TContractState, land_id: u256, area: u256, land_use: LandUse);
// fn get_approved_lands
//fn approve_land
}
11 changes: 9 additions & 2 deletions land_registry/src/land_register.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ pub mod LandRegistryContract {
}


//What are we storing
//lands

//lands, owners.
//What are we storing?

//lands, owners?

#[event]
#[derive(Drop, starknet::Event)]
Expand Down Expand Up @@ -97,5 +99,10 @@ pub mod LandRegistryContract {

self.emit(LandUpdated { land_id: land_id, area: area, land_use: land_use.into(), });
}

fn transfer_land(ref self: ContractState, land_id: u256, new_owner: ContractAddress) {
let land = self.lands.read(land_id);
self.lands.write(land_id, Land { owner: new_owner, ..land });
}
}
}

0 comments on commit f58c90d

Please sign in to comment.