forked from rmrk-team/evm
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLightmEquippableMultiAssetFacet.sol
More file actions
157 lines (138 loc) · 4.21 KB
/
LightmEquippableMultiAssetFacet.sol
File metadata and controls
157 lines (138 loc) · 4.21 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// SPDX-License-Identifier: Apache-2.0
// RMRKMR facet style which could be used alone
pragma solidity ^0.8.15;
import {ILightmMultiAssetExtension} from "./interfaces/ILightmMultiAsset.sol";
import "./RMRKMultiAssetFacet.sol";
import "./internalFunctionSet/LightmEquippableInternal.sol";
// !!!
// Before use, make sure you know the description below
// !!!
/**
@dev NOTE that MultiAsset take NFT as a real unique item on-chain,
so if you `burn` a NFT, it means that you NEVER wanna `mint` it again,
if you do so, you are trying to raising the soul of a dead man
(the `activeAssets` etc. of this burned token will not be removed when `burn`),
instead of creating a new life by using a empty shell.
You are responsible for any unknown consequences of this action, so take care of
`mint` logic in your own implementer.
*/
contract LightmEquippableMultiAssetFacet is
ILightmMultiAssetExtension,
LightmEquippableInternal,
RMRKMultiAssetFacet
{
constructor(string memory name_, string memory symbol_)
RMRKMultiAssetFacet(name_, symbol_)
{}
// No need to override `supportsInterface` here,
// this contract is only used to be cut by Diamond
// and Diamond loupe facet is responsible for IERC165
/**
* @inheritdoc ILightmMultiAssetExtension
*/
function acceptAsset(uint256 tokenId, uint64 assetId)
external
virtual
onlyApprovedForAssetsOrOwner(tokenId)
{
_acceptAsset(tokenId, assetId);
}
/**
* @inheritdoc ILightmMultiAssetExtension
*/
function rejectAsset(uint256 tokenId, uint64 assetId)
external
virtual
onlyApprovedForAssetsOrOwner(tokenId)
{
_rejectAsset(tokenId, assetId);
}
/**
* @inheritdoc ILightmMultiAssetExtension
*/
function getAssetMetadata(uint64 assetId)
public
view
virtual
returns (string memory)
{
return _getAssetMetadata(assetId);
}
/**
* @inheritdoc ILightmMultiAssetExtension
*/
function getFullAssets(uint256 tokenId)
external
view
virtual
returns (Asset[] memory)
{
return _getFullAssets(tokenId);
}
/**
* @inheritdoc ILightmMultiAssetExtension
*/
function getFullPendingAssets(uint256 tokenId)
external
view
virtual
returns (Asset[] memory)
{
return _getFullPendingAssets(tokenId);
}
function _acceptAssetByIndex(uint256 tokenId, uint256 index)
internal
override(RMRKMultiAssetInternal, LightmEquippableInternal)
{
LightmEquippableInternal._acceptAssetByIndex(tokenId, index);
}
function _acceptAsset(uint256 tokenId, uint64 assetId)
internal
override(RMRKMultiAssetInternal, LightmEquippableInternal)
{
LightmEquippableInternal._acceptAsset(tokenId, assetId);
}
function _burn(uint256 tokenId)
internal
override(RMRKMultiAssetInternal, RMRKNestableMultiAssetInternal)
{
RMRKNestableMultiAssetInternal._burn(tokenId);
}
function _exists(uint256 tokenId)
internal
view
override(ERC721Internal, RMRKNestableMultiAssetInternal)
returns (bool)
{
return RMRKNestableMultiAssetInternal._exists(tokenId);
}
function _mint(address to, uint256 tokenId)
internal
override(ERC721Internal, RMRKNestableMultiAssetInternal)
{
RMRKNestableMultiAssetInternal._mint(to, tokenId);
}
function _ownerOf(uint256 tokenId)
internal
view
override(ERC721Internal, RMRKNestableMultiAssetInternal)
returns (address)
{
return RMRKNestableMultiAssetInternal._ownerOf(tokenId);
}
function _tokenURI(uint256 tokenId)
internal
view
override(RMRKMultiAssetInternal, RMRKNestableMultiAssetInternal)
returns (string memory)
{
return RMRKNestableMultiAssetInternal._tokenURI(tokenId);
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal override(ERC721Internal, RMRKNestableMultiAssetInternal) {
RMRKNestableMultiAssetInternal._transfer(from, to, tokenId);
}
}