Follow
"Follow" is a term used on social media platforms to describe the act that a user follows another to monitor the latter's new posts. This increases interaction between users.
The "Follow" contract we provide is used to describe a one-way action of following.
Schema
FollowRegister
The schema corresponding to the FollowRegister contract is saved to Arweave in the form of a ttl file, with the transaction hash as the schemaURI to be passed to the contract during its initialization stage. For example:
To describe the Follow contract address of a certain address, we can use the following rdf as an example:
The list of prefixes.
Class
":Soul" means the address for accepting and bounding a name. ":Contract" means the address of the "Follow" contract.
Predicate
"p:followContract" is used to describe the addresses of the "follow" contracts owned by a particular address.
Follow
The schema corresponding to the Follow contract is saved to Arweave in the form of a ttl file, with the transaction hash as the schemaURI to be passed to the contract during its initialization stage. For example:
To describe that certain address is following the owner of the current contract, we can use the following rdf as an example:
Prefix of a namespace.
Class
":Soul" means the address for accepting and bounding a name. ":Contract" means the address of the "Follow" contract.
Predicate
"p:following" is used to describe the "follow" relationship between addresses.
Contract
The contract template for the Follow contract. We use FollowRegister as the factory pattern and registration center to deploy and record a user's Follow contract.
FollowRegister
Follow
Contract implementation note
As a factory pattern, registration center and router contract, the "FollowRegister" has the following business logic:
deployFollowContract: To deploy the "Follow" contract.
ownedFollowContract: To query the "Follow" contract owned by an address.
As the contract actually records a user's "follow" relationships, "Follow" can be owned by each user. When a new fan follows a user, a token will be minted by the user's "Follow" contract and distributed to the fan.
follow: A fan will mint a token via the "Follow" contract of the person he/she follows.
unfollow: When a fan cancels the "follow" relationship and burns the token generated by that particular relationship.
Full source code:
Last updated