The distributeAssets()
function is responsible to distribute assets rewards among the stakers when ever a vault is liquidated.This function rely on chainLink Price oracle to get The latest price from chainlink oracle contract, However it does not check for stale prices which will result in wrong price calculation for assets and staker position will be decreased by wrong value.
The staker position in EUROs will be effected by wrong values. for simplicity i am going to ignore the decimals.
Consider the current price of token and assets in USD is 1$. and the staking position of user is 10 TST, total stake is 20 TST , assets amount is 10, and _collateralRate and _hundredPC = 1.
The equation to receive the Reward is => uint256 _portion = asset.amount * _positionStake / stakeTotal; putting the above mentioned values in this equation will return 5, so _portion = 5.
oracle return the stale price of token as 0.8$.
The equation to find the costinEUROs => uint256 costInEuros = _portion * 10 ** (18 - asset.token.dec) * uint256(assetPriceUsd) / uint256(priceEurUsd)
* _hundredPC / _collateralRate;
The user position will be decreased by 3.773584905660377 in EUROs but it was suppose to be decreased by 4.716981132075471. The difference is directly proportional with the _portion value.
Manual Review
Interoduces some Time Period and allow oracle perice only in that time frame.
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.