Event Emissions

Events are emitted at every state-changing function call, in addition to standard ERC721 events. Events often include the timestamp as a specific parameter, which allows for direct consumption using a bloom filter without needing to fetch block context on every event.

Furthermore, collect and follow NFT transfers hook into an event emitter on the LensHub, which simplifies event consumption by tracking NFT transfers without indexing numerous follow and collect NFTs.

The Events library contains a convenient list of all custom Lens Protocol events as well as explanations for each. It also references the DataTypes library.

See the events emitted below:

BaseInitialized

event BaseInitialized(string name, string symbol, uint256 timestamp);

Emitted when the NFT contract's name and symbol are set at initialization by initialize()

Parameter NameTypeDescription
namestringThe name given to the Lens profile NFT
symbolstringThe symbol given to the Lens profile NFT
timestampuint256The block timestamp at which the NFT contract is initialized

StateSet

event StateSet(address indexed caller, DataTypes.ProtocolState indexed prevState, DataTypes.ProtocolState indexed newState, uint256 timestamp);

Emitted when the hub state is set by setState()

Parameter NameTypeDescription
calleraddressThe caller who sets the state
prevStateEnum: DataTypes.ProtocolStateThe previous protocol state. Enum of Paused, PublishingPaused or Unpaused
newStateEnum: DataTypes.ProtocolStateThe newly set state. Enum of Paused, PublishingPaused or Unpaused
timestampuint256The block timestamp at which state is set

GovernanceSet

event GovernanceSet(address indexed caller, address indexed prevGovernance, address indexed newGovernance, uint256 timestamp);.

Emitted when the governance address is changed by setGovernance()

Parameter NameTypeDescription
calleraddressThe caller who set the governance address. Mostly previous governance address, but cannot guarantee due to upgradeability
prevGovernanceaddressThe previous governance address
newGovernanceaddressThe new governance address set
timestampuint256The block timestamp at which governance is set

EmergencyAdminSet

event EmergencyAdminSet(address indexed caller, address indexed oldEmergencyAdmin, address indexed newEmergencyAdmin, uint256 timestamp);

Emitted when the emergency admin is changed by setEmergencyAdmin()

Parameter NameTypeDescription
calleraddressThe caller who set the emergency admin address. Mostly previous governance address, but cannot guarantee due to upgradeability
oldEmergencyAdminaddressThe previous emergency admin address
newEmergencyAdminaddressThe new emergency admin address set
timestampuint256The block timestamp at which emergency admin is set

ProfileCreatorWhitelisted

event ProfileCreatorWhitelisted(address indexed profileCreator, bool indexed whitelisted, uint256 timestamp);

Emitted when a profile creator is added to or removed from the whitelist by whitelistProfileCreator()

Parameter NameTypeDescription
profileCreatoraddressThe address of the profile creator
whitelistedbool1 => profile creator is being added, 0 => profile creator is being removed
timestampuint256The block timestamp at which profile creator is added/removed from the whitelist

FollowModuleWhitelisted

event FollowModuleWhitelisted(address indexed followModule, bool indexed whitelisted, uint256 timestamp);

Emitted when a follow module is added to or removed from the whitelist by whitelistFollowModule()

Parameter NameTypeDescription
followModuleaddressThe address of the follow module
whitelistedbool1 => follow module is being added, 0 => follow module is being removed
timestampuint256The block timestamp at which follow module is added/removed from the whitelist

ReferenceModuleWhitelisted

event ReferenceModuleWhitelisted(address indexed referenceModule, bool indexed whitelisted, uint256 timestamp);

Emitted when a reference module is added to or removed from the whitelist by whitelistReferenceModule()

Parameter NameTypeDescription
referenceModuleaddressThe address of the reference module
whitelistedbool1 => reference module is being added, 0 => reference module is being removed
timestampuint256The block timestamp at which the reference module is added/removed from whitelist

CollectModuleWhitelisted

event CollectModuleWhitelisted(address indexed collectModule, bool indexed whitelisted, uint256 timestamp);

Emitted when a collect module is added to or removed from the whitelist by whitelistCollectModule()

