# Bond operations will always revert at certain time when putOptionsRequired is true

Dopex bond purchases revert for ~14 minutes each funding epoch because OptionPricingSimple truncates timeToExpiry under 864s to zero, breaking Black-Scholes.

- Payout: Contest reward
- Severity: high
- Program: Dopex
- Credited: said
- Disclosed: 2023-12-29
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2023-08-dopex-findings/issues/756
- Library page: https://bugbountylibrary.com/r/c4%3A2023-08-dopex%3AH-06
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:dos

**Target:** RdpxV2Core bond / PerpetualAtlanticVault option pricing
**Root cause:** OptionPricingSimple computes timeToExpiry = (expiry*100)/86400, so sub-864-second expiries truncate to 0; Black-Scholes then divides by v*sqrt(T)=0 and reverts.
**Steps:**
1. Call `bond()` with `putOptionsRequired=true` shortly before `nextFundingPaymentTimestamp()`.
2. `_purchaseOptions` calls `PerpetualAtlanticVault.purchase`, which calls `calculatePremium`.
3. `calculatePremium` passes `timeToExpiry = nextFundingPaymentTimestamp() - block.timestamp` (<864s) to `OptionPricingSimple.getOptionPrice`.
4. `getOptionPrice` computes `(expiry*100)/86400 == 0`, Black-Scholes divides by zero and reverts, so bond reverts.
5. PoC: `vm.warp(block.timestamp + 7 days - 863 seconds)` then call `optionPricingSimple.getOptionPrice(strike, price, 100, timeToExpiry)` expecting revert.
**How found:** Reading the bond->purchase->calculatePremium->getOptionPrice call chain and noticing the integer division of expiry by 86400 truncates to zero for short expiries, causing a divide-by-zero in Black-Scholes.
**Insight:** When a pricing/math library divides by a time or scale factor, check integer truncation at small inputs; a value that becomes 0 can turn a benign edge into a recurring DoS window each epoch.
