Participants in staking will not get rewards/assets after liquidation process as being promised. Implementation of distribution logic seems to be flawed.
Following lines are of Whitepaper of this protocol:
As we can see here , its clearly stated that the participants will get the distribution of assets based on the combined stake i.e sEURO + TST , to the total combined stake.
Now for this part, relevant code in the codebase is :
Now from the code , we can understand that while distributing assets , the portion of holder , presumably the proportion of distribution is being calculated by this line:
Now the _positionStake is the stake of individual participant which is obtained from calling stake function and stakeTotal is the total stake in the liquidity pool which is obtained from calling getStakeTotal() function.
But the ambiguity lies in the stake & getStakeTotal function.
In stake function there's this statement using ternary operator
Which means : if TST stake is greater than EUROs stake , then return EUROs else return TST.
And in getStakeTotal function uses this stake function itself for calculating the total stake in pool.
And before stating the ambiguity, according to the testcases done in the Test file of LiquidationPool contract. Participants are allowed to stake using either one of TST or EUROs OR both .
Relevant code is provided below from the test file, which does passes test while running the test file.
Now the ambiguity part:
In stake function , only either value of TST or EUROs is being used . Which further is used in getStakeTotal function.
For example:
Now lets say A participant stakes 100 TST and 70 EUROS, the stake function, while calculating his portion , since TST> EURO, it will return EUROs value.
Now lets say B participant stakes 50 TST and 0 EUROS, the 'stake' function will return EUROs value , i.e 0.
Now lets say C participant stakes 100 TST and 120 EUROS, the stake function will return TST value, i.e 100.
Here the getStakeTotal() function will return (70 + 0 + 100) = 170.
Issues :
B participant will get no portion of distribution of assets ,since stake function returned 0, even if he/she staked 50 TST in the pool as it was allowed as we saw in the test cases above. Hence getting NO rewards. Where he/she should have got (50+0)/(100+70+0+50+100+120) ~= 11.3637 % based on the combined stake.
According to the protocol, A participant should get (100+70)/(100+70+0+50+100+120) = 38.6364 % of distribution, but according to the code it will get 70/170 ~= 41.1764 % of distribution.
And for C, according to whitepaper => (100+120)/(100+70+0+50+100+120) = 50 %, but according to the code will get 100/170 ~= 58.82
This leads to uneven distribution of rewards where B is not getting any reward but A & C are getting more than they deserved according to their stake.
Also , participants are getting no benefit of staking more of TST or EUROs as the stake function is returning only the smaller one among them.
And they have also stated in whitepaper that liquidity staking should be done on 1:1 ratio of TST & EUROs or TST should be greater than EUROs, but in code base as we saw in the test cases, any one of both , staking is allowed. SO THIS WAS ALSO A POINT OF AMBUIGUITY .
Because of this issue, participants will not get fair amount of rewards as they are being promised. Also if deposited only one of the TST or EURO, they will not get any portion of the distribution asset.
This would be unfair for the participants because of which they may also lose trust, heavily impacting the protocol.
Thorough manual reviewing of code was being done.
The fix for this issue would be to update the stake function to correctly calculate the combined stake of a participant (both TST and EUROS stakes together) as being stated in the whitepaper, rather than just the smaller of the two stakes. This would ensure a fair distribution of rewards to all participants, regardless of how they choose to stake their tokens
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.