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; }