From 1717da074877c09cb912e8336ae164a4d56c5a54 Mon Sep 17 00:00:00 2001 From: steven2308 Date: Thu, 29 Feb 2024 09:22:28 -0500 Subject: [PATCH] Makes getEquippableSlotsFromParent public on render utils. --- contracts/RMRK/utils/RMRKEquipRenderUtils.sol | 12 ++++---- docs/RMRK/utils/RMRKEquipRenderUtils.md | 30 +++++++++++++++++-- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/contracts/RMRK/utils/RMRKEquipRenderUtils.sol b/contracts/RMRK/utils/RMRKEquipRenderUtils.sol index 49890e15..ce98d74e 100644 --- a/contracts/RMRK/utils/RMRKEquipRenderUtils.sol +++ b/contracts/RMRK/utils/RMRKEquipRenderUtils.sol @@ -277,7 +277,7 @@ contract RMRKEquipRenderUtils is */ function getEquipped( address target, - uint64 tokenId, + uint256 tokenId, uint64 assetId ) public @@ -452,7 +452,7 @@ contract RMRKEquipRenderUtils is EquippableData[] memory assetsWithSlotsForParentAsset; for (uint256 i; i < totalParentAssets; ) { - assetsWithSlotsForParentAsset = _getEquippableSlotsFromParent( + assetsWithSlotsForParentAsset = getEquippableSlotsFromParent( targetChild, childId, parentAddress, @@ -543,7 +543,7 @@ contract RMRKEquipRenderUtils is childId ); - equippableData = _getEquippableSlotsFromParent( + equippableData = getEquippableSlotsFromParent( targetChild, childId, parentAddress, @@ -596,7 +596,7 @@ contract RMRKEquipRenderUtils is childId ); - equippableData = _getEquippableSlotsFromParent( + equippableData = getEquippableSlotsFromParent( targetChild, childId, parentAddress, @@ -685,13 +685,13 @@ contract RMRKEquipRenderUtils is * @return equippableData An array of `EquippableData` structs containing info about the equippable child assets and * their corresponding slot parts */ - function _getEquippableSlotsFromParent( + function getEquippableSlotsFromParent( address childAddress, uint256 childId, address parentAddress, uint256 parentId, uint64 parentAssetId - ) private view returns (EquippableData[] memory equippableData) { + ) public view returns (EquippableData[] memory equippableData) { ( uint64[] memory parentSlotPartIds, address parentAssetCatalog diff --git a/docs/RMRK/utils/RMRKEquipRenderUtils.md b/docs/RMRK/utils/RMRKEquipRenderUtils.md index 9f0f8c27..6af51b11 100644 --- a/docs/RMRK/utils/RMRKEquipRenderUtils.md +++ b/docs/RMRK/utils/RMRKEquipRenderUtils.md @@ -231,6 +231,32 @@ function getChildrenWithTopMetadata(address parentAddress, uint256 parentId) ext ### getEquippableSlotsFromParent +```solidity +function getEquippableSlotsFromParent(address childAddress, uint256 childId, address parentAddress, uint256 parentId, uint64 parentAssetId) external view returns (struct RMRKEquipRenderUtils.EquippableData[] equippableData) +``` + +Used to get the child's assets and slot parts pairs, identifying parts the said assets can be equipped into. + +*Reverts if child token is not owned by an NFT.The full `EquippableData` struct looks like this: [ slotPartId childAssetId parentAssetId priority parentCatalogAddress isEquipped partMetadata, childAssetMetadata, parentAssetMetadata ]* + +#### Parameters + +| Name | Type | Description | +|---|---|---| +| childAddress | address | Address of the smart contract of the given token | +| childId | uint256 | ID of the child token whose assets will be matched against parent's slot parts | +| parentAddress | address | Address of the parent token's smart contract | +| parentId | uint256 | ID of the parent token | +| parentAssetId | uint64 | ID of the target parent asset to use to equip the child | + +#### Returns + +| Name | Type | Description | +|---|---|---| +| equippableData | RMRKEquipRenderUtils.EquippableData[] | An array of `EquippableData` structs containing info about the equippable child assets and their corresponding slot parts | + +### getEquippableSlotsFromParent + ```solidity function getEquippableSlotsFromParent(address targetChild, uint256 childId, uint64 parentAssetId) external view returns (uint256 childIndex, struct RMRKEquipRenderUtils.EquippableData[] equippableData) ``` @@ -282,7 +308,7 @@ Used to get the child's assets and slot parts pairs, identifying parts the s ### getEquipped ```solidity -function getEquipped(address target, uint64 tokenId, uint64 assetId) external view returns (uint64[] slotPartIds, struct IERC6220.Equipment[] childrenEquipped, string[] childrenAssetMetadata) +function getEquipped(address target, uint256 tokenId, uint64 assetId) external view returns (uint64[] slotPartIds, struct IERC6220.Equipment[] childrenEquipped, string[] childrenAssetMetadata) ``` Used to retrieve the equipped parts of the given token. @@ -294,7 +320,7 @@ Used to retrieve the equipped parts of the given token. | Name | Type | Description | |---|---|---| | target | address | Address of the smart contract of the given token | -| tokenId | uint64 | ID of the token to retrieve the equipped items in the asset for | +| tokenId | uint256 | ID of the token to retrieve the equipped items in the asset for | | assetId | uint64 | ID of the asset being queried for equipped parts | #### Returns