Interest Protocol
  • 👋Welcome to Interest Protocol
  • Overview
    • Sui💧
      • Contracts
        • Memez
        • Libs 📚
      • Suicoins
        • Swap
        • Dollar-Cost Averaging (DCA)
        • Airdrop
          • Suiplay Airdrop
        • Incinerator
        • Send
        • Merger
        • Suicoins Terminal
      • Memez.gg
        • Coins on Memez.GG
        • Memez.Fun
          • SDK
            • Pump API
            • Interfaces
          • Configuration
          • Migrators
          • Bonding Curve
          • Fees
      • IPX Coin Standard
    • Movement
      • Interest Protocol Decentralized Exchange (DEX)
        • Key Features
        • Core Innovations
      • sr-AMM
      • Token
        • Tokenomics
        • Utility
      • GTM
    • Audits
    • Security
    • Deprecated
      • Coin X Oracle 🔮
        • Pyth Network
        • Switchboard
      • Sui Tears 💧
        • Airdrop
          • Airdrop
          • Airdrop Utils
          • Linear Vesting Airdrop
        • Capabilities
          • Access Control
          • Owner
          • Quest
          • Timelock
        • Collections
          • Bitmap
          • Coin Decimals
        • DeFi
          • Oracle
          • Farm
          • Fund
          • Linear Vesting Wallet
          • Linear Clawback Vesting Wallet
          • Vesting
        • Governance
          • DAO
          • DAO Admin
          • DAO Treasury
        • Utils
          • ASCII
          • Comparator
          • Merkle Proof
          • Vectors
        • Math
          • Fixed Point 64
          • Fixed Point Roll
          • Fixed Point Wad
          • Int
          • Math64
          • Math128
          • Math256
      • CLAMM🐚
        • Hooks
      • Whitepapers
  • Glossary
Powered by GitBook
On this page
  • Structs
  • Quest
  • Interface
  • new
  • required_tasks
  • completed_tasks
  • complete
  • finish

Was this helpful?

Export as PDF
  1. Overview
  2. Deprecated
  3. Sui Tears 💧
  4. Capabilities

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

Quest

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

new

Creates a {Quest} .

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>.

required_tasks

Returns the required tasks of the self.

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.

completed_tasks

Returns the completed tasks of the self.

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.

complete

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

public fun complete<Reward: store, Task: drop>(self: &mut Quest<Reward>, _: Task)
  • @param self: A {Quest}.

  • @param: _ A witness Task.

finish

Finishes a quest and returns the Reward to the caller.

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

PreviousOwnerNextTimelock

Last updated 1 year ago

Was this helpful?