From 0973df026b14c7ccc57319d47c0f4a9bfa9474c8 Mon Sep 17 00:00:00 2001 From: Iain Nash Date: Sat, 17 Dec 2022 01:24:45 -0500 Subject: [PATCH] Add getters for metadata renderer information (#87) * add getters for metadata renderer information * fix tests --- src/token/metadata/MetadataRenderer.sol | 8 ++++++++ .../metadata/storage/MetadataRendererStorageV1.sol | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/token/metadata/MetadataRenderer.sol b/src/token/metadata/MetadataRenderer.sol index 3dbcbeb..b9be085 100644 --- a/src/token/metadata/MetadataRenderer.sol +++ b/src/token/metadata/MetadataRenderer.sol @@ -93,16 +93,24 @@ contract MetadataRenderer is /// /// /// @notice The number of properties + /// @return properties array length function propertiesCount() external view returns (uint256) { return properties.length; } /// @notice The number of items in a property /// @param _propertyId The property id + /// @return items array length function itemsCount(uint256 _propertyId) external view returns (uint256) { return properties[_propertyId].items.length; } + /// @notice The number of items in the IPFS data store + /// @return ipfs data array size + function ipfsDataCount() external view returns (uint256) { + return ipfsData.length; + } + /// @notice Updates the additional token properties associated with the metadata. /// @dev Be careful to not conflict with already used keys such as "name", "description", "properties", function setAdditionalTokenProperties(AdditionalTokenProperty[] memory _additionalTokenProperties) external onlyOwner { diff --git a/src/token/metadata/storage/MetadataRendererStorageV1.sol b/src/token/metadata/storage/MetadataRendererStorageV1.sol index 9477104..be0f856 100644 --- a/src/token/metadata/storage/MetadataRendererStorageV1.sol +++ b/src/token/metadata/storage/MetadataRendererStorageV1.sol @@ -8,14 +8,16 @@ import { MetadataRendererTypesV1 } from "../types/MetadataRendererTypesV1.sol"; /// @notice The Metadata Renderer storage contract contract MetadataRendererStorageV1 is MetadataRendererTypesV1 { /// @notice The metadata renderer settings - Settings internal settings; + Settings public settings; /// @notice The properties chosen from upon generation - Property[] internal properties; + Property[] public properties; /// @notice The IPFS data of all property items - IPFSGroup[] internal ipfsData; + IPFSGroup[] public ipfsData; - /// @notice The attributes generated for a token - mapping(uint256 => uint16[16]) internal attributes; + /// @notice The attributes generated for a token - mapping of tokenID uint16 array + /// @dev Array of size 16 1st element [0] used for number of attributes chosen, next N elements for those selections + /// @dev token ID + mapping(uint256 => uint16[16]) public attributes; }