From ce4383a6bb5380069e84a746d50c68b7b5d9482a Mon Sep 17 00:00:00 2001 From: t11s Date: Tue, 5 Oct 2021 20:59:33 -0700 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20lastHarvestTimestamp=20->?= =?UTF-8?q?=20lastHarvest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Vault.sol | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Vault.sol b/src/Vault.sol index b9b869a..be8055f 100644 --- a/src/Vault.sol +++ b/src/Vault.sol @@ -137,11 +137,10 @@ contract Vault is ERC20, Auth { HARVEST STORAGE //////////////////////////////////////////////////////////////*/ - /// @notice The most recent timestamp where a harvest occurred. - uint256 public lastHarvestTimestamp; + /// @notice A timestamp representing when the last harvest occurred. + uint256 public lastHarvest; /// @notice The amount of locked profit at the end of the last harvest. - /// @dev Does not change between harvests, instead unlocked profit is computed and subtracted from on the fly. uint256 public maxLockedProfit; /// @notice The approximate period in seconds over which locked profits are unlocked. @@ -345,9 +344,9 @@ contract Vault is ERC20, Auth { function lockedProfit() public view returns (uint256) { // TODO: Cache SLOADs? return - block.timestamp >= lastHarvestTimestamp + profitUnlockDelay + block.timestamp >= lastHarvest + profitUnlockDelay ? 0 // If profit unlock delay has passed, there is no locked profit. - : maxLockedProfit - (maxLockedProfit * (block.timestamp - lastHarvestTimestamp)) / profitUnlockDelay; + : maxLockedProfit - (maxLockedProfit * (block.timestamp - lastHarvest)) / profitUnlockDelay; } /// @notice Returns the amount of underlying tokens that idly sit in the Vault. @@ -386,8 +385,8 @@ contract Vault is ERC20, Auth { : 0 // If the strategy registered a net loss we don't have any new profit to lock. ); - // Set the lastHarvestTimestamp to the current timestamp, as a harvest was just completed. - lastHarvestTimestamp = block.timestamp; + // Set lastHarvest to the current timestamp. + lastHarvest = block.timestamp; // TODO: Cache SLOAD here? emit Harvest(strategy, maxLockedProfit);