Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

G1-G2 Immutable asset definition #493

Closed 0xdcota closed 1 year ago

0xdcota commented 1 year ago

The following issues were lumped into one, due to similarity.

[G-1] Consider defining _asset as immutable inside BaseVault.sol

Description

BaseVault.sol

L65: IERC20Metadata internal _asset;

Since there is no option to change the collateral asset of the vault once it is defined, consider defining _asset as immutable. This will save gas since gas-intensive SLOADs will no longer be required.

[G-2] Consider defining _debtAsset as immutable inside BorrowingVault.sol

Description

BorrowingVault.sol

L87: IERC20Metadata internal _debtAsset;

Since there is no option to change the debt asset of the vault once it is defined, consider defining _debtAsset as immutable. This will save gas since gas-intensive SLOADs will no longer be required.