Skip to content

Commit

Permalink
fixed sending ETH fees to a proxy network fee wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
yudilevi committed Oct 26, 2023
1 parent 4c9c11f commit dc378ab
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions contracts/converter/types/standard-pool/StandardPoolConverter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity 0.6.12;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

import "../../ConverterVersion.sol";
Expand All @@ -26,6 +27,7 @@ contract StandardPoolConverter is ConverterVersion, IConverter, ContractRegistry
using SafeMath for uint256;
using ReserveToken for IReserveToken;
using SafeERC20 for IERC20;
using Address for address payable;
using MathEx for *;

uint256 private constant MAX_UINT128 = 2**128 - 1;
Expand Down Expand Up @@ -393,8 +395,20 @@ contract StandardPoolConverter is ConverterVersion, IConverter, ContractRegistry

_setReserveBalances(1, 2, reserveBalance0, reserveBalance1);

_reserveTokens[0].safeTransfer(address(wallet), fee0);
_reserveTokens[1].safeTransfer(address(wallet), fee1);
// using a regular transfer here for the native token would revert due to exceeding
// the 2300 gas limit which is why we're using call instead (via sendValue),
// which the 2300 gas limit does not apply for
if (_reserveTokens[0].isNativeToken()) {
payable(address(wallet)).sendValue(fee0);
} else {
_reserveTokens[0].safeTransfer(address(wallet), fee0);
}

if (_reserveTokens[1].isNativeToken()) {
payable(address(wallet)).sendValue(fee1);
} else {
_reserveTokens[1].safeTransfer(address(wallet), fee1);
}

return (reserveBalance0, reserveBalance1);
}
Expand Down

0 comments on commit dc378ab

Please sign in to comment.