code-423n4 / 2022-04-badger-citadel-findings

0 stars 1 forks source link

QA Report #227

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

2022-04-badger-citadel

1 delete unused import statement. The following import statement is never used.

https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/CitadelMinter.sol#L7

Delete it.

2 delete an unused import statement. The following import statement is never used.

https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/GlobalAccessControl.sol#L10

3 delete the unused library. The following using for is never used in the contract.

https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/GlobalAccessControl.sol#L6 https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/GlobalAccessControl.sol#L23

Delete them.

4 Lock pragmas to specific compiler version. Contracts should be deployed with the same compiler version and flags that they have been tested with thoroughly. Locking the pragma helps to ensure that contracts do not accidentally get deployed using, for example, an outdated compiler version that might introduce bugs that affect the contract system negatively.

In GlobalAccessControl.sol and CitadelToken.sol

pragma solidity 0.8.12;

5 wrong description. The following comment is not proper to explain the function finalize. If totalTokenIn is equal to or greater than tokenInLimit you can finalize the sale.

https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/KnightingRound.sol#L269

6 missing validation for input _tokenInLimit in setTokenInLimit. There is no validation for _tokenInLimit. I am not sure whether you intend or not. However if _tokenInLimit is less than totalTokenIn, the owner can immediately finalize the sale with the function finalize. If you do not intend it, try to use validation for _tokenInLimit to check whether the input _tokenInLimit is greater than totalTokenIn.

https://github.com/code-423n4/2022-04-badger-citadel/blob/main/src/KnightingRound.sol#L380-L389

require(totalTokenIn < tokenInLimit);