Open github-actions[bot] opened 1 year ago
Fixed, https://github.com/kree-dotcom/isomorph/commit/f8ddef0671d8e33bd0a019aaa26834aab6688306 . The exchange rate of the given Synth collateral to sUSD is calculated on each valuation call and removed from the collateral value.
Fixes look good. Exchange fee is now queried and removed from the valuation of the collateral
ctf_sec
medium
Vault_Synths.sol code does not consider protocol exchange fee when evaluating the Collateral worth
Summary
Vault_Synths.sol code does not consider protocol fee.
Vulnerability Detail
If we look into the good-written documentation:
https://github.com/kree-dotcom/isomorph/blob/789338c8979ab75b8187781a2500908bb26dcdea/docs/Vault_Lyra.md#getwithdrawalfee
I want to quote:
In Vault_Lyra.sol, when calculating the collateral of the LP token, the fee is taken into consideration.
This is not the case for Vault_Synths.sol, the underlying token also charge exchange fee, but this fee is not reflected when evaluating the Collateral worth.
https://docs.synthetix.io/incentives/#exchange-fees
If we go to https://synthetix.io/synths,
we can see that the sETH token charges 0.25%, the sBTC token charges 0.25%, the sUSD charges 0% fee, but this does not ensure this fee rate will not change in the future.
Impact
The collateral may be overvalued because the exchange does not count when evaluating the Collateral worth and result in bad debt which makes the project insolvent.
Code Snippet
Tool used
Manual Review
Recommendation
We recommend the project consider protocol exchange fee when evaluating the Collateral worth in Vault_Synths.sol
https://github.com/Synthetixio/synthetix/blob/develop/contracts/SystemSettings.sol#L362
Precisely when the exchange fee is updated, the fee is reflected in the collateral worth.