Assessment reports>Singularity>Discussion>Assumption on non-fungible position identifiers

Assumption on non-fungible position identifiers

Uniswap V3 positions are represented by a token following EIP-721. Those tokens are minted at the Uniswap side by the NonfungiblePositionManager contract. Each token has a a unique uint256 identifier. EIP-721 explicitly warns that “callers SHALL NOT assume that ID numbers have any specific pattern to them, and MUST treat the ID as a 'black box'”. The token ID is passed as a field element to the collecting fee circuit. It would make the circuit fail in the case the ID is not in the field-element range; the ID value is above the prime number defining the field. A user would not be able to collect fees of such NFT. It is not an issue in practice in this particular usage since, in the Uniswap contract, the IDs are generated consecutively as it is filed. At the timing of writing, the current ID is about 700000. But this is a nonstandard usage of NFT token IDs and may be problematic if used for other use cases.

Zellic © 2024Back to top ↑