Skip to content
enoloo edited this page May 21, 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, // Entity_Info 信息 like: u32, // 赞数 unlike: u32, // 踩数 }

// Entity对象由wowok协议内部创建,用于存储和管理用户和对象信息 struct Entity has key { id: UID, table: Table<address, Ent>, // 实体地址列表及其信息 }

// 点赞/取消点赞 一个实体地址;如果发起者Resource中没有赞过,则Resource中收集该地址到like,并且wowok Entity为该地址的赞数量+1;如果用户Resource中已存在该地址,则从用户Resource中删除该地址,并且wowok Entity为该地址的赞数量-1 like(self:&mut Entity, resource: &mut Resource, addr: address) : u32 // 和上面机制一样 ,这里是踩一个地址或对象 unlike(self:&mut Entity, resource: &mut Resource, addr: address) : u32 // 签名者更新自己的实体信息 avatar_update(self:&mut Entity, avatar:vector)

Clone this wiki locally