use sui::table;
Explore this module further in the Mover Registry: @sage/shared

Structs

Moderation

Table of Users authorized to take moderator actions on a forum.
public struct Moderation has store

Constants

Represents that the moderator is the owner.
const OWNER: u8 = 0;
Represents that the moderator has the lowest permissions.
const MODERATOR: u8 = 1;
Represents that a moderator was added.
const MODERATOR_ADD: u8 = 10;
Represents that a moderator was removed.
const MODERATOR_REMOVE: u8 = 11;
Error code used when a moderator tries to remove the owner.
const EIsOwner: u64 = 370;
Error code used when a non-moderator attempts a moderator action.
const EIsNotModerator: u64 = 371;
Error code used when a non-owner attempts an owner action.
const EIsNotOwner: u64 = 372;

Functions

assert_is_moderator

Aborts with EIsNotModerator if the user is not a moderator or owner.
public fun assert_is_moderator(moderation: &Moderation, user: address)

assert_is_owner

Aborts with EIsNotOwner if the user is not the owner.
public fun assert_is_owner(moderation: &Moderation, user: address)

create

Creates a new Moderation instance.
public fun create(ctx: &mut TxContext): (Moderation, u8, u8)

get_length

Get number of moderators and owners.
public fun get_length(moderation: &Moderation): u64

is_moderator

Returns true or false based on whether the address is a moderator.
public fun is_moderator(moderation: &Moderation, user: address): bool

is_owner

Returns true or false based on whether the address is the owner.
public fun is_owner(moderation: &Moderation, user: address): bool

make_moderator

Adds the address as a moderator.
public fun make_moderator(moderation: &mut Moderation, user: address): (u8, u8)

make_owner

Adds the address as the owner.
public fun make_owner(moderation: &mut Moderation, user: address): (u8, u8)

remove_moderator

Removes the address as a moderator. Aborts with EIsOwner if attempting to remove the owner.
public fun remove_moderator(moderation: &mut Moderation, user: address): (u8, u8)