Quest Core

The QuestRewarder contract mints reward items for QuestCoreV3, and should not be directly interacted with. It emits the RewardMinted event log as part of Quest Completion transactions.

Contracts

Addresses

DFK Chain

NameMainnetTestnet

QuestCoreV3

0x530fff22987E137e7C8D2aDcC4c15eb45b4FA752

0x08BDdaB7d681c6406fE61d261c26Da80678874f6

QuestRewarder

0x08D93Db24B783F8eBb68D7604bF358F5027330A6

0xE79C79564A74DC75b9B0476a8500773f83e73590

Quest Fund

0x1137643FE14b032966a59Acd68EBf3c1271Df316

0x36a0f2Bf04BCDBd38b2d97CA785B266dd39BF21c

Klaytn

NameMainnetTestnet

QuestCoreV3

0x1Ac6Cd893EDdb6Cac15E5A9FC549335b8b449015

0x00746dF5d408ff9c0021867Eb0776Bc60A1C043A

QuestRewarder

0x3fAB563BD19CaFbf8717Cd99a605b3661Cf3391f

0x931aB25e12dF3bd881985ACFa1b25d7424357757

Quest Fund

0x24D557a1C580ec8B78E6e0de910df5E0CE090049

0x298Ae561513ee00eA120c596919d4187CA1557dD

Interfaces

interface IQuestCoreV3 {

    // Events
    event PetBonusReceived(uint256 indexed questId, address indexed player, uint256 heroId, uint256 petId);
    event QuestCanceled(uint256 indexed questId, address indexed player, uint256 indexed heroId, tuple(uint256 id, uint256 questInstanceId, uint8 level, uint256[] heroes, address player, uint256 startBlock, uint256 startAtTime, uint256 completeAtTime, uint8 attempts, uint8 status, uint8 questType) quest);
    event QuestCompleted(uint256 indexed questId, address indexed player, uint256 indexed heroId, tuple(uint256 id, uint256 questInstanceId, uint8 level, uint256[] heroes, address player, uint256 startBlock, uint256 startAtTime, uint256 completeAtTime, uint8 attempts, uint8 status, uint8 questType) quest);
    event QuestSkillUp(uint256 indexed questId, address indexed player, uint256 heroId, uint8 profession, uint16 skillUp);
    event QuestStaminaSpent(uint256 indexed questId, address indexed player, uint256 heroId, uint256 staminaFullAt, uint256 staminaSpent);
    event QuestStarted(uint256 indexed questId, address indexed player, uint256 indexed heroId, tuple(uint256 id, uint256 questInstanceId, uint8 level, uint256[] heroes, address player, uint256 startBlock, uint256 startAtTime, uint256 completeAtTime, uint8 attempts, uint8 status, uint8 questType) quest, uint256 startAtTime, uint256 completeAtTime);
    event QuestXP(uint256 indexed questId, address indexed player, uint256 heroId, uint64 xpEarned);
    event RewardMinted(uint256 indexed questId, address indexed player, uint256 heroId, address indexed reward, uint256 amount, uint256 data);
    event TokenBonusAwarded(uint256 indexed questId, address indexed player, uint256 heroId, uint256 amount);
    event TrainingAttemptDone(bool success, uint256 attempt, uint256 indexed heroId);
    event TrainingSuccessRatio(uint256 winCount, uint256 attempts, uint256 indexed heroId);

    // Transactions
    function clearActiveQuests(uint256 _questInstanceId);
    function clearActiveQuestsAndHeroes();
    function clearActiveQuestsAndHeroesWithOffset(uint256 _offset, uint256 _amount);
    function clearActiveQuestsByType(uint256 _questInstanceId, uint8 _level, uint8 _type);   
    function cancelQuest(uint256 _heroId);
    function completeQuest(uint256 _heroId);
    function multiCompleteQuest(uint256[] _heroIds);
    function multiStartQuest(uint256[][] _heroIds, uint256[] _questInstanceId, uint8[] _attempts, uint8[] _level, uint8[] _type);
    function startQuest(uint256[] _heroIds, uint256 _questInstanceId, uint8 _attempts, uint8 _level, uint8 _type);
            
