Lossless Staking
Last updated
Was this helpful?
Last updated
Was this helpful?
This contract manages all staking done over reports.
stakes
Stake
StakeInfo
stakingToken
losslessReporting
losslessGovernance
losslessController
stakingAmount
HUNDRED
MILLION
reportCoefficient
stakedOnReport
PerReportAmount
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.
onlyLosslessAdmin()
onlyPauseAdmin()
notBlacklisted()
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);
stake()
stakerClaim()
pause()
unpause()
getVersion()
setStakingToken()
setStakingAmount()
setLssReporting()
setLosslessGovernance()
stakerClaimableAmount()
getIsAccountStaked()
getStakerCoefficient()
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.
_reportId
Uint256
Report Id to stake on.
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.
_reportId
Uint256
Report Id to claim staking rewards.
Sets the pause flag to true which in turn pauses some of the contracts functionality. Can be called only by the pauseAdmin
.
Sets the pause flag to false which in turn unpauses some of the contracts functionality. Can be called only by the pauseAdmin
.
This method returns the version of the smart contract.
Provided address is used to set new stake token.
Stake token is used in many parts of the protocol.
Called by Lossless Admin
_stakingToken
ILERC20
Staking token address.
Provided value is used to set report stake amount (RSA).
Called by Lossless Admin
_stakingAmount
Uint256
New staking amount.
Sets the Lossless Reporting Address to allow interaction.
Called by Lossless Admin
_losslessReporting
ILssReporting
Lossless Reporting Smart Contract Address.
Sets the Lossless Governance Address to allow interaction.
Called by Lossless Admin
_losslessGovernance
ILssGovernance
Lossless Governance Smart Contract Address.
Calculates and returns the claimable amount by the stakers
_reportId
Uint256
Report Id to check claimable amount.
### getIsAccountStaked()
```solidity
function getIsAccountStaked(uint256 _reportId, address _account) override public view returns(bool)
```
Returns if an address is already staking on a report
_reportId
Uint256
Report Id to check if an address is staking.
_account
address
Address to verify if it's staked.
Returns the coefficient of a staker in a report
_reportId
Uint256
Report Id to get the coefficient.
_address
address
Address to get the coefficient.