Platform: Code4rena
Start Date: 31/01/2023
Pot Size: $90,500 USDC
Total HM: 47
Participants: 169
Period: 7 days
Judge: LSDan
Total Solo HM: 9
Id: 211
League: ETH
Rank: 150/169
Findings: 1
Award: $35.48
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x3b, 0xAgro, 0xBeirao, 0xMirce, 0xNineDec, 0xRobocop, 0xSmartContract, 0xTraub, 0xWeiss, 2997ms, 41i3xn, Awesome, Aymen0909, Bauer, Bnke0x0, Breeje, Cryptor, DadeKuma, Deathstore, Deekshith99, DevABDee, DevTimSch, Dewaxindo, Diana, Ermaniwe, Guild_3, H0, IceBear, Inspectah, JDeryl, Kaiziron, Kaysoft, Kenshin, Mukund, Praise, RaymondFam, Rickard, Rolezn, Ruhum, Sathish9098, SkyWalkerMan, SleepingBugs, UdarTeam, Udsen, Walter, aashar, adeolu, apvlki, arialblack14, ast3ros, btk, chaduke, chandkommanaboyina, chrisdior4, climber2002, codetilda, cryptonue, cryptostellar5, csanuragjain, ddimitrov22, descharre, dharma09, doublesharp, eccentricexit, ethernomad, fs0c, georgits, halden, hansfriese, hashminer0725, immeas, lukris02, luxartvinsec, matrix_0wl, merlin, mookimgo, mrpathfindr, nadin, olegthegoat, pavankv, rbserver, rebase, savi0ur, sayan, scokaf, seeu, shark, simon135, tnevler, tsvetanovv, ulqiorra, ustas, waldenyan20, y1cunhui, yongskiws, yosuke
35.4779 USDC - $35.48
Issue | Contexts | |
---|---|---|
LOW‑1 | Use _safeMint instead of _mint | 6 |
LOW‑2 | Lock pragmas to specific compiler version | All Contracts |
Issue | Contexts | |
---|---|---|
NC‑1 | Public functions not called by the contract should be declared external instead | 4 |
NC‑2 | Add parameter to Event-Emit | 1 |
NC‑3 | Include return parameters in NatSpec comments | All contracts |
NC‑4 | NatSpec is missing | 3 |
_safeMint
 instead of _mint
According to openzepplin's ERC721, the use of _mint
 is discouraged, use _safeMint
whenever possible. https://docs.openzeppelin.com/contracts/3.x/api/token/erc721#ERC721-_mint-address-uint256-
/src/vault/adapter/abstracts/AdapterBase.sol 160: _mint(receiver, shares); /src/vault/Vault.sol 151: _mint(receiver, shares); 191: _mint(receiver, shares); /src/utils/MultiRewardStaking.sol 80: mint(_amount, msg.sender); 115: _mint(receiver, shares); 148: _mint(to, amount);
Description: Pragma statements can be allowed to float when a contract is intended for consumption by other developers, as in the case with contracts in a library or EthPM package. Otherwise, the developer would need to manually update the pragma in order to compile locally. https://swcregistry.io/docs/SWC-103
Recommendation: Ethereum Smart Contract Best Practices - Lock pragmas to specific compiler version. solidity-specific/locking-pragmas
All Contracts pragma solidity ^0.8.15;
Contracts are allowed to override their parents' functions and change the visibility from external to public. Functions marked by external use call data to read arguments, where public will first allocate in local memory and then load them.
/src/vault/adapter/abstracts/AdapterBase.sol 271: function convertToUnderlyingShares(uint256 assets, uint256 shares) 456: function strategyDeposit(uint256 amount, uint256 shares) 467: function strategyWithdraw(uint256 amount, uint256 shares) 610: function supportsInterface(bytes4 interfaceId)
Some event-emit description hasn’t parameter. Add to parameter for front-end website or client app , they can has that something has happened on the blockchain.
/src/vault/adapter/abstracts/AdapterBase.sol 449: emit Harvested();
return parameters
 in NatSpec commentsContext: All Contracts
Description:
https://docs.soliditylang.org/en/v0.8.15/natspec-format.html
If Return parameters are declared, you must prefix them with "/// @return".
Some code analysis programs do analysis by reading NatSpec details, if they can't see the @return
tag, they do incomplete analysis.
Recommendation:Â Include return parameters in NatSpec comments
Recommendation Code Style:
/// @notice information about what a function does /// @param pageId The id of the page to get the URI for. /// @return Returns a page's URI if it has been minted function tokenURI(uint256 pageId) public view virtual override returns (string memory) { if (pageId == 0 || pageId > currentId) revert("NOT_MINTED"); return string.concat(BASE_URI, pageId.toString()); }
Description:Â NatSpec is missing for the following functions , constructor and modifier:
/src/vault/VaultController.sol 704: modifier canCreate() { /src/vault/Vault.sol# 496: modifier syncFeeCheckpoint() { /src/utils/MultiRewardStaking.sol 362: function getAllRewardsTokens() external view returns (IERC20[] memory) {
#0 - c4-judge
2023-02-28T15:04:49Z
dmvt marked the issue as grade-b