Open code423n4 opened 2 years ago
> 0
!= 0
Proof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/AnyswapFacet.sol#L92 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/NXTPFacet.sol#L98
Recommended Mitigation Steps: Change to:
require(_postSwapBalance != 0, "ERR_INVALID_AMOUNT");
========================================================================
Proof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/HopFacet.sol#L48
Recommended Mitigation Steps: Change uint8 to uint256
uint8
uint256
i++
++i
Proof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/HopFacet.sol#L48 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/DiamondLoupeFacet.sol#L24 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/DexManagerFacet.sol#L33
Recommended Mitigation Steps: Change i++ to ++i
Proof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Libraries/LibDiamond.sol#L121 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Libraries/LibDiamond.sol#L189 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Libraries/LibDiamond.sol#L196 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Libraries/LibDiamond.sol#L212
Recommended Mitigation Steps: Replace > with ! =
>
! =
SafeERC20.function
Proof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/WithdrawFacet.sol#L9
Recommended Mitigation Steps: by not declaring:
using SafeERC20 for IERC20;
and use:
SafeERC20.safeTransfer(IERC20(_assetAddress), sendTo, _amount);
Duplicate of #100
Duplicate of #196
We internally decided to avoid previx increments for now.
> 0
is less efficient than!= 0
Proof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/AnyswapFacet.sol#L92 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/NXTPFacet.sol#L98
Recommended Mitigation Steps: Change to:
========================================================================
Proof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/HopFacet.sol#L48
Recommended Mitigation Steps: Change
uint8
touint256
========================================================================
i++
to++i
can save gasProof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/HopFacet.sol#L48 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/DiamondLoupeFacet.sol#L24 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/DexManagerFacet.sol#L33
Recommended Mitigation Steps: Change
i++
to++i
========================================================================
Proof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Libraries/LibDiamond.sol#L121 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Libraries/LibDiamond.sol#L189 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Libraries/LibDiamond.sol#L196 https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Libraries/LibDiamond.sol#L212
Recommended Mitigation Steps: Replace
>
with! =
========================================================================
SafeERC20.function
for gas optProof of Concept: https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/WithdrawFacet.sol#L9
Recommended Mitigation Steps: by not declaring:
and use:
========================================================================