function createOffer
is used to create a offer in PreMarkets.sol
. It also creates three mappings entry(makerInfoMap
, offerInfoMap
and stockInfoMap
) during creation of offer. The wrong offerId
is used in the struct of offerInfoMap
and stockInfoMap
.
In createOffer
, offerId
is used to determine makerAddr
, stockAddr
and offerAddr
. Once, address is determined, the offerId
is incremented as shown below. After incrementing, while filling the struct data for offerInfoMap
and stockInfoMap
, it is using incremented offerId
instead of the offerId
through which addresses are generated.
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/PreMarkets.sol#L39-L158
Wrong data being filled in offerInfoMap
and stockInfoMap
.
Manual review
Update the code as follows:
I believe this is valid low severity, although there is inconsistency here when using the correct `offerId` for assigning offerIds and generating the unique addresses as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L67-L69), this is purely an accounting error for offerIds. If we generate the offerId using current `offerId - 1`, the appropriate listing/taker orders can still be created against those offers.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.