Relations Modules

How to establish the relationship index

As the on-chain storage fee is taken into consideration, the complete relationship network isn’t stored on-chain, and it needs to be figured out off-chain. Given that 5Degrees completely follows the EIP-1155 protocol, we can quickly index data through TransferSingle and TransferBatch to establish complete relationship network data.

TransferSingle()

event TransferSingle(address indexed operator, address indexed from, 
address indexed to, uint256 id, uint256 value)

While mint (the follow action), parameter from is address(0), to is follower address, id is serialization of the address being followed.

While burn (the unfollow action), parameter from is follower's address, to is address(0), id is serialization of the address being followed.

eg: value always 1

TransferBatch()

event TransferBatch(address indexed operator, address indexed from, 
address indexed to, uint256[] ids, uint256[] values)

ids is a set of serializations of addresses being followed.

Last updated