> For the complete documentation index, see [llms.txt](https://docs.interestprotocol.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.interestprotocol.com/overview/deprecated/sui-tears/capabilities/quest.md).

# Quest

This module wraps an object labeled as rewards that can only be unwrapped if a set of witness objects are passed as arguments to the complete function. A witness is a struct with the drop key. The idea is to have a user complete a set of tasks for a reward in different protocols . The protocols certify that the user completed the task via their Witnesses.

## Structs

### <mark style="color:blue;">**Quest**</mark>

```rust
struct Quest<Reward: store> has key, store {
    id: UID,
    required_tasks: VecSet<TypeName>,
    completed_tasks: VecSet<TypeName>,
    reward: Reward,
 }
```

* **required\_tasks** - Stores the Witnesses of all required tasks.
* **completed\_tasks** - Contains all the Witnesses the user must complete to unwrap the {Reward}.
* **reward** - An object that will be returned once the Quest has been completed.

## Interface

### <mark style="color:blue;">new</mark>

**Creates a {Quest} .**

```rust
public fun new<Reward: store>(
  required_tasks: VecSet<TypeName>, 
  reward: Reward, 
  ctx: &mut TxContext
): Quest<Reward>
```

* **@param required\_tasks:** A vector set of the required tasks to unlock the `reward`.
* **@param reward:** An object with the store ability that can be redeemed once all tasks are completed.
* **@return** Quest\<Reward>.&#x20;

### <mark style="color:blue;">required\_tasks</mark>

**Returns the required tasks of the `self`.**

```rust
public fun required_tasks<Reward: store>(self: &Quest<Reward>): vector<TypeName>
```

* **@param self:** A {Quest}.
* **@return** vector\<TypeName>. A vector of the required Witness names to complete the quest.

### <mark style="color:blue;">completed\_tasks</mark>

**Returns the completed tasks of the `self`.**

```rust
public fun required_tasks<Reward: store>(self: &Quest<Reward>): vector<TypeName>
```

* **@param self:** A {Quest}.
* **@return** vector\<TypeName>. A vector of the completed Witness names to complete the quest.

### <mark style="color:blue;">complete</mark>

**Completes a quest by adding the witness `Task` name to the `self.completed_tasks` vector.**

```rust
public fun complete<Reward: store, Task: drop>(self: &mut Quest<Reward>, _: Task)
```

* **@param self:** A {Quest}.
* **@param:** \_ A witness `Task`.

### <mark style="color:blue;">finish</mark>

**Finishes a quest and returns the `Reward` to the caller.**

```rust
public fun complete<Reward: store, Task: drop>(self: &mut Quest<Reward>, _: Task)
```

* **@param self:** A {Quest}.
* **@return:** Reward.

**Aborts**

* If the required\_tasks do not match the completed\_tasks


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.interestprotocol.com/overview/deprecated/sui-tears/capabilities/quest.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
