View Source: contracts/governance/Staking/modules/StakingAdminModule.sol
↗ Extends: IFunctionsList, StakingShared
Implements administrative functionality pause, freeze and setting addresses and parameters related to staking
Events
event AdminAdded(address admin);
event AdminRemoved(address admin);
event PauserAddedOrRemoved(address indexed pauser, bool indexed added);
event StakingPaused(bool indexed setPaused);
event StakingFrozen(bool indexed setFrozen);- addAdmin(address _admin)
- removeAdmin(address _admin)
- addPauser(address _pauser)
- removePauser(address _pauser)
- pauseUnpause(bool _pause)
- freezeUnfreeze(bool _freeze)
- setFeeSharing(address _feeSharing)
- setWeightScaling(uint96 _weightScaling)
- setNewStakingContract(address _newStakingContract)
- migrateToNewStakingContract()
- getFunctionsList()
Add account to Admins ACL.
function addAdmin(address _admin) external nonpayable onlyOwner whenNotFrozen Arguments
| Name | Type | Description |
|---|---|---|
| _admin | address | The addresses of the account to grant permissions. |
Source Code
function addAdmin(address _admin) external onlyOwner whenNotFrozen {
require(_admin != address(0), "cannot add the zero address as an admin");
admins[_admin] = true;
emit AdminAdded(_admin);
}Remove account from Admins ACL.
function removeAdmin(address _admin) external nonpayable onlyOwner whenNotFrozen Arguments
| Name | Type | Description |
|---|---|---|
| _admin | address | The addresses of the account to revoke permissions. |
Source Code
function removeAdmin(address _admin) external onlyOwner whenNotFrozen {
require(admins[_admin], "address is not an admin");
admins[_admin] = false;
emit AdminRemoved(_admin);
}Add account to pausers ACL.
function addPauser(address _pauser) external nonpayable onlyOwner whenNotFrozen Arguments
| Name | Type | Description |
|---|---|---|
| _pauser | address | The address to grant pauser permissions. |
Source Code
function addPauser(address _pauser) external onlyOwner whenNotFrozen {
require(_pauser != address(0), "cannot add the zero address as a pauser");
pausers[_pauser] = true;
emit PauserAddedOrRemoved(_pauser, true);
}Remove account from pausers ACL.
function removePauser(address _pauser) external nonpayable onlyOwner whenNotFrozen Arguments
| Name | Type | Description |
|---|---|---|
| _pauser | address | The address to grant pauser permissions. |
Source Code
function removePauser(address _pauser) external onlyOwner whenNotFrozen {
require(pausers[_pauser], "address is not a pauser");
delete pausers[_pauser];
emit PauserAddedOrRemoved(_pauser, false);
}Pause/unpause contract
function pauseUnpause(bool _pause) public nonpayable onlyPauserOrOwner whenNotFrozen Arguments
| Name | Type | Description |
|---|---|---|
| _pause | bool | true when pausing, false when unpausing |
Source Code
function pauseUnpause(bool _pause) public onlyPauserOrOwner whenNotFrozen {
paused = _pause;
emit StakingPaused(_pause);
}Freeze contract - disable all functions
function freezeUnfreeze(bool _freeze) external nonpayable onlyPauserOrOwner Arguments
| Name | Type | Description |
|---|---|---|
| _freeze | bool | true when freezing, false when unfreezing |
Source Code
function freezeUnfreeze(bool _freeze) external onlyPauserOrOwner {
require(_freeze != frozen, "Cannot freeze/unfreeze to the same state"); // WS25
if (_freeze) pauseUnpause(true);
frozen = _freeze;
emit StakingFrozen(_freeze);
}Allow the owner to set a fee sharing proxy contract. We need it for unstaking with slashing.
function setFeeSharing(address _feeSharing) external nonpayable onlyOwner whenNotFrozen Arguments
| Name | Type | Description |
|---|---|---|
| _feeSharing | address | The address of FeeSharingCollectorProxy contract. |
Source Code
function setFeeSharing(address _feeSharing) external onlyOwner whenNotFrozen {
require(_feeSharing != address(0), "FeeSharing address shouldn't be 0"); // S17
feeSharing = IFeeSharingCollector(_feeSharing);
}Allow the owner to set weight scaling. We need it for unstaking with slashing.
function setWeightScaling(uint96 _weightScaling) external nonpayable onlyOwner whenNotFrozen Arguments
| Name | Type | Description |
|---|---|---|
| _weightScaling | uint96 | The weight scaling. |
Source Code
function setWeightScaling(uint96 _weightScaling) external onlyOwner whenNotFrozen {
require(
MIN_WEIGHT_SCALING <= _weightScaling && _weightScaling <= MAX_WEIGHT_SCALING,
"scaling doesn't belong to range [1, 9]" // S18
);
weightScaling = _weightScaling;
}Allow the owner to set a new staking contract. As a consequence it allows the stakers to migrate their positions to the new contract.
function setNewStakingContract(address _newStakingContract) external nonpayable onlyOwner whenNotFrozen Arguments
| Name | Type | Description |
|---|---|---|
| _newStakingContract | address | The address of the new staking contract. |
Source Code
function setNewStakingContract(address _newStakingContract) external onlyOwner whenNotFrozen {
require(_newStakingContract != address(0), "can't reset the new staking contract to 0"); // S16
newStakingContract = _newStakingContract;
}Allow a staker to migrate his positions to the new staking contract.
function migrateToNewStakingContract() external nonpayable whenNotFrozen Source Code
function migrateToNewStakingContract() external whenNotFrozen {
require(newStakingContract != address(0), "there is no new staking contract set"); // S19
revert("not implemented");
/// @dev implementation:
/// @dev Iterate over all possible lock dates from now until now + MAX_DURATION.
/// @dev Read the stake & delegate of the msg.sender
/// @dev If stake > 0, stake it at the new contract until the lock date with the current delegate.
}undefined
function getFunctionsList() external pure
returns(bytes4[])Source Code
function getFunctionsList() external pure returns (bytes4[] memory) {
bytes4[] memory functionsList = new bytes4[](13);
functionsList[0] = this.addAdmin.selector;
functionsList[1] = this.removeAdmin.selector;
functionsList[2] = this.addPauser.selector;
functionsList[3] = this.removePauser.selector;
functionsList[4] = this.pauseUnpause.selector;
functionsList[5] = this.freezeUnfreeze.selector;
functionsList[6] = this.setFeeSharing.selector;
functionsList[7] = this.setWeightScaling.selector;
functionsList[8] = this.setNewStakingContract.selector;
functionsList[9] = this.owner.selector;
functionsList[10] = this.isOwner.selector;
functionsList[11] = this.transferOwnership.selector;
functionsList[12] = this.migrateToNewStakingContract.selector;
return functionsList;
}- Address
- Administered
- AdminRole
- AdvancedToken
- AdvancedTokenStorage
- Affiliates
- AffiliatesEvents
- ApprovalReceiver
- BProPriceFeed
- CheckpointsShared
- Constants
- Context
- DevelopmentFund
- DummyContract
- EnumerableAddressSet
- EnumerableBytes32Set
- EnumerableBytes4Set
- ERC20
- ERC20Detailed
- ErrorDecoder
- Escrow
- EscrowReward
- FeedsLike
- FeesEvents
- FeeSharingCollector
- FeeSharingCollectorProxy
- FeeSharingCollectorStorage
- FeesHelper
- FourYearVesting
- FourYearVestingFactory
- FourYearVestingLogic
- FourYearVestingStorage
- GenericTokenSender
- GovernorAlpha
- GovernorVault
- IApproveAndCall
- IChai
- IContractRegistry
- IConverterAMM
- IERC1820Registry
- IERC20_
- IERC20
- IERC777
- IERC777Recipient
- IERC777Sender
- IFeeSharingCollector
- IFourYearVesting
- IFourYearVestingFactory
- IFunctionsList
- ILiquidityMining
- ILiquidityPoolV1Converter
- ILoanPool
- ILoanToken
- ILoanTokenLogicBeacon
- ILoanTokenLogicModules
- ILoanTokenLogicProxy
- ILoanTokenModules
- ILoanTokenWRBTC
- ILockedSOV
- IMoCState
- IModulesProxyRegistry
- Initializable
- InterestUser
- IPot
- IPriceFeeds
- IPriceFeedsExt
- IProtocol
- IRSKOracle
- ISovryn
- ISovrynSwapNetwork
- IStaking
- ISwapsImpl
- ITeamVesting
- ITimelock
- IV1PoolOracle
- IVesting
- IVestingFactory
- IVestingRegistry
- IWrbtc
- IWrbtcERC20
- LenderInterestStruct
- LiquidationHelper
- LiquidityMining
- LiquidityMiningConfigToken
- LiquidityMiningProxy
- LiquidityMiningStorage
- LoanClosingsEvents
- LoanClosingsLiquidation
- LoanClosingsRollover
- LoanClosingsShared
- LoanClosingsWith
- LoanClosingsWithoutInvariantCheck
- LoanInterestStruct
- LoanMaintenance
- LoanMaintenanceEvents
- LoanOpenings
- LoanOpeningsEvents
- LoanParamsStruct
- LoanSettings
- LoanSettingsEvents
- LoanStruct
- LoanToken
- LoanTokenBase
- LoanTokenLogicBeacon
- LoanTokenLogicLM
- LoanTokenLogicProxy
- LoanTokenLogicStandard
- LoanTokenLogicStorage
- LoanTokenLogicWrbtc
- LoanTokenSettingsLowerAdmin
- LockedSOV
- MarginTradeStructHelpers
- Medianizer
- ModuleCommonFunctionalities
- ModulesCommonEvents
- ModulesProxy
- ModulesProxyRegistry
- MultiSigKeyHolders
- MultiSigWallet
- Mutex
- Objects
- OrderStruct
- OrigingVestingCreator
- OriginInvestorsClaim
- Ownable
- Pausable
- PausableOz
- PreviousLoanToken
- PreviousLoanTokenSettingsLowerAdmin
- PriceFeedRSKOracle
- PriceFeeds
- PriceFeedsLocal
- PriceFeedsMoC
- PriceFeedV1PoolOracle
- ProtocolAffiliatesInterface
- ProtocolLike
- ProtocolSettings
- ProtocolSettingsEvents
- ProtocolSettingsLike
- ProtocolSwapExternalInterface
- ProtocolTokenUser
- Proxy
- ProxyOwnable
- ReentrancyGuard
- RewardHelper
- RSKAddrValidator
- SafeERC20
- SafeMath
- SafeMath96
- setGet
- SharedReentrancyGuard
- SignedSafeMath
- SOV
- sovrynProtocol
- StakingAdminModule
- StakingGovernanceModule
- StakingInterface
- StakingProxy
- StakingRewards
- StakingRewardsProxy
- StakingRewardsStorage
- StakingShared
- StakingStakeModule
- StakingStorageModule
- StakingStorageShared
- StakingVestingModule
- StakingWithdrawModule
- State
- SwapsEvents
- SwapsExternal
- SwapsImplLocal
- SwapsImplSovrynSwap
- SwapsUser
- TeamVesting
- Timelock
- TimelockHarness
- TimelockInterface
- TokenSender
- UpgradableProxy
- USDTPriceFeed
- Utils
- VaultController
- Vesting
- VestingCreator
- VestingFactory
- VestingLogic
- VestingRegistry
- VestingRegistry2
- VestingRegistry3
- VestingRegistryLogic
- VestingRegistryProxy
- VestingRegistryStorage
- VestingStorage
- WeightedStakingModule
- WRBTC