Platform: Code4rena
Start Date: 19/08/2021
Pot Size: $30,000 USDC
Total HM: 5
Participants: 11
Period: 7 days
Judge: 0xean
Total Solo HM: 4
Id: 26
League: ETH
Rank: 9/11
Findings: 3
Award: $486.83
🌟 Selected for report: 1
🚀 Solo Findings: 0
0xsanson
Treasury.sol has a mapping marketWhitelist[addr]
to check if a certain market has to be restricted.
The issue is that the contract doesn't have a function to change the marketWhitelist
values, so every market is always not-restricted.
In other words, the following requirement in RCMarket.sol is always satisfied:
// restrict certain markets to specific whitelists require( treasury.marketWhitelistCheck(_user), "Not approved for this market" );
https://github.com/code-423n4/2021-08-realitycards/blob/main/contracts/RCMarket.sol#L758-L761
editor
Add a function where the owner can change marketWhitelist
in Treasury.sol.
#0 - Splidge
2021-08-26T08:58:53Z
Duplicate of #18
0xsanson
In RCMarket.setWinner
, the conversion from uint256 to uint32 isn't performed safely.
uint256 _blockTimestamp = uint32(block.timestamp); require(_blockTimestamp <= type(uint32).max, "Overflow"); marketLockingTime = uint32(_blockTimestamp);
Indeed it checks that _blockTimestamp <= type(uint32).max
instead of block.timestamp <= type(uint32).max
.
Reference to the correct implementation: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0/contracts/utils/SafeCast.sol#L63-L66
https://github.com/code-423n4/2021-08-realitycards/blob/main/contracts/RCMarket.sol#L511-L513
editor
Change to:
require(block.timestamp <= type(uint32).max, "Overflow"); marketLockingTime = uint32(block.timestamp);
#0 - Splidge
2021-08-26T09:41:16Z
Duplicate of #28
🌟 Selected for report: 0xsanson
0 USDC - $0.00
0xsanson
In rcMarket._processRentCollection
it's possible to save a SLOAD by rewriting the lines:
uint256 _rentOwed = (card[_card].cardPrice * (_timeOfCollection - card[_card].timeLastCollected)) / 1 days; uint256 _timeHeldToIncrement = (_timeOfCollection - card[_card].timeLastCollected);
into:
uint256 _timeHeldToIncrement = (_timeOfCollection - card[_card].timeLastCollected); uint256 _rentOwed = (card[_card].cardPrice * _timeHeldToIncrement) / 1 days;
https://github.com/code-423n4/2021-08-realitycards/blob/main/contracts/RCMarket.sol#L1060-L1063
editor
Consider changing the code as illustrated.
#0 - Splidge
2021-09-07T11:05:14Z
Fixed here