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
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).
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
external
Updates the token name (i.e. symbol) for the provided tokenAddress
.
Parameters
tokenAddress
address
The address of the token.
tokenDescription
string
The name (i.e. symbol) of the token to be updated.
constructTokenURI() - public
view
returns
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
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
string
An encoded string that contains the ERC721 metadata JSON.
renderImage() - private
view
returns
private
view
returns
Renders a base64
string that represents the position's information in a SVG format.
Parameters
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
string
A base64
string representation of the position's SVG image that contains position data.
renderId() - private
view
returns
private
view
returns
Renders a SVG string of the position identifier.
Parameters
id
uint256
The identifier of the position managed by the Leverage Vault contract.
Returns
string
A SVG string representation of the position identifier.
renderStrategy() - private
view
returns
private
view
returns
Renders a SVG string of the Strategy's asset
and debt
names (i.e. symbols).
Parameters
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
string
A SVG string representation of the position's asset
and debt
token names.
renderAsset() - private
view
returns
private
view
returns
Renders a SVG string of the position's asset
balance.
Parameters
amount
uint256
The amount of asset
token held by the position.
Returns
string
A SVG string representation of the position's asset
balance.
renderDebt() - private
view
returns
private
view
returns
Renders a SVG string of the position's asset
balance.
Parameters
amount
uint256
The amount of debt
token held by the position.
Returns
string
A SVG string representation of the position's debt
balance.
Last updated