Skip to content

Implement disapprove() method #33

@databu

Description

@databu

A method to disapprove of an entity shall be added to the UTT contract. It should work similarly to how endorsement rewards work, but with a divisor D_d applied to the reward formula and the resulting penalty amount removed from the previous endorsers stake.

Endorsements work like this:

  1. endorse() method is called by the newly endorsing user.
  2. This creates an oracle request to retrieve the previous endorsers and stores call parameters in an OracleRequest object in a map.
  3. When the oracle received the data from our API, it calls fulfillEndorse().
  4. fulfillEndorse() looks up the original parameters for the endorse() call and invokes _endorse() with them.
  5. _endorse() iterates over the 1st- and 2nd-level previous endorsers separately, computes their rewards and mints that amount of UTT directly to them.

Disapprovals should work similarly:

  1. To build disapprove() method is called by the newly disapproving user.
  2. This creates an oracle request to retrieve the previous endorsers and stores call parameters in an OracleRequest object in a map. OracleRequest shall additionally store in property type flag whether it's for an endorsement or disapproval.
  3. fulfillEndorse() shall be renamed to fulfillPreviousEndorsers(). When the oracle received the data from our API, it calls fulfillPreviousEndorsers().
  4. fulfillPreviousEndorsers() looks up the original parameters for the endorse() or disapprove() call and invoke _endorse() or new to build _disapprove() with them.
  5. uint D_d shall be added as a constant to the contract, similar to O_n etc. Set D_d to 5 initially.
  6. _disapprove() shall iterate over the 1st- and 2nd-level previous endorsers, computes their penalties ( computeReward(...) / D_d) and remove that amount of UTT from the respective endorser's stake on the target, i.e. from previousEndorserStakes[target][from] and from totalStake[target]. Also according new events shall be emitted: Disapprove, PenalisePreviousEndorserLevel1 and PenalisePreviousEndorserLevel2 similar to the according Endorse and RewardPreviousEndorserLevel? events.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions