lens-modules 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/contracts/base/HubRestricted.sol +27 -0
- package/contracts/interfaces/ICollectNFT.sol +40 -0
- package/contracts/interfaces/IERC721Burnable.sol +19 -0
- package/contracts/interfaces/IERC721MetaTx.sol +27 -0
- package/contracts/interfaces/IERC721Timestamped.sol +50 -0
- package/contracts/interfaces/IFollowModule.sol +55 -0
- package/contracts/interfaces/ILensERC721.sol +11 -0
- package/contracts/interfaces/ILensGovernable.sol +141 -0
- package/contracts/interfaces/ILensHub.sol +19 -0
- package/contracts/interfaces/ILensHubEventHooks.sol +26 -0
- package/contracts/interfaces/ILensImplGetters.sol +34 -0
- package/contracts/interfaces/ILensProfiles.sol +32 -0
- package/contracts/interfaces/ILensProtocol.sol +474 -0
- package/contracts/interfaces/ILensVersion.sol +31 -0
- package/contracts/interfaces/IModuleRegistry.sol +32 -0
- package/contracts/interfaces/IPublicationActionModule.sol +53 -0
- package/contracts/libraries/constants/Errors.sol +52 -0
- package/contracts/libraries/constants/Events.sol +409 -0
- package/contracts/libraries/constants/Typehash.sol +32 -0
- package/contracts/libraries/constants/Types.sol +415 -0
- package/contracts/modules/ActionRestricted.sol +27 -0
- package/contracts/modules/FeeModuleBase.sol +43 -0
- package/contracts/modules/LensModule.sol +11 -0
- package/contracts/modules/LensModuleMetadata.sol +17 -0
- package/contracts/modules/LensModuleMetadataInitializable.sol +16 -0
- package/contracts/modules/act/collect/base/BaseFeeCollectModule.sol +298 -0
- package/contracts/modules/constants/Errors.sol +16 -0
- package/contracts/modules/interfaces/IBaseFeeCollectModule.sol +75 -0
- package/contracts/modules/interfaces/ICollectModule.sol +50 -0
- package/contracts/modules/interfaces/ILensModule.sol +18 -0
- package/contracts/modules/interfaces/IWMATIC.sol +11 -0
- package/contracts/modules/libraries/FollowValidationLib.sol +32 -0
- package/contracts/modules/libraries/constants/ModuleTypes.sol +25 -0
- package/package.json +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Avara Labs Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Lens Module Contracts
|
|
2
|
+
|
|
3
|
+
This repository contains the module contracts from the core Lens Protocol repo ([link](https://github.com/lens-protocol/core/tree/5454b58664fab805b6888a68ff40915d251f32f3/contracts)) as a standalone library.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install lens-modules
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```solidity
|
|
14
|
+
pragma solidity ^0.8.21;
|
|
15
|
+
|
|
16
|
+
import {HubRestricted} from "lens-modules/contracts/base/HubRestricted.sol";
|
|
17
|
+
import {IPublicationActionModule} from "lens-modules/contracts/interfaces/IPublicationActionModule.sol";
|
|
18
|
+
import {Types} from "lens-modules/contracts/libraries/constants/Types.sol";
|
|
19
|
+
import {LensModuleMetadata} from "lens-modules/contracts/modules/LensModuleMetadata.sol";
|
|
20
|
+
|
|
21
|
+
contract OpenActionModule is
|
|
22
|
+
HubRestricted,
|
|
23
|
+
IPublicationActionModule,
|
|
24
|
+
LensModuleMetadata
|
|
25
|
+
{
|
|
26
|
+
constructor(
|
|
27
|
+
address owner,
|
|
28
|
+
address hub
|
|
29
|
+
)
|
|
30
|
+
HubRestricted(hub)
|
|
31
|
+
LensModuleMetadata()
|
|
32
|
+
{
|
|
33
|
+
// ...
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function initializePublicationAction(
|
|
37
|
+
uint256 profileId,
|
|
38
|
+
uint256 pubId,
|
|
39
|
+
address /* transactionExecutor */,
|
|
40
|
+
bytes calldata data
|
|
41
|
+
) external override onlyHub returns (bytes memory) {
|
|
42
|
+
// ...
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function processPublicationAction(
|
|
46
|
+
Types.ProcessActionParams calldata params
|
|
47
|
+
) external override onlyHub returns (bytes memory) {
|
|
48
|
+
// ...
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.15;
|
|
4
|
+
|
|
5
|
+
import {Errors} from '../libraries/constants/Errors.sol';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @title HubRestricted
|
|
9
|
+
* @author Lens Protocol
|
|
10
|
+
*
|
|
11
|
+
* @notice This abstract contract adds a public `HUB` immutable field, as well as an `onlyHub` modifier,
|
|
12
|
+
* to inherit from contracts that have functions restricted to be only called by the Lens hub.
|
|
13
|
+
*/
|
|
14
|
+
abstract contract HubRestricted {
|
|
15
|
+
address public immutable HUB;
|
|
16
|
+
|
|
17
|
+
modifier onlyHub() {
|
|
18
|
+
if (msg.sender != HUB) {
|
|
19
|
+
revert Errors.NotHub();
|
|
20
|
+
}
|
|
21
|
+
_;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
constructor(address hub) {
|
|
25
|
+
HUB = hub;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title ICollectNFT
|
|
7
|
+
* @author Lens Protocol
|
|
8
|
+
*
|
|
9
|
+
* @notice This is the interface for the CollectNFT contract. Which is cloned upon the first collect for any given
|
|
10
|
+
* publication.
|
|
11
|
+
*/
|
|
12
|
+
interface ICollectNFT {
|
|
13
|
+
/**
|
|
14
|
+
* @notice Initializes the collect NFT, setting the feed as the privileged minter, storing the collected publication pointer
|
|
15
|
+
* and initializing the name and symbol in the LensNFTBase contract.
|
|
16
|
+
* @custom:permissions CollectPublicationAction.
|
|
17
|
+
*
|
|
18
|
+
* @param profileId The token ID of the profile in the hub that this Collect NFT points to.
|
|
19
|
+
* @param pubId The profile publication ID in the hub that this Collect NFT points to.
|
|
20
|
+
*/
|
|
21
|
+
function initialize(uint256 profileId, uint256 pubId) external;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @notice Mints a collect NFT to the specified address. This can only be called by the hub and is called
|
|
25
|
+
* upon collection.
|
|
26
|
+
* @custom:permissions CollectPublicationAction.
|
|
27
|
+
*
|
|
28
|
+
* @param to The address to mint the NFT to.
|
|
29
|
+
*
|
|
30
|
+
* @return uint256 An integer representing the minted token ID.
|
|
31
|
+
*/
|
|
32
|
+
function mint(address to) external returns (uint256);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @notice Returns the source publication of this collect NFT.
|
|
36
|
+
*
|
|
37
|
+
* @return tuple First is the profile ID, and second is the publication ID.
|
|
38
|
+
*/
|
|
39
|
+
function getSourcePublicationPointer() external view returns (uint256, uint256);
|
|
40
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title IERC721Burnable
|
|
7
|
+
* @author Lens Protocol
|
|
8
|
+
*
|
|
9
|
+
* @notice Extension of ERC-721 including a function that allows the token to be burned.
|
|
10
|
+
*/
|
|
11
|
+
interface IERC721Burnable {
|
|
12
|
+
/**
|
|
13
|
+
* @notice Burns an NFT, removing it from circulation and essentially destroying it.
|
|
14
|
+
* @custom:permission Owner of the NFT.
|
|
15
|
+
*
|
|
16
|
+
* @param tokenId The token ID of the token to burn.
|
|
17
|
+
*/
|
|
18
|
+
function burn(uint256 tokenId) external;
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title IERC721MetaTx
|
|
7
|
+
* @author Lens Protocol
|
|
8
|
+
*
|
|
9
|
+
* @notice Extension of ERC-721 including meta-tx signatures related functions.
|
|
10
|
+
*/
|
|
11
|
+
interface IERC721MetaTx {
|
|
12
|
+
/**
|
|
13
|
+
* @notice Returns the current signature nonce of the given signer.
|
|
14
|
+
*
|
|
15
|
+
* @param signer The address for which to query the nonce.
|
|
16
|
+
*
|
|
17
|
+
* @return uint256 The current nonce of the given signer.
|
|
18
|
+
*/
|
|
19
|
+
function nonces(address signer) external view returns (uint256);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @notice Returns the EIP-712 domain separator for this contract.
|
|
23
|
+
*
|
|
24
|
+
* @return bytes32 The domain separator.
|
|
25
|
+
*/
|
|
26
|
+
function getDomainSeparator() external view returns (bytes32);
|
|
27
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
import {Types} from '../libraries/constants/Types.sol';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @title IERC721Timestamped
|
|
9
|
+
* @author Lens Protocol
|
|
10
|
+
*
|
|
11
|
+
* @notice Extension of ERC-721 including a struct for token data, which contains the owner and the mint timestamp, as
|
|
12
|
+
* well as their associated getters.
|
|
13
|
+
*/
|
|
14
|
+
interface IERC721Timestamped {
|
|
15
|
+
/**
|
|
16
|
+
* @notice Returns the mint timestamp associated with a given NFT.
|
|
17
|
+
*
|
|
18
|
+
* @param tokenId The token ID of the NFT to query the mint timestamp for.
|
|
19
|
+
*
|
|
20
|
+
* @return uint256 Mint timestamp, this is stored as a uint96 but returned as a uint256 to reduce unnecessary
|
|
21
|
+
* padding.
|
|
22
|
+
*/
|
|
23
|
+
function mintTimestampOf(uint256 tokenId) external view returns (uint256);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @notice Returns the token data associated with a given NFT. This allows fetching the token owner and
|
|
27
|
+
* mint timestamp in a single call.
|
|
28
|
+
*
|
|
29
|
+
* @param tokenId The token ID of the NFT to query the token data for.
|
|
30
|
+
*
|
|
31
|
+
* @return TokenData A struct containing both the owner address and the mint timestamp.
|
|
32
|
+
*/
|
|
33
|
+
function tokenDataOf(uint256 tokenId) external view returns (Types.TokenData memory);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @notice Returns whether a token with the given token ID exists.
|
|
37
|
+
*
|
|
38
|
+
* @param tokenId The token ID of the NFT to check existence for.
|
|
39
|
+
*
|
|
40
|
+
* @return bool True if the token exists.
|
|
41
|
+
*/
|
|
42
|
+
function exists(uint256 tokenId) external view returns (bool);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @notice Returns the amount of tokens in circulation.
|
|
46
|
+
*
|
|
47
|
+
* @return uint256 The current total supply of tokens.
|
|
48
|
+
*/
|
|
49
|
+
function totalSupply() external view returns (uint256);
|
|
50
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title IFollowModule
|
|
7
|
+
* @author Lens Protocol
|
|
8
|
+
*
|
|
9
|
+
* @notice This is the standard interface for all Lens-compatible Follow Modules.
|
|
10
|
+
* These are responsible for processing the follow actions and can be used to implement any kind of follow logic.
|
|
11
|
+
* For example:
|
|
12
|
+
* - Token-gated follows (e.g. a user must hold a certain amount of a token to follow a profile).
|
|
13
|
+
* - Paid follows (e.g. a user must pay a certain amount of a token to follow a profile).
|
|
14
|
+
* - Rewarding users for following a profile.
|
|
15
|
+
* - Etc.
|
|
16
|
+
*/
|
|
17
|
+
interface IFollowModule {
|
|
18
|
+
/**
|
|
19
|
+
* @notice Initializes a follow module for a given Lens profile.
|
|
20
|
+
* @custom:permissions LensHub.
|
|
21
|
+
*
|
|
22
|
+
* @param profileId The Profile ID to initialize this follow module for.
|
|
23
|
+
* @param transactionExecutor The address of the transaction executor (e.g. for any funds to transferFrom).
|
|
24
|
+
* @param data Arbitrary data passed from the user to be decoded by the Follow Module during initialization.
|
|
25
|
+
*
|
|
26
|
+
* @return bytes The encoded data to be emitted from the hub.
|
|
27
|
+
*/
|
|
28
|
+
function initializeFollowModule(
|
|
29
|
+
uint256 profileId,
|
|
30
|
+
address transactionExecutor,
|
|
31
|
+
bytes calldata data
|
|
32
|
+
) external returns (bytes memory);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @notice Processes a given follow.
|
|
36
|
+
* @custom:permissions LensHub.
|
|
37
|
+
*
|
|
38
|
+
* @param followerProfileId The Profile ID of the follower's profile.
|
|
39
|
+
* @param followTokenId The Follow Token ID that is being used to follow. Zero if we are processing a new fresh
|
|
40
|
+
* follow, in this case, the follow ID assigned can be queried from the Follow NFT collection if needed.
|
|
41
|
+
* @param transactionExecutor The address of the transaction executor (e.g. for any funds to transferFrom).
|
|
42
|
+
* @param targetProfileId The token ID of the profile being followed.
|
|
43
|
+
* @param data Arbitrary data passed by the follower.
|
|
44
|
+
*
|
|
45
|
+
* @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by
|
|
46
|
+
* indexers or UIs.
|
|
47
|
+
*/
|
|
48
|
+
function processFollow(
|
|
49
|
+
uint256 followerProfileId,
|
|
50
|
+
uint256 followTokenId,
|
|
51
|
+
address transactionExecutor,
|
|
52
|
+
uint256 targetProfileId,
|
|
53
|
+
bytes calldata data
|
|
54
|
+
) external returns (bytes memory);
|
|
55
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';
|
|
6
|
+
import {IERC721Timestamped} from '../interfaces/IERC721Timestamped.sol';
|
|
7
|
+
import {IERC721Burnable} from '../interfaces/IERC721Burnable.sol';
|
|
8
|
+
import {IERC721MetaTx} from '../interfaces/IERC721MetaTx.sol';
|
|
9
|
+
import {IERC721Metadata} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
|
|
10
|
+
|
|
11
|
+
interface ILensERC721 is IERC721, IERC721Timestamped, IERC721Burnable, IERC721MetaTx, IERC721Metadata {}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
import {Types} from '../libraries/constants/Types.sol';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @title ILensGovernable
|
|
9
|
+
* @author Lens Protocol
|
|
10
|
+
*
|
|
11
|
+
* @notice This is the interface for the Lens Protocol main governance functions.
|
|
12
|
+
*/
|
|
13
|
+
interface ILensGovernable {
|
|
14
|
+
/**
|
|
15
|
+
* @notice Sets the privileged governance role.
|
|
16
|
+
* @custom:permissions Governance.
|
|
17
|
+
*
|
|
18
|
+
* @param newGovernance The new governance address to set.
|
|
19
|
+
*/
|
|
20
|
+
function setGovernance(address newGovernance) external;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @notice Sets the emergency admin, which is a permissioned role able to set the protocol state.
|
|
24
|
+
* @custom:permissions Governance.
|
|
25
|
+
*
|
|
26
|
+
* @param newEmergencyAdmin The new emergency admin address to set.
|
|
27
|
+
*/
|
|
28
|
+
function setEmergencyAdmin(address newEmergencyAdmin) external;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @notice Sets the protocol state to either a global pause, a publishing pause or an unpaused state.
|
|
32
|
+
* @custom:permissions Governance or Emergency Admin. Emergency Admin can only restrict more.
|
|
33
|
+
*
|
|
34
|
+
* @param newState The state to set. It can be one of the following:
|
|
35
|
+
* - Unpaused: The protocol is fully operational.
|
|
36
|
+
* - PublishingPaused: The protocol is paused for publishing, but it is still operational for others operations.
|
|
37
|
+
* - Paused: The protocol is paused for all operations.
|
|
38
|
+
*/
|
|
39
|
+
function setState(Types.ProtocolState newState) external;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @notice Adds or removes a profile creator from the whitelist.
|
|
43
|
+
* @custom:permissions Governance.
|
|
44
|
+
*
|
|
45
|
+
* @param profileCreator The profile creator address to add or remove from the whitelist.
|
|
46
|
+
* @param whitelist Whether or not the profile creator should be whitelisted.
|
|
47
|
+
*/
|
|
48
|
+
function whitelistProfileCreator(address profileCreator, bool whitelist) external;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @notice Sets the profile token URI contract.
|
|
52
|
+
* @custom:permissions Governance.
|
|
53
|
+
*
|
|
54
|
+
* @param profileTokenURIContract The profile token URI contract to set.
|
|
55
|
+
*/
|
|
56
|
+
function setProfileTokenURIContract(address profileTokenURIContract) external;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @notice Sets the follow token URI contract.
|
|
60
|
+
* @custom:permissions Governance.
|
|
61
|
+
*
|
|
62
|
+
* @param followTokenURIContract The follow token URI contract to set.
|
|
63
|
+
*/
|
|
64
|
+
function setFollowTokenURIContract(address followTokenURIContract) external;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @notice Sets the treasury address.
|
|
68
|
+
* @custom:permissions Governance
|
|
69
|
+
*
|
|
70
|
+
* @param newTreasury The new treasury address to set.
|
|
71
|
+
*/
|
|
72
|
+
function setTreasury(address newTreasury) external;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @notice Sets the treasury fee.
|
|
76
|
+
* @custom:permissions Governance
|
|
77
|
+
*
|
|
78
|
+
* @param newTreasuryFee The new treasury fee to set.
|
|
79
|
+
*/
|
|
80
|
+
function setTreasuryFee(uint16 newTreasuryFee) external;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @notice Returns the currently configured governance address.
|
|
84
|
+
*
|
|
85
|
+
* @return address The address of the currently configured governance.
|
|
86
|
+
*/
|
|
87
|
+
function getGovernance() external view returns (address);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @notice Gets the state currently set in the protocol. It could be a global pause, a publishing pause or an
|
|
91
|
+
* unpaused state.
|
|
92
|
+
* @custom:permissions Anyone.
|
|
93
|
+
*
|
|
94
|
+
* @return Types.ProtocolState The state currently set in the protocol.
|
|
95
|
+
*/
|
|
96
|
+
function getState() external view returns (Types.ProtocolState);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @notice Returns whether or not a profile creator is whitelisted.
|
|
100
|
+
*
|
|
101
|
+
* @param profileCreator The address of the profile creator to check.
|
|
102
|
+
*
|
|
103
|
+
* @return bool True if the profile creator is whitelisted, false otherwise.
|
|
104
|
+
*/
|
|
105
|
+
function isProfileCreatorWhitelisted(address profileCreator) external view returns (bool);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @notice Returns the treasury address.
|
|
109
|
+
*
|
|
110
|
+
* @return address The treasury address.
|
|
111
|
+
*/
|
|
112
|
+
function getTreasury() external view returns (address);
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @notice Returns the treasury fee.
|
|
116
|
+
*
|
|
117
|
+
* @return uint16 The treasury fee.
|
|
118
|
+
*/
|
|
119
|
+
function getTreasuryFee() external view returns (uint16);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @notice Returns the treasury address and treasury fee in a single call.
|
|
123
|
+
*
|
|
124
|
+
* @return tuple First, the treasury address, second, the treasury fee.
|
|
125
|
+
*/
|
|
126
|
+
function getTreasuryData() external view returns (address, uint16);
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @notice Gets the profile token URI contract.
|
|
130
|
+
*
|
|
131
|
+
* @return address The profile token URI contract.
|
|
132
|
+
*/
|
|
133
|
+
function getProfileTokenURIContract() external view returns (address);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @notice Gets the follow token URI contract.
|
|
137
|
+
*
|
|
138
|
+
* @return address The follow token URI contract.
|
|
139
|
+
*/
|
|
140
|
+
function getFollowTokenURIContract() external view returns (address);
|
|
141
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
import {ILensProtocol} from '../interfaces/ILensProtocol.sol';
|
|
6
|
+
import {ILensGovernable} from '../interfaces/ILensGovernable.sol';
|
|
7
|
+
import {ILensHubEventHooks} from '../interfaces/ILensHubEventHooks.sol';
|
|
8
|
+
import {ILensImplGetters} from '../interfaces/ILensImplGetters.sol';
|
|
9
|
+
import {ILensProfiles} from '../interfaces/ILensProfiles.sol';
|
|
10
|
+
import {ILensVersion} from '../interfaces/ILensVersion.sol';
|
|
11
|
+
|
|
12
|
+
interface ILensHub is
|
|
13
|
+
ILensProfiles,
|
|
14
|
+
ILensProtocol,
|
|
15
|
+
ILensGovernable,
|
|
16
|
+
ILensHubEventHooks,
|
|
17
|
+
ILensImplGetters,
|
|
18
|
+
ILensVersion
|
|
19
|
+
{}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title ILensHubEventHooks
|
|
7
|
+
* @author Lens Protocol
|
|
8
|
+
*
|
|
9
|
+
* @notice This is the interface for the LensHub contract's event hooks. As we want most of the core events to be
|
|
10
|
+
* emitted by the LensHub contract, event hooks are needed for core events generated by pheripheral contracts.
|
|
11
|
+
*/
|
|
12
|
+
interface ILensHubEventHooks {
|
|
13
|
+
/**
|
|
14
|
+
* @dev Helper function to emit an `Unfollowed` event from the hub, to be consumed by indexers to track unfollows.
|
|
15
|
+
* @custom:permissions FollowNFT of the Profile unfollowed.
|
|
16
|
+
*
|
|
17
|
+
* @param unfollowerProfileId The ID of the profile that executed the unfollow.
|
|
18
|
+
* @param idOfProfileUnfollowed The ID of the profile that was unfollowed.
|
|
19
|
+
* @param transactionExecutor The address of the account executing the unfollow operation.
|
|
20
|
+
*/
|
|
21
|
+
function emitUnfollowedEvent(
|
|
22
|
+
uint256 unfollowerProfileId,
|
|
23
|
+
uint256 idOfProfileUnfollowed,
|
|
24
|
+
address transactionExecutor
|
|
25
|
+
) external;
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title ILensImplGetters
|
|
7
|
+
* @author Lens Protocol
|
|
8
|
+
*
|
|
9
|
+
* @notice This is the interface for the LensHub contract's implementation getters. These implementations will be used
|
|
10
|
+
* for deploying each respective contract for each profile.
|
|
11
|
+
*/
|
|
12
|
+
interface ILensImplGetters {
|
|
13
|
+
/**
|
|
14
|
+
* @notice Returns the Follow NFT implementation address that is used for all deployed Follow NFTs.
|
|
15
|
+
*
|
|
16
|
+
* @return address The Follow NFT implementation address.
|
|
17
|
+
*/
|
|
18
|
+
function getFollowNFTImpl() external view returns (address);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @notice Returns the Collect NFT implementation address that is used for each new deployed Collect NFT.
|
|
22
|
+
* @custom:pending-deprecation
|
|
23
|
+
*
|
|
24
|
+
* @return address The Collect NFT implementation address.
|
|
25
|
+
*/
|
|
26
|
+
function getLegacyCollectNFTImpl() external view returns (address);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @notice Returns the address of the registry that stores all modules that are used by the Lens Protocol.
|
|
30
|
+
*
|
|
31
|
+
* @return address The address of the Module Registry contract.
|
|
32
|
+
*/
|
|
33
|
+
function getModuleRegistry() external view returns (address);
|
|
34
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
import {ILensERC721} from '../interfaces/ILensERC721.sol';
|
|
6
|
+
|
|
7
|
+
interface ILensProfiles is ILensERC721 {
|
|
8
|
+
/**
|
|
9
|
+
* @notice DANGER: Triggers disabling the profile protection mechanism for the msg.sender, which will allow
|
|
10
|
+
* transfers or approvals over profiles held by it.
|
|
11
|
+
* Disabling the mechanism will have a timelock before it becomes effective, allowing the owner to re-enable
|
|
12
|
+
* the protection back in case of being under attack.
|
|
13
|
+
* The protection layer only applies to EOA wallets.
|
|
14
|
+
*/
|
|
15
|
+
function DANGER__disableTokenGuardian() external;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @notice Enables back the profile protection mechanism for the msg.sender, preventing profile transfers or
|
|
19
|
+
* approvals (except when revoking them).
|
|
20
|
+
* The protection layer only applies to EOA wallets.
|
|
21
|
+
*/
|
|
22
|
+
function enableTokenGuardian() external;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @notice Returns the timestamp at which the Token Guardian will become effectively disabled.
|
|
26
|
+
*
|
|
27
|
+
* @param wallet The address to check the timestamp for.
|
|
28
|
+
*
|
|
29
|
+
* @return uint256 The timestamp at which the Token Guardian will become effectively disabled. Zero if enabled.
|
|
30
|
+
*/
|
|
31
|
+
function getTokenGuardianDisablingTimestamp(address wallet) external view returns (uint256);
|
|
32
|
+
}
|