Skip to content

Commit

Permalink
Clean up general staking vault
Browse files Browse the repository at this point in the history
  • Loading branch information
RCantu92 committed May 20, 2024
1 parent 1994635 commit 42a238e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion contracts/components/staking/GeneralFortaStakingVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ contract GeneralFortaStakingVault is ERC4626Upgradeable, AccessControlUpgradeabl

bytes32 public constant SLASHER_ROLE = keccak256("SLASHER_ROLE");
bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");

uint256 public constant MIN_WITHDRAWAL_DELAY = 1 days;
uint256 public constant MAX_WITHDRAWAL_DELAY = 90 days;

Expand Down Expand Up @@ -79,7 +80,7 @@ contract GeneralFortaStakingVault is ERC4626Upgradeable, AccessControlUpgradeabl
return _treasury;
}

/// Returns withdrawal delays need to wait before exiting vault (in seconds)
/// Returns withdrawal delay needed to wait before exiting vault (in seconds)
function withdrawalDelay() public view returns (uint64) {
return _withdrawalDelay;
}
Expand Down Expand Up @@ -109,11 +110,19 @@ contract GeneralFortaStakingVault is ERC4626Upgradeable, AccessControlUpgradeabl
function _authorizeUpgrade(address newImplementation) internal virtual override onlyRole(UPGRADER_ROLE) {
}

/**
* @inheritdoc ERC4626Upgradeable
* @dev Modified to track user deposits' timestamp for withdrawal delay
*/
function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal override {
_depositTimes[caller] = block.timestamp;
super._deposit(caller, receiver, assets, shares);
}

/**
* @inheritdoc ERC4626Upgradeable
* @dev Modified to check user deposits' timestamp for lapse of their withdrawal delay
*/
function _withdraw(
address caller,
address receiver,
Expand Down

0 comments on commit 42a238e

Please sign in to comment.