增加unstake cec时的约束
This commit is contained in:
parent
1c372ec6a4
commit
896b43ddc1
@ -56,6 +56,11 @@ contract RewardRouter is ReentrancyGuard, Governable {
|
||||
}
|
||||
|
||||
function unstakeCec(uint256 _amount) external nonReentrant {
|
||||
// check if the user has staked CEC in the vester
|
||||
if (IVester(cecVester).needCheckStake()) {
|
||||
IVester(cecVester).updateVesting(msg.sender);
|
||||
require(IERC20(cecVester).balanceOf(msg.sender) + _amount <= IRewardTracker(stakedCecTracker).depositBalances(msg.sender, cec), "RewardRouter: insufficient CEC balance");
|
||||
}
|
||||
_unstakeCec(msg.sender, cec, _amount);
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,11 @@ contract Vester is IVester, IERC20, ReentrancyGuard, Governable {
|
||||
emit Deposit(_account, _amount);
|
||||
}
|
||||
|
||||
function _updateVesting(address _account) private {
|
||||
function updateVesting(address _account) public {
|
||||
_updateVesting(_account);
|
||||
}
|
||||
|
||||
function _updateVesting(address _account) public {
|
||||
uint256 amount = _getNextClaimableAmount(_account);
|
||||
lastVestingTimes[_account] = block.timestamp;
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
pragma solidity 0.8.19;
|
||||
|
||||
interface IVester {
|
||||
function needCheckStake() external view returns (bool);
|
||||
function updateVesting(address _account) external;
|
||||
|
||||
function rewardTracker() external view returns (address);
|
||||
|
||||
function claimForAccount(address _account, address _receiver) external returns (uint256);
|
||||
|
@ -1,21 +1 @@
|
||||
[
|
||||
"constructor(address,address,address,address)",
|
||||
"event StakeCec(address,address,uint256)",
|
||||
"event UnstakeCec(address,address,uint256)",
|
||||
"function batchStakeCecForAccount(address[],uint256[])",
|
||||
"function cec() view returns (address)",
|
||||
"function cecVester() view returns (address)",
|
||||
"function claim()",
|
||||
"function claimEsCec()",
|
||||
"function esCec() view returns (address)",
|
||||
"function gov() view returns (address)",
|
||||
"function handleRewards(bool,bool,bool,bool)",
|
||||
"function setGov(address)",
|
||||
"function stakeCec(uint256)",
|
||||
"function stakeCecForAccount(address,uint256)",
|
||||
"function stakeEsCec(uint256)",
|
||||
"function stakedCecTracker() view returns (address)",
|
||||
"function unstakeCec(uint256)",
|
||||
"function unstakeEsCec(uint256)",
|
||||
"function withdrawToken(address,address,uint256)"
|
||||
]
|
||||
["constructor(address,address,address,address)","event StakeCec(address,address,uint256)","event UnstakeCec(address,address,uint256)","function batchStakeCecForAccount(address[],uint256[])","function cec() view returns (address)","function cecVester() view returns (address)","function claim()","function esCec() view returns (address)","function gov() view returns (address)","function handleRewards(bool,bool,bool,bool)","function setGov(address)","function stakeCec(uint256)","function stakeCecForAccount(address,uint256)","function stakeEsCec(uint256)","function stakedCecTracker() view returns (address)","function unstakeCec(uint256)","function unstakeEsCec(uint256)","function withdrawToken(address,address,uint256)"]
|
Loading…
x
Reference in New Issue
Block a user