Parameter NameTypeDescription
collectModuleaddressThe address of the collect module.
whitelistedbool1 => collect module is being added, 0 => collect module is being removed
timestampuint256The block timestamp at which the collect module is added/removed from whitelist

ProfileCreated

event ProfileCreated(uint256 indexed profileId, address indexed creator, address indexed to, string handle, string imageURI, address followModule, bytes followModuleReturnData, string followNFTURI, uint256 timestamp);

Parameter NameTypeDescription
profileIduint256The newly created profile's token ID
creatorThe profile creator created the token with the given profile ID
toaddressThe address to which the profile with the given profile ID is minted to
handlestringThe handle set for the profile
imageURIstringThe image uri set for the profile
followModuleaddressThe profile's newly set follow module. This can be the zero address
followModuleReturnDatabytesThe data returned from the follow module's initialization. This is abi encoded and depends on the follow module chosen
followNFTURIstringThe uri set for follow NFT
timestampuint256The block timestamp at which profile NFT is created

DispatcherSet

event DispatcherSet(uint256 indexed profileId, address indexed dispatcher, uint256 timestamp);

Emitted when a dispatcher is set for a specific profile by setDispatcher()

Parameter NameTypeDescription
profileIduint256The token ID of the profile for which the dispatcher is set
dispatcheraddressThe dispatcher is set for the given profile
timestampuint256The block timestamp at which the dispatcher is set

ProfileImageURISet

event ProfileImageURISet(uint256 indexed profileId, string imageURI, uint256 timestamp);

Emitted when a profile's URI is set by setProfileImageURI()

Parameter NameTypeDescription
profileIduint256The token ID of the profile for which the URI is set
imageURIstringThe URI set for the given profile
timestampuint256The block timestamp at which URI is set

FollowNFTURISet

event FollowNFTURISet(uint256 indexed profileId, string followNFTURI, uint256 timestamp);

Emitted when a follow NFT's URI is set by setFollowNFTURI()

Parameter NameTypeDescription
profileIduint256The token ID of the profile for which the follow NFT URI is set
followNFTURIstringThe follow NFT URI is set for the given profile
timestampuint256The block timestamp at which NFT URI is set

FollowModuleSet

event FollowModuleSet(uint256 indexed profileId, address followModule, bytes followModuleReturnData, uint256 timestamp);

Emitted when a profile's follow module is set by setFollowModule()

Parameter NameTypeDescription
profileIduint256The token ID of the profile
followModuleaddressThe profile's newly set follow module. This CAN be the zero address
followModuleReturnDataaddressThe data returned from the follow module's initialization. This is abi encoded and depends on the follow module chosen
timestampuint256The block timestamp at which follow module is set

PostCreated

event PostCreated(uint256 indexed profileId, uint256 indexed pubId, string contentURI, address collectModule, bytes collectModuleReturnData, address referenceModule, bytes referenceModuleReturnData, uint256 timestamp);

Emitted when a "post" is published by either post() or postWithSig()

Parameter NameTypeDescription
profileIduint256The token ID of the profile to which post is published
pubIduint256The ID of the new post
contentURIstringThe URI mapped to this new post
collectModuleaddressThe collect module is mapped to this new post. This CAN NOT be the zero address
collectModuleReturnDatabytesThe data returned from the collect module's initialization for this given post. This is abi encoded, and totally depends on the collect module chosen
referenceModuleaddressThe reference module set for this post
referenceModuleReturnDatabytesThe data returned from the reference module at initialization. This is abi encoded and totally depends on the reference module chosen
timestampuint256The block timestamp at which this new post is created

CommentCreated

event CommentCreated(uint256 indexed profileId, uint256 indexed pubId, string contentURI, uint256 profileIdPointed, uint256 pubIdPointed, address collectModule, bytes collectModuleReturnData, address referenceModule, bytes referenceModuleReturnData, uint256 timestamp);

Emitted when a "comment" is published by either comment() or commentWithSig()

