Skip to content
Open
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
11 changes: 10 additions & 1 deletion contracts/market/src/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,16 @@ pub fn deposit_collateral(
return Err(ContractError::MarketClosedToDeposits);
}

if env.ledger().timestamp() > market.end_time {
// Reject deposits at or after end_time. A market expires the moment the
// ledger timestamp reaches end_time, so a deposit submitted in the same
// ledger second as expiry must be rejected (>= not just >).
//
// Using strict greater-than (>) would admit a deposit at exactly
// end_time, which is inside the expired window from the market's
// perspective — the same ledger second is simultaneously the last
// valid trading instant and the first expired one, so we treat it as
// expired and reject it.
if env.ledger().timestamp() >= market.end_time {
return Err(ContractError::MarketExpired);
}

Expand Down