PropChain smart contracts provide a comprehensive API for real estate tokenization and management on the blockchain. This document outlines the complete contract interface, methods, and data structures for all core system components.
The primary token contract for property representation, compatible with ERC-721 and ERC-1155 standards, with added real estate specific features and cross-chain support.
Registers a property and mints its corresponding ownership token.
Standard ERC-721 balance check.
Standard ERC-721 owner query.
Standard ERC-721 transfer with property-specific authorization checks.
safe_batch_transfer_from(from: AccountId, to: AccountId, ids: Vec<TokenId>, amounts: Vec<u128>, data: Vec<u8>) -> Result<(), Error>
Standard ERC-1155 batch transfer support.
attach_legal_document(token_id: TokenId, document_hash: Hash, document_type: String) -> Result<(), Error>
Attaches a legal document reference (IPFS hash) to a property token.
Updates the compliance verification status for a token.
Retrieves the complete on-chain ownership history for a property.
Manages user identity verification (KYC), AML checks, and jurisdiction-specific compliance requirements.
submit_verification(account: AccountId, jurisdiction: Jurisdiction, kyc_hash: [u8; 32], risk_level: RiskLevel, document_type: DocumentType, biometric_method: BiometricMethod, risk_score: u8) -> Result<()>
Submits a user for KYC/AML verification.
Checks if an account currently meets all compliance requirements (including GDPR consent).
Enforces compliance for contract calls.
Updates the Anti-Money Laundering status for a user.
update_sanctions_status(account: AccountId, passed: bool, list_checked: SanctionsList) -> Result<()>
Updates the sanctions screening status.
Manages GDPR data processing consent.
Enables secure cross-chain property token transfers using a multi-signature bridge architecture.
initiate_bridge_multisig(token_id: TokenId, destination_chain: ChainId, recipient: AccountId, required_signatures: u8, timeout_blocks: Option<u64>, metadata: PropertyMetadata) -> Result<u64, Error>
Initiates a cross-chain transfer request.
Allows bridge operators to sign/approve a pending request.
Executes the bridge operation once the required signature threshold is met.
Estimates the gas costs for a cross-chain transfer.
A decentralized insurance platform for properties, managing risk pools, premiums, and automated claims.
create_risk_pool(name: String, coverage_type: CoverageType, max_coverage_ratio: u32, reinsurance_threshold: u128) -> Result<u64, InsuranceError>
Creates a new insurance risk pool.
Allows users to provide capital to risk pools and earn rewards.
calculate_premium(property_id: u64, coverage_amount: u128, coverage_type: CoverageType) -> Result<PremiumCalculation, InsuranceError>
Calculates the insurance premium based on property risk assessment.
create_policy(property_id: u64, coverage_type: CoverageType, coverage_amount: u128, pool_id: u64, duration_seconds: u64, metadata_url: String) -> Result<u64, InsuranceError>
Issues a new insurance policy for a property.
Manages property-related documents and metadata stored on IPFS with integrated access control.
Validates and registers core property metadata.
register_ipfs_document(property_id: u64, ipfs_cid: IpfsCid, document_type: DocumentType, content_hash: Hash, file_size: u64, mime_type: String, is_encrypted: bool) -> Result<u64, Error>
Registers a document stored on IPFS.
Manages document access permissions.
Advanced privacy-preserving compliance using Zero-Knowledge proofs.
submit_zk_proof(proof_type: ZkProofType, public_inputs: Vec<[u8; 32]>, proof_data: Vec<u8>, metadata: Vec<u8>) -> Result<u64>
Submits a ZK proof for verification.
Verifies a submitted ZK proof.
Performs a compliance check without revealing any sensitive user data.
Note: PropertyToken replaces many of these functions in newer implementations.
Creates a new PropertyRegistry instance.
Registers a new property.
Note: AdvancedEscrow features are now integrated into core flows.
create_escrow(property_id: PropertyId, buyer: AccountId, amount: Balance) -> Result<EscrowId, Error>
Creates a new escrow for property transfer.
Provides real-time property valuations using multiple oracle sources with aggregation and confidence scoring.
Gets the current property valuation.
get_valuation_with_confidence(property_id: PropertyId) -> Result<ValuationWithConfidence, OracleError>
Gets property valuation with confidence metrics including volatility and confidence intervals.
Updates property valuation by aggregating prices from all active oracle sources.
pub struct PropertyMetadata {
pub location: String,
pub size: u64,
pub legal_description: String,
pub valuation: Balance,
pub documents_url: String,
}pub struct OwnershipTransfer {
pub from: AccountId,
pub to: AccountId,
pub timestamp: u64,
pub transaction_hash: Hash,
}pub struct ComplianceData {
pub status: VerificationStatus,
pub jurisdiction: Jurisdiction,
pub risk_level: RiskLevel,
pub verification_timestamp: Timestamp,
pub expiry_timestamp: Timestamp,
pub kyc_hash: [u8; 32],
pub aml_checked: bool,
pub sanctions_checked: bool,
pub document_type: DocumentType,
pub biometric_method: BiometricMethod,
pub risk_score: u8,
}pub struct InsurancePolicy {
pub policy_id: u64,
pub property_id: u64,
pub policyholder: AccountId,
pub coverage_type: CoverageType,
pub coverage_amount: u128,
pub premium_amount: u128,
pub deductible: u128,
pub start_time: u64,
pub end_time: u64,
pub status: PolicyStatus,
}pub struct IpfsDocument {
pub document_id: u64,
pub property_id: u64,
pub ipfs_cid: String,
pub document_type: DocumentType,
pub content_hash: Hash,
pub file_size: u64,
pub uploader: AccountId,
pub uploaded_at: u64,
}pub struct ZkProofData {
pub proof_type: ZkProofType,
pub status: ZkProofStatus,
pub public_inputs: Vec<[u8; 32]>,
pub proof_data: Vec<u8>,
pub created_at: Timestamp,
pub expires_at: Timestamp,
}pub struct PropertyValuation {
pub property_id: u64,
pub valuation: u128, // Current valuation in USD with 8 decimals
pub confidence_score: u32, // Confidence score 0-100
pub sources_used: u32, // Number of price sources used
pub last_updated: u64, // Last update timestamp
pub valuation_method: ValuationMethod,
}pub enum Error {
TokenNotFound,
Unauthorized,
PropertyNotFound,
InvalidMetadata,
ComplianceFailed,
BridgePaused,
InsufficientSignatures,
}pub enum ComplianceError {
NotAuthorized,
NotVerified,
VerificationExpired,
HighRisk,
JurisdictionNotSupported,
ConsentNotGiven,
}pub enum InsuranceError {
PolicyNotFound,
ClaimNotFound,
InsufficientPremium,
InsufficientPoolFunds,
OracleVerificationFailed,
PropertyNotInsurable,
}let metadata = PropertyMetadata {
location: "123 Main St, City, State".to_string(),
size: 2000,
legal_description: "Lot 1, Block 2".to_string(),
valuation: 500000,
documents_url: "ipfs://Qm...".to_string(),
};
let token_id = property_token.register_property_with_token(metadata)?;let request_id = bridge.initiate_bridge_multisig(
token_id,
destination_chain_id,
recipient_account,
2, // required signatures
Some(100), // timeout blocks
metadata
)?;let policy_id = insurance.create_policy(
property_id,
CoverageType::Comprehensive,
500000, // coverage amount
pool_id,
31536000, // 1 year in seconds
"https://metadata.url".to_string()
)?;let is_compliant = zk_compliance.anonymous_compliance_check(
user_account,
vec![ZkProofType::IdentityVerification, ZkProofType::FinancialStanding]
);- Use efficient data structures (e.g.,
MappingoverVec) - Batch operations when possible (use
safe_batch_transfer_from) - Minimize storage writes
- Use appropriate visibility modifiers
- Always validate input parameters
- Implement proper access control using
require_compliance - Use multi-signature verification for high-value operations (Bridge, Escrow)
- Monitor contract events for anomalies