Actions

Add Moderator

The add_moderator_as_owner function has these effects:

  1. Borrows the Moderators table stored on the Channel

  2. Asserts the sender is the owner of the Moderation table

  3. Asserts the payment matches the configuration

  4. Adds the provided address as a new moderator

  5. Emits the "ChannelModerationUpdate" event:

    1. public struct ChannelModerationUpdate has copy, drop {
              channel_key: String,
              message: u8,
              moderator_type: u8,
              updated_at: u64,
              user: address
      }
  6. Collects any payment

Add Moderator (Admin)

The add_moderator_as_admin function has these effects:

  1. Borrows the Moderators table stored on the Channel

  2. Adds the provided address as a new moderator

  3. Emits the "ChannelModerationUpdate" event:

    1. public struct ChannelModerationUpdate has copy, drop {
              channel_key: String,
              message: u8,
              moderator_type: u8,
              updated_at: u64,
              user: address
      }

Create

The create function has these effects:

  1. Asserts authentication

  2. Asserts the payment matches the configuration

  3. Creates Membership, Moderation, and Post tables for the Channel

  4. Creates the Channel

  5. Adds the lowercase channel key into the Channel Registry

  6. Collects any payment

  7. Emits the "ChannelCreated", "ChannelMembershipUpdate", and "ChannelModerationUpdate" events:

    1. public struct ChannelCreated has copy, drop {
              id: address,
              avatar_hash: String,
              banner_hash: String,
              channel_key: String,
              channel_name: String,
              created_at: u64,
              created_by: address,
              description: String
      }

    2. public struct ChannelMembershipUpdate has copy, drop {
              account_type: u8,
              channel_key: String,
              message: u8,
              updated_at: u64,
              user: address
      }
    3. public struct ChannelModerationUpdate has copy, drop {
              channel_key: String,
              message: u8,
              moderator_type: u8,
              updated_at: u64,
              user: address
      }
  8. Returns the Channel address

Join

The join function has these effects:

  1. Asserts authentication

  2. Asserts the payment matches the configuration

  3. Borrows the Membership table stored on the Channel

  4. Adds address as wallet member

  5. Emits the "ChannelMembershipUpdate" event:

    1. public struct ChannelMembershipUpdate has copy, drop {
              account_type: u8,
              channel_key: String,
              message: u8,
              updated_at: u64,
              user: address
      }
  6. Collects any payment

Leave

The leave function has these effects:

  1. Asserts the payment matches the configuration

  2. Borrows the Membership table stored on the Channel

  3. Removes address as a member

  4. Emits the "ChannelMembershipUpdate" event:

    1. public struct ChannelMembershipUpdate has copy, drop {
              account_type: u8,
              channel_key: String,
              message: u8,
              updated_at: u64,
              user: address
      }
  5. Collects any payment

Post

The post function has these effects:

  1. Borrows the Membership table stored on the Channel

  2. Asserts address is member of the Channel

  3. Asserts the payment matches the configuration

  4. Borrows the Posts table stored on the Channel

  5. Creates Post and stores it in the Posts table

  6. Collects any payment

  7. Emits the "ChannelPostCreated" event:

    1. public struct ChannelPostCreated has copy, drop {
              id: address,
              app: String,
              channel_key: String,
              created_at: u64,
              created_by: address,
              data: String,
              description: String,
              title: String
      }
  8. Returns the (post_address, post_timestamp)

Remove Moderator

The remove_moderator_as_owner function has these effects:

  1. Borrows the Moderators table stored on the Channel

  2. Asserts the sender is the owner of the Moderation table

  3. Asserts the payment matches the configuration

  4. Removes the provided address as a moderator

  5. Emits the "ChannelModerationUpdate" event:

    1. public struct ChannelModerationUpdate has copy, drop {
              channel_key: String,
              message: u8,
              moderator_type: u8,
              updated_at: u64,
              user: address
      }
  6. Collects any payment

Remove Moderator (Admin)

Theremove_moderator_as_admin function has these effects:

  1. Borrows the Moderators table stored on the Channel

  1. Removes the provided address as a moderator

  2. Emits the "ChannelModerationUpdate" event:

    1. public struct ChannelModerationUpdate has copy, drop {
              channel_key: String,
              message: u8,
              moderator_type: u8,
              updated_at: u64,
              user: address
      }

Update

The update_as_owner function has these effects:

  1. Borrows the Moderators table stored on the Channel

  2. Asserts the sender is a moderator of the Moderation table

  3. Asserts the payment matches the configuration

  4. Updates the Channel data

  5. Emits the "ChannelUpdated" event:

    1. public struct ChannelUpdated has copy, drop {
              avatar_hash: String,
              banner_hash: String,
              channel_key: String,
              channel_name: String,
              description: String,
              updated_at: u64
      }
  6. Collects any payment

Update (Admin)

The update_as_owner function has these effects:

  1. Borrows the Moderators table stored on the Channel

  2. Asserts the sender is a moderator of the Moderation table

  3. Asserts the payment matches the configuration

  4. Updates the Channel data

  5. Emits the "ChannelUpdated" event:

    1. public struct ChannelUpdated has copy, drop {
              avatar_hash: String,
              banner_hash: String,
              channel_key: String,
              channel_name: String,
              description: String,
              updated_at: u64
      }
  6. Collects any payment

Last updated