Platform: Code4rena
Start Date: 19/04/2022
Pot Size: $30,000 USDC
Total HM: 10
Participants: 43
Period: 3 days
Judges: moose-code, JasoonS
Total Solo HM: 7
Id: 90
League: ETH
Rank: 38/43
Findings: 1
Award: $28.99
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0v3rf10w, 0xDjango, 0xNazgul, 0xkatana, Dravee, Kenshin, MaratCerby, Tadashi, TerrierLover, Tomio, TrungOre, defsec, ellahi, fatherOfBlocks, fatima_naz, gzeon, joestakey, kenta, minhquanym, oyc_109, rayn, rfa, robee, simon135, slywaters, windhustler, z3s
28.9852 USDC - $28.99
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code:
require(_assetPerBaseInUQ > 0, "IndexLibrary: ORACLE");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error IndexLibrary_Oracle(); .. if (_assetPerBaseInUQ <= 0) { revert IndexLibrary_Oracle(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/libraries/NAV.sol#L49
require(shares > 0, "NAV: INSUFFICIENT_AMOUNT");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error NAV_InsufficientAmount(); .. if (shares <= 0) { revert NAV_InsufficientAmount(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/libraries/NAV.sol#L59
require(amount > 0, "NAV: INSUFFICIENT_SHARES_BURNED");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error NAV_InsufficientSharesBurned(); .. if (amount <= 0) { revert NAV_InsufficientSharesBurned(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/BaseIndex.sol#L29
require(IAccessControl(registry).hasRole(role, msg.sender), "GovernableIndex: FORBIDDEN");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error GovernableIndex_Forbidden(); .. if (!IAccessControl(registry).hasRole(role, msg.sender)) { revert GovernableIndex_Forbidden(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/BaseIndex.sol#L34
require(_factory.supportsInterface(type(IIndexFactory).interfaceId), "BaseIndex: INTERFACE");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error BaseIndex_Interface(); .. if (!_factory.supportsInterface(type(IIndexFactory).interfaceId)) { revert BaseIndex_Interface(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/ChainlinkPriceOracle.sol#L51
require(_baseAggregator != address(0) && _base != address(0), "ChainlinkPriceOracle: ZERO");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ChainlinkPriceOracleEqualsZero(); .. if (_baseAggregator == address(0) && _base == address(0)) { revert ChainlinkPriceOracleEqualsZero(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/ChainlinkPriceOracle.sol#L61
require(registry.hasRole(ASSET_MANAGER_ROLE, msg.sender), "ChainlinkPriceOracle: FORBIDDEN");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ChainlinkPriceOracle_Forbidden(); .. if (!registry.hasRole(ASSET_MANAGER_ROLE, msg.sender) { revert ChainlinkPriceOracle_Forbidden(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/ChainlinkPriceOracle.sol#L62
require(_asset != address(0), "ChainlinkPriceOracle: ZERO");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ChainlinkPriceOracle_Zero(); .. if (_asset == address(0)) { revert ChainlinkPriceOracle_Zero(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/ChainlinkPriceOracle.sol#L86
require(basePrice > 0 && quotePrice > 0, "ChainlinkPriceOracle: NEGATIVE");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ChainlinkPriceOracle_Negative(); .. if (!(basePrice > 0 && quotePrice > 0)) { revert ChainlinkPriceOracle_Negative(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/IndexLogic.sol#L40
require(IAccessControl(registry).hasRole(ASSET_ROLE, assets.at(i)), "Index: INVALID_ASSET");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error Index_InvalidAsset(); .. if (!IAccessControl(registry).hasRole(ASSET_ROLE, assets.at(i))) { revert Index_InvalidAsset(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/IndexLogic.sol#L76
require(lastAssetBalanceInBase > 0, "Index: INSUFFICIENT_AMOUNT");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error Index_InsufficientAmount(); .. if (lastAssetBalanceInBase <= 0) { revert Index_InsufficientAmount(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/IndexLogic.sol#L98
require(value > 0, "Index: INSUFFICIENT_AMOUNT");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error Index_InsufficientAmount(); .. if (value <= 0) { revert Index_InsufficientAmount(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/ManagedIndex.sol#L28
require(msg.sender == factory, "ManagedIndex: FORBIDDEN");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ManagedIndex_Forbidden(); .. if (msg.sender != factory) { revert ManagedIndex_Forbidden(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/ManagedIndex.sol#L44-L48
require( IAccessControl(registry).hasRole(INDEX_MANAGER_ROLE, msg.sender) || IAccessControl(registry).hasRole(REWEIGHT_INDEX_ROLE, msg.sender), "ManagedIndex: FORBIDDEN" );
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ManagedIndex_Forbidden(); .. if (!(IAccessControl(registry).hasRole(INDEX_MANAGER_ROLE, msg.sender) || IAccessControl(registry).hasRole(REWEIGHT_INDEX_ROLE, msg.sender))) { revert ManagedIndex_Forbidden(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
require( _updatedAssets.length > 1 && _updatedWeights.length == _updatedAssets.length && _updatedAssets.length <= IIndexRegistry(registry).maxComponents(), "ManagedIndex: INVALID" );
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ManagedIndex_Invalid(); .. if (!(_updatedAssets.length > 1 && _updatedWeights.length == _updatedAssets.length && _updatedAssets.length <= IIndexRegistry(registry).maxComponents())) { revert ManagedIndex_Invalid(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
require(asset != address(0), "ManagedIndex: ZERO");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ManagedIndex_Zero(); .. if (asset == address(0)) { revert ManagedIndex_Zero(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
require(_updatedAssets[i - 1] < asset, "ManagedIndex: SORT");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ManagedIndex_Sort(); .. if (_updatedAssets[i - 1] >= asset) { revert ManagedIndex_Sort(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
require(IAccessControl(registry).hasRole(ASSET_ROLE, asset), "ManagedIndex: INVALID_ASSET");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ManagedIndex_InvalidAsset(); .. if (!IAccessControl(registry).hasRole(ASSET_ROLE, asset)) { revert ManagedIndex_InvalidAsset(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
require(assets.remove(asset), "ManagedIndex: INVALID");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error ManagedIndex_Invalid(); .. if (!assets.remove(asset)) { revert ManagedIndex_Invalid(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/PhuturePriceOracle.sol#L38
require(IAccessControl(registry).hasRole(_role, msg.sender), "PhuturePriceOracle: FORBIDDEN");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error PhuturePriceOracle_Forbidden(); .. if (!IAccessControl(registry).hasRole(_role, msg.sender)) { revert PhuturePriceOracle_Forbidden(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/PhuturePriceOracle.sol#L46
require(_registry.supportsAllInterfaces(interfaceIds), "PhuturePriceOracle: INTERFACE");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error PhuturePriceOracle_Interface(); .. if (!_registry.supportsAllInterfaces(interfaceIds)) { revert PhuturePriceOracle_Interface(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/PhuturePriceOracle.sol#L47
require(_base != address(0), "PhuturePriceOracle: ZERO");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error PhuturePriceOracle_Zero(); .. if (_base == address(0)) { revert PhuturePriceOracle_Zero(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/PhuturePriceOracle.sol#L56
require(_oracle.supportsInterface(type(IPriceOracle).interfaceId), "PhuturePriceOracle: INTERFACE");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error PhuturePriceOracle_Interface(); .. if (!_oracle.supportsInterface(type(IPriceOracle).interfaceId)) { revert PhuturePriceOracle_Interface(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/PhuturePriceOracle.sol#L63
require(priceOracleOf[_asset] != address(0), "PhuturePriceOracle: UNSET");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error PhuturePriceOracle_Unset(); .. if (priceOracleOf[_asset] == address(0)) { revert PhuturePriceOracle_Unset(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/PhuturePriceOracle.sol#L83
require(priceOracleOf[_asset] != address(0), "PhuturePriceOracle: UNSET");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error PhuturePriceOracle_Unset(); .. if (priceOracleOf[_asset] == address(0)) { revert PhuturePriceOracle_Unset(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/PhuturePriceOracle.sol#L93
require(priceOracleOf[_asset] != address(0), "PhuturePriceOracle: UNSET");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error PhuturePriceOracle_Unset(); .. if (priceOracleOf[_asset] == address(0)) { revert PhuturePriceOracle_Unset(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/TopNMarketCapIndex.sol#L45
require(msg.sender == factory, "TopNMarketCapIndex: FORBIDDEN");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error TopNMarketCapIndex_Forbidden(); .. if (msg.sender != factory) { revert TopNMarketCapIndex_Forbidden(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/TopNMarketCapIndex.sol#L55
require(asset != address(0), "TopNMarketCapIndex: ZERO");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error TopNMarketCapIndex_Zero(); .. if (asset == address(0)) { revert TopNMarketCapIndex_Zero(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
require(IAccessControl(registry).hasRole(ASSET_ROLE, asset), "TopNMarketCapIndex: INVALID_ASSET");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error TopNMarketCapIndex_InvalidAsset(); .. if (!IAccessControl(registry).hasRole(ASSET_ROLE, asset)) { revert TopNMarketCapIndex_InvalidAsset(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/TrackedIndex.sol#L30
require(msg.sender == factory, "TrackedIndex: FORBIDDEN");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error TrackedIndex_Forbidden(); .. if (msg.sender != factory) { revert TrackedIndex_Forbidden(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
require(IAccessControl(registry).hasRole(ASSET_ROLE, assets.at(i)), "TrackedIndex: INVALID_ASSET");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error TrackedIndex_InvalidAsset(); .. if (!IAccessControl(registry).hasRole(ASSET_ROLE, assets.at(i)) { revert TrackedIndex_InvalidAsset(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/UniswapV2PathPriceOracle.sol#L24
require(_path.length >= 2, "UniswapV2PathPriceOracle: PATH");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error UniswapV2PathPriceOracle_Path(); .. if (_path.length < 2) { revert UniswapV2PathPriceOracle_Path(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/UniswapV2PathPriceOracle.sol#L25
require(_oracles.length == _path.length - 1, "UniswapV2PathPriceOracle: ORACLES");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error UniswapV2PathPriceOracle_Oracles(); .. if (_oracles.length != _path.length - 1) { revert UniswapV2PathPriceOracle_Oracles(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/UniswapV2PriceOracle.sol#L46
require(reserve0 != 0 && reserve1 != 0, "UniswapV2PriceOracle: RESERVES");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error UniswapV2PriceOracle_Reserves(); .. if (reserve0 == 0 && reserve1 == 0) { revert UniswapV2PriceOracle_Reserves(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/UniswapV2PriceOracle.sol#L83
require(_asset == asset1, "UniswapV2PriceOracle: UNKNOWN");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error UniswapV2PriceOracle_Unknown(); .. if (_asset != asset1) { revert UniswapV2PriceOracle_Unknown(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/vToken.sol#L46
require(IAccessControl(registry).hasRole(_role, msg.sender), "vToken: FORBIDDEN");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error vToken_Forbidden(); .. if (!IAccessControl(registry).hasRole(_role, msg.sender)) { revert vToken_Forbidden(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/vToken.sol#L59
require(_registry.supportsAllInterfaces(interfaceIds), "vToken: INTERFACE");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error vToken_Interface(); .. if (!_registry.supportsAllInterfaces(interfaceIds)) { revert vToken_Interface(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/vToken.sol#L60
require(_asset != address(0), "vToken: ZERO");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error vToken_Zero(); .. if (_asset == address(0)) { revert vToken_Zero(); }
As per 0.8.4 solidity version it supports new custom errors. It spends 30 gas less when the revert condition is not met and 250 gas otherwise. Also reduces contract size and deployment costs.
Affected code: https://github.com/code-423n4/2022-04-phuture/blob/594459d0865fb6603ba388b53f3f01648f5bb6fb/contracts/vToken.sol#L71
require(msg.sender == IIndexRegistry(registry).orderer(), "vToken: FORBIDDEN");
https://blog.soliditylang.org/2021/04/21/custom-errors/
Recommended code: error vToken_Forbidden(); .. if (!msg.sender == IIndexRegistry(registry).orderer()) { revert vToken_Forbidden(); }
#0 - moose-code
2022-05-23T14:33:30Z
For readability warden should consider not copying and pasting same sentence 10 times.