The problem of duplicate statistics in the calculation of synthetic asset and underlying asset balances
Assumptions
Asset Definition
• aLETH (synthetic asset): can be converted to WETH through transmuter.
• WETH (underlying asset): the target asset of aLETH.
System Status
• The current contract address has the following assets:
• aLETH directly held: 100.
• WETH directly held: 50.
• Transmuter shows:
• Unfinished aLETH: 80 (referring to the part submitted to transmuter and waiting for redemption).
Current balanceDeployed function:
Execution logic:
• transmuter.getUnexchangedBalance(address(this)) returns the unexchanged aLETH: 80.
• underlying.balanceOf(address(this)) returns the held WETH: 50.
• asset.balanceOf(address(this)) returns the directly held aLETH: 100.
Calculation result:
Total asset balance = 80 (unexchanged aLETH) + 50 (WETH) + 100 (directly held aLETH) = 230.
Actual Asset Analysis
The 80 returned by transmuter.getUnexchangedBalance is already included in the directly held aLETH (100).
• These 80 aLETH are being exchanged, but they still belong to the directly held assets.
Therefore, part of the calculation of transmuter.getUnexchangedBalance and asset.balanceOf duplicates 80 aLETH.
Actual Total Assets:
• Directly held WETH: 50.
• Directly held aLETH: 100.
The total assets should be 50 + 100 = 150, not 230.
If transmuter.getUnexchangedBalance has already calculated the aLETH being exchanged, we should not add the aLETH in asset.balanceOf separately. Instead, we should only consider the WETH and aLETH directly held to avoid duplicate counting.
Manual review
To avoid duplicate counting, you can adjust the logic to ensure that getUnexchangedBalance and asset.balanceOf are not counted repeatedly:
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.