Parameter NameTypeDescription
profileIduint256The profile token ID from which comment is published
pubIduint256The ID of the new comment
contentURIstringThe URI mapped to this new comment
profileIdPointeduint256The profile token ID that this comment points to
pubIdPointeduint256The publication ID that this comment points to
collectModuleaddressThe collect module mapped to this new comment. This CANNOT be the zero address
collectModuleReturnDatabytesThe data returned from the collect module's initialization for this given comment. This is abi encoded and totally depends on the collect module chosen
referenceModuleaddressThe reference module set for this comment
referenceModuleReturnDatabytesThe data returned from the reference module at initialization. This is abi encoded and totally depends on the reference module chosen
timestampuint256The block timestamp at which this comment is created

MirrorCreated

event MirrorCreated(uint256 indexed profileId, uint256 indexed pubId, uint256 profileIdPointed, uint256 pubIdPointed, address referenceModule, bytes referenceModuleReturnData, uint256 timestamp);

Emitted when a "mirror" is published by either mirror() or mirrorWithSig()

Parameter NameTypeDescription
profileIduint256The profile token ID from which the mirror is published
pubIduint256The ID of the new mirror
profileIdPointeduint256The profile token ID that this mirror points to
pubIdPointeduint256The publication ID that this mirror points to
referenceModuleaddressThe reference module set for this publication.
referenceModuleReturnDatabytesThe data returned from the reference module at initialization. This is abi encoded and totally depends on the reference module chosen
timestampuint256The block timestamp at which this mirror is created

FollowNFTDeployed

event FollowNFTDeployed(uint256 indexed profileId, address indexed followNFT, uint256 timestamp);

Emitted when a followNFT clone is deployed using a lazy deployment pattern i.e. in case Follow NFT contract does not already exist when either follow() or followWithSig() is called.

Parameter NameTypeDescription
profileIduint256The token ID of the profile to which this followNFT is associated
followNFTaddressThe address of the newly deployed followNFT clone
timestampuint256The current block timestamp

CollectNFTDeployed

event CollectNFTDeployed(uint256 indexed profileId, uint256 indexed pubId, address indexed collectNFT, uint256 timestamp);

Emitted when a collectNFT clone is deployed using a lazy deployment pattern i.e. in case collect NFT contract does not already exist when either collect() or collectWithSig() is called.

Parameter NameTypeDescription
profileIduint256The profile ID of publisher
pubIduint256The publication associated with the newly deployed collectNFT clone's ID
collectNFTaddressThe address of the newly deployed collectNFT clone
timestampuint256The current block timestamp

Collected

event Collected(address indexed collector, uint256 indexed profileId, uint256 indexed pubId, uint256 rootProfileId, uint256 rootPubId, uint256 timestamp);

Emitted upon a successful collect action by either collect() or collectWithSig()

Parameter NameTypeDescription
collectoraddressThe address collecting the publication
profileIduint256The token ID of the profile that the collect was initiated towards, useful to differentiate mirrors
pubIduint256The publication ID that the collect was initiated towards, useful to differentiate mirrors
rootProfileIduint256The profile token ID of the profile whose publication is being collected
rootPubIduint256The publication ID of the publication being collected
timestampuint256The current block timestamp

FollowNFTTransferred

event FollowNFTTransferred(uint256 indexed profileId, uint256 indexed followNFTId, address from, address to, uint256 timestamp);

Emitted via callback when a followNFT is transferred.

Parameter NameTypeDescription
profileIduint256The token ID of the profile associated with the followNFT being transferred
followNFTIduint256The ID of followNFT being transferred
fromaddressThe address the followNFT is being transferred from
toaddressThe address the followNFT is being transferred to
timestampuint256The current block timestamp

CollectNFTTransferred

event CollectNFTTransferred(uint256 indexed profileId, uint256 indexed pubId, uint256 indexed collectNFTId, address from, address to, uint256 timestamp);

Emitted via callback when a collectNFT is transferred.

Parameter NameTypeDescription
profileIduint256The token ID of the profile associated with the collectNFT being transferred.
pubIduint256The publication ID associated with the collectNFT being transferred
collectNFTIduint256The ID of the collectNFT being transferred
fromaddressThe address the collectNFT is being transferred from
toaddressThe address the collectNFT is being transferred to
timestampuint256The current block timestamp

