Platform: Code4rena
Start Date: 07/07/2022
Pot Size: $75,000 USDC
Total HM: 32
Participants: 141
Period: 7 days
Judge: HardlyDifficult
Total Solo HM: 4
Id: 144
League: ETH
Rank: 99/141
Findings: 1
Award: $62.31
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: xiaoming90
Also found by: 0x1f8b, 0x29A, 0x52, 0xA5DF, 0xDjango, 0xNazgul, 0xNineDec, 0xf15ers, 0xsanson, 0xsolstars, 242, 8olidity, Amithuddar, Aymen0909, Bnke0x0, BowTiedWardens, David_, Deivitto, ElKu, Funen, Hawkeye, IllIllI, JC, Kaiziron, Keen_Sheen, Kthere, Kulk0, Kumpa, Lambda, MEP, ReyAdmirado, Rohan16, Ruhum, Sm4rty, TomJ, Tomio, Treasure-Seeker, TrungOre, Tutturu, Viksaa39, Waze, _Adam, __141345__, ak1, apostle0x01, asutorufos, async, ayeslick, aysha, bbrho, benbaessler, berndartmueller, c3phas, cccz, chatch, cloudjunky, codexploder, cryptphi, delfin454000, dipp, durianSausage, dy, exd0tpy, fatherOfBlocks, hake, hansfriese, horsefacts, hubble, joestakey, jonatascm, kebabsec, kenzo, kyteg, mektigboy, neumo, oyc_109, pashov, pedr02b2, peritoflores, rajatbeladiya, rbserver, robee, rokinot, s3cunda, sach1r0, sahar, sashik_eth, scaraven, shenwilly, simon135, sorrynotsorry, sseefried, svskaushik, unforgiven, z3s, zzzitron
62.3135 USDC - $62.31
(IERC1155, IERC20, IERC1155)
imported in Transfer.sol
is not used anywhere inside the contract.require()
to the boolean return values.Buyout.sol
, while calulating totalSupply
of vault IVaultRegistry(registry).totalSupply(_vault)
.
This could be calculated directly by calling FERC1155(token).totalSupply(id)
directly which will make one less external call.// before (address token, uint256 id) = IVaultRegistry(registry).vaultToToken(_vault); .... uint256 totalSupply = IVaultRegistry(registry).totalSupply(_vault); .... // After .... (address token, uint256 id) = IVaultRegistry(registry).vaultToToken(_vault); ......... uint256 totalSupply = IERC1155(token).totalSupply(id);
error MethodNotFound()
in IVault.sol
is not used in the inherited contracts.if (owner != msg.sender) revert NotOwner(owner, msg.sender)
is used in multiple methods inside vault.sol
. It is recommended to use a single modifer for better code resue.transferOwnership()
could use two step process to prevent unintended mistakes.transferController()
for eg.
modifier vaultState(address _vault, State required) { // Reverts if address is not a registered vault (address token, uint256 id) = IVaultRegistry(registry).vaultToToken( _vault ); if (id == 0) revert NotVault(_vault); // Reverts if auction state is not successful (, , State current, , , ) = this.buyoutInfo(_vault); if (current != required) revert InvalidState(required, current); }
Now this modifier can be used in any function that needs to check the vault is in a certain state before performing certain actions.
for eg, lets use function porpose
of Migration.sol
function propose( address _vault, address[] calldata _modules, address[] calldata _plugins, bytes4[] calldata _selectors, uint256 _newFractionSupply, uint256 _targetPrice ) external vaultState(_vault, State.INACTIVE) { ... ... }
#0 - HardlyDifficult
2022-08-15T01:11:38Z