NonfungibleTokenPositionDescriptor

The NonfungibleTokenPositionDescriptor generates metadata and SVG visualizations for position NFTs.

Source: contracts/periphery/NonfungibleTokenPositionDescriptor.sol

Overview

The descriptor:

  • Generates on-chain SVG images for position NFTs

  • Provides ERC721 tokenURI metadata

  • Displays position details (tokens, range, liquidity)

Functions

tokenURI

function tokenURI(
    INonfungiblePositionManager positionManager,
    uint256 tokenId
) external view override returns (string memory)

Returns the full URI for a position NFT's metadata.

Parameters:

Name
Type
Description

positionManager

INonfungiblePositionManager

Position manager contract

tokenId

uint256

NFT token ID

Returns:

A base64-encoded data URI containing JSON metadata:

Generated SVG

The SVG visualization includes:

  • Token symbols - Both tokens in the pair

  • Fee tier - Pool fee percentage

  • Price range - Lower and upper tick prices

  • Position ID - Token ID

  • Pool address - Contract address

Example SVG Elements

Dependencies

NFTDescriptor Library

The descriptor uses the NFTDescriptor library for SVG generation:

NFTSVG Library

Lower-level SVG construction:

Token Symbol Resolution

The descriptor attempts to resolve token symbols:

  1. Calls symbol() on the token contract

  2. Falls back to address truncation if call fails

  3. Uses WVC native symbol for wrapped VC

Constructor

Parameter
Description

_WVC

Wrapped native currency address

_nativeCurrencyLabelBytes

Native currency symbol (e.g., "VC")

Integration

Position Manager Integration

The NonfungiblePositionManager calls the descriptor:

Marketplace Compatibility

The generated metadata is compatible with:

  • OpenSea

  • Rarible

  • LooksRare

  • Other NFT marketplaces supporting ERC721 metadata

Customization

To customize NFT appearance:

  1. Deploy new NFTDescriptor library

  2. Deploy new NonfungibleTokenPositionDescriptor

  3. Link to position manager (requires redeployment or proxy update)

Gas Considerations

  • tokenURI is a view function (no gas for reads)

  • SVG generation is computationally intensive

  • Large positions with many ticks may hit view function limits

Interface

Last updated