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:
endorse() method is called by the newly endorsing user.
- This creates an oracle request to retrieve the previous endorsers and stores call parameters in an
OracleRequest object in a map.
- When the oracle received the data from our API, it calls
fulfillEndorse().
fulfillEndorse() looks up the original parameters for the endorse() call and invokes _endorse() with them.
_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:
- To build
disapprove() method is called by the newly disapproving user.
- 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.
fulfillEndorse() shall be renamed to fulfillPreviousEndorsers(). When the oracle received the data from our API, it calls fulfillPreviousEndorsers().
fulfillPreviousEndorsers() looks up the original parameters for the endorse() or disapprove() call and invoke _endorse() or new to build _disapprove() with them.
uint D_d shall be added as a constant to the contract, similar to O_n etc. Set D_d to 5 initially.
_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.
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_dapplied to the reward formula and the resulting penalty amount removed from the previous endorsers stake.Endorsements work like this:
endorse()method is called by the newly endorsing user.OracleRequestobject in a map.fulfillEndorse().fulfillEndorse()looks up the original parameters for theendorse()call and invokes_endorse()with them._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:
disapprove()method is called by the newly disapproving user.OracleRequestobject in a map.OracleRequestshall additionally store in propertytypeflag whether it's for an endorsement or disapproval.fulfillEndorse()shall be renamed tofulfillPreviousEndorsers(). When the oracle received the data from our API, it callsfulfillPreviousEndorsers().fulfillPreviousEndorsers()looks up the original parameters for theendorse()ordisapprove()call and invoke_endorse()or new to build_disapprove()with them.uint D_dshall be added as a constant to the contract, similar toO_netc. SetD_dto 5 initially._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. frompreviousEndorserStakes[target][from]and fromtotalStake[target]. Also according new events shall be emitted:Disapprove,PenalisePreviousEndorserLevel1andPenalisePreviousEndorserLevel2similar to the accordingEndorseandRewardPreviousEndorserLevel?events.