#
LibTokenizedVaultStaking
#
Functions
#
_vTokenId
First 4 bytes: "VTOK", next 8 bytes: interval, next 20 bytes: right 20 bytes of tokenId
function _vTokenId(bytes32 _tokenId, uint64 _interval) internal pure returns (bytes32 vTokenId_);
Parameters
#
_vTokenIdBucket
function _vTokenIdBucket(bytes32 _tokenId) internal pure returns (bytes32);
#
_initStaking
function _initStaking(bytes32 _entityId, StakingConfig calldata _config) internal;
#
_isStakingInitialized
function _isStakingInitialized(bytes32 _entityId) internal view returns (bool);
#
_stakingConfig
function _stakingConfig(bytes32 _entityId) internal view returns (StakingConfig memory);
#
_currentInterval
function _currentInterval(bytes32 _entityId) internal view returns (uint64 currentInterval_);
#
_payReward
function _payReward(bytes32 _stakingRewardId, bytes32 _entityId, bytes32 _rewardTokenId, uint256 _rewardAmount)
internal;
#
_stake
function _stake(bytes32 _stakerId, bytes32 _entityId, uint256 _amount) internal;
#
_unstake
function _unstake(bytes32 _stakerId, bytes32 _entityId) internal;
#
_getStakingStateWithRewardsBalances
function _getStakingStateWithRewardsBalances(bytes32 _stakerId, bytes32 _entityId, uint64 _interval)
internal
view
returns (StakingState memory state, RewardsBalances memory rewards);
#
_getStakingState
function _getStakingState(bytes32 _stakerId, bytes32 _entityId) internal view returns (StakingState memory state);
#
_collectRewards
function _collectRewards(bytes32 _stakerId, bytes32 _entityId, uint64 _interval) internal;
#
_validateStakingParams
function _validateStakingParams(StakingConfig calldata _config) internal view;
#
_getR
function _getR(bytes32 _entityId) internal view returns (uint64);
#
_getA
function _getA(bytes32 _entityId) internal view returns (uint64);
#
_getD
function _getD(bytes32 _entityId) internal view returns (uint64);
#
addUniqueValue
function addUniqueValue(RewardsBalances memory rewards, bytes32 newValue)
public
pure
returns (RewardsBalances memory, uint256);
#
_calculateStartTimeOfInterval
Get the starting time of a given interval
function _calculateStartTimeOfInterval(bytes32 _entityId, uint64 _interval)
internal
view
returns (uint64 intervalTime_);
Parameters
#
_calculateStartTimeOfCurrentInterval
function _calculateStartTimeOfCurrentInterval(bytes32 _entityId) internal view returns (uint64 intervalTime_);
#
_stakedAmount
function _stakedAmount(bytes32 _stakerId, bytes32 _entityId) internal view returns (uint256);
#
Events
#
TokenStakingStarted
event TokenStakingStarted(
bytes32 indexed entityId, bytes32 tokenId, uint256 initDate, uint64 a, uint64 r, uint64 divider, uint64 interval
);
#
TokenStaked
event TokenStaked(bytes32 indexed stakerId, bytes32 entityId, bytes32 tokenId, uint256 amount);
#
TokenUnstaked
event TokenUnstaked(bytes32 indexed stakerId, bytes32 entityId, bytes32 tokenId, uint256 amount);
#
TokenRewardPaid
event TokenRewardPaid(bytes32 guid, bytes32 entityId, bytes32 tokenId, bytes32 rewardTokenId, uint256 rewardAmount);
#
TokenRewardCollected
event TokenRewardCollected(
bytes32 indexed stakerId,
bytes32 entityId,
bytes32 tokenId,
uint64 interval,
bytes32 rewardCurrency,
uint256 rewardAmount
);