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)
Parameter NameTypeDescription

operator

address

operator of transaction

from

address

Profile NFT old owner

to

address

Profile NFT new owner

id

uint256

Profile NFT ID

value

uint256

Profile NFT 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)
Parameter NameTypeDescription

operator

address

operator of transaction

from

address

Profile NFT old owner

to

address

Profile NFT new owner

ids

uint256[]

Profile NFT ID's list

values

uint256[]

Profile NFT ID value's list

ids is a set of serializations of addresses being followed.

Last updated