The transfer of NFTs representing short positions can be frontrun by the current owner of the short position, allowing them to transfer a short position that is less collateralized than expected.
The protocol allows shorters to mint NFTs that represent their short positions and transfer these NFTs. This opens the possibility of trading short positions in secondary markets.
The protocol applies some restrictions to the transfer of NFTs, not allowing the transfer of NFTs that represent short positions that have been flagged for liquidation or that are closed. This is probably done to protect the recipient of the NFT from receiving a short position that is about to be liquidated or that is not active.
However, there is still a risk of frontrunning when transferring NFTs that represent short positions. The following scenario illustrates this risk:
Alice creates a short position.
Alice mints an NFT that represents the short position and puts it up for sale.
Bob buys the NFT, but Alice frontruns the transaction from the marketplace and decreases the amount of collateral for the short position.
Bob receives the NFT and, with it, the short position that is backed by less collateral than expected.
Add the following code snippet into test/Shorts.t.sol
and run forge test --mt testFrontrunNftTransfer
.
The recipient of an NFT that represents a short position can be frontrun and receive a short position that is backed by less collateral than expected.
Manual review.
Add a property similar to updateAt
that is updated with all changes to the short position and, when transferFrom
is called, check that the last update to the short position wasn't made in a given period or, at least, in the same block. This check could be performed only when msg.sender
is not the owner of the short position.
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.