feat: Implement TicketNFT contract and stabilize workspace structure #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
Description
This PR implements the
TicketNFT
contract as part of the Tokenbound Accounts (TBA) demonstration. The contract manages the lifecycle of event tickets as unique NFTs, enforcing a strict "one ticket per user" policy to ensure fairness and prevent bulk buying.
Additionally, this PR fixes workspace-wide compilation issues by properly initializing the
Cargo.toml
files for all associated contracts in the soroban-contract directory.
Key Features
Core NFT Logic:
mint_ticket_nft
: Mints tickets with auto-incrementing IDs.
owner_of
: Reliable ownership tracking.
balance_of
: Tracks ownership counts (guaranteed to be 0 or 1 per address).
transfer_from
: Enables ticket trading while strictly maintaining the one-per-user constraint for the recipient.
Security & Constraints:
One-per-user rule: Enforced during both initial minting and secondary transfers.
Role-based Authentication: Only the designated Minter (Event Manager) can create new tickets.
Comprehensive Testing:
Verified minting flow and ID generation.
Validated failure modes for double-minting and unauthorized access.
Confirmed transfer logic and balance synchronization.
Workspace Infrastructure:
Resolved build errors by configuring
Cargo.toml
for tba_account, tba_registry, ticket_factory, and event_manager.
Why This Matters
These NFTs are the "anchors" for the TBA system. Each ticket NFT will own a Tokenbound Account, allowing for decentralized refund mechanisms and ownership-linked assets that move seamlessly with the ticket during a sale.
Closes #3