Lossless Reporting

This contract is in charge of generating new reports and storing various parameters for rewards and report specefic timeframes.

Hack Mitigation Repository

Variables

  • reporterReward

  • losslessReward

  • stakersReward

  • committeeReward

  • reportLifetime

  • reportingAmount

  • reportCount

  • HUNDRED

  • stakingToken

  • losslessController

  • losslessGovernance

  • tokenReports

  • TokenReports

  • reportInfo

  • Report

reporterReward

Percentage dedicated to the reporter rewards.

losslessReward

Percentage dedicated to the Lossless Team rewards.

stakersReward

Percentage dedicated to the Stakers rewards.

committeeReward

Percentage dedicated to the Committee Members rewards.

reportLifetime

Max period of time in seconds that a report can persist and be interacted with.

reportingAmount

Amount of tokens needed to generate a report.

reportCount

Amount of reports generated.

HUNDRED

Used in order to calculate percentages. Constant value of 100.

stakingToken

LERC20 Token used to generate a report.

losslessController

The ILssController type refers to the Lossless Controller Interface, the variable itself contains the Smart Contract address of the Lossless Controller to allow interaction.

losslessGovernance

The ILssGovernance type refers to the Lossless Governance Interface, the variable itself contains the Smart Contract address of the Lossless Governance to allow interaction.

tokenReports

It contains all the addresses reported for a certain LERC20 token and the report number associated with the malicious account via the TokenReports structure.

TokenReports

It contains a mapping associating an address with a report Id.

reportInfo

It contains all the information associated with a report Id via the Report structure.

Report

It contains all the info related to a report Id with the following items:

  • address reporter: Address that generated the report

  • address reportedAddress: Address reported

  • address secondReportedAddress: Second address reported

  • uint256 reportTimestamps: Timestamp when the report was generated

  • ILERC20 reportTokens: LERC20 token on which the report was generated

  • bool secondReports: Indicator if it has a second report associated

  • bool reporterClaimStatus: Indicator if the reporter has claimed the rewards

Modifiers

  • onlyLosslessAdmin()

  • onlyPauseAdmin()

  • notBlacklisted()

  • onlyLosslessGov()

  • cannotExceedHundred()

onlyLosslessAdmin()

This modifiers ensures that the wrapped method can only be executed by the Lossless Admin

onlyPauseAdmin()

This modifiers ensures that the wrapped method can only be executed by the Pause Admin

notBlacklisted()

This modifiers ensures that the wrapped method can only be executed by an address that is not blacklisted.

onlyLosslessGov()

This modifiers ensures that the wrapped method can only be executed by the Lossless Governance Contract

cannotExceedHundred()

This modifiers ensures that the set rewards cannot exceed 100%

Events

  • ReportSubmission(ILERC20 indexed _token, address indexed _account, uint256 indexed _reportId);

  • SecondReportSubmission(ILERC20 indexed _token, address indexed _account, uint256 indexed _reportId);

  • NewReportingAmount(uint256 indexed _newAmount);

  • NewStakingToken(ILERC20 indexed _token);

  • NewGovernanceContract(ILssGovernance indexed _adr);

  • NewReporterReward(uint256 indexed _newValue);

  • NewLosslessReward(uint256 indexed _newValue);

  • NewStakersReward(uint256 indexed _newValue);

  • NewCommitteeReward(uint256 indexed _newValue);

  • NewReportLifetime(uint256 indexed _newValue);

  • ReporterClaim(address indexed _reporter, uint256 indexed _reportId, uint256 indexed _amount);

  • CompensationRetrieve(address indexed _adr, uint256 indexed _amount);

Functions

  • report()

  • secondReport()

  • reporterClaim()

  • pause()

  • unpause()

  • getVersion()

  • retrieveCompensation()

  • setLosslessReward()

  • setLosslessGovernance()

  • setLssReporting()

  • setReportingAmount()

  • getRewards()

  • setCommitteeReward()

  • setStakersReward()

  • setReporterReward()

  • setStakingToken()

  • setReportLifetime()

  • reporterClaimableAmount()

  • getReportInfo()

report()

function report(ILERC20 _token, address _account) override public notBlacklisted whenNotPaused returns (uint256)

After report is submitted reported address immediately gets blacklisted.

Every submitted report costs finder report stake amount (RSA).

Every report generates a unique report ID.

Successfully submitting report triggers an emergency mode for all particular token’s transfers.

Parameters:

Name
Type
Description

_token

ILERC20

Token to generate report.

_account

address

Reported Address.

Conditions

  1. Finder has to approve lossless to spend staking tokens from his wallet.

    • Minimum amount to be approved is equal to report stake amount.

    • Staking tokens are tokens of particular type. On ETH it could be LSS tokens, on other chains it could set to whichever token the Lossless Team decides.

  2. Finder has to make sure he has at least report stake amount tokens on his address.

  3. No two identical pending reports can be created (identical token + hacker address pair reported). Pending report is:

    • Not resolved by decision making body yet.

    • Report lifetime is not over.

  4. Finder cannot report an address that’s whitelisted.

  5. Report cannot be accepted if finder’s address is blacklisted.

  6. Finder cannot report an address that is in Dex list.

secondReport()

function secondReport(uint256 _reportId, address _account) override public whenNotPaused

After report is submitted reported address immediately gets blacklisted.

