Skip to content

Commit

Permalink
Add getters for metadata renderer information (#87)
Browse files Browse the repository at this point in the history
* add getters for metadata renderer information

* fix tests
  • Loading branch information
iainnash authored Dec 17, 2022
1 parent 99afbe0 commit 0973df0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/token/metadata/MetadataRenderer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 7 additions & 5 deletions src/token/metadata/storage/MetadataRendererStorageV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 0973df0

Please sign in to comment.