Skip to content
Open
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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions contracts/escrow/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
}
}
Expand Down Expand Up @@ -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
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion contracts/escrow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ mod propchain_escrow {
fee_rate_bps: u16,
/// Fee recipient account
fee_recipient: Option<AccountId>,
/// Escrow analytics data
analytics: EscrowAnalytics,
/// Unique participant tracking for analytics
analytics_participants: Mapping<AccountId, bool>,
}

// Events
Expand Down Expand Up @@ -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(),
}
}

Expand Down
19 changes: 19 additions & 0 deletions contracts/escrow/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
1 change: 0 additions & 1 deletion contracts/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}