Files
core/contracts/libraries/Events.sol

530 lines
20 KiB
Solidity

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
import {DataTypes} from './DataTypes.sol';
library Events {
/**
* @dev Emitted when the NFT contract's name and symbol are set at initialization.
*
* @param name The NFT name set.
* @param symbol The NFT symbol set.
* @param timestamp The current block timestamp.
*/
event BaseInitialized(string name, string symbol, uint256 timestamp);
/**
* @dev Emitted when the hub state is set.
*
* @param caller The caller who set the state.
* @param prevState The previous protocol state, an enum of either `Paused`, `PublishingPaused` or `Unpaused`.
* @param newState The newly set state, an enum of either `Paused`, `PublishingPaused` or `Unpaused`.
* @param timestamp The current block timestamp.
*/
event StateSet(
address indexed caller,
DataTypes.ProtocolState indexed prevState,
DataTypes.ProtocolState indexed newState,
uint256 timestamp
);
/**
* @dev Emitted when the governance address is changed. We emit the caller even though it should be the previous
* governance address, as we cannot guarantee this will always be the case due to upgradeability.
*
* @param caller The caller who set the governance address.
* @param prevGovernance The previous governance address.
* @param newGovernance The new governance address set.
* @param timestamp The current block timestamp.
*/
event GovernanceSet(
address indexed caller,
address indexed prevGovernance,
address indexed newGovernance,
uint256 timestamp
);
/**
* @dev Emitted when the emergency admin is changed. We emit the caller even though it should be the previous
* governance address, as we cannot guarantee this will always be the case due to upgradeability.
*
* @param caller The caller who set the emergency admin address.
* @param oldEmergencyAdmin The previous emergency admin address.
* @param newEmergencyAdmin The new emergency admin address set.
* @param timestamp The current block timestamp.
*/
event EmergencyAdminSet(
address indexed caller,
address indexed oldEmergencyAdmin,
address indexed newEmergencyAdmin,
uint256 timestamp
);
/**
* @dev Emitted when a profile creator is added to or removed from the whitelist.
*
* @param profileCreator The address of the profile creator.
* @param whitelisted Whether or not the profile creator is being added to the whitelist.
* @param timestamp The current block timestamp.
*/
event ProfileCreatorWhitelisted(
address indexed profileCreator,
bool indexed whitelisted,
uint256 timestamp
);
/**
* @dev Emitted when a follow module is added to or removed from the whitelist.
*
* @param followModule The address of the follow module.
* @param whitelisted Whether or not the follow module is being added to the whitelist.
* @param timestamp The current block timestamp.
*/
event FollowModuleWhitelisted(
address indexed followModule,
bool indexed whitelisted,
uint256 timestamp
);
/**
* @dev Emitted when a reference module is added to or removed from the whitelist.
*
* @param referenceModule The address of the reference module.
* @param whitelisted Whether or not the reference module is being added to the whitelist.
* @param timestamp The current block timestamp.
*/
event ReferenceModuleWhitelisted(
address indexed referenceModule,
bool indexed whitelisted,
uint256 timestamp
);
/**
* @dev Emitted when a collect module is added to or removed from the whitelist.
*
* @param collectModule The address of the collect module.
* @param whitelisted Whether or not the collect module is being added to the whitelist.
* @param timestamp The current block timestamp.
*/
event CollectModuleWhitelisted(
address indexed collectModule,
bool indexed whitelisted,
uint256 timestamp
);
/**
* @dev Emitted when a profile is created.
*
* @param profileId The newly created profile's token ID.
* @param creator The profile creator, who created the token with the given profile ID.
* @param to The address receiving the profile with the given profile ID.
* @param handle The handle set for the profile.
* @param imageURI The image uri set for the profile.
* @param followModule The profile's newly set follow module. This CAN be the zero address.
* @param followModuleReturnData The data returned from the follow module's initialization. This is abi encoded
* and totally depends on the follow module chosen.
* @param followNFTURI The URI set for the profile's follow NFT.
* @param timestamp The current block timestamp.
*/
event ProfileCreated(
uint256 indexed profileId,
address indexed creator,
address indexed to,
string handle,
string imageURI,
address followModule,
bytes followModuleReturnData,
string followNFTURI,
uint256 timestamp
);
/**
* @dev Emitted when a a default profile is set for a wallet as its main identity
*
* @param wallet The wallet which set or unset its default profile.
* @param profileId The token ID of the profile being set as default, or zero.
* @param timestamp The current block timestamp.
*/
event DefaultProfileSet(address indexed wallet, uint256 indexed profileId, uint256 timestamp);
/**
* @dev Emitted when a dispatcher is set for a specific profile.
*
* @param profileId The token ID of the profile for which the dispatcher is set.
* @param dispatcher The dispatcher set for the given profile.
* @param timestamp The current block timestamp.
*/
event DispatcherSet(uint256 indexed profileId, address indexed dispatcher, uint256 timestamp);
/**
* @dev Emitted when a profile's URI is set.
*
* @param profileId The token ID of the profile for which the URI is set.
* @param imageURI The URI set for the given profile.
* @param timestamp The current block timestamp.
*/
event ProfileImageURISet(uint256 indexed profileId, string imageURI, uint256 timestamp);
/**
* @dev Emitted when a follow NFT's URI is set.
*
* @param profileId The token ID of the profile for which the followNFT URI is set.
* @param followNFTURI The follow NFT URI set.
* @param timestamp The current block timestamp.
*/
event FollowNFTURISet(uint256 indexed profileId, string followNFTURI, uint256 timestamp);
/**
* @dev Emitted when a profile's follow module is set.
*
* @param profileId The profile's token ID.
* @param followModule The profile's newly set follow module. This CAN be the zero address.
* @param followModuleReturnData The data returned from the follow module's initialization. This is abi encoded
* and totally depends on the follow module chosen.
* @param timestamp The current block timestamp.
*/
event FollowModuleSet(
uint256 indexed profileId,
address followModule,
bytes followModuleReturnData,
uint256 timestamp
);
/**
* @dev Emitted when a "post" is published.
*
* @param profileId The profile's token ID.
* @param pubId The new publication's ID.
* @param contentURI The URI mapped to this new publication.
* @param collectModule The collect module mapped to this new publication. This CANNOT be the zero address.
* @param collectModuleReturnData The data returned from the collect module's initialization for this given
* publication. This is abi encoded and totally depends on the collect module chosen.
* @param referenceModule The reference module set for this publication.
* @param referenceModuleReturnData The data returned from the reference module at initialization. This is abi
* encoded and totally depends on the reference module chosen.
* @param timestamp The current block timestamp.
*/
event PostCreated(
uint256 indexed profileId,
uint256 indexed pubId,
string contentURI,
address collectModule,
bytes collectModuleReturnData,
address referenceModule,
bytes referenceModuleReturnData,
uint256 timestamp
);
/**
* @dev Emitted when a "comment" is published.
*
* @param profileId The profile's token ID.
* @param pubId The new publication's ID.
* @param contentURI The URI mapped to this new publication.
* @param profileIdPointed The profile token ID that this comment points to.
* @param pubIdPointed The publication ID that this comment points to.
* @param referenceModuleData The data passed to the reference module.
* @param collectModule The collect module mapped to this new publication. This CANNOT be the zero address.
* @param collectModuleReturnData The data returned from the collect module's initialization for this given
* publication. This is abi encoded and totally depends on the collect module chosen.
* @param referenceModule The reference module set for this publication.
* @param referenceModuleReturnData The data returned from the reference module at initialization. This is abi
* encoded and totally depends on the reference module chosen.
* @param timestamp The current block timestamp.
*/
event CommentCreated(
uint256 indexed profileId,
uint256 indexed pubId,
string contentURI,
uint256 profileIdPointed,
uint256 pubIdPointed,
bytes referenceModuleData,
address collectModule,
bytes collectModuleReturnData,
address referenceModule,
bytes referenceModuleReturnData,
uint256 timestamp
);
/**
* @dev Emitted when a "mirror" is published.
*
* @param profileId The profile's token ID.
* @param pubId The new publication's ID.
* @param profileIdPointed The profile token ID that this mirror points to.
* @param pubIdPointed The publication ID that this mirror points to.
* @param referenceModuleData The data passed to the reference module.
* @param referenceModule The reference module set for this publication.
* @param referenceModuleReturnData The data returned from the reference module at initialization. This is abi
* encoded and totally depends on the reference module chosen.
* @param timestamp The current block timestamp.
*/
event MirrorCreated(
uint256 indexed profileId,
uint256 indexed pubId,
uint256 profileIdPointed,
uint256 pubIdPointed,
bytes referenceModuleData,
address referenceModule,
bytes referenceModuleReturnData,
uint256 timestamp
);
/**
* @dev Emitted when a followNFT clone is deployed using a lazy deployment pattern.
*
* @param profileId The token ID of the profile to which this followNFT is associated.
* @param followNFT The address of the newly deployed followNFT clone.
* @param timestamp The current block timestamp.
*/
event FollowNFTDeployed(
uint256 indexed profileId,
address indexed followNFT,
uint256 timestamp
);
/**
* @dev Emitted when a collectNFT clone is deployed using a lazy deployment pattern.
*
* @param profileId The publisher's profile token ID.
* @param pubId The publication associated with the newly deployed collectNFT clone's ID.
* @param collectNFT The address of the newly deployed collectNFT clone.
* @param timestamp The current block timestamp.
*/
event CollectNFTDeployed(
uint256 indexed profileId,
uint256 indexed pubId,
address indexed collectNFT,
uint256 timestamp
);
/**
* @dev Emitted upon a successful collect action.
*
* @param collector The address collecting the publication.
* @param profileId The token ID of the profile that the collect was initiated towards, useful to differentiate mirrors.
* @param pubId The publication ID that the collect was initiated towards, useful to differentiate mirrors.
* @param rootProfileId The profile token ID of the profile whose publication is being collected.
* @param rootPubId The publication ID of the publication being collected.
* @param collectModuleData The data passed to the collect module.
* @param timestamp The current block timestamp.
*/
event Collected(
address indexed collector,
uint256 indexed profileId,
uint256 indexed pubId,
uint256 rootProfileId,
uint256 rootPubId,
bytes collectModuleData,
uint256 timestamp
);
/**
* @dev Emitted upon a successful follow action.
*
* @param follower The address following the given profiles.
* @param profileIds The token ID array of the profiles being followed.
* @param followModuleDatas The array of data parameters passed to each follow module.
* @param timestamp The current block timestamp.
*/
event Followed(
address indexed follower,
uint256[] profileIds,
bytes[] followModuleDatas,
uint256 timestamp
);
/**
* @dev Emitted via callback when a followNFT is transferred.
*
* @param profileId The token ID of the profile associated with the followNFT being transferred.
* @param followNFTId The followNFT being transferred's token ID.
* @param from The address the followNFT is being transferred from.
* @param to The address the followNFT is being transferred to.
* @param timestamp The current block timestamp.
*/
event FollowNFTTransferred(
uint256 indexed profileId,
uint256 indexed followNFTId,
address from,
address to,
uint256 timestamp
);
/**
* @dev Emitted via callback when a collectNFT is transferred.
*
* @param profileId The token ID of the profile associated with the collectNFT being transferred.
* @param pubId The publication ID associated with the collectNFT being transferred.
* @param collectNFTId The collectNFT being transferred's token ID.
* @param from The address the collectNFT is being transferred from.
* @param to The address the collectNFT is being transferred to.
* @param timestamp The current block timestamp.
*/
event CollectNFTTransferred(
uint256 indexed profileId,
uint256 indexed pubId,
uint256 indexed collectNFTId,
address from,
address to,
uint256 timestamp
);
// Collect/Follow NFT-Specific
/**
* @dev Emitted when a newly deployed follow NFT is initialized.
*
* @param profileId The token ID of the profile connected to this follow NFT.
* @param timestamp The current block timestamp.
*/
event FollowNFTInitialized(uint256 indexed profileId, uint256 timestamp);
/**
* @dev Emitted when delegation power in a FollowNFT is changed.
*
* @param delegate The delegate whose power has been changed.
* @param newPower The new governance power mapped to the delegate.
* @param timestamp The current block timestamp.
*/
event FollowNFTDelegatedPowerChanged(
address indexed delegate,
uint256 indexed newPower,
uint256 timestamp
);
/**
* @dev Emitted when a newly deployed collect NFT is initialized.
*
* @param profileId The token ID of the profile connected to the publication mapped to this collect NFT.
* @param pubId The publication ID connected to the publication mapped to this collect NFT.
* @param timestamp The current block timestamp.
*/
event CollectNFTInitialized(
uint256 indexed profileId,
uint256 indexed pubId,
uint256 timestamp
);
// Module-Specific
/**
* @notice Emitted when the ModuleGlobals governance address is set.
*
* @param prevGovernance The previous governance address.
* @param newGovernance The new governance address set.
* @param timestamp The current block timestamp.
*/
event ModuleGlobalsGovernanceSet(
address indexed prevGovernance,
address indexed newGovernance,
uint256 timestamp
);
/**
* @notice Emitted when the ModuleGlobals treasury address is set.
*
* @param prevTreasury The previous treasury address.
* @param newTreasury The new treasury address set.
* @param timestamp The current block timestamp.
*/
event ModuleGlobalsTreasurySet(
address indexed prevTreasury,
address indexed newTreasury,
uint256 timestamp
);
/**
* @notice Emitted when the ModuleGlobals treasury fee is set.
*
* @param prevTreasuryFee The previous treasury fee in BPS.
* @param newTreasuryFee The new treasury fee in BPS.
* @param timestamp The current block timestamp.
*/
event ModuleGlobalsTreasuryFeeSet(
uint16 indexed prevTreasuryFee,
uint16 indexed newTreasuryFee,
uint256 timestamp
);
/**
* @notice Emitted when a currency is added to or removed from the ModuleGlobals whitelist.
*
* @param currency The currency address.
* @param prevWhitelisted Whether or not the currency was previously whitelisted.
* @param whitelisted Whether or not the currency is whitelisted.
* @param timestamp The current block timestamp.
*/
event ModuleGlobalsCurrencyWhitelisted(
address indexed currency,
bool indexed prevWhitelisted,
bool indexed whitelisted,
uint256 timestamp
);
/**
* @notice Emitted when a module inheriting from the `FeeModuleBase` is constructed.
*
* @param moduleGlobals The ModuleGlobals contract address used.
* @param timestamp The current block timestamp.
*/
event FeeModuleBaseConstructed(address indexed moduleGlobals, uint256 timestamp);
/**
* @notice Emitted when a module inheriting from the `ModuleBase` is constructed.
*
* @param hub The LensHub contract address used.
* @param timestamp The current block timestamp.
*/
event ModuleBaseConstructed(address indexed hub, uint256 timestamp);
/**
* @notice Emitted when one or multiple addresses are approved (or disapproved) for following in
* the `ApprovalFollowModule`.
*
* @param owner The profile owner who executed the approval.
* @param profileId The profile ID that the follow approvals are granted/revoked for.
* @param addresses The addresses that have had the follow approvals grnated/revoked.
* @param approved Whether each corresponding address is now approved or disapproved.
* @param timestamp The current block timestamp.
*/
event FollowsApproved(
address indexed owner,
uint256 indexed profileId,
address[] addresses,
bool[] approved,
uint256 timestamp
);
/**
* @dev Emitted when the user wants to enable or disable follows in the `LensPeripheryDataProvider`.
*
* @param owner The profile owner who executed the toggle.
* @param profileIds The array of token IDs of the profiles each followNFT is associated with.
* @param enabled The array of whether each FollowNFT's follow is enabled/disabled.
* @param timestamp The current block timestamp.
*/
event FollowsToggled(
address indexed owner,
uint256[] profileIds,
bool[] enabled,
uint256 timestamp
);
/**
* @dev Emitted when the metadata associated with a profile and user is set in the `LensPeripheryDataProvider`.
*
* @param user The user the metadata is set for.
* @param profileId The profile ID the metadata is set for.
* @param metadata The metadata set for the profile and user.
* @param timestamp The current block timestamp.
*/
event ProfileMetadataSet(
address indexed user,
uint256 indexed profileId,
string metadata,
uint256 timestamp
);
}