The YieldFacet::distributeYield()
does not update the Vault's zethYieldRate
before distributing the yield earned to shorter's ShortRecord
positions.
As a result, the shorter will receive the zETH
and Ditto
rewards less than expected.
The distributeYield()
does not update the Vault's zethYieldRate
before distributing the yield earned to the shorter's ShortRecord
positions.
Once the _distributeYield()
is executed, the non-updated zethYieldRate
will be consumed. Subsequently, the computed yield
(zETH
) and dittoYieldShares
will be less than expected.
Finally, the shorter will receive the zETH
and Ditto
rewards less than expected.
The distributeYield() distributes yield earned to the shorter's ShortRecord positions without updating the Vault's zethYieldRate
: https://github.com/Cyfrin/2023-09-ditto/blob/a93b4276420a092913f43169a353a6198d3c21b9/contracts/facets/YieldFacet.sol#L58-L69
The distributeYield() credits the zETH and Ditto rewards to a shorter
: https://github.com/Cyfrin/2023-09-ditto/blob/a93b4276420a092913f43169a353a6198d3c21b9/contracts/facets/YieldFacet.sol#L71
Since the Vault's zethYieldRate is not updated, the _distributeYield() will consume the non-updated zethYieldRate
: https://github.com/Cyfrin/2023-09-ditto/blob/a93b4276420a092913f43169a353a6198d3c21b9/contracts/facets/YieldFacet.sol#L83
Consequently, the computed yield (zETH) and dittoYieldShares will be less than expected
: https://github.com/Cyfrin/2023-09-ditto/blob/a93b4276420a092913f43169a353a6198d3c21b9/contracts/facets/YieldFacet.sol#L101-L114
As a result, the shorter will receive the zETH
and Ditto
rewards less than expected.
Manual Review
Update the Vault's zethYieldRate
before distributing the yield earned to the shorter's ShortRecord
positions.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.