Platform: Code4rena
Start Date: 12/04/2023
Pot Size: $60,500 USDC
Total HM: 21
Participants: 199
Period: 7 days
Judge: hansfriese
Total Solo HM: 5
Id: 231
League: ETH
Rank: 138/199
Findings: 1
Award: $22.60
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: juancito
Also found by: 0xAgro, 0xNorman, 0xSmartContract, 0xStalin, 0xTheC0der, 0xWaitress, 0xhacksmithh, 0xnev, 3dgeville, 8olidity, Arz, Aymen0909, BGSecurity, BRONZEDISC, Bauchibred, Bauer, BenRai, ChainHunters, ChrisTina, CodeFoxInc, DedOhWale, DishWasher, EloiManuel, IceBear, Inspex, Jorgect, Kaysoft, LeoGold, LewisBroadhurst, Madalad, MiloTruck, MohammedRizwan, Nyx, Polaris_tow, RaymondFam, SaharDevep, SanketKogekar, Sathish9098, SolidityATL, Udsen, W0RR1O, aria, ayden, berlin-101, bin2chen, catellatech, codeslide, crc32, decade, descharre, evmboi32, eyexploit, fatherOfBlocks, georgits, giovannidisiena, joestakey, karanctf, kodyvim, ltyu, lukris02, m9800, matrix_0wl, mov, mrpathfindr, nadin, niser93, p0wd3r, parlayan_yildizlar_takimi, pavankv, pontifex, qpzm, ravikiranweb3, rbserver, santipu_, shealtielanz, slvDev, tnevler, wonjun, xmxanuel, yixxas
22.6007 USDC - $22.60
1.Use a more recent version of solidity instead of ^0.8.0
2.Import declarations should import specific symbols Prefer import declarations that specify the symbol(s) using the form import {SYMBOL} from "SomeContract.sol" rather than importing the whole file.
3.require() / revert() statements should have descriptive reason strings https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/MintingHub.sol#L171#L172
4.the function name isPosition may be a bit misleading because function names that start with 'is' typically indicate a boolean return value that represents whether a certain state is true or not. In this case, the function name may mislead people into thinking that it returns a boolean value. It is suggested to change the function name to a more descriptive name, such as getPositionMinter() https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Frankencoin.sol#L300
function getPositionMinter(address _position) override public view returns (address){ return positions[_position]; }
5.The "Withdraw" function's target address parameter is missing a zero address check,if the target address is accidentally set to 0 address, the token will be lost forever https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L249#L255
6.For important operations like withdrawals, it's better to include an event to record the action https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol#L249#L255
function withdraw(address token, address target, uint256 amount) external onlyOwner { if (token == address(collateral)){ withdrawCollateral(target, amount); } else { IERC20(token).transfer(target, amount); } + emit WithDrawEvent(token,targer,amount); }
7.lack of a zero address check. https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/MintingHub.sol#L54#L57 https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/StablecoinBridge.sol#L26#L31 https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Frankencoin.sol#L83#L90
8.The mintInternal function does not check whether the target address is a valid address or not. This could result in the minted tokens being sent to a non-existent address, which would cause them to be permanently lost https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/StablecoinBridge.sol#L49#L54
9.Before burning, it is necessary to check whether the user's balance is sufficient. https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/StablecoinBridge.sol#L68
function burnInternal(address zchfHolder, address target, uint256 amount) internal { + require(zchf.balanceOf(msg.sender)>=amount,"Insufficient funds"); zchf.burn(zchfHolder, amount); chf.transfer(target, amount); }
#0 - 0xA5DF
2023-04-26T19:38:41Z
2 - automated 9 - wrong
#1 - c4-judge
2023-05-16T16:50:03Z
hansfriese marked the issue as grade-b