From 89995fc43603a3606e5dd62d43b6618507d405c0 Mon Sep 17 00:00:00 2001 From: saddam92 Date: Tue, 7 Apr 2026 13:42:24 +0000 Subject: [PATCH] fix: correct vesting schedule boundary and silent ETH transfer failure --- src/recovery/Recovery.sol | 2 +- src/smart-escrow/SmartEscrow.sol | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/recovery/Recovery.sol b/src/recovery/Recovery.sol index fbab950f..a695ac1c 100644 --- a/src/recovery/Recovery.sol +++ b/src/recovery/Recovery.sol @@ -43,7 +43,7 @@ contract Recovery is UUPSUpgradeable { function withdrawETH(address[] calldata targets, uint256[] calldata amounts) public onlyOwner { for (uint256 i = 0; i < targets.length; i++) { (bool success,) = targets[i].call{ value: amounts[i] }(""); - if (!success) continue; + require(success, "Recovery: ETH transfer failed"); } } } diff --git a/src/smart-escrow/SmartEscrow.sol b/src/smart-escrow/SmartEscrow.sol index 654bc665..666298aa 100644 --- a/src/smart-escrow/SmartEscrow.sol +++ b/src/smart-escrow/SmartEscrow.sol @@ -319,8 +319,12 @@ contract SmartEscrow is AccessControlDefaultAdminRules { function _vestingSchedule(uint256 timestamp) internal view returns (uint256) { if (timestamp < cliffStart) { return 0; - } else if (timestamp > end) { - return OP_TOKEN.balanceOf({ account: address(this) }) + released; + } else if (timestamp >= end) { + // Return the total number of tokens that were ever vested, computed from + // the schedule parameters, so the value is stable regardless of how many + // tokens have already been released and transferred out of this contract. + uint256 totalVestingEvents = (end - start) / vestingPeriod; + return initialTokens + totalVestingEvents * vestingEventTokens; } else { return initialTokens + ((timestamp - start) / vestingPeriod) * vestingEventTokens; }