Skip to content

Commit

Permalink
Set only individual receiver internal balance in L1RecieverFacet
Browse files Browse the repository at this point in the history
  • Loading branch information
nickkatsios committed Sep 10, 2024
1 parent 09a0f93 commit 148cd6c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion protocol/contracts/beanstalk/migration/L1RecieverFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {IBean} from "contracts/interfaces/IBean.sol";
import {IFertilizer} from "contracts/interfaces/IFertilizer.sol";
import {Order} from "contracts/beanstalk/market/MarketplaceFacet/Order.sol";
import {Listing} from "contracts/beanstalk/market/MarketplaceFacet/Listing.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";

/**
* @author Brean
Expand Down Expand Up @@ -462,14 +463,19 @@ contract L1RecieverFacet is ReentrancyGuard {

/**
* @notice adds the migrated internal balances to the account.
* Since global internal balances set in ReseedGlobal also reflect smart contract balances,
* we do not need to update global internal balances here,
* only balances for the individual account.
*/
function addMigratedInternalBalancesToAccount(
address reciever,
address[] calldata tokens,
uint256[] calldata amounts
) internal {
for (uint i; i < tokens.length; i++) {
LibBalance.increaseInternalBalance(reciever, IERC20(tokens[i]), amounts[i]);
IERC20 token = IERC20(tokens[i]);
s.accts[reciever].internalTokenBalance[token] += amounts[i];
emit LibBalance.InternalBalanceChanged(reciever, token, SafeCast.toInt256(amounts[i]));
}
}

Expand Down

0 comments on commit 148cd6c

Please sign in to comment.