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: 126/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
The owner
argument of the initializeClone
function in Position.sol shadows the owner state variable in the Ownable contract that Position.sol inherited.
function initializeClone(address owner, uint256 _price, uint256 _limit, uint256 _coll, uint256 _mint) external onlyHub { if (_coll < minimumCollateral) revert InsufficientCollateral(); setOwner(owner); //@audit state variable shadowing price = _mint * ONE_DEC18 / _coll; if (price > _price) revert InsufficientCollateral(); limit = _limit; mintInternal(owner, _mint, _coll); emit PositionOpened(owner, original, address(zchf), address(collateral), _price); }
Consider renaming the owner
argument on the initializeClone
function in the Position.sol file to _owner
.
The code in the else
block of the onTokenTransfer
function in the StablecoinBridge.sol
would be better if the require(false)
is replaced with revert().
function onTokenTransfer(address from, uint256 amount, bytes calldata) external returns (bool){ if (msg.sender == address(chf)){ mintInternal(from, amount); } else if (msg.sender == address(zchf)){ burnInternal(address(this), from, amount); } else { 81: require(false, "unsupported token"); } return true; }
The OPENING_FEE
is fixed at 1000 * 10 ** 18. Add a function to adjust opening fee with a limit check.
There may be need to adjust the `OPENING_FEE in the future due to changing value of assets with time.
uint256 public constant OPENING_FEE = 1000 * 10**18;
#0 - c4-judge
2023-05-16T16:09:46Z
hansfriese marked the issue as grade-b