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
Property | Type | Modifier | Description |
---|---|---|---|
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).
Variables | Type | Description |
---|---|---|
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 |
debtToken | address | The address of the |
assetAmount | uint256 | The amount of |
debtAmount | uint256 | The amount of |
Methods
setTokenName() - external
external
Updates the token name (i.e. symbol) for the provided tokenAddress
.
Parameters
Params | Type | Description |
---|---|---|
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 | Type | Description |
---|---|---|
params | An object that contains position information queried from the position's Strategy contract:
|
Returns
Type | Description |
---|---|
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
Params | Type | Description |
---|---|---|
id | uint256 | The identifier of the position managed by the Leverage Vault contract. |
assetToken | address | The address of the |
debtToken | address | The address of the |
assetAmount | uint256 | The amount of |
debtAmount | uint256 | The amount of |
Returns
Type | Description |
---|---|
string | A |
renderId() - private
view
returns
private
view
returns
Renders a SVG string of the position identifier.
Parameters
Params | Type | Description |
---|---|---|
id | uint256 | The identifier of the position managed by the Leverage Vault contract. |
Returns
Type | Description |
---|---|
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
Params | Type | Description |
---|---|---|
asset | string | The name (i.e. symbol) of the Strategy's |
debt | string | The name (i.e. symbol) of the Strategy's |
Returns
Type | Description |
---|---|
string | A SVG string representation of the position's |
renderAsset() - private
view
returns
private
view
returns
Renders a SVG string of the position's asset
balance.
Parameters
Params | Type | Description |
---|---|---|
amount | uint256 | The amount of |
Returns
Type | Description |
---|---|
string | A SVG string representation of the position's |
renderDebt() - private
view
returns
private
view
returns
Renders a SVG string of the position's asset
balance.
Parameters
Params | Type | Description |
---|---|---|
amount | uint256 | The amount of |
Returns
Type | Description |
---|---|
string | A SVG string representation of the position's |
Last updated