[G-01] ADD REQUIRE()
FOR ASSET ADDRESS CHECKS BEFORE DOING THE EXCHANGE
2022-05-sturdy/LidoVault.sol at 78f51a7a74ebe8adfd055bdbaedfddc05632566f · code-423n4/2022-05-sturdy
[G-02] ADD AN UNREGISTERASSET()
FUNCTION
By unregistering and setting a mapping field to 0
, you’ll be getting a Gsreset gas refund (2900 gas). If most registerAsset()
calls are paired with unregisterAsset()
calls, transactions will be cheaper
File: smart-contracts/YieldManager.sol #1
73 function registerAsset(address _asset) external onlyAdmin {
74 _assetsList[_assetsCount] = _asset;
75 _assetsCount = _assetsCount + 1;
76: }
[G-03] MULTIPLE ADDRESS
MAPPINGS CAN BE COMBINED INTO A SINGLE MAPPING
OF AN ADDRESS
TO A STRUCT
, WHERE APPROPRIATE
[G-04] STATE VARIABLES SHOULD BE CACHED IN STACK VARIABLES RATHER THAN RE-READING THEM FROM STORAGE
[G-05] INTERNAL
FUNCTIONS ONLY CALLED ONCE CAN BE INLINED TO SAVE GAS