Skip to content

Commit bb0e658

Browse files
committed
S Feat: Small changes.
1 parent 3cd11be commit bb0e658

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/mainnet-fork/ERC4626DonationAttack.t.sol

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,17 @@ contract ERC4626DonationAttack is ERC4626DonationAttackTestBase {
111111
assertEq(morphoVault.totalAssets(), 3_000_000e18 + 1);
112112
assertEq(morphoVault.totalSupply(), 4);
113113

114-
uint256 assetsOfProxy = morphoVault.convertToAssets(morphoVault.balanceOf(almProxy));
114+
uint256 assetsOfProxy = morphoVault.convertToAssets(morphoVault.balanceOf(address(almProxy)));
115115
uint256 assetsOfAttacker = morphoVault.convertToAssets(morphoVault.balanceOf(attacker));
116116

117-
assertEq(assetsOfProxy, 1_500_000e18 + 1);
117+
// convertToAssets(shares) == shares * (totalAssets + 1) / (totalSupply + 1)
118+
// convertToAssets(3) == 3 * (3_000_000e18 + 1 + 1) / (4 + 1)
119+
// == 1_800_000e18 + 1
120+
assertEq(assetsOfProxy, 1_800_000e18 + 1);
118121
assertLt(assetsOfProxy, 2_000_000e18); // The proxy owns less than it deposited
119-
assertEq(assetsOfAttacker, 500_000e18);
122+
// convertToAssets(1) == 1 * (3_000_000e18 + 1 + 1) / (4 + 1)
123+
// == 600_000e18
124+
assertEq(assetsOfAttacker, 600_000e18);
120125
}
121126

122127
function _doAttack() internal {

0 commit comments

Comments
 (0)