From 25378440c62ba060537cd7337568b6fdc13dbbd4 Mon Sep 17 00:00:00 2001 From: Nabila Sani <70010702+Nabeelahh@users.noreply.github.com> Date: Fri, 26 Jun 2026 07:57:55 +0000 Subject: [PATCH] storgae clean up --- Cargo.lock | 1 - contracts/escrow/src/errors.rs | 8 ++++++++ contracts/escrow/src/lib.rs | 7 ++++++- contracts/escrow/src/types.rs | 19 +++++++++++++++++++ contracts/staking/src/tests.rs | 1 - 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7299a4c6..caf5d11c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5864,7 +5864,6 @@ dependencies = [ "ink 5.1.1", "parity-scale-codec", "propchain-traits", - "proptest", "scale-info", ] diff --git a/contracts/escrow/src/errors.rs b/contracts/escrow/src/errors.rs index 9206cf7c..cae7c41d 100644 --- a/contracts/escrow/src/errors.rs +++ b/contracts/escrow/src/errors.rs @@ -55,6 +55,8 @@ impl core::fmt::Display for Error { Error::ApprovalRequestAlreadyExecuted => write!(f, "Large-transfer approval request already executed"), Error::ApprovalRequestCancelled => write!(f, "Large-transfer approval request was cancelled"), Error::LargeTransferApprovalRequired => write!(f, "Transfer requires multi-step approval due to large amount"), + Error::FeeRateTooHigh => write!(f, "Fee rate exceeds maximum allowed (1000 bps = 10%)"), + Error::InvalidFeeAmount => write!(f, "Fee calculation resulted in an invalid amount"), } } } @@ -107,6 +109,12 @@ impl ContractError for Error { Error::LargeTransferApprovalRequired => { propchain_traits::errors::escrow_codes::LARGE_TRANSFER_APPROVAL_REQUIRED } + Error::FeeRateTooHigh => { + propchain_traits::errors::escrow_codes::FEE_RATE_TOO_HIGH + } + Error::InvalidFeeAmount => { + propchain_traits::errors::escrow_codes::INVALID_FEE_AMOUNT + } } } diff --git a/contracts/escrow/src/lib.rs b/contracts/escrow/src/lib.rs index 185e1ce4..9c0633eb 100644 --- a/contracts/escrow/src/lib.rs +++ b/contracts/escrow/src/lib.rs @@ -76,6 +76,10 @@ mod propchain_escrow { fee_rate_bps: u16, /// Fee recipient account fee_recipient: Option, + /// Escrow analytics data + analytics: EscrowAnalytics, + /// Unique participant tracking for analytics + analytics_participants: Mapping, } // Events @@ -323,12 +327,13 @@ mod propchain_escrow { large_transfer_requests: Mapping::default(), large_transfer_request_count: 0, escrow_active_large_transfer: Mapping::default(), - // 0 means "use global constant from propchain_traits::constants" large_transfer_threshold: 0, very_large_transfer_threshold: 0, tax_compliance_contract, fee_rate_bps: 0, fee_recipient: None, + analytics: EscrowAnalytics::default(), + analytics_participants: Mapping::default(), } } diff --git a/contracts/escrow/src/types.rs b/contracts/escrow/src/types.rs index 1b028410..2a27b900 100644 --- a/contracts/escrow/src/types.rs +++ b/contracts/escrow/src/types.rs @@ -223,3 +223,22 @@ pub struct EscrowAnalytics { /// Number of unique participants (buyers + sellers) pub unique_participants: u64, } + +impl Default for EscrowAnalytics { + fn default() -> Self { + Self { + total_created: 0, + total_released: 0, + total_refunded: 0, + total_disputed: 0, + total_active: 0, + total_volume: 0, + total_released_volume: 0, + total_fees_collected: 0, + average_escrow_amount: 0, + average_dispute_resolution_time: 0, + total_disputes_resolved: 0, + unique_participants: 0, + } + } +} diff --git a/contracts/staking/src/tests.rs b/contracts/staking/src/tests.rs index be0de9b1..53ce59e4 100644 --- a/contracts/staking/src/tests.rs +++ b/contracts/staking/src/tests.rs @@ -1588,5 +1588,4 @@ fn set_early_withdrawal_penalty_max_cap() { assert_eq!(vesting_after_claim.claimable_at_block(200), 0); assert_eq!(vesting_after_claim.claimable_at_block(300), 500); } -}