Issue: Require message too long
Explanation: The require errors below return error messages (found in Errors.sol) that can be shortened to 32 characters or fewer (as shown) to save gas.
Error string: "Not allowed to exceed maximum boost on Convex"
Change to "Can't exceed max boost on Convex"
Issue: Should use != 0 instead of > 0 in a require statement if variable is an unsigned integer (uint)
Explanation: != 0 should be used instead of > 0 where possible since > 0 costs more gas.
Issue: Variables should not be initialized to their default values
Explanation: Initializing variables to their default values is unnecessary and costs gas.
Issue: Duplicate import https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L9-L10
Remove duplicate import
Issue: Require message too long Explanation: The require errors below return error messages (found in Errors.sol) that can be shortened to 32 characters or fewer (as shown) to save gas.
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L67
Error string: "insufficient funds for updating the position" Change to "insufficient funds to update pos"
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L218
Error string: "token not usable for the specific action" Change to "token not usable for this action"
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L578
Error string: "too much ETH will be used for gas" Change to "too much ETH to be used for gas"
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L585
Error string: "not enough ETH in gas bank to cover gas" Change to "gas bank lacks ETH to cover gas"
The following two lines use the same error message: https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L159
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L182
Error string: "invalid pool implementation for given coin" Change to "invalid pool imp for given coin"
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L162
Error string: "invalid LP Token implementation for given coin" Change to "inv LP Token imp for given coin"
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L165
Error string: "invalid vault implementation for given coin" Change to "invalid vault imp for given coin"
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/PoolFactory.sol#L172
Error string: "invalid stakerVault implementation for given coin" Change to "invalid stakerVault imp for coin"
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L165
Error string: "Pool must be paused to withdraw from reserve" Change to "Pool must be paused to withdraw"
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/AddressProvider.sol#L285
Error string: "a staker vault already exists for the token" Change to "a staker vault exists for token"
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/CvxCrvRewardsLocker.sol#L85
Error string: "Not allowed to exceed maximum boost on Convex" Change to "Can't exceed max boost on Convex"
Issue: Should use != 0 instead of > 0 in a require statement if variable is an unsigned integer (uint) Explanation: != 0 should be used instead of > 0 where possible since > 0 costs more gas.
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L210
Change 'record.singleTopUpAmount > 0' to 'record.singleTopUpAmount != 0'
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L554
Change 'position.totalTopUpAmount > 0' to 'position.totalTopUpAmount != 0'
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpActionFeeHandler.sol#L123
Change 'totalClaimable > 0' to 'totalClaimable != 0'
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L401
Change '_depositCap > 0' to '_depositCap != 0'
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L471
Change 'underlyingAmount > 0' to 'underlyingAmount != 0'
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L549
Change 'redeemLpTokens > 0' to 'redeemLpTokens != 0'
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/vault/Vault.sol#L164
Change 'amount > 0' to 'amount != 0'
Issue: Should use additional require instead of && within a require function Explanation: Using require instead of && saves gas
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L359-L363
Change to: require(newSwapperSlippage >= _MIN_SWAPPER_SLIPPAGE, Error.INVALID_AMOUNT); require(newSwapperSlippage <= _MAX_SWAPPER_SLIPPAGE, Error.INVALID_AMOUNT);
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/actions/topup/TopUpAction.sol#L676
Change to: require(vars.success, Error.TOP_UP_FAILED); require(abi.decode(vars.topupResult, (bool)), Error.TOP_UP_FAILED);
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/strategies/ConvexStrategyBase.sol#L273-L276
Change to: require(token_ != address(_CVX), Error.INVALID_TOKEN_TOADD); require(token != address(underlying), Error.INVALID_TOKEN_TOADD); require(token != address(_CRV), Error.INVALID_TOKEN_TO_ADD);
Issue: Variables should not be initialized to their default values Explanation: Initializing variables to their default values is unnecessary and costs gas.
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/pool/LiquidityPool.sol#L483
Change 'uint256 currentFeeRatio = 0;' to 'uint256 currentFeeRatio;'
https://github.com/code-423n4/2022-04-backd/blob/c856714a50437cb33240a5964b63687c9876275b/backd/contracts/StakerVault.sol#L144
Change 'uint256 startingAllowance = 0;' to 'uint256 startingAllowance;'