Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETH fees to a proxy network fee wallet fix #709

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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