Skip to content

Commit

Permalink
fix: optimize sloads
Browse files Browse the repository at this point in the history
  • Loading branch information
xenide committed Nov 20, 2024
1 parent d9bd36f commit 35c0708
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/asset-management/EulerV2Manager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,13 @@ contract EulerV2Manager is IAssetManager, Owned(msg.sender), ReentrancyGuard {
uint256 lNewShares = lVault.deposit(aAmount, address(this));

uint256 lOldTotalShares = totalShares[lVault];
totalShares[lVault] += lNewShares;
totalShares[lVault] = lOldTotalShares + lNewShares;
uint256 lSharesAllocated;
uint256 lLength = aPairs.length;
for (uint256 i = 0; i < lLength - 1; ++i) {
uint256 lOldShares = shares[aPairs[i]][aAsset];
uint256 lNewSharesEntitled = lNewShares.mulDiv( lOldShares, lOldTotalShares);
shares[aPairs[i]][aAsset] += lNewSharesEntitled;
uint256 lNewSharesEntitled = lNewShares.mulDiv(lOldShares, lOldTotalShares);
shares[aPairs[i]][aAsset] = lOldShares + lNewSharesEntitled;
lSharesAllocated += lNewSharesEntitled;
}

Expand Down

0 comments on commit 35c0708

Please sign in to comment.