Invite

Defines:

public struct Invite has copy, drop, store {
        hash: vector<u8>,
        user: address
}
public struct InviteConfig has key, store {
        id: UID,
        required: bool
}
public struct UserInviteRegistry has key, store {
        id: UID,
        registry: Table<String, Invite>
}

Assert Invite Exists

The assert_invite_exists functions have these effects:

  1. Throws error (371 - EInviteDoesNotExist) if the invite does not exist in the registry

Assert Invite Not Required

The assert_invite_not_required functions have these effects:

  1. Throws error (370 - EInviteNotAllowed) if invites are required

Assert Valid Invite

The assert_invite_is_valid functions have these effects:

  1. Throws error (373 - EInviteInvalid) if the invite is not valid

Create

The create_invite function has these effects:

  1. Asserts invite with key does not exist

  2. Creates invite

  3. Adds invite to registry

Delete

The delete_invite function has these effects:

  1. Removes invite from registry

  2. Emits the "InviteDeleted" event:

    1. public struct InviteDeleted has copy, drop {
              invite_key: String
      }

Get Destructured Invite

The get_destructured_invite functions have these effects:

  1. Borrows invite from registry

  2. Returns (invite vector hash, user wallet address)

Has Record

The has_record function has these effects:

  1. Returns boolean if the String key exists in the Invites registry

Is Invite Required

The is_invite_required function has these effects:

  1. Returns boolean if invite is required or not

Is Invite Valid

The is_invite_valid function has these effects:

  1. Returns boolean if the invite is valid or not

Set Invite Config

The set_invite_config function has these effects:

  1. Sets whether invites are required or not

Last updated