- Home
- Skills
- Dojoengine
- Book
- Dojo Token
dojo-token_skill
- TypeScript
51
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill dojoengine/book --skill dojo-token- SKILL.md8.0 KB
Overview
This skill implements ERC20-like fungible tokens and ERC721-like NFTs for Dojo games using the Origami library or native Dojo models. It provides minting, burning, transfers, balance tracking, and event emission patterns tailored for game currencies, resources, and unique items. Use it to add secure token mechanics and consistent token interfaces to your Dojo project.
How this skill works
The skill supplies reusable token components and example implementations showing how to model balances and ownership with Dojo storage. It demonstrates ERC20-style operations (mint, transfer, balance_of) using u256 for amounts and ERC721-style flows (mint, transfer, owner_of) with token IDs. Event structs and permission guidance are included so token actions can be indexed and secured in your game world.
When to use it
- Add game currency like gold, gems, or experience points.
- Create unique items, characters, or land as NFTs.
- Implement resource systems (wood, stone, iron) with fungible tokens.
- Build token-based game mechanics: crafting, trading, equipment.
- Integrate token indexing and client-side wallets or marketplaces.
Best practices
- Always check balances and ownership before state changes to prevent unauthorized transfers.
- Use u256 for token amounts to avoid overflow in arithmetic operations.
- Emit events for all token operations to support indexing and analytics.
- Grant explicit writer permissions to token contracts and minimize privileged roles.
- Prefer Origami components when available for standard interfaces and reuse.
Example use cases
- Award fungible gold on quest completion and deduct on purchases using ERC20-style model.
- Mint weapon NFTs with unique token IDs and attach stats (damage, rarity).
- Equip NFTs by verifying ownership and updating player equipment models.
- Track multiple resource types in a single model (wood, stone, iron) for crafting systems.
- Integrate token events with off-chain indexers to power leaderboards and marketplaces.
FAQ
No. Origami provides reusable components and standard interfaces, but the skill includes native Dojo examples showing ERC20-like and ERC721-like implementations you can adapt.
How should I handle permissions and security?
Limit writer permissions to trusted token contracts, perform ownership and balance checks before state changes, and restrict mint/burn functions to authorized roles to prevent abuse.