create_space
:- Parameters:
hub
: A mutable reference to theSpaceHub
.name
: Name of the new space.description
: Description of the space.image_url
: Direct link to the space's image.website_url
: Official website of the space.twitter_url
: Twitter handle or link associated with the space.
- Description: Initializes and creates a new space. Verifies if the sender is an authorized space creator and adjusts their allotted space creation count. Also emits a
SpaceCreated
event.
- Parameters:
Here's a markdown-style documentation for the provided Journey
and associated functions:
create_journey
:- Parameters:
hub
: A mutable reference to theSpaceHub
.coin
: A cryptocurrency coin of typeSUI
.space
: A mutable reference to the targetedSpace
.admin_cap
: A reference to theSpaceAdminCap
object (or NFT), which is acquired when a space is created, ensuring administrative rights over the space.- ... (Additional Parameters related to journey characteristics
name
,description
etc) ctx
: Likely a transaction context or related structure.
- Returns: ID of the created journey.
- Description: Initializes and creates a new journey. Validates the reward type and handles the journey creation fee. Emits a
JourneyCreated
event after the journey is successfully established.
- Parameters:
remove_journey
:- Parameters:
admin_cap
: A reference to theSpaceAdminCap
object (or NFT) which is acquired when a space is created, ensuring administrative rights over the space.space
: A mutable reference to the targetedSpace
.journey_id
: ID of the journey to be removed.
- Description: Deletes a specified journey and emits a
JourneyRemoved
event. It also ensures the cleanup of associated objects and tables linked with the journey.
- Parameters:
create_quest
:- Parameters:
admin_cap
: A reference to theSpaceAdminCap
object (or NFT) which is acquired when a space is created, ensuring administrative rights over the space.space
: A mutable reference to the targetedSpace
.- ... (Additional Parameters related to quest characteristics)
ctx
: Likely a transaction context or related structure.
- Returns: ID of the created quest.
- Description: Constructs a new quest under a specific journey. Validates space version and admin rights, then establishes the quest and emits a
QuestCreated
event.
- Parameters:
remove_quest
:- Parameters:
admin_cap
: A reference to theSpaceAdminCap
object (or NFT) which is acquired when a space is created, ensuring administrative rights over the space.space
: A mutable reference to the targetedSpace
.journey_id
: ID of the journey under which the quest resides.quest_id
: ID of the quest to be deleted.
- Description: Erases a designated quest from a particular journey and emits a
QuestRemoved
event. Also ensures the cleanup of associated objects and tables related to the quest.
- Parameters:
These functions are intended for backend verification systems. Normal users don't have access to these functionalities.
-
complete_quest
:Complete a quest for a given user once the verifier confirms its completion.
- Parameters:
_
: A capability token (VerifierCap
) to ensure the caller has verifier privileges.space
: A mutable reference to the targetedSpace
where the quest resides.journey_id
: The identifier for the specificJourney
that the quest belongs to.quest_id
: The identifier for the specificQuest
to mark as completed.user
: The address of the user completing the quest.clock
: Reference to theClock
object for time validation purposes.
- Description:
- Checks if the
space
is of a valid version usingcheck_space_version(space)
. - Ensures the current time, as per the
Clock
object, is within the start and end time of the journey. - Validates if the quest has been started by the user and hasn't already been marked as completed.
- Emits a
QuestCompleted
event with details of the space, journey, quest, and user. - Increments the total completed count for the quest.
- Marks the quest as completed for the user.
- Updates the point tables for the journey and space with points earned from the quest completion.
- Checks if the
- Parameters:
These functions enable users to interact with the system by starting quests, completing journeys, and receiving rewards upon journey completion.
-
start_quest
:Allows a user to start a quest within a specific journey of a space. Users are charged a fee for starting a quest.
- Parameters:
hub
: A mutable reference to the mainSpaceHub
.coin
: Payment by the user in the form ofCoin<SUI>
.space
: A mutable reference to the targetedSpace
where the quest resides.journey_id
: Identifier for the specificJourney
that the quest belongs to.quest_id
: Identifier for the specificQuest
to start.clock
: Reference to theClock
object for time validation.ctx
: Transaction context.
- Description:
- Validates the version of the space.
- Transfers the fee for starting the quest to the verifier.
- Ensures the current time is within the valid time frame for the journey.
- Validates that the user hasn't already started or completed the quest.
- Marks the quest as started for the user.
- Parameters:
-
complete_journey
:Allows a user to complete a journey if they have accumulated enough points and haven't previously completed it. On successful completion, users receive rewards based on the type specified for the journey.
- Parameters:
space
: A mutable reference to the targetedSpace
.journey_id
: Identifier for the specificJourney
to complete.ctx
: Transaction context.
- Description:
- Validates the version of the space.
- Validates that the user hasn't already completed the journey.
- Checks if the user has sufficient points to complete the journey.
- Emits a
JourneyCompleted
event with details of the space, journey, and user. - Increments the total completion count for the journey.
- Marks the journey as completed for the user.
- Issues a reward (either an NFT or a Soulbound reward) to the user based on the journey's reward type.
- Parameters: