👍Likes
Like and Unlike posts
The Likes contract is a Solidity smart contract that provides a system for tracking likes on a certain message. The contract has functions to add and remove likes, get a list of users that liked a message, get a list of messages liked by a user, and more. It maintains mappings for easier access of like information based on message ID or user addresses.
Table of Contents
Events
logAddLike
Event that gets emitted when a like is added to a message.
Example with ethers.js
logRemoveLike
Event that gets emitted when a like is removed from a message.
Example with ethers.js
Public Functions
getLikesFromMsgID
This function returns a list of users that liked a specific message.
Parameters
msgID
uint256
The ID of the message.
startFrom
uint256
The number from where to start getting records.
Returns
address[]
An array of addresses of users and groups that liked a message.
Example with ethers.js
getLikesByAddress
This function returns a list of messages liked by a specific user.
Parameters
liker
address
The address of the user.
startFrom
uint256
The number from where to start getting records.
Returns
uint256[]
An array of message IDs that were liked by the user.
Example with ethers.js
Last updated