Skip to main content

Contract Architecture

Abyss is built on three main contracts deployed on Starknet:

1. Abyss Game Contract

The main game logic contract handling:

Core Features

  • Session Management - Create, play, and end game sessions
  • Spin Mechanics - Request spins, process results via VRF
  • Scoring System - Calculate scores based on patterns and items
  • Leaderboard - Track and rank player scores
  • Prize Pool - Manage and distribute prize tokens

Key Functions

Storage Structure

2. CHIP Token Contract

Standard ERC20 token with additional game integrations:

Features

  • Standard ERC20 transfers
  • Minting by authorized game contract
  • Burning for certain game actions

3. Relic NFT Contract

ERC721 NFT collection with on-chain metadata:

Key Functions

Upgradeability

All contracts implement the OpenZeppelin Upgradeable pattern:
This allows the admin to upgrade contract logic while preserving state.

Security Considerations

Access Control

  • Admin-only functions protected by assert_only_owner()
  • Session ownership verified for all player actions
  • Relic ownership verified before equip

Randomness

  • All random values from Pragma VRF (see VRF documentation)
  • No on-chain pseudo-random that could be manipulated

Reentrancy

  • State changes happen before external calls
  • Token transfers use safe patterns