Skip to content

Commit

Permalink
fix: handle fee on transfer tokens in balancer v3 gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
Van0k committed Feb 15, 2025
1 parent f0f4a92 commit 03f50da
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contracts/helpers/balancer/BalancerV3RouterGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ contract BalancerV3RouterGateway is IBalancerV3Router {
bool wethIsEth,
bytes calldata userData
) external returns (uint256 amountOut) {
uint256 balanceBefore = tokenIn.balanceOf(address(this));

tokenIn.safeTransferFrom(msg.sender, address(this), exactAmountIn);

exactAmountIn = tokenIn.balanceOf(address(this)) - balanceBefore;

tokenIn.forceApprove(permit2, exactAmountIn);
IPermit2(permit2).approve(address(tokenIn), balancerV3Router, uint160(exactAmountIn), uint48(block.timestamp));

Expand Down

0 comments on commit 03f50da

Please sign in to comment.