-
Notifications
You must be signed in to change notification settings - Fork 0
Entity
enoloo edited this page May 23, 2024
·
4 revisions
export interface Entity_Info {
name: string;
description?: string;
avatar?: string;
twitter?: string;
discord?: string;
homepage?: string;
}
struct Ent has copy, store, drop {
avatar: vector<u8>, // Vector containing Entity_Info data
like: u32, // Number of likes
dislike: u32, // Number of dislikes
}
Entity objects are internally created by the wowok protocol for storing and managing user and object information
struct Entity has key {
id: UID,
table: Table<address, Ent>, // Table associated with the entity
}
Like or dislike an entity address; if the initiator has not liked it in their Resource, the address is collected in the like section of the Resource, and the wowok Entity increments the like count for that address by 1; if the address already exists in the user's Resource, it is removed from the user's Resource, and the wowok Entity decrements the like count for that address by 1.
like(self: &mut Entity, resource: &mut Resource, addr: address) : u32
The mechanism is the same as above, but this is for disliking an address or object
dislike(self: &mut Entity, resource: &mut Resource, addr: address) : u32
The signer updates their own entity information
avatar_update(self:&mut Entity, avatar:vector<u8>)