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

NestedFactory: _fromReserve param in _submitOutOrders() is redundant #128

Open
code423n4 opened this issue Nov 17, 2021 · 2 comments
Open
Assignees
Labels
bug Something isn't working G (Gas Optimization) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

GreyArt

Vulnerability details

Impact

_submitOutOrders() is invoked by 2 functions sellTokensToNft() and sellTokensToWallet(), both of which specify the _fromReserve parameter to be true. This parameter is therefore unneeded.

Recommended Mitigation Steps

function _submitOutOrders(
  uint256 _nftId,
  IERC20 _outputToken,
  uint256[] memory _inputTokenAmounts,
  Order[] calldata _orders,
  bool _reserved
) private returns (uint256 feesAmount, uint256 amountBought) {
	...
	
	IERC20 _inputToken = _transferInputTokens(
    _nftId,
    IERC20(_orders[i].token),
    _inputTokenAmounts[i],
    true
	);
}
@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Nov 17, 2021
code423n4 added a commit that referenced this issue Nov 17, 2021
@maximebrugel maximebrugel self-assigned this Nov 19, 2021
@maximebrugel maximebrugel added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Nov 23, 2021
@maximebrugel
Copy link
Collaborator

The parameter was added in the case of _submitOutOrders from a wallet (not the portfolio/reserve) to set the value to false. Since we are not allowing to do this, we can remove it.

However, it is not a bad idea to include a deposit function to add multiple tokens.

@maximebrugel maximebrugel removed their assignment Nov 25, 2021
@maximebrugel
Copy link
Collaborator

Same in _submitInOrders with _reserved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

2 participants