Actions

Create User

The create function has these effects:

  1. Asserts the payment matches the configuration

  2. Asserts invite is not required or is included

  3. If required, verifies invite exists and is valid

  4. If included:

    1. Asserts invite exists

    2. Asserts invite is valid

    3. Determine referer's wallet address

    4. Deletes invite reference

  5. Creates Membership and Posts tables

  6. Creates a Soul

  7. Creates a User

  8. Adds the User name to the User Registry

  9. Collects any payment

  10. Emits the "UserCreated" event:

    1. public struct UserCreated has copy, drop {
              id: address,
              avatar_hash: String,
              banner_hash: String,
              created_at: u64,
              description: String,
              invited_by: Option<address>,
              owner: address,
              soul: address,
              user_key: String,
              user_name: String
      }

Create Invite

  1. Asserts authentication

  2. Asserts invites are not required

  3. Asserts the payment matches the configuration

  4. Creates an Invite

  5. Collects any payment

  6. Emits the "InviteCreated" event:

    1. public struct InviteCreated has copy, drop {
              invite_code: String,
              invite_key: String,
              user: address
      }

Create Invite (Admin)

  1. Creates an Invite

  2. Emits the "InviteCreated" event:

    1. public struct InviteCreated has copy, drop {
              invite_code: String,
              invite_key: String,
              user: address
      }

Join

The join function has these effects:

  1. Asserts authentication

  2. Asserts the payment matches the configuration

  3. Asserts User is not following themself

  4. Borrow Membership table from User

  5. Add User to the Membership table

  6. Emits the "UserMembershipUpdate" event:

    1. public struct UserMembershipUpdate has copy, drop {
              account_type: u8,
              followed_user: address,
              message: u8,
              updated_at: u64,
              user: address
      }
  7. Collect any payment

Leave

The leave function has these effects:

  1. Asserts the payment matches the configuration

  2. Borrow Membership table from User

  3. Remove User from the Membership table

  4. Emits the "UserMembershipUpdate" event:

    1. public struct UserMembershipUpdate has copy, drop {
              account_type: u8,
              followed_user: address,
              message: u8,
              updated_at: u64,
              user: address
      }
  5. Collect any payment

Post

The post function has these effects:

  1. Asserts the payment matches the configuration

  2. Borrow Posts table from User

  3. Create Post

  4. Add Post to Posts table

  5. Collect any payment

  6. Emits the "UserPostCreated" event:

    1. public struct UserPostCreated has copy, drop {
              id: address,
              app: String,
              created_at: u64,
              created_by: address,
              data: String,
              description: String,
              title: String,
              user_key: String
      }
  7. Return (post address, timestamp)

Update

The update function has these effects:

  1. Asserts the payment matches the configuration

  2. Asserts new name matches old name, and that the User belongs to the wallet address

  3. Update User data

  4. Collect any payment

  5. Emits the "UserUpdated" event:

    1. public struct UserUpdated has copy, drop {
              avatar_hash: String,
              banner_hash: String,
              description: String,
              updated_at: u64,
              user_key: String,
              user_name: String
      }

Last updated