Resync
This commit is contained in:
@@ -506,27 +506,6 @@ contract CunaFinanceBsc is Initializable, ReentrancyGuardUpgradeable {
|
||||
|
||||
// Bot Functions for Staking Management
|
||||
|
||||
/// @notice Create or update a user's big stake (for migration or manual adjustment)
|
||||
/// @dev Only to be used by bots for initial setup or emergency adjustments
|
||||
/// @param user The user address to create/update stake for
|
||||
/// @param amount The stake amount
|
||||
function createUserStake(address user, uint256 amount) external onlyBot {
|
||||
require(user != address(0), "Invalid address");
|
||||
require(amount > 0, "Invalid amount");
|
||||
|
||||
// Update total stakes accounting
|
||||
totalBigStakes = totalBigStakes - userBigStake[user] + amount;
|
||||
|
||||
// Set original stake only if this is the first time (never changes after)
|
||||
if (userOriginalStake[user] == 0) {
|
||||
userOriginalStake[user] = amount;
|
||||
}
|
||||
|
||||
// Set user's big stake
|
||||
userBigStake[user] = amount;
|
||||
|
||||
emit StakeCreated(user, amount);
|
||||
}
|
||||
|
||||
/// @notice Batch create stakes for multiple users (efficient for migration)
|
||||
/// @dev Only to be used by bots for initial setup
|
||||
@@ -545,6 +524,11 @@ contract CunaFinanceBsc is Initializable, ReentrancyGuardUpgradeable {
|
||||
// Update accounting
|
||||
totalAdded = totalAdded - userBigStake[users[i]] + amounts[i];
|
||||
|
||||
// Set original stake only if this is the first time (never changes after)
|
||||
if (userOriginalStake[users[i]] == 0) {
|
||||
userOriginalStake[users[i]] = amounts[i];
|
||||
}
|
||||
|
||||
// Set user's big stake
|
||||
userBigStake[users[i]] = amounts[i];
|
||||
|
||||
@@ -600,7 +584,7 @@ contract CunaFinanceBsc is Initializable, ReentrancyGuardUpgradeable {
|
||||
uint256[] memory amounts,
|
||||
uint256 totalUnclaimed
|
||||
) {
|
||||
uint256 remainingStake = userBigStake[user];
|
||||
uint256 remainingStake = getNetStake(user);
|
||||
uint256 startEpoch = userLastClaimedEpoch[user];
|
||||
uint256 epochCount = currentEpochId - startEpoch;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user