Additional Functions
1. Cooldown Function
mapping(address => uint256) public depositTimestamps; // Timestamp of the last deposit
uint256 public cooldownPeriod = 7 days; // Cooldown period (7 days)
function deposit(uint256 _amount) public {
require(_amount > 0, "Amount must be greater than 0");
depositTimestamps[msg.sender] = block.timestamp; // Record the deposit timestamp
IERC20(want).safeTransferFrom(msg.sender, address(this), _amount);
_stake(_amount); // Delegate assets to the pool
}
function unstake(uint256 _amount) public {
require(block.timestamp >= depositTimestamps[msg.sender] + cooldownPeriod, "Cooldown period not over");
_unstake(_amount); // Withdraw assets from the pool
IERC20(want).safeTransfer(msg.sender, _amount);
}2. Exit Pool Function
3. Pool Activation
Security
Last updated