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

feat: land approver #56

Merged
merged 1 commit into from
Oct 14, 2024
Merged
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
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 });
}
}
}
Loading