Cooldown Mechanism
CooldownManager enforces an anti-fraud cooldown for C2C trades. Its core purpose is to prevent malicious participants from withdrawing their deposit and disappearing right after completing a C2C trade—a buyer's deposit must wait 24 hours after their last active trade ends before it can be withdrawn.
Scope
CooldownManager applies specifically to the C2C buyer deposit. It does not affect marketplace listing or ordering flows:
- The deposit a buyer pays in a C2C trade (the
buyerDepositRateportion, locked into CooldownManager) - Once the cooldown ends, the buyer can call
CooldownManager.withdrawDeposit()to reclaim the deposit
Cooldown State Logic
Trade in progress → active trade count > 0 → cannot withdraw deposit
Last trade ends → cooldown starts (24h)
After 24h → deposit can be withdrawn
- When a C2C trade is created,
CooldownManager.activeTradeCount[user]is incremented by 1 - When a trade completes or is cancelled,
activeTradeCount[user]is decremented by 1 - When
activeTradeCountdrops to 0,cooldownStartrecords the current time - Only after
cooldownStart + 24hhas elapsed doescanWithdraw()return true
Withdrawal Conditions (canWithdraw)
A buyer must satisfy all of the following conditions simultaneously to withdraw the deposit:
- No C2C trades currently in progress (
activeTradeCount == 0) - No active C2C sell orders or buy orders (
activeC2COrderCount == 0) - No arbitration in progress (
hasDispute == false) - More than 24 hours have passed since the last trade ended (
COOLDOWN_PERIOD)
Deposit Disposition
When a buyer defaults in a C2C trade (loses arbitration), the deposit is disposed of according to the ruling. The disposition amount is not decided manually—it is computed by C2CTradeTemplate using a fixed formula: the deposit first covers the shortfall of the 10% arbitration fee, and any remainder is force-refunded to the buyer.
penalizeToCase(buyer, caseContract, amount, token): transfers the deposit to the arbitration case contract to pay the arbitration feepenalize(buyer, seller, amount, token): transfers the deposit to the seller as compensationreleaseDeposit(buyer, amount, token): refunds the remaining deposit to the buyer
Platform Admin Authority Boundaries
Every exit path for the deposit is constrained by contract-level authorization. The platform (owner/admin) cannot autonomously penalize, withhold, or transfer this deposit:
- Only authorized trade contracts can trigger disposition:
penalize,penalizeToCase, andreleaseDepositall carry theonlyAuthorizedmodifier and can only be called by C2CTrade clone contracts authorized by C2CFactory, with the amount determined by business logic (the arbitration ruling plus the formula above). No owner/admin function can call them directly. - Buyer self-withdrawal is bound by both cooldown and arbitration: when a buyer calls
withdrawDeposit()it carries thenoContractmodifier and can only withdraw the caller's own balance, and it must still passcanWithdraw()—no trades in progress, no active listings, no pending arbitration, and the 24-hour cooldown elapsed. - Even forced cancellation for content violations does not seize the deposit: the admin's only intervention entry point,
adminCancel(), is used to take down violating content. In that case the trade's USDT is routed to the platform fee-split contract, but the buyer's deposit is refunded to the buyer as-is (viareleaseDeposit), so the deposit is never permanently locked—the admin cannot appropriate the deposit through this path.
In other words, the decision of "compensate the seller or penalize" rests with the on-chain arbitration result and the cooldown rules, not the platform. The platform can neither autonomously penalize nor autonomously withhold the buyer's deposit.
Merchant Deposit Withdrawal Cooldown (Separate Mechanism)
The withdrawal cooldown for merchant deposits is managed by DepositFactory (distinct from CooldownManager) and requires:
- No active products, no auctions in progress, no active C2C listings, and no active trades
- After all business is settled, the 24-hour cooldown (
UNLOCK_COOLDOWN_PERIOD) must elapse before withdrawal
Key Parameters
| Parameter | Value | Source |
|---|---|---|
| C2C buyer deposit cooldown | 24 hours | CooldownManager.COOLDOWN_PERIOD |
| Merchant deposit unlock cooldown | 24 hours | DepositFactory.UNLOCK_COOLDOWN_PERIOD |