# Quest Manager

Centralised place to track quest management and completion status. Contracts are upgradable.

Contract: [QuestManager.sol](https://github.com/mstable/mStable-contracts/blob/master/contracts%2Fgovernance%2Fstaking%2FQuestManager.sol)

### getQuest()

`function getQuest () external returns (struct Quest)`

Gets raw quest data

### hasCompleted()

`function hasCompleted (address _account, uint256 _id) public returns (bool)`

Simply checks if a given user has already completed a given quest

| Parameter  | Type    | Description                |
| ---------- | ------- | -------------------------- |
| `_account` | address | User address               |
| `_id`      | uint256 | Position of quest in array |

### balanceData()

`function balanceData () external returns (struct QuestBalance)`

Raw quest balance

### completeUserQuests()

`function completeUserQuests (address _account, uint256[] _ids, bytes _signature) external`

Called by anyone to complete one or more quests for a staker. The user must first collect a signed message from the whitelisted \_signer.

| Parameter    | Type       | Description                                                                        |
| ------------ | ---------- | ---------------------------------------------------------------------------------- |
| `_account`   | address    | Account that has completed the quest                                               |
| `_ids`       | uint256\[] | Quest IDs (its position in the array)                                              |
| `_signature` | bytes      | Signature from the verified \_questSigner, containing keccak hash of account & ids |

### checkForSeasonFinish()

`function checkForSeasonFinish (address _account) public returns (uint8 newQuestMultiplier)`

Checks if the season has just finished between now and the users last action. If it has, we reset the seasonMultiplier. Either way, we update the lastAction for the user. NOTE - it is important that this is called as a hook before each state change operation

| Parameter  | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| `_account` | address | Address of user that should be updated |


---

# Agent Instructions: 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:

```
GET https://developers.mstable.org/contracts/governance/quest-manager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
