Lossless Governance

This contract is in charge of implementing the logic regarding the voting, solving and claiming rewards over the reports.

Hack Mitigation Repository

Variables

  • LSS_TEAM_INDEX

  • TOKEN_OWNER_INDEX

  • COMMITEE_INDEX

  • COMMITTEE_ROLE

  • HUNDRED

  • committeeMembersCount

  • walletDisputePeriod

  • compensationPercentage

  • losslessReporting

  • losslessStaking

  • losslessController

  • reportVotes

  • Vote

  • proposedWalletOnReport

  • ProposedWallet

  • MemberVotesOnProposal

  • compensation

  • Compensation

LSS_TEAM_INDEX

It refers to the index corresponding to the Lossless Team.

TOKEN_OWNER_INDEX

It refers to the index corresponding to the Token Owner.

COMMITEE_INDEX

It refers to the index corresponding to the Committee Members.

COMMITTEE_ROLE

It refers to the bytes32 role utilized by OpenZeppelin’s Access Control.

HUNDRED

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

committeeMembersCount

It refers to amount of members in the committee.

walletDisputePeriod

It refers to amount of time in seconds that a proposed wallet can be disputed.

compensationPercentage

It refers to the percentage dedicated for compensation when a report is solved negatively.

losslessReporting

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

losslessStaking

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

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.

reportVotes

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

VoteIt contains all the voting information associated with a report Id in the following items

  • mapping(address => bool) committeeMemberVoted - Mapping that indicates if a committee member has voted

  • mapping(address => bool) committeeMemberClaimed - Mapping that indicates if a committee member has claim their rewards

  • bool[] committeeVotes - Votes done by the committee

  • bool[3] votes - Array of three votes, one per part, indicating their decision

  • bool[3] voted - Array of three votes, one per part, indicating if they voted.

  • bool resolved - Indicates if the report has been solved

  • bool resolution - Indicates the report resolution

  • bool losslessPayed - Indicates if the lossless team claimed their rewards

  • uint256 amountReported - Indicates the amount reported

proposedWalletOnReport

It contains the information associated with a funds retrieve wallet proposal associated with a report Id via the ProposedWallet structure.

ProposedWallet

It contains the information associated with a funds retrieve wallet proposal associated with a report Id in the following variables.

  • uint16 proposal - Number of proposal

  • uint256 retrievalAmount - Amount to be retrieved

  • uint256 timestamp - Timestamp of the proposal

  • uint16 committeeDisagree - Amount of committee members that disagree

  • address wallet - Wallet proposed

  • bool status - Indicator if the funds were claimed

  • bool losslessVote - Vote casted by the Lossless Team

  • bool losslessVoted - Indicator if the Lossless Team has voted

  • bool tokenOwnersVote - Vote casted by the Token Owners

  • bool tokenOwnersVoted - Indicator if the Token Owners have voted

  • bool walletAccepted - Indicator of the proposal state

  • mapping (uint16 => MemberVotesOnProposal) memberVotesOnProposal - Mapping indicating if a member has voted on a proposal via the MemberVotesOnProposal structure

MemberVotesOnProposal

It contains the indicator if a certain committee member has voted on a proposal.

compensation

It contains the indicator and amount if an address has claimed and the amount to claim using the Compensation structure

Compensation

It contains a Uint256 indicating the amount to be compensated with and a bool indicating if it has already been claimed.

Modifiers

  • onlyLosslessAdmin()

  • onlyPauseAdmin()

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

