added withdrawstake addition
This commit is contained in:
@@ -506,6 +506,33 @@ contract CunaFinanceBsc is Initializable, ReentrancyGuardUpgradeable {
|
||||
|
||||
// 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)
|
||||
/// @dev Only to be used by bots for initial setup
|
||||
|
||||
Reference in New Issue
Block a user