Skip to content

Inventory and item NFTs - #72

Merged
cdsaidev merged 56 commits into
mainfrom
feat/inventory-item-nfts
Aug 9, 2026
Merged

Inventory and item NFTs#72
cdsaidev merged 56 commits into
mainfrom
feat/inventory-item-nfts

Conversation

@heyradcode

Copy link
Copy Markdown
Collaborator

Description

Implements roadmap §4: items as ERC-1155 NFTs, an inventory, equipment that
changes how a fight resolves, and battle-reward drops. EVM only; Solana is
deferred per §4's own EVM-first recommendation.

56 commits, 188 files, +16,401 / -293.

Read this part first: merging schedules a re-consent event

ENGINE_VERSION goes 1 to 2, and Ruleset gains the combat-affecting item
catalog. Both feed rulesetHash, so the hash changes for every battle, not
only geared ones. Every outstanding DefenseAuthorization is invalidated and
every defender has to re-consent.

That is the designed cost of a rules change and protocol/src/consent/types.ts
documents it as such, but it is user-visible and should ship deliberately rather
than land unnoticed.

Both schema versions are append-only, as AGENTS.md requires. snapshot and
ruleset go to 2, version 1 stays in SUPPORTED_VERSIONS permanently, and an
absent version still means 1. The first draft defaulted to "current" and 35
receipt vectors caught it immediately.

How it fits together

Layer What landed
contracts/ethereum ItemCore.sol, an ERC-1155 where the token id is the item type. PetCore refuses to transfer a geared pet.
Subgraph ItemBalance and PetEquipment entities with their own start block.
services/indexer-go Item and equipment ingest on watermarks separate from the roster's, plus the Go equipment modifiers.
backend Four tables, the catalog and its seeder, reads, writes, and drops paid from the battle's own drand seed.
protocol / verifier Snapshot v2, ruleset v2, equipment in the engine, and a verifier check that gear was priced from the published catalog.
shared / frontend Inventory hooks, the bag, the equip panel, and gear shown on pet art.
services/image-generator Item art and ERC-1155 metadata, generated once per type and cached.

Testing

Package Result
backend 914 passed
protocol 595 passed
shared 517 passed
frontend 420 passed
image-generator 323 passed
contracts/ethereum 143 passing
verifier 86 passed
indexer-go go test ./... clean

contracts/test-vectors/battle.json and xp.json are unchanged and still pass:
with no equipment the deltas are zero and the engine stays bit-identical, which
is the compatibility proof. Equipment cases live in a new equipment.json, read
by both live ports. Its first case reproduces a battle.json row exactly, which
proves an ungeared fight costs nothing rather than merely claiming so.

Already live on Base Sepolia

  • ItemCore proxy 0xA6F2f05C2721937D0379482CFC39b7aBd641cD30, verified
  • PetCore upgraded to implementation 0x98a6d7a6f020a93e8ec6baada869ad879ec32364, verified, with the transfer guard enabled and proven on chain (ungeared transfer allowed, geared reverts with Unequip items before transferring, allowed again after stripping)
  • All 8 equipment slots registered; a dedicated item wallet authorized and funded
  • Subgraph 0.3.0 deployed and syncing, EVM_SUBGRAPH_URL bumped
  • Prisma migration applied, catalog seeded, scripts/verify-inventory-setup.ts passes 13/13

State survived the PetCore upgrade intact: 12 pets with names, levels and
owners preserved. itemCore lands on slot 410, previously __gap[0], read as
zero on the live proxy before the upgrade.

@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
do-not-stop-frontend Ready Ready Preview Aug 9, 2026 12:57pm
do-not-stop-website Ready Ready Preview Aug 9, 2026 12:57pm

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

🧪 Coverage

Package Statements Branches Functions Lines Overall
backend 84.82% (2438/2874) 78.51% (1246/1587) 82.62% (466/564) 85.38% (2313/2709) 83.57% (6463/7734)
frontend 71.20% (1761/2473) 72.45% (1510/2084) 69.54% (459/660) 71.94% (1585/2203) 71.63% (5315/7420)
shared 58.97% (1564/2652) 59.31% (977/1647) 58.88% (328/557) 60.82% (1436/2361) 59.65% (4305/7217)

@cdsaidev cdsaidev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! 👍

@cdsaidev
cdsaidev merged commit 9db4a61 into main Aug 9, 2026
11 checks passed
@cdsaidev
cdsaidev deleted the feat/inventory-item-nfts branch August 9, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants