-
Notifications
You must be signed in to change notification settings - Fork 8
/
ITokenHandleRegistry.sol
89 lines (83 loc) · 4.12 KB
/
ITokenHandleRegistry.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
89
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
/**
* @title ITokenHandleRegistry
* @author Lens Protocol
*
* @notice The interface for TokenHandleRegistry contract that is responsible for linking a handle NFT to a token NFT.
* Linking means a connection between the two NFTs is created, and the handle NFT can be used to resolve the token NFT
* or vice versa.
* The registry is responsible for keeping track of the links between the NFTs, and for resolving them.
* The first version of the registry is hard-coded to support only the .lens namespace and the Lens Protocol Profiles.
*/
interface ITokenHandleRegistry {
/**
* @notice Lens V1 -> V2 migration function. Links a handle NFT to a profile NFT without additional checks to save
* gas.
* Will be called by the migration function (in MigrationLib) in LensHub, only for new handles being migrated.
*
* @custom:permissions LensHub
*
* @param handleId ID of the .lens namespace handle NFT
* @param tokenId ID of the Lens Protocol Profile NFT
*/
function migrationLink(uint256 handleId, uint256 tokenId) external;
/**
* @notice Links a handle NFT with a profile NFT.
* Linking means a connection between the two NFTs is created, and the handle NFT can be used to resolve the profile
* NFT or vice versa.
* @custom:permissions Caller must own both NFTs.
*
* @dev In the first version of the registry, the NFT contracts are hard-coded:
* - Handle is hard-coded to be of the .lens namespace
* - Token is hard-coded to be of the Lens Protocol Profile
* In future versions, the registry will be more flexible and allow for different namespaces and tokens, so this
* function might be deprecated and replaced with a new one accepting addresses of the handle and token contracts.
*
* @param handleId ID of the .lens namespace handle NFT
* @param tokenId ID of the Lens Protocol Profile NFT
*/
function link(uint256 handleId, uint256 tokenId) external;
/**
* @notice Unlinks a handle NFT from a profile NFT.
* @custom:permissions Called can be the owner of either of the NFTs.
*
* @dev In the first version of the registry, the contracts are hard-coded:
* - Handle is hard-coded to be of the .lens namespace
* - Token is hard-coded to be of the Lens Protocol Profile
* In future versions, the registry will be more flexible and allow for different namespaces and tokens, so this
* function might be deprecated and replaced with a new one accepting addresses of the handle and token contracts.
*
* @param handleId ID of the .lens namespace handle NFT
* @param tokenId ID of the Lens Protocol Profile NFT
*/
function unlink(uint256 handleId, uint256 tokenId) external;
/**
* @notice Resolves a handle NFT to a profile NFT.
*
* @dev In the first version of the registry, the contracts are hard-coded:
* - Handle is hard-coded to be of the .lens namespace
* - Token is hard-coded to be of the Lens Protocol Profile
* In future versions, the registry will be more flexible and allow for different namespaces and tokens, so this
* function might be deprecated and replaced with a new one.
*
* @param handleId ID of the .lens namespace handle NFT
*
* @return tokenId ID of the Lens Protocol Profile NFT
*/
function resolve(uint256 handleId) external view returns (uint256);
/**
* @notice Gets a default handle for a profile NFT (aka reverse resolution).
*
* @dev In the first version of the registry, the contracts are hard-coded:
* - Handle is hard-coded to be of the .lens namespace
* - Token is hard-coded to be of the Lens Protocol Profile
* In future versions, the registry will be more flexible and allow for different namespaces and tokens, so this
* function might be deprecated and replaced with a new one.
*
* @param tokenId ID of the Lens Protocol Profile NFT
*
* @return handleId ID of the .lens namespace handle NFT
*/
function getDefaultHandle(uint256 tokenId) external view returns (uint256);
}