forked from rmrk-team/evm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRMRKEquippableFacet.sol
88 lines (80 loc) · 2.12 KB
/
RMRKEquippableFacet.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./interfaces/IERC6220.sol";
import "./internalFunctionSet/RMRKEquippableInternal.sol";
contract RMRKEquippableFacet is
IERC6220WithoutIERC5773,
RMRKEquippableInternal,
ReentrancyGuard
{
/**
* @inheritdoc IERC6220WithoutIERC5773
*/
function equip(
IntakeEquip memory data
) public virtual onlyApprovedOrOwner(data.tokenId) nonReentrant {
_equip(data);
}
/**
* @inheritdoc IERC6220WithoutIERC5773
*/
function unequip(
uint256 tokenId,
uint64 assetId,
uint64 slotPartId
) public virtual onlyApprovedOrOwner(tokenId) {
_unequip(tokenId, assetId, slotPartId);
}
/**
* @inheritdoc IERC6220WithoutIERC5773
*/
function isChildEquipped(
uint256 tokenId,
address childAddress,
uint256 childId
) public view virtual returns (bool) {
return _isChildEquipped(tokenId, childAddress, childId);
}
/**
* @inheritdoc IERC6220WithoutIERC5773
*/
function canTokenBeEquippedWithAssetIntoSlot(
address parent,
uint256 tokenId,
uint64 assetId,
uint64 slotId
) public view virtual returns (bool) {
return
_canTokenBeEquippedWithAssetIntoSlot(
parent,
tokenId,
assetId,
slotId
);
}
/**
* @inheritdoc IERC6220WithoutIERC5773
*/
function getAssetAndEquippableData(
uint256 tokenId,
uint64 assetId
)
public
view
virtual
returns (string memory, uint64, address, uint64[] memory)
{
return _getAssetAndEquippableData(tokenId, assetId);
}
/**
* @inheritdoc IERC6220WithoutIERC5773
*/
function getEquipment(
uint256 tokenId,
address targetCatalogAddress,
uint64 slotPartId
) public view virtual returns (Equipment memory) {
return _getEquipment(tokenId, targetCatalogAddress, slotPartId);
}
}