Platform: Code4rena
Start Date: 09/12/2022
Pot Size: $36,500 USDC
Total HM: 9
Participants: 69
Period: 3 days
Judge: Picodes
Total Solo HM: 2
Id: 190
League: ETH
Rank: 14/69
Findings: 3
Award: $583.62
🌟 Selected for report: 0
🚀 Solo Findings: 0
530.4488 USDC - $530.45
createMarket
function in PrePOMarketFactory.sol
contract creates a new PrePOMarket
contract. Salt is used for creating the contract which is computed from _createPairTokens
function. Variables passed to this function are visible from anyone (they are input parameter for the createMarket
function).
After the PrePOMarket
contract is created, only the team should mint Long and Short Tokens (Reference). This check is done with hook
function from MintHook.sol
contract. When the contract is created, _mintHook
variable points to zero address, which means that the check here will not execute.
Since all transactions are visible in the mempool for a short while before being executed, there could be an observer which can see the PrePOMarket
contract creation, compute the contract's address and call mint
function before the team has set the mintHook
's address. This can break the team's market economy or other things which depend on Long/Short Tokens.
Manual
One way is to set the mintHook
variable in PrePOMarket.sol
constructor when creating the contract in createMarket
function. The other way is to use some type of enhanced commit and reveal schemes.
#0 - c4-judge
2022-12-17T18:18:13Z
Picodes marked the issue as primary issue
#1 - c4-sponsor
2022-12-19T22:51:40Z
ramenforbreakfast marked the issue as sponsor acknowledged
#2 - ramenforbreakfast
2022-12-19T22:52:30Z
We acknowledge this issue, but are not going to address it since we do not plan on addressing the situation of being frontrun during market deployment via changing our SC architecture, since funds would not be impacted. We will try to mitigate this risk through our deployment process.
#3 - c4-judge
2023-01-07T11:35:36Z
Picodes marked the issue as satisfactory
#4 - C4-Staff
2023-01-17T19:11:48Z
captainmangoC4 marked issue 93 as selected for report. Updating associated duplicate and primary issues.
🌟 Selected for report: 0xSmartContract
Also found by: 0Kage, 0x52, 0xAgro, 0xNazgul, 0xTraub, 0xhacksmithh, Awesome, Aymen0909, Bnke0x0, Englave, Janio, Mukund, Parth, RaymondFam, Rolezn, SmartSek, Tointer, UdarTeam, Udsen, Zarf, caventa, chaduke, csanuragjain, deliriusz, gz627, idkwhatimdoing, izhelyazkov, joestakey, neumo, obront, oyc_109, rvierdiiev, shark, trustindistrust, wait, yongskiws
28.124 USDC - $28.12
Use (e.g. 1e6) rather than decimal literals (e.g. 1000000), for better code readability
apps/smart-contracts/core/contracts/Collateral.sol: 19 apps/smart-contracts/core/contracts/ManagerWithdrawHook.sol: 12
Scientific notation should be used for better code readability
apps/smart-contracts/core/contracts/Collateral.sol: 31 apps/smart-contracts/core/contracts/TokenSender.sol: 33
On lines L8-L9 it says that Users can mint/redeem long/short positions on a specific asset in exchange for Collateral tokens.
.
On lines L73-L74 there is a comment about the mint
which says Minting will only be done by the team, and thus relies on the `_mintHook` to enforce access controls
.
#0 - c4-judge
2022-12-19T14:32:48Z
Picodes marked the issue as grade-b
🌟 Selected for report: ReyAdmirado
Also found by: 0xSmartContract, 0xTraub, Aymen0909, Englave, Mukund, RHaO-sec, RaymondFam, Rolezn, Sathish9098, Tomio, UdarTeam, chaduke, dharma09, gz627, martin, nadin, pavankv, rjs, saneryee
25.0472 USDC - $25.05
X + Y
IS MORE EFFICIENT, THAN X += Y
(6 INSTANCES)packages/prepo-shared-contracts/contracts/NFTScoreRequirement.sol: 60 apps/smart-contracts/core/contracts/DepositRecord.sol: 31, 32, 36 apps/smart-contracts/core/contracts/WithdrawHook.sol: 64, 71
apps/smart-contracts/core/contracts/DepositRecord.sol: 42
function setGlobalNetDepositCap(uint256 _newGlobalNetDepositCap) external override onlyRole(SET_GLOBAL_NET_DEPOSIT_CAP_ROLE) { globalNetDepositCap = _newGlobalNetDepositCap; - emit GlobalNetDepositCapChange(globalNetDepositCap); + emit GlobalNetDepositCapChange(_newGlobalNetDepositCap); }
#0 - c4-judge
2022-12-19T13:23:11Z
Picodes marked the issue as grade-b