Events

  • NewCommitteeMembers(address[] _members);

  • CommitteeMembersRemoval(address[] _members);

  • LosslessTeamPositiveVote(uint256 indexed _reportId);

  • LosslessTeamNegativeVote(uint256 indexed _reportId);

  • TokenOwnersPositiveVote(uint256 indexed _reportId);

  • TokenOwnersNegativeVote(uint256 indexed _reportId);

  • CommitteeMemberPositiveVote(uint256 indexed _reportId, address indexed _member);

  • CommitteeMemberNegativeVote(uint256 indexed _reportId, address indexed _member);

  • ReportResolve(uint256 indexed _reportId, bool indexed _resolution);

  • WalletProposal(uint256 indexed _reportId, address indexed _wallet);

  • CommitteeMemberClaim(uint256 indexed _reportId, address indexed _member, uint256 indexed _amount);

  • CommitteeMajorityReach(uint256 indexed _reportId, bool indexed _result);

  • NewDisputePeriod(uint256 indexed _newPeriod);

  • WalletRejection(uint256 indexed _reportId);

  • FundsRetrieval(uint256 indexed _reportId, uint256 indexed _amount);

  • CompensationRetrieval(address indexed _wallet, uint256 indexed _amount);

  • LosslessClaim(ILERC20 indexed _token, uint256 indexed _reportID, uint256 indexed _amount);

  • ExtraordinaryProposalAccept(ILERC20 indexed _token);

Functions

  • addCommitteeMembers()

  • isCommitteeMember()

  • getIsVoted()

  • getVote()

  • isReportSolved()

  • reportResolution()

  • retrieveCompensation()

  • losslessVote()

  • tokenOwnersVote()

  • committeeMemberVote()

  • resolveReport()

  • proposeWallet()

  • rejectWallet()

  • losslessClaim()

  • claimCommitteeReward()

  • retrieveFunds()

  • pause()

  • unpause()

  • getVersion()

  • setCompensationAmount()

  • setDisputePeriod()

  • removeCommitteeMembers()

  • isReportActive()

  • getAmountReported()

addCommitteeMembers()

function addCommitteeMembers(address[] memory _members) override public onlyLosslessAdmin whenNotPaused

Provided list of addresses will be given the role of Committee members.

No duplicate members can ever exist in the committee. Meaning one address cannot be included in the committee twice.

Called by Lossless Admin

NameTypeDescription

_members

address

Array of addresses to add to the committee.

isCommitteeMember()

function isCommitteeMember(address _account) override public view returns(bool)

Determines if an address belongs to the Committee.

NameTypeDescription

_account

address

Address to check if is member.

getIsVoted()

function getIsVoted(uint256 _reportId, uint256 _voterIndex) override public view returns(bool)

Returns if a report has been voted by one of the three pillars.

NameTypeDescription

_reportId

Uint256

Report ID to check voting.

_voterIndex

Uint256

Voter index.

getVote()

function getVote(uint256 _reportId, uint256 _voterIndex) override public view returns(bool)

Returns the resolution on a report by a team.

NameTypeDescription

_reportId

Uint256

Report ID to vote.

_voterIndex

Uint256

Voter index.

isReportSolved()

function isReportSolved(uint256 _reportId) override public view returns(bool)

Returns if report has been resolved.

NameTypeDescription

_reportId

Uint256

Report ID to check if it's solved.

reportResolution()

function reportResolution(uint256 _reportId) override public view returns(bool)

Runction returns report resolution.

NameTypeDescription

_reportId

Uint256

Report ID to it's resolution.

retrieveCompensation()

function retrieveCompensation() override public whenNotPaused

Once report is resolved negatively or report lifetime is over reporter address become entitled to the compensation.

This feature sends compensation amount to reporter addresses wallet.

Compensation amount (CA) is equal to report stake amount (RSA) multiplied by compensation percentage (CP).

CA = CP * RSA

Compensation is payed out in stake tokens.

Called by Staker

losslessVote()

function losslessVote(uint256 _reportId, bool _vote) override public onlyLosslessAdmin whenNotPaused

Lossless Team has a voting power of 1/3.

Called by Lossless Admin

NameTypeDescription

_reportId

Uint256

Report ID to vote.

_vote

bool

Resolution.

tokenOwnersVote()

function tokenOwnersVote(uint256 _reportId, bool _vote) override public onlyLosslessAdmin whenNotPaused

Token Owners have a voting power of 1/3.

Called by Token Owner

NameTypeDescription

_reportId

Uint256

Report ID to vote.

_vote

bool

Resolution.

committeeMemberVote()

function committeeMemberVote(uint256 _reportId, bool _vote) override public whenNotPaused

All committee members have combined voting power of 1/3.

Committee vote is a result of more than 1/2 of all committee members voting one way or another.

Called by Committee members

NameTypeDescription

_reportId

Uint256

Report ID to vote.

_vote

bool

Resolution.

resolveReport()

function resolveReport(uint256 _reportId) override public whenNotPaused

This feature can be triggered by anyone.

It should mark reported as resolved.

  • Resolve positively

    Meaning that report was indeed a valid report.

    It should move all reported token type tokens from reported address to lossless protocol. This should be done for all reported addresses (reported both in first and second reports).

  • Resolve negatively

    Remove reported address from the blacklist.

    Enable refund payout for incorrectly blacklisted addresses.

NameTypeDescription

_reportId

Uint256

Report ID to resolve.

proposeWallet()

function proposeWallet(uint256 _reportId, address _wallet) override public whenNotPaused

Once wallet is proposed dispute period is started.

Dispute period is set by Lossless Team and it starts once the wallet is proposed.

Proposed wallet is set to become refund wallet after dispute period is over without any disputes.

Called by Lossless Admin or Token Owner

NameTypeDescription

_reportId

Uint256

Report ID to generate proposal.

_wallet

address

Proposed wallet.

rejectWallet()

function rejectWallet(uint256 _reportId) override public whenNotPaused

Once 2/3 of all decision making body entities dispute a proposed wallet becomes rejected.

Once the proposed wallet is rejected dispute period is over and new wallet can be proposed.

For committee to dispute the wallet more than 1/2 of all committee members have to dispute it.

Called by Lossless Admin, Token Owner or Committee members

NameTypeDescription

_reportId

Uint256

Report ID to reject proposal.

losslessClaim()

function losslessClaim(uint256 _reportId) override public whenNotPaused onlyLosslessAdmin

Both Lossless Team take part of the retrieved tokens as a reward.

For Lossless Team reward (LTR) is equal to retrieved funds (RF) multiplied by lossless reward (LF)

LTR = LF * RF

Called by Lossless Admin

NameTypeDescription

_reportId

Uint256

Report ID to claim rewards.

claimCommitteeReward()

function claimCommitteeReward(uint256 _reportId) override public whenNotPaused

Committee Member take part of the retrieved tokens as a reward.

For Committee Member reward (CMR) is equal to retrieved funds (RF) multiplied by committee reward (CF) and divided by number of committee member that voted on this particular report (CM).

CMR = RF * CF / votesCountOnReport(report id)

Called by Committee members

NameTypeDescription

_reportId

Uint256

Report ID to claim rewards.

retrieveFunds()

function retrieveFunds(uint256 _reportId) override public whenNotPaused

Refund amount (RA) is sent to the refund wallet.

Refund amount (RA) is part of retrieved funds (RF). RA is equal to retrieved funds (RF) minus all the other rewards that other parties take.

RA = RF - (RF * CF) - LTR - SW - RW

Report is marked so that no further actions could be taken on it.

Called by Refund Wallet

NameTypeDescription

_reportId

Uint256

Report ID to retrieve funds.

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.

setCompensationAmount()

function setCompensationAmount(uint256 _amount) override public onlyLosslessAdmin

Provided value is used to set compensation amount (CA).

Called by Lossless Admin

NameTypeDescription

_amount

Uint256

New Compensation percentage.

setDisputePeriod()

function setDisputePeriod(uint256 _timeFrame) override public onlyLosslessAdmin whenNotPaused

Provided value is used for the setting new dispute period.

Dispute period is the time period in which the decision making body entities can dispute the proposed refund wallet.

Called by Lossless Admin

NameTypeDescription

_timeFrame

Uint256

New dispute timeframe.

removeCommitteeMembers()

function removeCommitteeMembers(address[] memory _members) override public onlyLosslessAdmin whenNotPaused

Provided list of addresses will be revoked the role of Committee members.

Called by Lossless Admin

NameTypeDescription

_members

address

Array of addresses to remove from committee.

isReportActive()

function isReportActive(uint256 _reportId) public view returns(bool)

It returns if a report is still active

NameTypeDescription

_reportId

uint256

Report Id to check if it's active.

getAmountReported()

function getAmountReported(uint256 _reportId) override external view returns(uint256)

Returns the total balance of a reported account at the moment the report was solved.

NameTypeDescription

_reportId

uint256

Report Id to verify.

Last updated