QA Report #3
Labels
bug
Something isn't working
edited-by-warden
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
valid
1. Use of addrSet variable in HomeFi.sol
The addrSet variable in HomeFi.sol, does not look to have any significant use other than checking if the address is already set.
This can be also achieved by checking for already set addresses such as projectFactoryInstance or communityContract or even checking the length of wrappedToken[].
The addrSet variable can be safely removed with small code modification.
Code:
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/HomeFi.sol#L50
2. tokenCurrent1-3 can an array
In HomeFi.sol, three separate variables are defined for tokenCurrent(1-3). These variables are primarily used as indexes and it seems the number of currencies is always 3. In this case, instead of defining 3 separate variables, one array of length 3 can be defined to store all three currencies. This will save some storage gas.
Additionally, these 3 variables can be completely removed and directly referenced when populating the wrappedToken map at line 148
This will make the code a little smaller and much more readable.
Code:
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/HomeFi.sol#L50
3. Remove unused code:
The below code is never used and can be safely removed to save some gas
Code:
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/Community.sol#L910-918
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/HomeFi.sol#L314-322
4 bool parameter for delegateContractor can be removed
Code:
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/delegateContractor.sol#L148
The function delegateContractor(bool _bool) take bool parameter. However, this parameter can be removed as I am assuming when the function is called, the contractDelegated will either be true or false and that can be determined by evaluating the existing value of contractDelegated.
The code can be changed to contractDelegated = !contractDelegated;
The text was updated successfully, but these errors were encountered: