DefaultTokenUriResolver
Inherits: IJBTokenUriResolver
, JBOperatable
, Ownable
State Variables
fundingCycleStore
The address of the Juicebox Funding Cycle Store contract.
IJBFundingCycleStore public immutable fundingCycleStore;
projects
The address of the Juicebox Projects contract.
IJBProjects public immutable projects;
directory
The address of the Juicebox Directory contract.
IJBDirectory public immutable directory;
projectHandles
The address of the Juicebox Project Handles contract.
IJBProjectHandles public immutable projectHandles;
capsulesTypeface
The address of the Capsules typeface contract.
ITypeface public immutable capsulesTypeface;
themes
Mapping containing each project's theme, if one is set. Themes describe the color palette to be used when generating the token uri SVG.
Theme 0 is the default theme used for all projects without custom themes.
mapping(uint256 => Theme) private themes;
Functions
constructor
constructor(
IJBOperatorStore _operatorStore,
IJBDirectory _directory,
IJBProjectHandles _projectHandles,
ITypeface _capsulesTypeface
) JBOperatable(_operatorStore);
getTheme
Gets the Theme for a given id in the private themes mapping.
function getTheme(uint256 id) external view returns (Theme memory);
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | The id of the theme to fetch. This is the project's ID for all values except 0, which is the default theme. |
Returns
Name | Type | Description |
---|---|---|
<none> | Theme | Theme The Theme corresponding to the id passed as an argument. |
getFontSource
Gets the Base64 encoded Capsules-500.otf typeface.
function getFontSource() internal view returns (bytes memory fontSource);
Returns
Name | Type | Description |
---|---|---|
fontSource | bytes | The Base64 encoded font file. |
pad
Transform strings to target length by abbreviating or padding with spaces.
Shortens long strings to 13 characters including an ellipsis and adds left padding spaces to short strings. Allows variable target length to account for strings that have unicode characters that are longer than 1 byte but only take up 1 character space.
function pad(bool left, string memory str, uint256 targetLength) internal pure returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
left | bool | True adds padding to the left of the passed string, and false adds padding to the right. |
str | string | The string to transform. |
targetLength | uint256 | The length of the string to return. |
Returns
Name | Type | Description |
---|---|---|
<none> | string | string The transformed string. |
getProjectName
Returns either a project's handle, if set, or a string with the project's ID number if no project handle is found.
function getProjectName(uint256 _projectId) internal view returns (string memory projectName);
getTerminalStore
Gets the IJBSingleTokenPaymentTerminalStore for a given project.
function getTerminalStore(uint256 _projectId) internal view returns (IJBSingleTokenPaymentTerminalStore);
getRightPaddedCycle
Returns a right-padded string containing the project's current cycle number.
function getRightPaddedCycle(JBFundingCycle memory _fundingCycle)
internal
pure
returns (string memory rightPaddedCycleString);
getLeftPaddedTimeLeft
Returns a left-padded string containing the time left in the project's current cycle.
function getLeftPaddedTimeLeft(JBFundingCycle memory _fundingCycle)
internal
view
returns (string memory leftPaddedTimeLeftString);
getCycleTimeLeftRow
Returns a string containing the cycle count and time left.
function getCycleTimeLeftRow(JBFundingCycle memory fundingCycle)
internal
view
returns (string memory cycleTimeLeftRow);
getBalanceRow
Returns the balance row string.
function getBalanceRow(IJBPaymentTerminal primaryEthPaymentTerminal, uint256 _projectId)
internal
view
returns (string memory balanceRow);
getPayouts
Returns a string containing the projects payouts. Used in the JSON metadata.
function getPayouts(IJBPaymentTerminal primaryEthPaymentTerminal, uint256 _projectId)
internal
view
returns (string memory payouts);