If we have some loss in the strategy, that loss will not be taken into account if user withdraws tokens from the strategy and have available withdraw limit for that.
In the strategy, only way a profit/loss is realized is when report(...)
is called. And that is not taken into account when a user withdraws those tokens. There will only be losses if user are withdrawing tokens that are not within the withdraw limit of the strategy. During withdraw, the strategy will call the _maxWithdraw(...)
first to get the available withdraw limit:
_maxWithdraw()
calls availableWithdrawLimit(...)
function and this is how the available limit is calculated:
so it's just the total alETH
balance of the transmuter and strategy iteself.
Then freeFunds()
method is called to withdraw the required tokens from the transmuter if not have already:
_freeFunds(...):
Github Link
So as far as the transmuter has enough balance to withdraw, not upcoming loss or profit will be realized. So if there is an upcoming loss, a user can just frontrun the transaction and withdraw his tokens before that so that no loss is incurred to him. This is the problem because when there is a profit, a user frontrunning the transaction will not have much impact as the profit is unlocked over some time not at the same moment. But in case of loss, the shares are burnt immediately:
A user can get away without paying his losses share.
Foundry
Manual Review
It is recommended to have some kind of locking mechanism before report is called or go for some other alternative.
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.