Skip to content

Commit

Permalink
safeErc20 in emergencyWithdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
defi-dev committed May 28, 2022
1 parent c1f6b92 commit 01f1426
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/AssetManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "./interfaces/IRouterVaultConnector.sol";

contract AssetManager is AbstractPowerIndexRouter {
using SafeMath for uint256;
using SafeERC20 for IERC20;

enum BalancerV2JoinKind {
INIT,
Expand Down Expand Up @@ -106,7 +107,7 @@ contract AssetManager is AbstractPowerIndexRouter {
_redeem(c, _underlyingAmount.sub(diff));
}

IERC20(poolAddress).transferFrom(msg.sender, address(this), _maxBPTAmountIn);
IERC20(poolAddress).safeTransferFrom(msg.sender, address(this), _maxBPTAmountIn);

uint256 poolBalanceBefore;
if (_returnDiff) {
Expand All @@ -118,7 +119,7 @@ contract AssetManager is AbstractPowerIndexRouter {
if (_returnDiff) {
uint256 poolBalanceAfter = IERC20(poolAddress).balanceOf(address(this));
poolBalanceDiff = poolBalanceBefore.sub(poolBalanceAfter);
IERC20(poolAddress).transfer(msg.sender, poolBalanceDiff);
IERC20(poolAddress).safeTransfer(msg.sender, poolBalanceDiff);
}
}

Expand Down

0 comments on commit 01f1426

Please sign in to comment.