mirror of
https://github.com/logos-co/staking.git
synced 2025-02-03 14:24:13 +00:00
force users to migrate or leave
This commit is contained in:
parent
da5ea645b0
commit
6bf8d66221
@ -104,6 +104,16 @@ contract StakeManager is Ownable {
|
|||||||
multiplierSupply += increasedMultiplier;
|
multiplierSupply += increasedMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notice leave without processing account
|
||||||
|
*/
|
||||||
|
function leave() external onlyVault {
|
||||||
|
Account memory account = accounts[msg.sender];
|
||||||
|
delete accounts[msg.sender];
|
||||||
|
multiplierSupply -= account.multiplier;
|
||||||
|
stakeSupply -= _account.mount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Release rewards for current epoch and increase epoch.
|
* @notice Release rewards for current epoch and increase epoch.
|
||||||
*/
|
*/
|
||||||
@ -170,7 +180,8 @@ contract StakeManager is Ownable {
|
|||||||
|
|
||||||
function processAccount(Account storage account, uint256 _limitEpoch) private {
|
function processAccount(Account storage account, uint256 _limitEpoch) private {
|
||||||
processEpoch();
|
processEpoch();
|
||||||
require(_limitEpoch <= currentEpoch, "Non-sese call");
|
require(address(migration) == address(0), "Contract ended, please migrate");
|
||||||
|
require(_limitEpoch <= currentEpoch, "Non-sense call");
|
||||||
uint256 userReward;
|
uint256 userReward;
|
||||||
uint256 userEpoch = account.epoch;
|
uint256 userEpoch = account.epoch;
|
||||||
for (Epoch memory iEpoch = epochs[userEpoch]; userEpoch < _limitEpoch; userEpoch++) {
|
for (Epoch memory iEpoch = epochs[userEpoch]; userEpoch < _limitEpoch; userEpoch++) {
|
||||||
|
@ -32,6 +32,11 @@ contract StakeVault is Ownable {
|
|||||||
stakedToken.transferFrom(address(this), msg.sender, _amount);
|
stakedToken.transferFrom(address(this), msg.sender, _amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function leave() external onlyOwner {
|
||||||
|
stakeManager.leave();
|
||||||
|
stakedToken.transferFrom(address(this), msg.sender, stakedToken.balanceOf(address(this)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Opt-in migration to a new StakeManager contract.
|
* @notice Opt-in migration to a new StakeManager contract.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user