Problem
No logic validates whether a workspace owner is eligible to withdraw their accumulated escrow earnings. Withdrawals lack caller verification and balance checks.
Proposed Solution
Create contracts/cntr/withdrawal_validator.rs implementing pub fn validate_withdrawal(owner_address: &str, caller_address: &str, available_balance: i128, requested_amount: i128) -> Result<(), &'static str>. Validates: caller must be the owner, amount must be positive, amount must not exceed available balance. All implementation must live inside contracts/cntr/.
Acceptance Criteria
Problem
No logic validates whether a workspace owner is eligible to withdraw their accumulated escrow earnings. Withdrawals lack caller verification and balance checks.
Proposed Solution
Create
contracts/cntr/withdrawal_validator.rsimplementingpub fn validate_withdrawal(owner_address: &str, caller_address: &str, available_balance: i128, requested_amount: i128) -> Result<(), &'static str>. Validates: caller must be the owner, amount must be positive, amount must not exceed available balance. All implementation must live insidecontracts/cntr/.Acceptance Criteria
contracts/cntr/withdrawal_validator.rsErr("Unauthorized: caller is not the owner")when caller != ownerErr("Withdrawal amount must be positive")whenrequested_amount <= 0Err("Insufficient balance")whenrequested_amount > available_balanceOk(())when all validations passcargo test