💫Technical documentation
repository: https://github.com/zbagdzevicius/tokentails
Existing web3 implementations on the testnet:
Account wallet creation upon sign-up
NFT cat adoption - AKA NFT cat minting
Integration web3 with NFT cat to enable on-chain gaming
How NFT cat works
NFT cat can be adopted used in-game earned coins or by making a purchase via $TAILS tokens ( will be released soon ).
Upcoming web3 implementations:
existing NFT cat enchantment on Soroban - link Soroban NFT cat with a real cat in a shelter from a pool of cats in a shelter
Each link will give additional enchantment
There's no limitation on how many enchantments each NFT cat can have
Enchantments will reside on a separate Smart Contract and will be linked with NFT cat as a vector in Struct { tokenId: Vec<enchantmentId> } where enchantmentId is a Symbol and tokenId is a string
Number of enchantments will be equal to the number of cats that needs funding
Once real cat in a shelter is healed by cost coverage of enchantment - enchantment bonus stats will be increased X2
Accept payments in XLM, USDC, USDT, BNB, SKL in web version
Soroban NFT Wearables - gives permanent in-game stats
Soroban NFT Consumables - gives temporary stats and will be destroyed after usage
$TAILS token for in-game utilization
Stake to earn - stake tokens for a certain amount to win NFT mystery boxes which contains different NFT items
PvP staking - Clash of Claws - stake tokens and play against another player to win tokens
Enchantments
Donations and Real-World Impact:
Since the enchantment system ties into real-world donations for shelter cats, the better the enchantment (and the higher the donation), the more powerful the in-game effects.
Donation Reflects Enchantment Quality: The more a player donates to a shelter cat, the rarer and more powerful the enchantments their in-game NFT cat will receive. This creates a circular economy where players are incentivized to donate more, not just for in-game benefits, but for real-world impact.
Special Rewards for High Donors: Players who make large donations to shelter cats may unlock special exclusive enchantments or even a new rarity tier (e.g., Mythical Enchantments) that have extremely powerful in-game effects:
Mythical Speed Enchantment: +50% speed boost in Purrquest and Clash of Claws.
Mythical Diplomatic Enchantment: +100% rewards yield and unlocks super rare quests in Catbassadors.
Enchantment prototype Soroban pseudo-code:
Explanation of the Prototype:
Enchantment Structure:
Each Enchantment has a type (like Strength, Speed), a power level based on the donation amount, and a rarity (Common, Rare, Epic, Legendary) depending on the amount donated.
The enchantment also tracks the cost, which reflects the amount needed to heal or care for a shelter cat.
ShelterCat Structure:
This structure holds details about the shelter cat, including a unique ID and the amount of donation needed for its care.
EnchantedNFT Structure:
Each EnchantedNFT structure stores the NFT owner's address, the list of shelter cats linked to that NFT, and the list of enchantments applied to it.
Main Functions:
link_shelter_cat_with_enchantment
: Links an existing NFT to a shelter cat and applies an enchantment. It checks if the donation amount is sufficient and applies the corresponding enchantment based on that amount.add_shelter_cat
: Allows an admin to add shelter cats that can receive donations and grant enchantments to NFTs.get_enchantments
: Retrieves the list of enchantments applied to a specific NFT.get_linked_shelter_cats
: Retrieves the list of shelter cats linked to a specific NFT.
Key Mechanics:
Enchantment Quality: The donation amount determines the power and rarity of the enchantment, making higher donations more valuable.
Multiple Enchantments: A single NFT can be enchanted multiple times with different enchantments, giving it enhanced abilities.
Linking to Shelter Cats: NFTs can be linked to multiple real shelter cats, allowing players to support multiple causes and receive multiple enchantments in return.
Future Improvements:
Enchantment Stacking: Rules for how enchantments stack or interact (e.g., diminishing returns for multiple similar enchantments).
Dynamic Enchantment Effects: You can extend this system to have more complex in-game effects based on enchantment types, such as modifying stats or unlocking special abilities in gameplay.
Interfacing with Tokenomics: Integrating $TAILS token payments more deeply, perhaps requiring the token for enchantment application.
Summary of Mechanics Integration:
Purrquest: Enchantments boost stats like speed, strength, and agility, making it easier to collect coins, avoid obstacles, and defeat enemies.
Catbassadors: Enchantments increase rewards from quests, improve luck, and unlock special quests.
Cat Home: Enchantments help maintain cat statuses (energy, joy, cleanliness) and unlock special items for the home that boost daily max rewards cap
Rewards: Enchantments grant bonus coins, leaderboard points, and unlock special rewards based on the donation amount.
Real-World Donations: The higher the donation to a real shelter cat, the better the enchantments and in-game rewards.
Rewards and Leaderboards:
Rewards systems in Token Tails heavily rely on player performance in games and activities. Enchantments will directly influence a player's ability to earn rewards and rank higher on the leaderboards.
Mechanics of Enchantments in Rewards:
Coin Collection Boosts: Some enchantments (like speed, luck, or agility) will increase the number of coins collected in Purrquest. Higher enchantments will mean higher collection rates, contributing to the player’s overall coin total.
Common: +5% more coins collected.
Legendary: +25% more coins collected.
Leaderboard Ranks: Players with enchanted cats can earn bonus leaderboard points for each quest or mission completed. This could be based on the power and rarity of their enchantments.
Rare: +10 leaderboard points per enchanted quest completion.
Legendary: +50 leaderboard points per enchanted quest completion.
Example in Rewards:
A player with multiple Legendary Enchantments on their cat could collect 50% more coins in Purrquest, boosting their position on the leaderboard. Additionally, the same player could receive bonus leaderboard points for completing enchanted quests in Catbassadors.
Cat Home Integration (Tamagotchi-like Features):
In the Cat Home, players manage the day-to-day care of their cats (feeding, playing, grooming). Enchantments can have a significant impact on how efficiently players can manage their cats.
Mechanics of Enchantments in Cat Home:
Energy Enchantments: Increases the cat’s energy regeneration rate, allowing it to take part in more activities or reduce downtime between actions.
Common: 5% faster energy regeneration.
Epic: 25% faster energy regeneration, reducing the need for constant feeding.
Joy and Socialization Enchantments: These enchantments improve the joy and social levels of the cat, making it happier, more energetic, and less likely to lose lives due to poor care.
Rare: Joy level decreases 50% slower.
Legendary: Cats automatically refill joy when playing with other cats, even when you’re offline.
Care Enchantment: This enchantment boosts the overall care stats (cleanliness, joy, energy) and can unlock special furniture or items within the Cat Home.
Rare: Unlock special NFT furniture that boosts stat regeneration rates.
Epic: Cats clean themselves periodically, reducing player effort in maintaining cleanliness.
Example in Cat Home:
A player with an Epic Energy Enchantment will find that their cat’s energy refills 25% faster, allowing them to participate in more quests or games like Purrquest without needing to feed or rest their cat as often.
Catbassadors Game (Ambassadors & Quests):
In Catbassadors, cats act as representatives or ambassadors in various quests, which involve coin collection and performing tasks.
Mechanics of Enchantments in Catbassadors:
Diplomatic Enchantments: These enchantments boost the cat's success in negotiation tasks, giving players better rewards from the quests.
Common: +5% more rewards from successful missions.
Rare: +15% better rewards from completed quests.
Epic: Unlocks exclusive quests and bonuses that are not available to non-enchanted cats.
Luck Enchantments: Improves the cat’s chances of getting rare items or bonuses while completing ambassadorial quests.
Common: +10% chance to get rare items.
Legendary: +50% chance to get rare and powerful items.
Example in Catbassadors:
A player who equips their cat with a Legendary Diplomatic Enchantment can complete quests with 50% more rewards and access special "high-reward quests" exclusive to their enchanted cat.
Purrquest Integration (RPG gameplay):
In Purrquest, players control their NFT cats to collect coins, avoid obstacles, and rescue other cats. Enchantments will provide significant boosts to gameplay, directly affecting how players perform in the game.
Mechanics of Enchantments in Purrquest:
Stat Boosts:
Speed Enchantment: Increases the cat’s speed by a percentage based on the enchantment’s power and rarity. For example:
Common: +10% Speed
Rare: +25% Speed
Legendary: +50% Speed
Strength Enchantment: Boosts the cat's ability to destroy obstacles or defeat enemies. Higher levels allow the cat to break through obstacles faster or reduce the damage taken from enemies. Examples:
Common: Breaks small obstacles; takes 10% less damage.
Epic: Breaks medium obstacles; takes 25% less damage.
Legendary: Breaks large obstacles; takes 50% less damage.
Jump Enchantment: Enhances the cat’s jump height or grants a double-jump ability. Example:
Common: +1 extra jump height.
Rare: Unlocks double-jump for the cat.
Epic: 2x Jump height and distance.
Agility Enchantment: Reduces the cooldown of special abilities or lets cats move more nimbly through traps and enemies.
Common: 10% faster ability cooldowns.
Legendary: 50% faster ability cooldowns, and traps are easier to avoid.
Gameplay Example in Purrquest:
If a player equips their cat with a Legendary Speed Enchantment and a Rare Strength Enchantment, the cat will:
Move 50% faster in the game, allowing it to collect more coins and avoid obstacles more easily.
Break through medium and small obstacles without taking as much damage, reducing the number of lives lost.
This means that players with better enchantments are more efficient at collecting rewards and completing levels faster.
Stake to Craft
Explanation of the Technical Solution:
Staking Process:
Users stake $TAILS tokens by calling
stake_tokens(staker, amount, duration)
.The contract checks if the staked amount is above the minimum requirement and if the duration is valid (7, 30, or 90 days).
Once staked, the contract saves the stake details (amount, duration, start time) to persistent storage and emits a
STAKE
event.
Claiming Rewards:
After the staking period has passed, the user can call
claim_reward(staker)
to receive a random NFT.The contract verifies if the staking period has completed by comparing the current block timestamp with the staking end time.
If the stake is valid, the contract generates a random reward based on the staked amount and duration. Rewards can be Wearables, Consumables, or Enchantments.
The reward's rarity and effect are also determined based on the staked amount and time.
After the reward is claimed, the contract marks the stake as claimed and emits a
CLAIM
event.
Random Reward Generation:
The
generate_random_reward
function uses the staked amount and duration to decide the reward’s rarity.It randomly selects between Wearable, Consumable, and Enchantment as the reward type.
Each reward type has different effects, which can be expanded based on the needs of the game
4. Random Reward Generation (continued):
The effect of each reward is determined by its type:
Wearables: These items (e.g., hats, amulets, glasses) offer permanent stat boosts or cosmetic changes. For example, a Legendary Hat might grant +20% speed to the player's NFT cat.
Consumables: Items like potions or treats are one-time use and provide temporary boosts or healing. A Rare Potion might restore 50% health in a game like Purrquest, while a Common Treat might increase trust or joy for a limited time in Cat Home.
Enchantments: These grant permanent stat boosts to a specific NFT cat, such as +10% Strength or +15% Speed. Higher rarity enchantments would have stronger effects.
This random generation of rewards ensures variability, providing incentives for players to stake larger amounts for longer periods in order to receive better rewards.
5. Staking and Crafting Mechanics:
The system provides flexibility in staking amounts and durations, allowing players to engage with the feature based on their own preferences.
Shorter stakes (e.g., 7 days) offer quicker rewards, but these are more likely to be Common or Rare items.
Longer stakes (e.g., 30 or 90 days) will provide higher chances for Epic or Legendary rewards.
6. Extended Functionality:
Batch Staking: The system can be expanded to allow for batch staking, where players can stake multiple amounts of $TAILS simultaneously, each with different durations.
Upgrading Rewards: Players could also have the option to upgrade multiple Common or Rare items into higher-quality Epic or Legendary items using $TAILS tokens.
Game Integration:
Here’s how the staking and crafting system can be integrated into various parts of Token Tails' games, such as Purrquest, Cat Home, and the rewards system:
1. Purrquest (RPG Game):
In Purrquest, cats are involved in exploration, coin collection, and obstacle avoidance. Here’s how Staking Rewards (Wearables, Consumables, and Enchantments) affect gameplay:
Wearables:
Speed Boosts: If the user receives a Legendary Speed Amulet from staking, the cat will move faster, allowing it to collect more coins and avoid obstacles easily.
Armor: A Rare Defense Cape might reduce the damage taken from obstacles or traps, helping the cat last longer in the game.
Consumables:
Health Potions: A Consumable Health Potion can restore lives during gameplay, allowing the cat to survive longer in difficult stages.
Buff Potions: Temporary Buff Potions like increased jump height or attack power can help defeat enemies or avoid obstacles.
Enchantments:
Enchantments earned from staking (e.g., Strength Enchantment, Jump Enchantment) are linked permanently to a specific NFT cat, giving them an edge in gameplay by providing bonuses such as stronger attacks, faster movement, or longer jumps.
Example:
A player who stakes 5000 $TAILS for 30 days might receive ( the higher the amount, the higher the chance ) an Epic Speed Amulet (+30% Speed) and a Rare Health Potion (+50% health recovery). This allows their NFT cat to run faster in Purrquest, avoid traps, and recover health when needed.
2. Cat Home (Tamagotchi-Style Care):
In Cat Home, players take care of their NFT cats by feeding, grooming, and playing with them. Staking rewards can improve how cats are cared for:
Wearables:
Feeding and Grooming: A Wearable Collar might reduce the amount of time it takes for the player to groom their cat or improve the cat’s mood (Joy level) over time.
Consumables:
Energy Treats: These treats can instantly refill the cat’s energy, allowing it to engage in more activities or quests without having to wait for energy regeneration.
Mood Potions: Potions that instantly improve the cat’s Joy or Socialization levels, reducing the time needed to engage with the cat.
Enchantments:
Permanent enchantments can give cats higher base stats in energy regeneration or joy level, reducing the amount of effort players need to put into maintaining their virtual cat’s happiness.
Example:
A player receives a Legendary Joy Potion (consumable) from staking. This potion instantly boosts their cat’s Joy level to 100%, allowing the player to focus on other aspects of care.
3. Rewards and Leaderboards:
In the Rewards System, players earn points and rewards based on their performance in various games and activities (e.g., Purrquest, Catbassadors). The Staking to Craft system can contribute to this by offering additional leaderboard points and rare item rewards.
Wearables:
Cats equipped with Wearables can collect bonus coins in Purrquest or perform better in Catbassadors quests, contributing to higher leaderboard rankings.
Consumables:
Consumables, such as health or energy potions, allow cats to last longer in the game, providing opportunities to collect more coins or complete more difficult challenges.
Enchantments:
Enchantments earned from staking will permanently boost a cat’s stats, giving players a competitive advantage in leaderboard events, particularly when rare or legendary enchantments are applied.
Example:
A player stakes for 90 days and earns a Legendary Enchantment that boosts Strength. This gives their NFT cat an advantage in the Purrquest leaderboard by allowing them to break more obstacles and earn more coins, increasing their rank.
Summary of the Staking to Craft System:
Players stake $TAILS tokens for a fixed duration (7, 30, 90 days).
Random NFT rewards (Wearables, Consumables, Enchantments) are generated at the end of the staking period, based on the staked amount and duration.
Wearables provide permanent stat boosts, Consumables are one-time-use items, and Enchantments permanently enhance a specific NFT cat.
These rewards impact various aspects of Token Tails' gameplay, including Purrquest, Cat Home, and the Leaderboard/Rewards System.
The Staking to Craft system adds depth to the Token Tails economy by encouraging players to engage more with $TAILS tokens and providing meaningful in-game rewards that improve performance across different game modes. Let me know if you need further elaboration on any part or more functionality!
Last updated