Frankencoin - SaharDevep's results

A decentralized and fully collateralized stablecoin.

General Information

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

Frankencoin

Findings Distribution

Researcher Performance

Rank: 125/199

Findings: 1

Award: $22.60

QA:
grade-b

🌟 Selected for report: 0

šŸš€ Solo Findings: 0

Audit Report

Summary

Low Risk Issues

IssueInstances
[L‑01]registerPosition() should be done at the end of the function1
[L‑02]Use safeERC20.safeApprove() instead of approve()2

Non-critical Issues

IssueInstances
[N‑01]initPeriod should be 7 days1
[N‑02]Interfaces should be in seperate files2
[N‑03]Constants should be used rather than magic numbers3

[L‑01] registerPosition() should be done at the end of the function

Impact

This does not pose any immediate risks, but it is better to register the position after all the other effects are done.

Findings

https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/MintingHub.sol#L107

registerPosition() should be called at the end of openPosition() and before return.

[L‑02] Use safeERC20.safeApprove() instead of approve()

Impact

Note that approve() will fail for certain token implementations that do not return a boolean value . Hence it is recommend to use safeApprove().

Findings

https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/ERC20.sol#L108 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/ERC20.sol#L221

Update the code with safeApprove().

[N‑01] initPeriod should be 7 days

Impact

It's recommended to set initPeriod to a constant value and specially because elsewhere the period is assumed to be a week. According to the docs it should be 7 days.

Findings

https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Position.sol#L53 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/MintingHub.sol#L88

Hardcode the passed parameter with 7 days in openPosition().

[N‑02] Interfaces should be in seperate files

Impact

Move the interfaces to a seperate file for better readability.

Findings

https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/MintingHub.sol#L299

[N‑03] Constants should be used rather than magic numbers

Findings

https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Frankencoin.sol#L118 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Frankencoin.sol#L205 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Frankencoin.sol#L166 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Frankencoin.sol#L239 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Equity.sol#L211 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Equity.sol#L247 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Equity.sol#L268 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/MintingHub.sol#L265 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Position.sol#L122 https://github.com/code-423n4/2023-04-frankencoin/blob/1022cb106919fba963a89205d3b90bf62543f68f/contracts/Position.sol#L124

Define constant variables for the findings mentioned above.

#0 - 0xA5DF

2023-04-26T19:56:58Z

N1 is dupe of #242 L2, N3 are in automated findings

#1 - c4-judge

2023-05-16T16:44:44Z

hansfriese marked the issue as grade-b

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Ā© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter