StakingAuRaBase
Index
- AddedPool
- ClaimedOrderedWithdrawal
- MovedStake
- OrderedWithdrawal
- PlacedStake
- RemovedPool
- WithdrewStake
- _addPoolActive
- _addPoolDelegator
- _addPoolDelegatorInactive
- _addPoolInactive
- _addPoolToBeElected
- _addPoolToBeRemoved
- _deletePoolToBeElected
- _deletePoolToBeRemoved
- _getCurrentBlockNumber
- _getDelegatorStake
- _getMaxCandidates
- _isPoolEmpty
- _isPoolToBeElected
- _isWithdrawAllowed
- _removePool
- _removePoolDelegator
- _removePoolDelegatorInactive
- _removePoolInactive
- _sendWithdrawnStakeAmount
- _setLikelihood
- _snapshotDelegatorStake
- _stake
- _stake
- _thisBalance
- _withdraw
- _withdrawCheckPool
- addPool
- areStakeAndWithdrawAllowed
- claimOrderedWithdraw
- clearUnremovableValidator
- fallback
- gasPriceIsValid
- getPools
- getPoolsInactive
- getPoolsLikelihood
- getPoolsToBeElected
- getPoolsToBeRemoved
- getStakerPools
- getStakerPoolsLength
- incrementStakingEpoch
- initialValidatorStake
- initialize
- isInitialized
- isPoolActive
- maxWithdrawAllowed
- maxWithdrawOrderAllowed
- moveStake
- onTokenTransfer
- onlyBlockRewardContract
- onlyInitialized
- onlyValidatorSetContract
- orderWithdraw
- poolDelegators
- poolDelegatorsInactive
- removeMyPool
- removePool
- removePools
- setCandidateMinStake
- setDelegatorMinStake
- setStakingEpochStartBlock
- stake
- stakeAmountByCurrentEpoch
- stakingEpochEndBlock
- withdraw
Reference
Events
AddedPool
event AddedPool(address poolStakingAddress)
Emitted by `_addPoolActive` internal function to signal that the specified staking address created a new pool.
- Parameters:
poolStakingAddress
- The staking address of newly added pool.
ClaimedOrderedWithdrawal
event ClaimedOrderedWithdrawal(address fromPoolStakingAddress, address staker, uint256 stakingEpoch, uint256 amount)
Emitted by the `claimOrderedWithdraw` function to signal the staker withdrew the specified amount of requested tokens/coins from the specified pool during the specified staking epoch.
- Parameters:
fromPoolStakingAddress
- The pool from which the `staker` withdrew the `amount`.staker
- The address of the staker that withdrew the `amount`.stakingEpoch
- The serial number of the staking epoch during which the claim was made.amount
- The withdrawal amount.
MovedStake
event MovedStake(address fromPoolStakingAddress, address toPoolStakingAddress, address staker, uint256 stakingEpoch, uint256 amount)
Emitted by the `moveStake` function to signal the staker moved the specified amount of stake from one pool to another during the specified staking epoch.
- Parameters:
fromPoolStakingAddress
- The pool from which the `staker` moved the stake.toPoolStakingAddress
- The destination pool where the `staker` moved the stake.staker
- The address of the staker who moved the `amount`.stakingEpoch
- The serial number of the staking epoch during which the `amount` was moved.amount
- The stake amount which was moved.
OrderedWithdrawal
event OrderedWithdrawal(address fromPoolStakingAddress, address staker, uint256 stakingEpoch, int256 amount)
Emitted by the `orderWithdraw` function to signal the staker ordered the withdrawal of the specified amount of their stake from the specified pool during the specified staking epoch.
- Parameters:
fromPoolStakingAddress
- The pool from which the `staker` ordered a withdrawal of the `amount`.staker
- The address of the staker that ordered the withdrawal of the `amount`.stakingEpoch
- The serial number of the staking epoch during which the order was made.amount
- The ordered withdrawal amount. Can be either positive or negative. See the `orderWithdraw` function.
PlacedStake
event PlacedStake(address toPoolStakingAddress, address staker, uint256 stakingEpoch, uint256 amount)
Emitted by the `stake` function to signal the staker placed a stake of the specified amount for the specified pool during the specified staking epoch.
- Parameters:
toPoolStakingAddress
- The pool in which the `staker` placed the stake.staker
- The address of the staker that placed the stake.stakingEpoch
- The serial number of the staking epoch during which the stake was made.amount
- The stake amount.
RemovedPool
event RemovedPool(address poolStakingAddress)
Emitted by `_removePool` internal function to signal that a pool with the specified staking address was removed.
- Parameters:
poolStakingAddress
- The staking address of removed pool.
WithdrewStake
event WithdrewStake(address fromPoolStakingAddress, address staker, uint256 stakingEpoch, uint256 amount)
Emitted by the `withdraw` function to signal the staker withdrew the specified amount of a stake from the specified pool during the specified staking epoch.
- Parameters:
fromPoolStakingAddress
- The pool from which the `staker` withdrew the `amount`.staker
- The address of staker that withdrew the `amount`.stakingEpoch
- The serial number of the staking epoch during which the withdrawal was made.amount
- The withdrawal amount.
Modifiers
gasPriceIsValid
modifier gasPriceIsValid()
Ensures the transaction gas price is not zero.
onlyBlockRewardContract
modifier onlyBlockRewardContract()
Ensures the caller is the BlockRewardAuRa contract address.
onlyInitialized
modifier onlyInitialized()
Ensures the `initialize` function was called before.
onlyValidatorSetContract
modifier onlyValidatorSetContract()
Ensures the caller is the ValidatorSetAuRa contract address.
Functions
_addPoolActive
function _addPoolActive(address _stakingAddress, bool _toBeElected) internal
Adds the specified staking address to the array of active pools returned by the `getPools` getter. Used by the `stake`, `addPool`, and `orderWithdraw` functions.
- Parameters:
_stakingAddress
- The pool added to the array of active pools._toBeElected
- The boolean flag which defines whether the specified address should be added simultaneously to the `poolsToBeElected` array. See the `getPoolsToBeElected` getter.
_addPoolDelegator
function _addPoolDelegator(address _poolStakingAddress, address _delegator) internal
Adds the specified address to the array of the current active delegators of the specified pool. Used by the `stake` and `orderWithdraw` functions. See the `poolDelegators` getter.
- Parameters:
_poolStakingAddress
- The pool staking address._delegator
- The delegator's address.
_addPoolDelegatorInactive
function _addPoolDelegatorInactive(address _poolStakingAddress, address _delegator) internal
Adds the specified address to the array of the current inactive delegators of the specified pool. Used by the `_removePoolDelegator` internal function.
- Parameters:
_poolStakingAddress
- The pool staking address._delegator
- The delegator's address.
_addPoolInactive
function _addPoolInactive(address _stakingAddress) internal
Adds the specified staking address to the array of inactive pools returned by the `getPoolsInactive` getter. Used by the `_removePool` internal function.
- Parameters:
_stakingAddress
- The pool added to the array of inactive pools.
_addPoolToBeElected
function _addPoolToBeElected(address _stakingAddress) internal
Adds the specified staking address to the array of pools returned by the `getPoolsToBeElected` getter. Used by the `_addPoolActive` internal function. See the `getPoolsToBeElected` getter.
- Parameters:
_stakingAddress
- The pool added to the `poolsToBeElected` array.
_addPoolToBeRemoved
function _addPoolToBeRemoved(address _stakingAddress) internal
Adds the specified staking address to the array of pools returned by the `getPoolsToBeRemoved` getter. Used by withdrawal functions. See the `getPoolsToBeRemoved` getter.
- Parameters:
_stakingAddress
- The pool added to the `poolsToBeRemoved` array.
_deletePoolToBeElected
function _deletePoolToBeElected(address _stakingAddress) internal
Deletes the specified staking address from the array of pools returned by the `getPoolsToBeElected` getter. Used by the `_addPoolToBeRemoved` and `_removePool` internal functions. See the `getPoolsToBeElected` getter.
- Parameters:
_stakingAddress
- The pool deleted from the `poolsToBeElected` array.
_deletePoolToBeRemoved
function _deletePoolToBeRemoved(address _stakingAddress) internal
Deletes the specified staking address from the array of pools returned by the `getPoolsToBeRemoved` getter. Used by the `_addPoolToBeElected` and `_removePool` internal functions. See the `getPoolsToBeRemoved` getter.
- Parameters:
_stakingAddress
- The pool deleted from the `poolsToBeRemoved` array.
_getCurrentBlockNumber
function _getCurrentBlockNumber() internal view returns (uint256)
Returns the current block number. Needed mostly for unit tests.
- Returns:
- uint256
_getDelegatorStake
function _getDelegatorStake(uint256 _epoch, uint256 _firstEpoch, uint256 _prevDelegatorStake, address _poolStakingAddress, address _delegator) internal view returns (uint256)
The internal function used by the `claimReward` function and `getRewardAmount` getter. Finds the stake amount made by a specified delegator into a specified pool before a specified staking epoch.
- Parameters:
_epoch
- uint256_firstEpoch
- uint256_prevDelegatorStake
- uint256_poolStakingAddress
- address_delegator
- address- Returns:
- uint256
_getMaxCandidates
function _getMaxCandidates() internal pure returns (uint256)
Returns the max number of candidates (including validators). See the MAX_CANDIDATES constant. Needed mostly for unit tests.
- Returns:
- uint256
_isPoolEmpty
function _isPoolEmpty(address _poolStakingAddress) internal view returns (bool)
Returns a boolean flag indicating whether the specified pool is fully empty (all stakes are withdrawn including ordered withdrawals).
- Parameters:
_poolStakingAddress
- The staking address of the pool- Returns:
- bool
_isPoolToBeElected
function _isPoolToBeElected(address _stakingAddress) internal view returns (bool, uint256)
Determines if the specified pool is in the `poolsToBeElected` array. See the `getPoolsToBeElected` getter. Used by the `_setLikelihood` internal function.
- Parameters:
_stakingAddress
- The staking address of the pool.- Returns:
- `bool toBeElected` - The boolean flag indicating whether the `_stakingAddress` is in the `poolsToBeElected` array. `uint256 index` - The position of the item in the `poolsToBeElected` array if `toBeElected` is `true`.
_isWithdrawAllowed
function _isWithdrawAllowed(address _miningAddress, bool _isDelegator) internal view returns (bool)
Returns `true` if withdrawal from the pool of the specified candidate/validator is allowed at the moment. Used by all withdrawal functions.
- Parameters:
_miningAddress
- The mining address of the validator's pool._isDelegator
- Whether the withdrawal is requested by a delegator, not by a candidate/validator.- Returns:
- bool
_removePool
function _removePool(address _stakingAddress) internal
Removes the specified staking address from the array of active pools returned by the `getPools` getter. Used by the `removePool`, `removeMyPool`, and withdrawal functions.
- Parameters:
_stakingAddress
- The pool removed from the array of active pools.
_removePoolDelegator
function _removePoolDelegator(address _poolStakingAddress, address _delegator) internal
Removes the specified address from the array of the current active delegators of the specified pool. Used by the withdrawal functions. See the `poolDelegators` getter.
- Parameters:
_poolStakingAddress
- The pool staking address._delegator
- The delegator's address.
_removePoolDelegatorInactive
function _removePoolDelegatorInactive(address _poolStakingAddress, address _delegator) internal
Removes the specified address from the array of the inactive delegators of the specified pool. Used by the `_addPoolDelegator` and `_removePoolDelegator` internal functions.
- Parameters:
_poolStakingAddress
- The pool staking address._delegator
- The delegator's address.
_removePoolInactive
function _removePoolInactive(address _stakingAddress) internal
Removes the specified staking address from the array of inactive pools returned by the `getPoolsInactive` getter. Used by withdrawal functions, by the `_addPoolActive` and `_removePool` internal functions.
- Parameters:
_stakingAddress
- The pool removed from the array of inactive pools.
_sendWithdrawnStakeAmount
abstract function _sendWithdrawnStakeAmount(address _to, uint256 _amount) internal
- Parameters:
_to
- address_amount
- uint256
_setLikelihood
function _setLikelihood(address _poolStakingAddress) internal
Calculates (updates) the probability of being selected as a validator for the specified pool and updates the total sum of probability coefficients. Actually, the probability is equal to the amount totally staked into the pool. See the `getPoolsLikelihood` getter. Used by the staking and withdrawal functions.
- Parameters:
_poolStakingAddress
- The address of the pool for which the probability coefficient must be updated.
_snapshotDelegatorStake
function _snapshotDelegatorStake(address _poolStakingAddress, address _delegator) internal
Makes a snapshot of the amount currently staked by the specified delegator into the specified pool (staking address). Used by the `orderWithdraw`, `_stake`, and `_withdraw` functions.
- Parameters:
_poolStakingAddress
- The staking address of the pool._delegator
- The address of the delegator.
_stake
abstract function _stake(address _toPoolStakingAddress, uint256 _amount) internal
- Parameters:
_toPoolStakingAddress
- address_amount
- uint256
_stake
function _stake(address _poolStakingAddress, address _staker, uint256 _amount) internal
The internal function used by the `_stake` and `moveStake` functions. See the `stake` public function for more details.
- Parameters:
_poolStakingAddress
- The staking address of the pool where the tokens/coins should be staked._staker
- The staker's address._amount
- The amount of tokens/coins to be staked.
_thisBalance
abstract function _thisBalance() internal view returns (uint256)
Returns the balance of this contract in staking tokens or coins depending on implementation.
- Returns:
- uint256
_withdraw
function _withdraw(address _poolStakingAddress, address _staker, uint256 _amount) internal
The internal function used by the `withdraw` and `moveStake` functions. See the `withdraw` public function for more details.
- Parameters:
_poolStakingAddress
- The staking address of the pool from which the tokens/coins should be withdrawn._staker
- The staker's address._amount
- The amount of the tokens/coins to be withdrawn.
_withdrawCheckPool
function _withdrawCheckPool(address _poolStakingAddress, address _staker) internal
The internal function used by the `_withdraw` and `claimOrderedWithdraw` functions. Contains a common logic for these functions.
- Parameters:
_poolStakingAddress
- The staking address of the pool from which the tokens/coins are withdrawn._staker
- The staker's address.
addPool
function addPool(uint256 _amount, address _miningAddress) external payable
Adds a new candidate's pool to the list of active pools (see the `getPools` getter) and moves the specified amount of staking tokens/coins from the candidate's staking address to the candidate's pool. A participant calls this function using their staking address when they want to create a pool. This is a wrapper for the `stake` function.
- Parameters:
_amount
- The amount of tokens to be staked. Ignored when staking in native coins because `msg.value` is used in that case._miningAddress
- The mining address of the candidate. The mining address is bound to the staking address (msg.sender). This address cannot be equal to `msg.sender`.
areStakeAndWithdrawAllowed
function areStakeAndWithdrawAllowed() public view returns (bool)
Determines whether staking/withdrawal operations are allowed at the moment. Used by all staking/withdrawal functions.
- Returns:
- bool
claimOrderedWithdraw
function claimOrderedWithdraw(address _poolStakingAddress) external
Withdraws the staking tokens/coins from the specified pool ordered during the previous staking epochs with the `orderWithdraw` function. The ordered amount can be retrieved by the `orderedWithdrawAmount` getter.
- Modifiers:
- gasPriceIsValid onlyInitialized
- Parameters:
_poolStakingAddress
- The staking address of the pool from which the ordered tokens/coins are withdrawn.
clearUnremovableValidator
function clearUnremovableValidator(address _unremovableStakingAddress) external
Adds the `unremovable validator` to either the `poolsToBeElected` or the `poolsToBeRemoved` array depending on their own stake in their own pool when they become removable. This allows the `ValidatorSetAuRa.newValidatorSet` function to recognize the unremovable validator as a regular removable pool. Called by the `ValidatorSet.clearUnremovableValidator` function.
- Modifiers:
- onlyValidatorSetContract
- Parameters:
_unremovableStakingAddress
- The staking address of the unremovable validator.
fallback
function () external payable
Fallback function. Prevents direct sending native coins to this contract.
getPools
function getPools() external view returns (address[])
Returns an array of the current active pools (the staking addresses of candidates and validators). The size of the array cannot exceed MAX_CANDIDATES. A pool can be added to this array with the `_addPoolActive` internal function which is called by the `stake` or `orderWithdraw` function. A pool is considered active if its address has at least the minimum stake and this stake is not ordered to be withdrawn.
- Returns:
- address[]
getPoolsInactive
function getPoolsInactive() external view returns (address[])
Returns an array of the current inactive pools (the staking addresses of former candidates). A pool can be added to this array with the `_addPoolInactive` internal function which is called by `_removePool`. A pool is considered inactive if it is banned for some reason, if its address has zero stake, or if its entire stake is ordered to be withdrawn.
- Returns:
- address[]
getPoolsLikelihood
function getPoolsLikelihood() external view returns (uint256[], uint256)
Returns the array of stake amounts for each corresponding address in the `poolsToBeElected` array (see the `getPoolsToBeElected` getter) and a sum of these amounts. Used by the `ValidatorSetAuRa.newValidatorSet` function when randomly selecting new validators at the last block of a staking epoch. An array value is updated every time any staked amount is changed in this pool (see the `_setLikelihood` internal function).
- Returns:
- `uint256[] likelihoods` - The array of the coefficients. The array length is always equal to the length of the `poolsToBeElected` array. `uint256 sum` - The total sum of the amounts.
getPoolsToBeElected
function getPoolsToBeElected() external view returns (address[])
Returns the list of pools (their staking addresses) which will participate in a new validator set selection process in the `ValidatorSetAuRa.newValidatorSet` function. This is an array of pools which will be considered as candidates when forming a new validator set (at the last block of a staking epoch). This array is kept updated by the `_addPoolToBeElected` and `_deletePoolToBeElected` internal functions.
- Returns:
- address[]
getPoolsToBeRemoved
function getPoolsToBeRemoved() external view returns (address[])
Returns the list of pools (their staking addresses) which will be removed by the `ValidatorSetAuRa.newValidatorSet` function from the active `pools` array (at the last block of a staking epoch). This array is kept updated by the `_addPoolToBeRemoved` and `_deletePoolToBeRemoved` internal functions. A pool is added to this array when the pool's address withdraws (or orders) all of its own staking tokens from the pool, inactivating the pool.
- Returns:
- address[]
getStakerPools
function getStakerPools(address _staker, uint256 _offset, uint256 _length) external view returns (address[])
Returns the list of pools (staking addresses) into which the specified staker have ever staked.
- Parameters:
_staker
- The staker address (it can be a delegator or a pool staking address itself)._offset
- The index in the array at which the reading should start. Ignored if the `_length` is 0._length
- The max number of items to return.- Returns:
- address[]
getStakerPoolsLength
function getStakerPoolsLength(address _staker) external view returns (uint256)
Returns the length of the list of pools into which the specified staker have ever staked.
- Parameters:
_staker
- The staker address (it can be a delegator or a pool staking address itself).- Returns:
- uint256
incrementStakingEpoch
function incrementStakingEpoch() external
Increments the serial number of the current staking epoch. Called by the `ValidatorSetAuRa.newValidatorSet` at the last block of the finished staking epoch.
- Modifiers:
- onlyValidatorSetContract
initialValidatorStake
function initialValidatorStake(uint256 _totalAmount) external
Makes initial validator stakes. Can only be called by the owner before the network starts (after `initialize` is called but before `stakingEpochStartBlock`). Cannot be called more than once and cannot be called when starting from genesis. Requires `StakingAuRa` contract balance to be equal to the `_totalAmount`.
- Modifiers:
- onlyOwner
- Parameters:
_totalAmount
- The initial validator total stake amount (for all initial validators).
initialize
function initialize(address _validatorSetContract, address[] _initialStakingAddresses, uint256 _delegatorMinStake, uint256 _candidateMinStake, uint256 _stakingEpochDuration, uint256 _stakingEpochStartBlock, uint256 _stakeWithdrawDisallowPeriod) external
Initializes the network parameters. Can only be called by the constructor of the `InitializerAuRa` contract or owner.
- Parameters:
_validatorSetContract
- The address of the `ValidatorSetAuRa` contract._initialStakingAddresses
- The array of initial validators' staking addresses._delegatorMinStake
- The minimum allowed amount of delegator stake in Wei._candidateMinStake
- The minimum allowed amount of candidate/validator stake in Wei._stakingEpochDuration
- The duration of a staking epoch in blocks (e.g., 120954 = 1 week for 5-seconds blocks in AuRa)._stakingEpochStartBlock
- The number of the first block of initial staking epoch (must be zero if the network is starting from genesis block)._stakeWithdrawDisallowPeriod
- The duration period (in blocks) at the end of a staking epoch during which participants cannot stake/withdraw/order/claim their staking tokens/coins (e.g., 4320 = 6 hours for 5-seconds blocks in AuRa).
isInitialized
function isInitialized() public view returns (bool)
Returns a boolean flag indicating if the `initialize` function has been called.
- Returns:
- bool
isPoolActive
function isPoolActive(address _stakingAddress) public view returns (bool)
Returns a flag indicating whether a specified address is in the `pools` array. See the `getPools` getter.
- Parameters:
_stakingAddress
- The staking address of the pool.- Returns:
- bool
maxWithdrawAllowed
function maxWithdrawAllowed(address _poolStakingAddress, address _staker) public view returns (uint256)
Returns the maximum amount which can be withdrawn from the specified pool by the specified staker at the moment. Used by the `withdraw` and `moveStake` functions.
- Parameters:
_poolStakingAddress
- The pool staking address from which the withdrawal will be made._staker
- The staker address that is going to withdraw.- Returns:
- uint256
maxWithdrawOrderAllowed
function maxWithdrawOrderAllowed(address _poolStakingAddress, address _staker) public view returns (uint256)
Returns the maximum amount which can be ordered to be withdrawn from the specified pool by the specified staker at the moment. Used by the `orderWithdraw` function.
- Parameters:
_poolStakingAddress
- The pool staking address from which the withdrawal will be ordered._staker
- The staker address that is going to order the withdrawal.- Returns:
- uint256
moveStake
function moveStake(address _fromPoolStakingAddress, address _toPoolStakingAddress, uint256 _amount) external
Moves staking tokens/coins from one pool to another. A staker calls this function when they want to move their tokens/coins from one pool to another without withdrawing their tokens/coins.
- Modifiers:
- gasPriceIsValid onlyInitialized
- Parameters:
_fromPoolStakingAddress
- The staking address of the source pool._toPoolStakingAddress
- The staking address of the target pool._amount
- The amount of staking tokens/coins to be moved. The amount cannot exceed the value returned by the `maxWithdrawAllowed` getter.
onTokenTransfer
function onTokenTransfer(address , uint256 , bytes ) public pure returns (bool)
Prevents sending tokens directly to the `StakingAuRa` contract address by the `ERC677BridgeTokenRewardable.transferAndCall` function.
- Parameters:
- address
- uint256
- bytes
- Returns:
- bool
orderWithdraw
function orderWithdraw(address _poolStakingAddress, int256 _amount) external
Orders tokens/coins withdrawal from the staking address of the specified pool to the staker's address. The requested tokens/coins can be claimed after the current staking epoch is complete using the `claimOrderedWithdraw` function.
- Modifiers:
- gasPriceIsValid onlyInitialized
- Parameters:
_poolStakingAddress
- The staking address of the pool from which the amount will be withdrawn._amount
- The amount to be withdrawn. A positive value means the staker wants to either set or increase their withdrawal amount. A negative value means the staker wants to decrease a withdrawal amount that was previously set. The amount cannot exceed the value returned by the `maxWithdrawOrderAllowed` getter.
poolDelegators
function poolDelegators(address _poolStakingAddress) public view returns (address[])
Returns an array of the current active delegators of the specified pool. A delegator is considered active if they have staked into the specified pool and their stake is not ordered to be withdrawn.
- Parameters:
_poolStakingAddress
- The pool staking address.- Returns:
- address[]
poolDelegatorsInactive
function poolDelegatorsInactive(address _poolStakingAddress) public view returns (address[])
Returns an array of the current inactive delegators of the specified pool. A delegator is considered inactive if their entire stake is ordered to be withdrawn but not yet claimed.
- Parameters:
_poolStakingAddress
- The pool staking address.- Returns:
- address[]
removeMyPool
function removeMyPool() external
Removes the candidate's or validator's pool from the `pools` array (a list of active pools which can be retrieved by the `getPools` getter). When a candidate or validator wants to remove their pool, they should call this function from their staking address. A validator cannot remove their pool while they are an `unremovable validator`.
- Modifiers:
- gasPriceIsValid onlyInitialized
removePool
function removePool(address _stakingAddress) external
Removes a specified pool from the `pools` array (a list of active pools which can be retrieved by the `getPools` getter). Called by the `ValidatorSetAuRa._removeMaliciousValidator` internal function when a pool must be removed by the algorithm.
- Modifiers:
- onlyValidatorSetContract
- Parameters:
_stakingAddress
- The staking address of the pool to be removed.
removePools
function removePools() external
Removes pools which are in the `_poolsToBeRemoved` internal array from the `pools` array. Called by the `ValidatorSetAuRa.newValidatorSet` function when a pool must be removed by the algorithm.
- Modifiers:
- onlyValidatorSetContract
setCandidateMinStake
function setCandidateMinStake(uint256 _minStake) external
Sets (updates) the limit of the minimum candidate stake (CANDIDATE_MIN_STAKE). Can only be called by the `owner`.
- Modifiers:
- onlyOwner onlyInitialized
- Parameters:
_minStake
- The value of a new limit in Wei.
setDelegatorMinStake
function setDelegatorMinStake(uint256 _minStake) external
Sets (updates) the limit of the minimum delegator stake (DELEGATOR_MIN_STAKE). Can only be called by the `owner`.
- Modifiers:
- onlyOwner onlyInitialized
- Parameters:
_minStake
- The value of a new limit in Wei.
setStakingEpochStartBlock
function setStakingEpochStartBlock(uint256 _blockNumber) external
Sets the number of the first block in the upcoming staking epoch. Called by the `ValidatorSetAuRa.newValidatorSet` function at the last block of a staking epoch.
- Modifiers:
- onlyValidatorSetContract
- Parameters:
_blockNumber
- The number of the very first block in the upcoming staking epoch.
stake
function stake(address _toPoolStakingAddress, uint256 _amount) external payable
Moves the specified amount of staking tokens/coins from the staker's address to the staking address of the specified pool. Actually, the amount is stored in a balance of this StakingAuRa contract. A staker calls this function when they want to make a stake into a pool.
- Parameters:
_toPoolStakingAddress
- The staking address of the pool where the tokens should be staked._amount
- The amount of tokens to be staked. Ignored when staking in native coins because `msg.value` is used instead.
stakeAmountByCurrentEpoch
function stakeAmountByCurrentEpoch(address _poolStakingAddress, address _staker) public view returns (uint256)
Returns the amount of staking tokens/coins staked into the specified pool by the specified staker during the current staking epoch (see the `stakingEpoch` getter). Used by the `stake`, `withdraw`, and `orderWithdraw` functions.
- Parameters:
_poolStakingAddress
- The pool staking address._staker
- The staker's address.- Returns:
- uint256
stakingEpochEndBlock
function stakingEpochEndBlock() public view returns (uint256)
Returns the number of the last block of the current staking epoch.
- Returns:
- uint256
withdraw
function withdraw(address _fromPoolStakingAddress, uint256 _amount) external
Moves the specified amount of staking tokens/coins from the staking address of the specified pool to the staker's address. A staker calls this function when they want to withdraw their tokens/coins.
- Modifiers:
- gasPriceIsValid onlyInitialized
- Parameters:
_fromPoolStakingAddress
- The staking address of the pool from which the tokens/coins should be withdrawn._amount
- The amount of tokens/coins to be withdrawn. The amount cannot exceed the value returned by the `maxWithdrawAllowed` getter.