diff --git a/contracts/oracles/PendlePTOracle.sol b/contracts/oracles/PendlePTOracle.sol index a411d443..26e59376 100644 --- a/contracts/oracles/PendlePTOracle.sol +++ b/contracts/oracles/PendlePTOracle.sol @@ -112,8 +112,7 @@ contract PendlePTOracle is AggregatorV2V3Interface { int256 ptRate = _getPTRate(); // ptRate is always returned in 1e18 decimals (rateDecimals) - answer = (ptRate * baseToUSD * rateDecimals) / - (baseToUSDDecimals * rateDecimals); + answer = (ptRate * baseToUSD) / baseToUSDDecimals; } function latestRoundData() external view override returns ( diff --git a/contracts/vaults/staking/PendlePTKelpVault.sol b/contracts/vaults/staking/PendlePTKelpVault.sol index 72a3f7a4..d9051633 100644 --- a/contracts/vaults/staking/PendlePTKelpVault.sol +++ b/contracts/vaults/staking/PendlePTKelpVault.sol @@ -10,6 +10,7 @@ import { KelpLib, KelpCooldownHolder, rsETH} from "./protocols/Kelp.sol"; contract PendlePTKelpVault is PendlePrincipalToken { using TypeConvert for int256; address public HOLDER_IMPLEMENTATION; + uint256 internal constant rsETH_PRECISION = 1e18; constructor( address marketAddress, @@ -43,10 +44,10 @@ contract PendlePTKelpVault is PendlePrincipalToken { uint256 requestId, uint256 /* totalVaultShares */, uint256 /* stakeAssetPrice */ ) internal override view returns (uint256) { uint256 tokenOutSY = getTokenOutSYForWithdrawRequest(requestId); - // NOTE: in this vault the tokenOutSy is known to be stETH. + // NOTE: in this vault the tokenOutSy is known to be rsETH. (int256 ethPrice, /* */) = TRADING_MODULE.getOraclePrice(TOKEN_OUT_SY, BORROW_TOKEN); return (tokenOutSY * ethPrice.toUint() * BORROW_PRECISION) / - (Constants.EXCHANGE_RATE_PRECISION * Constants.EXCHANGE_RATE_PRECISION); + (rsETH_PRECISION * Constants.EXCHANGE_RATE_PRECISION); } function _initiateSYWithdraw( diff --git a/contracts/vaults/staking/protocols/Kelp.sol b/contracts/vaults/staking/protocols/Kelp.sol index 12e2cc9a..bba0f687 100644 --- a/contracts/vaults/staking/protocols/Kelp.sol +++ b/contracts/vaults/staking/protocols/Kelp.sol @@ -100,8 +100,11 @@ library KelpLib { function _canFinalizeWithdrawRequest(uint256 requestId) internal view returns (bool) { address holder = address(uint160(requestId)); - (/* */, /* */, /* */, uint256 userWithdrawalRequestNonce) = WithdrawManager.getUserWithdrawalRequest(Deployments.ALT_ETH_ADDRESS, holder, 0); + (/* */, /* */, uint256 userWithdrawalStartBlock, uint256 userWithdrawalRequestNonce) = WithdrawManager.getUserWithdrawalRequest(Deployments.ALT_ETH_ADDRESS, holder, 0); uint256 nextNonce = WithdrawManager.nextLockedNonce(Deployments.ALT_ETH_ADDRESS); - return userWithdrawalRequestNonce < nextNonce; + return ( + userWithdrawalRequestNonce < nextNonce && + (userWithdrawalStartBlock + WithdrawManager.withdrawalDelayBlocks()) < block.number + ); } } \ No newline at end of file