FactorLeverageDescriptor.sol

Contract Overview

The FactorLeverageDescriptor.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 Leverage Vault contract).

VariablesTypeDescription

id

uint256

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

name

string

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

description

string

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

assetToken

address

The address of the asset used as collateral for the position.

debtToken

address

The address of the debt used as collateral for the position.

assetAmount

uint256

The amount of asset token held by the position.

debtAmount

uint256

The amount of debt token held by the position.

Methods

setTokenName() - external

Updates the token name (i.e. symbol) for the provided tokenAddress.

Parameters

ParamsTypeDescription

tokenAddress

address

The address of the token.

tokenDescription

string

The name (i.e. symbol) of the token to be updated.

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 Leverage Vault collection description = Symbol of the Leverage Vault collection assetToken = Address of asset token debtToken = Address of debt token assetAmount = The position's asset balance debtAmount = The position's debt balance

Returns

TypeDescription

string

An encoded string that contains the ERC721 metadata JSON.

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 Leverage Vault contract.

assetToken

address

The address of the asset used as collateral for the position.

debtToken

address

The address of the debt used as collateral for the position.

assetAmount

uint256

The amount of asset token held by the position.

debtAmount

uint256

The amount of debt token held by the position.

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 Leverage 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

asset

string

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

debt

string

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

Returns

TypeDescription

string

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

renderAsset() - private view returns

Renders a SVG string of the position's asset balance.

Parameters

ParamsTypeDescription

amount

uint256

The amount of asset token held by the position.

Returns

TypeDescription

string

A SVG string representation of the position's asset balance.

renderDebt() - private view returns

Renders a SVG string of the position's asset balance.

Parameters

ParamsTypeDescription

amount

uint256

The amount of debt token held by the position.

Returns

TypeDescription

string

A SVG string representation of the position's debt balance.

Last updated