forked from rmrk-team/evm
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLightmImplementer.sol
More file actions
94 lines (79 loc) · 2.75 KB
/
LightmImplementer.sol
File metadata and controls
94 lines (79 loc) · 2.75 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
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.15;
import "../src/library/LibDiamond.sol";
import "../src/internalFunctionSet/LightmEquippableInternal.sol";
import "../src/internalFunctionSet/RMRKCollectionMetadataInternal.sol";
import "../src/internalFunctionSet/LightmImplInternal.sol";
import "../src/internalFunctionSet/ERC2981Internal.sol";
import "../src/access/AccessControl.sol";
import {ILightmImplementer} from "../src/interfaces/ILightmImplementer.sol";
import {IERC2981WithoutIERC165} from "../src/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
contract LightmImpl is
ILightmImplementer,
IERC2981WithoutIERC165,
AccessControl,
LightmEquippableInternal,
RMRKCollectionMetadataInternal,
ERC2981Internal,
LightmImplInternal,
Multicall
{
error LightmImplNotOwnerOrAssetContributor();
bytes32 public constant ASSET_CONTRIBUTOR_ROLE =
keccak256("ASSET_CONTRIBUTOR_ROLE");
function _onlyOwnerOrAssetContributor() internal view {
if (!_isOwner() && !_hasRole(ASSET_CONTRIBUTOR_ROLE, msg.sender)) {
revert LightmImplNotOwnerOrAssetContributor();
}
}
modifier onlyOwnerOrAssetContributor() {
_onlyOwnerOrAssetContributor();
_;
}
function owner() public view returns (address _owner) {
_owner = getLightmImplState()._owner;
}
function transferOwnership(address target) external onlyOwner {
_setCollectionOwner(target);
}
function setCollectionMetadata(string calldata newMetadata)
external
onlyOwner
{
_setCollectionMetadata(newMetadata);
}
function setFallbackURI(string calldata fallbackURI) external onlyOwner {
_setFallbackURI(fallbackURI);
}
function addCatalogRelatedAssetEntry(
uint64 id,
CatalogRelatedData calldata catalogRelatedAssetData,
string memory metadataURI
) external onlyOwnerOrAssetContributor {
_addCatalogRelatedAssetEntry(id, catalogRelatedAssetData, metadataURI);
}
function addAssetEntry(uint64 id, string memory metadataURI)
external
onlyOwnerOrAssetContributor
{
_addAssetEntry(id, metadataURI);
}
function addAssetToToken(
uint256 tokenId,
uint64 assetId,
uint64 toBeReplacedId
) external onlyOwnerOrAssetContributor {
_addAssetToToken(tokenId, assetId, toBeReplacedId);
// Auto accept asset if invoker is owner of token
if (msg.sender == _ownerOf(tokenId)) {
_acceptAsset(tokenId, assetId);
}
}
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) public view returns (address, uint256) {
return _royaltyInfo(tokenId, salePrice);
}
}