added withdrawstake addition

This commit is contained in:
2025-09-17 16:23:35 +02:00
parent bd880c18d1
commit d5f2152547
2 changed files with 57 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@@ -506,6 +506,33 @@ contract CunaFinanceBsc is Initializable, ReentrancyGuardUpgradeable {
// Bot Functions for Staking Management // Bot Functions for Staking Management
/// @notice Create a withdraw stake for a user (for admin/migration purposes)
/// @dev Only to be used by bots for manual withdraw stake creation
/// @param user The user address to create the withdraw stake for
/// @param amount The amount for the withdraw stake
/// @param unlockTime The unlock timestamp for the withdraw stake
/// @param token The token address for the withdraw stake
function createWithdrawStakeForUser(address user, uint256 amount, uint256 unlockTime, address token) external onlyBot {
require(user != address(0), "Invalid user address");
require(amount > 0, "Invalid amount");
require(token != address(0), "Invalid token address");
// Generate unique stakeId
stakeIdCounter++;
// Create the withdraw stake
withdrawStakes[user].push(WithdrawStake({
stakeId: stakeIdCounter,
amount: amount,
unlockTime: unlockTime,
token: token
}));
// Increment withdraw liabilities for this token
withdrawLiabilities[token] += amount;
emit StakeWithdrawn(user, amount, stakeIdCounter);
}
/// @notice Batch create stakes for multiple users (efficient for migration) /// @notice Batch create stakes for multiple users (efficient for migration)
/// @dev Only to be used by bots for initial setup /// @dev Only to be used by bots for initial setup