Collect/Follow NFT-Specific

FollowNFTInitialized

event FollowNFTDelegatedPowerChanged(address delegate, uint256 newPower, uint256 timestamp);

Emitted when a newly deployed follow NFT is initialized.

Parameter NameTypeDescription
profileIduint256The token ID of the profile connected to this follow NFT
timestampuint256The current block timestamp

FollowNFTDelegatedPowerChanged

event FollowNFTDelegatedPowerChanged(address delegate, uint256 newPower, uint256 timestamp);

Emitted when delegation power in a FollowNFT is changed.

Parameter NameTypeDescription
delegateaddressThe delegate whose power has been changed
newPoweruint256The new governance power mapped to the delegate
timestampuint256The current block timestamp

CollectNFTInitialized

event CollectNFTInitialized(uint256 profileId, uint256 pubId, uint256 timestamp);

Emitted when a newly deployed collect NFT is initialized.

Parameter NameTypeDescription
profileIduint256The token ID of the profile connected to the publication mapped to this collect NFT
pubIduint256The publication ID connected to the publication mapped to this collect NFT
timestampuint256The current block timestamp

Module-Specific

ModuleGlobalsGovernanceSet

event ModuleGlobalsGovernanceSet(address indexed prevGovernance, address indexed newGovernance, uint256 timestamp);

Emitted when the ModuleGlobals governance address is set.

Parameter NameTypeDescription
prevGovernanceaddressThe previous governance address
newGovernanceaddressThe new governance address set
timestampuint256The current block timestamp

ModuleGlobalsTreasurySet

event ModuleGlobalsTreasurySet(address indexed prevTreasury, address indexed newTreasury, uint256 timestamp);

Emitted when the ModuleGlobals treasury address is set.

Parameter NameTypeDescription
prevTreasuryaddressThe previous treasury address
newTreasuryaddressThe new treasury address set
timestampuint256The current block timestamp

ModuleGlobalsTreasuryFeeSet

event ModuleGlobalsTreasuryFeeSet(uint16 indexed prevTreasuryFee, uint16 indexed newTreasuryFee, uint256 timestamp);

Emitted when the ModuleGlobals treasury fee is set.

Parameter NameTypeDescription
prevTreasuryFeeuint16The previous treasury fee in BPS
newTreasuryFeeuint16The new treasury fee in BPS
timestampuint256The current block timestamp

ModuleGlobalsCurrencyWhitelisted

event ModuleGlobalsCurrencyWhitelisted(address indexed currency, bool indexed prevWhitelisted, bool indexed whitelisted, uint256 timestamp);

Emitted when a currency is added to or removed from the ModuleGlobals whitelist.

Parameter NameTypeDescription
currencyaddressThe currency address
prevWhitelistedbool1 => Currency was previously whitelisted, 0 => Currency was not previously whitelisted
whitelistedbool1 => Currency whitelisted, 0 => Currency not whitelisted
timestampuint256The current block timestamp

FeeModuleBaseConstructed

event FeeModuleBaseConstructed(address indexed moduleGlobals, uint256 timestamp);

Emitted when a module inheriting from the FeeModuleBase is constructed.

Parameter NameTypeDescription
moduleGlobalsaddressThe ModuleGlobals contract address used
timestampuint256The current block timestamp

ModuleBaseConstructed

event ModuleBaseConstructed(address indexed hub, uint256 timestamp);

Emitted when a module inheriting from the ModuleBase is constructed.

Parameter NameTypeDescription
hubaddressThe LensHub contract address used
timestampuint256The current block timestamp

FollowsApproved

event FollowsApproved(address indexed owner, uint256 indexed profileId, address[] addresses, bool[] approved, uint256 timestamp);

Emitted when one or multiple addresses are approved (or disapproved) for following in the ApprovalFollowModule.

Parameter NameTypeDescription
owneraddressThe profile owner who executed the approval
profileIduint256The profile ID that the follow approvals are granted/revoked for
addressesaddress[]The addresses that have had the follow approvals granted/revoked
approvedboolWhether each corresponding address is now approved or disapproved
timestampuint256The current block timestamp

Did this page help you?