The function getUserVaultMeowllateralInEuros
is critical for determining the value of user collateral. However, there is an issue with the current calculation. Given the conversion rate of 1 EUR = 1.09 USD, the value in euros should be less than in USD. The current formula used:
results in a value that is consistently higher than the original collateral amount (collateralAns
). This discrepancy occurs because the formula incorrectly scales the conversion rate.
The calculation does not accurately reflect the conversion from USD to EUR. Given the current rate of 1 EUR = 1.09 USD, the value in euros should be lower than in USD. However, the formula provided leads to inflated results:
This error results in the getUserVaultMeowllateralInEuros
function returning a value that exceeds the USD equivalent of the collateral, contradicting the expected behaviour where EUR should be less than USD.
Deposit 5 ether into the vault.
Mint 5 ether from the pool.
Observe that the output of getUserVaultMeowllateralInEuros(user)
is greater than the USD value of 5 ether. Since 1 EUR = 1.09 USD, the EUR value should be lower than the USD value, but this is not reflected correctly in the current implementation.
The incorrect calculation of collateral value in euros has significant implications for the KittyVault.sol
smart contract, particularly affecting the following areas:
Collateral Valuation Accuracy:
The current formula inflates the euro value of collateral, resulting in a value that is higher than expected given the USD to EUR conversion rate. This misvaluation can lead to inaccurate assessments of collateral worth, potentially affecting liquidity and risk management within the system.
User Funds and Liquidation Risks:
Users’ collateral might be undervalued or misrepresented, leading to potential issues with collateral requirements and liquidation thresholds. Users could face unintended liquidation risks or incorrect collateral requirements, which can erode trust in the system and affect user experience.
Manual
To correct the calculation and ensure the proper conversion of collateral value from USD to EUR, update the formula as follows:
By adjusting the formula in this way, the calculation will accurately reflect the value of the collateral in euros, taking into account the correct conversion rate
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.