Second report does not generate a new report ID but instead adds a second address to the same report Id.

Reasoning behind two reports:

  • Second report is needed in cases where the hacker manages to front run the reporter and move the funds before he gets blacklisted.

  • After the first report is submitted emergency mode kicks in.

  • While the emergency mode is on hacker is not able to front run second report.

Parameters:

Name
Type
Description

_reportId

Uint256

Report ID to add a second address.

_account

address

Second reported Address.

Conditions

  1. Finder cannot report an address that’s whitelisted.

  2. Finder cannot report an address that is in Dex list.

  3. Report id should be of report that is still pending.

  4. Second report for particular report id was already submitted. Only one second report can be submitted.

  5. Second report is being submitted from a different address than the first one.

reporterClaim()

function reporterClaim(uint256 _reportId) override public whenNotPaused

This feature should send part of the retrieved funds (RF) and all report stake amount (RSA) to reporter’s address.

RSA is sent in staking tokens. Reporter gets back his initially staked tokens back.

Report Reward Percentage (RRP) is percentage that describes what part of all retrieved funds should be sent to reporter.

  • RRP is set and controlled by Lossless Team

Report Reward (RW) is how many tokens the reporter receives after the report is resolved positively.

RW = RRP * RF

All in all, after when reporter claims reward he should receive both RW and RSA.

Parameters:

Name
Type
Description

_reportId

Uint256

Report ID to claim.

Conditions

  1. Report is resolved positively.

  2. Reporter hasn’t claimed the reward yet.

  3. Reward can be claimed only by the same address who created the report in the first place.

pause

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 pauseAdmin.

unpause

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 pauseAdmin.

getVersion()

function getVersion() external pure returns (uint256)

This method returns the version of the smart contract.

retrieveCompensation()

function retrieveCompensation(address _adr, uint256 _amount) override public onlyLosslessGov

Allows the Lossless Governance Contract to trigger the compensation for an erroneously reported address.

Called by Lossless Governance

Parameters:

Name
Type
Description

_reportId

Uint256

Report ID to claim.

setLosslessReward()

function setLosslessReward(uint256 _reward) override public onlyLosslessAdmin cannotExceedHundred

New value is used to set lossless reward (LF).

Called by Lossless Admin

Parameters:

Name
Type
Description

_reward

Uint256

Reward percentage.

setLosslessGovernance()

function setLosslessGovernance(ILssGovernance _losslessGovernance) override public onlyLosslessAdmin

Sets the Lossless Governance Address to allow interaction.

Called by Lossless Admin

Parameters:

Name
Type
Description

_losslessGovernance

ILssGovernance

Lossless Governance Smart Contract.

setLssReporting()

function setLssReporting(ILssReporting _losslessReporting) override public onlyLosslessAdmin

Sets the Lossless Reporting Address to allow interaction.

Called by Lossless Admin

Parameters:

Name
Type
Description

_losslessReporting

ILssReporting

Lossless Reporting Smart Contract.

setReportingAmount()

function setReportingAmount(uint256 _reportingAmount) override public onlyLosslessAdmin

Sets the amount of tokens to be staked when generating a new report.

Called by Lossless Admin

Parameters:

Name
Type
Description

_reportingAmount

Uint256

New reporting amount.

getRewards()

function getRewards() override external view returns (uint256 _reporter, uint256 _lossless, uint256 _committee, uint256 _stakers)

Returns the amount of rewards that have been set for each group.

setCommitteeReward()

function setCommitteeReward(uint256 _reward) override public onlyLosslessAdmin cannotExceedHundred

New value is used to set committee reward (CF).

Called by Lossless Admin

Parameters:

Name
Type
Description

_reward

Uint256

Reward percentage.

setStakersReward()

function setStakersReward(uint256 _reward) override public onlyLosslessAdmin cannotExceedHundred

New value is used to set stakers reward (SRF).

Called by Lossless Admin

Parameters:

Name
Type
Description

_reward

Uint256

Reward percentage.

### setReporterReward()

```solidity

function setReporterReward(uint256 _reward) override public onlyLosslessAdmin cannotExceedHundred

```

New value is used to set reporter reward (RRP).

Called by Lossless Admin

Parameters:

Name
Type
Description

_reward

Uint256

Reward percentage.

### setStakingToken()

```solidity

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.

Called by Lossless Admin

Parameters:

Name
Type
Description

_stakingToken

ILERC20

Staking token address.

setReportLifetime()

function setReportLifetime(uint256 _lifetime) override public onlyLosslessAdmin

Provided address is used to set new report lifetime.

Called by Lossless Admin

Parameters:

Name
Type
Description

_lifetime

Uint256

New report lifetime in seconds.

reporterClaimableAmount()

function reporterClaimableAmount(uint256 _reportId) override public view returns (uint256)

Returns the amount that the reporter can claim.

Parameters:

Name
Type
Description

_reportId

Uint256

Report Id to verify the amount to claim.

getReportInfo()

function getReportInfo(uint256 _reportId) override external view returns(
        address reporter,
        address reportedAddress,
        address secondReportedAddress,
        uint256 reportTimestamps,
        ILERC20 reportTokens,
        bool secondReports,
        bool reporterClaimStatus)

Returns the information regarding a certain report.

Parameters:

Name
Type
Description

_reportId

Uint256

Report Id to get the information from.

Last updated