FactorLPDescriptor.sol

Contract Overview

The FactorLPDescriptor.sol contract enables the SVG representation of a position to be generated on-chain. This is achieved via the encoding of position metadata as SVG strings.

Properties

Public

PropertyTypeModifierDescription

tokenDescriptions

mapping(address => string)

public

A mapping between the token address and the corresponding name (i.e. symbol).

Structs

TokenURIParams

A struct that defines the URI of the token (representing a position on the underlying LP Vault contract).

VariablesTypeDescription

id

uint256

The identifier of the position managed by the LP Vault contract.

name

string

The name of the LP Vault collection. Used as the NFT collection name.

description

string

The symbol of the LP Vault collection. Used as the NFT collection symbol.

token0

address

The address of the liquidity position's token0 (i.e. 1 half of the token pair sorted alphabetically by address).

token1

address

The address of the liquidity position's token1 (i.e. the other half of the token pair sorted alphabetically by address).

Methods

constructTokenURI() - public view returns

Assembles the encoded string which contains the ERC721 metadata JSON. This includes a base64 string representation of the position's SVG image that contains position data.

Parameters

ParamsTypeDescription

params

An object that contains position information queried from the position's Strategy contract: id = Position identifier name = Name of the LP Vault collection description = Symbol of the LP Vault collection token0 = Address of liquidity position's token0 token1 = Address of liquidity position's token1

Returns

TypeDescription

string

An encoded string that contains the ERC721 metadata JSON. This includes a base64 string representation of the position's SVG image that contains position data.

renderImage() - private view returns

Renders a base64 string that represents the position's information in a SVG format.

Parameters

ParamsTypeDescription

id

uint256

The identifier of the position managed by the LP Vault contract.

token0

address

The address of the liquidity position's token0 (i.e. 1 half of the token pair sorted alphabetically by address).

token1

address

The address of the liquidity position's token1 (i.e. the other half of the token pair sorted alphabetically by address).

Returns

TypeDescription

string

A base64 string representation of the position's SVG image that contains position data.

renderId() - private view returns

Renders a SVG string of the position identifier.

Parameters

ParamsTypeDescription

id

uint256

The identifier of the position managed by the LP Vault contract.

Returns

TypeDescription

string

A SVG string representation of the position identifier.

renderStrategy() - private view returns

Renders a SVG string of the Strategy's asset and debt names (i.e. symbols).

Parameters

ParamsTypeDescription

token0

string

The name (i.e. symbol) of the Strategy's token0

token1

string

The name (i.e. symbol) of the Strategy's token1

Returns

TypeDescription

string

A SVG string representation of the position's asset and debt token names.

Last updated