Overview
Lens Protocol is a decentralized social graph framework built on blockchain technology, designed to enable users and developers to own and control their interactions and data. It operates as an open-source foundation for building various social media applications, ensuring data portability and user sovereignty over content and connections.
Lens Protocol profiles are unique, blockchain-based identities created by users on the Lens Protocol network. These profiles represent a user's digital identity and are used to interact with various decentralized applications (dApps) built on the Lens Protocol, enabling users to control their data, content, and social connections in a secure and transparent manner.
Using QuickAlerts we will track when a Lens profile is followed or unfollwed.
Lens Profile Followed
The Lens Protocol Profiles smart contract emits the following event whenever someone follows an account on Lens Protocol:
Followed (index_topic_1 uint256 followerProfileId, uint256 idOfProfileFollowed, uint256 followTokenIdAssigned, bytes followModuleData, bytes processFollowModuleReturnData, address transactionExecutor, uint256 timestamp)
To create our expression, we will need to target three values:
- The Lens Protocol Profiles contract address - We'll use the contract address of the Lens Protocol Profiles contract deployed on the Polygon PoS Mainnet. This value gets set as the
tx_logs_address
, as we will be looking for any transactions from this address (the contract). - The event the contract emits when the action we're interested in occurs - In this case, we'll target
Followed
event. On EVM blockchains, the event is encoded and can be found intx_logs_topic0
. To get the encoded value, you will need to take the event definition (event name and parameters' types), run it through the Keccak-256 hash function, and prefix it with0x
.
Followed(uint256,uint256,uint256,bytes,bytes,address,uint256)
⬇
817d2c71a3ec35dc50f2e4b0d890943c89f2a7ab9d96eff233eda4932b506d0b
⬇
0x817d2c71a3ec35dc50f2e4b0d890943c89f2a7ab9d96eff233eda4932b506d0b
- The Lens Id to be tracked - We'll track for an event when a particular lens id is followed. Data in transaction logs are in the hexadecimal format, so we'll need to convert our Lens id to hexadecimal format using a tool similar to this. For example, the Lens id
115057
in hexadecimal format will be1C171
. This value is emitted in the data field of the transaction along with a lot of other data. So, we will use Regex Comparators to search for the id value in the data. This value gets set as thetx_logs_data
.
1tx_logs_address == '0xdb46d1dc155634fbc732f92e853b10b288ad5a1d'2&&3tx_logs_topic0 == '0x817d2c71a3ec35dc50f2e4b0d890943c89f2a7ab9d96eff233eda4932b506d0b'4&&5tx_logs_data =~ '1C171'
Lens Profile Unfollowed
The Lens Protocol Profiles smart contract emits the following event whenever someone unfollows an account on Lens Protocol:
Unfollowed (index_topic_1 uint256 unfollowerProfileId, uint256 idOfProfileUnfollowed, address transactionExecutor, uint256 timestamp)
To create our expression, we will need to target three values:
- The Lens Protocol Profiles contract address - We'll use the contract address of the Lens Protocol Profiles contract deployed on the Polygon PoS Mainnet. This value gets set as the
tx_logs_address
, as we will be looking for any transactions from this address (the contract). - The event the contract emits when the action we're interested in occurs - In this case, we'll target
Unfollowed
event. On EVM blockchains, the event is encoded and can be found intx_logs_topic0
. To get the encoded value, you will need to take the event definition (event name and parameters' types), run it through the Keccak-256 hash function, and prefix it with0x
.
Unfollowed(uint256,uint256,address,uint256)
⬇
9bbadc4d29f8416b3b1ed6fe7b42cc3588aaca742ac8c1661b3bb0a4c5ab1673
⬇
0x9bbadc4d29f8416b3b1ed6fe7b42cc3588aaca742ac8c1661b3bb0a4c5ab1673
- The Lens Id to be tracked - We'll track for an event when a particular lens id is unfollowed. Data in transaction logs are in the hexadecimal format, so we'll need to convert our Lens id to hexadecimal format using a tool similar to this. For example, the Lens id
115057
in hexadecimal format will be1C171
. This value is emitted in the data field of the transaction along with a lot of other data. So, we will use Regex Comparators to search for the id value in the data. This value gets set as thetx_logs_data
.
1tx_logs_address == '0xdb46d1dc155634fbc732f92e853b10b288ad5a1d'2&&3tx_logs_topic0 == '0x9bbadc4d29f8416b3b1ed6fe7b42cc3588aaca742ac8c1661b3bb0a4c5ab1673'4&&5tx_logs_data =~ '1C171'