Skip to content

Commit

Permalink
Makes getEquippableSlotsFromParent public on render utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
steven2308 committed Feb 29, 2024
1 parent 28e8735 commit 1717da0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
12 changes: 6 additions & 6 deletions contracts/RMRK/utils/RMRKEquipRenderUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ contract RMRKEquipRenderUtils is
*/
function getEquipped(
address target,
uint64 tokenId,
uint256 tokenId,
uint64 assetId
)
public
Expand Down Expand Up @@ -452,7 +452,7 @@ contract RMRKEquipRenderUtils is
EquippableData[] memory assetsWithSlotsForParentAsset;

for (uint256 i; i < totalParentAssets; ) {
assetsWithSlotsForParentAsset = _getEquippableSlotsFromParent(
assetsWithSlotsForParentAsset = getEquippableSlotsFromParent(
targetChild,
childId,
parentAddress,
Expand Down Expand Up @@ -543,7 +543,7 @@ contract RMRKEquipRenderUtils is
childId
);

equippableData = _getEquippableSlotsFromParent(
equippableData = getEquippableSlotsFromParent(
targetChild,
childId,
parentAddress,
Expand Down Expand Up @@ -596,7 +596,7 @@ contract RMRKEquipRenderUtils is
childId
);

equippableData = _getEquippableSlotsFromParent(
equippableData = getEquippableSlotsFromParent(
targetChild,
childId,
parentAddress,
Expand Down Expand Up @@ -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
Expand Down
30 changes: 28 additions & 2 deletions docs/RMRK/utils/RMRKEquipRenderUtils.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&#39;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&#39;s slot parts |
| parentAddress | address | Address of the parent token&#39;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)
```
Expand Down Expand Up @@ -282,7 +308,7 @@ Used to get the child&#39;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.
Expand All @@ -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
Expand Down

0 comments on commit 1717da0

Please sign in to comment.