    // View Methods
    function getAccountActiveQuests(address _account) view returns (tuple(uint256 id, uint256 questInstanceId, uint8 level, uint256[] heroes, address player, uint256 startBlock, uint256 startAtTime, uint256 completeAtTime, uint8 attempts, uint8 status, uint8 questType)[]);
    function getCurrentStamina(uint256 _heroId) view returns (uint256);
    function getCurrentStaminaForMultiple(uint256[] _heroIds) view returns (uint256[]);
    function getHeroQuest(uint256 heroId) view returns (tuple(uint256 id, uint256 questInstanceId, uint8 level, uint256[] heroes, address player, uint256 startBlock, uint256 startAtTime, uint256 completeAtTime, uint8 attempts, uint8 status, uint8 questType));
    function getQuestInstanceIds() view returns (uint256[]);
    function heroToQuest(uint256 _heroId) view returns (uint256);
    function questCounter() view returns (uint256);
    function quests(uint256 _id) view returns (tuple(uint256 id, uint256 questInstanceId, uint8 level, uint256[] heroes, address player, uint256 startBlock, uint256 startAtTime, uint256 completeAtTime, uint8 attempts, uint8 status, uint8 questType));

}

ABIs

Types

Quest

The primary struct for a Quest that has been created on the contract.

struct Quest {
    uint256 id;
    uint256 questInstanceId;
    uint8 level;
    uint256[] heroes;
    address player;
    uint256 startBlock;
    uint256 startAtTime;
    uint256 completeAtTime;
    uint8 attempts;
    QuestStatus status;
    uint8 questType;
}
NameTypeDescription

id

uint256

The unique id of the Quest on the contract

questInstanceId

uint256

A unique mapping indicating which category of Quest the Heroes are on (e.g. Fishing, Mining, Training). See Quest Instance.

level

uint8

The skill level of the Quest. Current values include: - Fishing, Foraging, Gardening: 0 or 10 - Token Mining, Gold Mining: 0 - Training Quests: 1

heroes

uint256[]

An array of the questing Hero ids

player

address

The 0x address of the wallet creating the Quest

startBlock

uint256

The block height at which the Quest was started

startAtTime

uint256

The UNIX timestamp at which the Quest was started

completeAtTime

uint256

The UNIX timestamp at which the Quest was/will be completed

attempts

uint8

The number of Quest attempts that the Heroes will perform

status

The current status of the Quest on the contract

questType

uint8

A unique mapping for Quests that have additional varieties, currently including Gardening and Training Quests. See Quest Type.

Quest Status

Indicates the current status of the Quest on the contract.

enum QuestStatus {
    NONE,
    STARTED,
    COMPLETED,
    CANCELED
}

Mappings

Quest Instance

Quests in QuestCore V3 are routed to the correct diamond facets by using Instance IDs that are unique to each Quest category. These IDs are also stored in each Hero's currentQuest state, padded as an 0x address (e.g. 0x0000000000000000000000000000000000000001).

{
  1: "Fishing",
  2: "Foraging",
  3: "Gold Mining",
  4: "Token Mining",
  5: "Gardening",
  6: "Training"
}

Quest Type

For Quests that have additional varieties, the type input determines which Quest the Hero is ultimately is sent to. Currently Gardening and Training Quests use these mappings.

Gardening Quests

The Quest type for Gardening Quests matches the poolId of the Garden, as defined here.

Training Quests

The Quest type for Training Quests uses the following mapping, matching the stat order used on the HeroCore contract, which is not the same order as the mapping used for stat growth and in the MeditationCircle and similar contracts.

{
  0: "Strength",
  1: "Intelligence",
  2: "Wisdom",
  3: "Luck",
  4: "Agility",
  5: "Vitality",
  6: "Endurance",
  7: "Dexterity"
}

Last updated