Skip to content

Commit

Permalink
Merge pull request #9 from euler-xyz/cantina-490
Browse files Browse the repository at this point in the history
Cantina 490: BalanceUtils.transferBalance may give wrong info to the hook
  • Loading branch information
dglowinski authored Jul 30, 2024
2 parents 50deb12 + 67533d4 commit a92a2fb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/EVault/shared/BalanceUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ abstract contract BalanceUtils is Base {
Shares newFromBalance = origFromBalance.subUnchecked(amount);
user.setBalance(newFromBalance);

if (fromBalanceForwarderEnabled) {
balanceTracker.balanceTrackerHook(from, newFromBalance.toUint(), isControlCollateralInProgress());
}

// update to

user = vaultStorage.users[to];
Expand All @@ -89,11 +93,7 @@ abstract contract BalanceUtils is Base {
Shares newToBalance = origToBalance + amount;
user.setBalance(newToBalance);

if (fromBalanceForwarderEnabled) {
balanceTracker.balanceTrackerHook(from, newFromBalance.toUint(), isControlCollateralInProgress());
}

if (toBalanceForwarderEnabled && from != to) {
if (toBalanceForwarderEnabled) {
balanceTracker.balanceTrackerHook(to, newToBalance.toUint(), false);
}
}
Expand Down

0 comments on commit a92a2fb

Please sign in to comment.