This contract manages all staking done over reports.
It contains all the stakes done over a report Id by an address via the Stake structure.
It contains all the stake info made by an address related to a report Id via the StakeInfo structure.
It contains all the information related to a stake made on a report using the following variables:
uint256 timestamp- Timestamp of the stake
uint256 coefficient- Address coefficient utilized to calculate the rewards
uint256 totalStakedOnReport- Amount staked on the report
bool staked- Indicator if the address has staked
bool payed- Indicator if the address has claimed the rewards
It refers to the address of the LERC20 token used for staking porpouses.
The ILssReporting type refers to the Lossless Reporting Interface, the variable itself contains the Smart Contract address of the Lossless Reporting to allow interaction.
The ILssGovernance type refers to the Lossless Governance Interface, the variable itself contains the Smart Contract address of the Lossless Governance to allow interaction.
The ILssController type refers to the Lossless Controller Interface, the variable itself contains the Smart Contract address of the Lossless Controller to allow interaction.
It refers to the amount of tokens needed to generate a stake.
Used in order to calculate percentages. Constant value of 100.
Used in order to calculate more precise amount. Constant value of 1000000.
It contains the total coefficient of a report in order to calculate individual stakers rewards.
It contains the total amount staked per report associated with a report Id over the PerReportAmount structure.
It contains a mapping that associates a report Id with the total amount staked on the report.
This modifiers ensures that the wrapped method can only be executed by the Lossless Admin
This modifiers ensures that the wrapped method can only be executed by the Pause Admin
This modifiers ensures that the wrapped method can only be executed by an address that is not blacklisted.
NewStake(ILERC20 indexed _token, address indexed _account, uint256 indexed _reportId);
StakerClaim(address indexed _staker, ILERC20 indexed _token, uint256 indexed _reportID, uint256 _amount);
NewStakingAmount(uint256 indexed _newAmount);
NewStakingToken(ILERC20 indexed _newToken);
NewReportingContract(ILssReporting indexed _newContract);
NewGovernanceContract(ILssGovernance indexed _newContract);
function stake(uint256 _reportId) override public notBlacklisted whenNotPaused
Community stake amount is transferred from the staker’s address to lossless protocol.
Stake info is saved for further references. Stake info must contain stake coefficient (SC). Stake coefficient is calculated like this:
(time when the report was submitted + report lifetime) - time when the stake was submitted.
The sooner the stake is made after the report is submitted the higher coefficient it gets.
Report Id to stake on.
function stakerClaim(uint256 _reportId) override public whenNotPaused
This feature should send part of the retrieved funds (RF) and all community stake amount (CSA) staker’s address.
CSA is sent in staking tokens. Staker gets back his initially staked tokens back.
Stakers Reward Percentage (SRP) is percentage that describes what part of all retrieved funds should be sent to all stakers combined.
- SRP is set and controller by Lossless Team
Stakers Reward (SW) is how many token the staker receives after the report is resolved positively.
SW = (RF * SRP)
Every staker receives only a part of the SW depending on what is his stake coefficient (SC).
One staker’s claimable reward (SWi) is calculated by dividing SW by the sum of all stakers coefficients and multiplying the result by the particular SCi .
SW(i) = SW / (SC(1) + SC(2) + ... + SC(n)) * SC(i)
All in all, after the staker claims his reward he should receive both SWi and CSA.
Report Id to claim staking rewards.
function pause() external onlyPauseAdmin
Sets the pause flag to true which in turn pauses some of the contracts functionality. Can be called only by the
function unpause() external onlyPauseAdmin
Sets the pause flag to false which in turn unpauses some of the contracts functionality. Can be called only by the
function getVersion() external pure returns (uint256)
This method returns the version of the smart contract.
function setStakingToken(ILERC20 _stakingToken) override public onlyLosslessAdmin
Provided address is used to set new stake token.
Stake token is used in many parts of the protocol.
Staking token address.
function setStakingAmount(uint256 _stakingAmount) override public onlyLosslessAdmin
Provided value is used to set report stake amount (RSA).
New staking amount.
function setLssReporting(ILssReporting _losslessReporting) override public onlyLosslessAdmin
Sets the Lossless Reporting Address to allow interaction.
Lossless Reporting Smart Contract Address.
function setLosslessGovernance(ILssGovernance _losslessGovernance) override public onlyLosslessAdmin
Sets the Lossless Governance Address to allow interaction.
Lossless Governance Smart Contract Address.
function stakerClaimableAmount(uint256 _reportId) override public view returns (uint256)
Calculates and returns the claimable amount by the stakers
Report Id to check claimable amount.
function getIsAccountStaked(uint256 _reportId, address _account) override public view returns(bool)
Returns if an address is already staking on a report
Report Id to check if an address is staking.
Address to verify if it's staked.
function getStakerCoefficient(uint256 _reportId, address _address) override public view returns (uint256)
Returns the coefficient of a staker in a report
Report Id to get the coefficient.
Address to get the coefficient.