Before the LibShortRecord#burnNFT()
would be called with a tokenID of the Short Position NFT in the ShortRecordFacet#combineShorts()
, the tokenID of the Short Position NFT is supposed to be minted by calling the ERC721Facet#mintNFT()
.
However, the ERC721Facet#mintNFT()
would never be called in any contracts and any functions. As a result, a Short Position NFT will never be minted.
If a NFT will never be minted, a Short Position NFT will never be burned in the ShortRecordFacet#combineShorts()
.
Because the currentShort.tokenId
would always 0
and therefore the condition (if (currentShort.tokenId != 0)
) would always be skipped in the ShortRecordFacet#combineShorts()
. Due to that, if-block under the condition would also always be skipped.
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/ShortRecordFacet.sol#L162-L169
This is unintended behavior of the Ditto protocol as a design.
In addition to that, the DittoETH protocol assume that a current shorter can transfer their short position to another user (a potential future shorter) as a design by transferring the Short Position NFT from a current shorter to another user.
However, the assumption (design) would also not work due to missing to call the ERC721Facet#mintNFT()
.
Within the ERC721Facet#mintNFT()
, a Short Position NFT that represents the Short Position would be minted like this:
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/ERC721Facet.sol#L260-L284
Within the LibShortRecord#burnNFT()
, a Short Position NFT would be burned like this:
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/libraries/LibShortRecord.sol#L363-L375
Within the ShortRecordFacet#combineShorts()
, the LibShortRecord#burnNFT()
would be called with a tokenID (currentShort.tokenId
) of the Short Position NFT to be combined like this:
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/ShortRecordFacet.sol#L168
Before the LibShortRecord#burnNFT()
would be called with a tokenID of the Short Position NFT in the ShortRecordFacet#combineShorts()
, the tokenID of the Short Position NFT is supposed to be minted by calling the ERC721Facet#mintNFT()
.
However, the ERC721Facet#mintNFT()
would never be called in any contracts and any functions. As a result, a Short Position NFT will never be minted.
If a NFT will never be minted, a Short Position NFT will never be burned in the ShortRecordFacet#combineShorts()
.
Because the currentShort.tokenId
would always 0
and therefore the condition (if (currentShort.tokenId != 0)
) would always be skipped in the ShortRecordFacet#combineShorts()
. Due to that, if-block under the condition would also always be skipped.
https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/facets/ShortRecordFacet.sol#L162-L169
This is unintended behavior of the Ditto protocol as a design.
In addition to that, the DittoETH protocol assume that a current shorter can transfer their short position to another user (a potential future shorter) as a design by transferring the Short Position NFT from a current shorter to another user.
However, the assumption (design) would also not work due to missing to call the ERC721Facet#mintNFT()
.
This lead to unintended behavior of the Ditto protocol as a design.
In addition to that, the DittoETH protocol assume that a current shorter can transfer their short position to another user (a potential future shorter) as a design by transferring the Short Position NFT from a current shorter to another user.
However, the assumption (design) would also not work due to missing to call the ERC721Facet#mintNFT()
.
Foundry
Consider calling the ERC721Facet#mintNFT()
in order to mint a new Short Position NFT when a new ShortRecord (shortRecordId
) would be created.
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.