# aruku-interactive/ifm-smart-contracts architecture

> Architecture diagram of the GitHub repository aruku-interactive/ifm-smart-contracts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aruku-interactive/ifm-smart-contracts
- Repository: https://github.com/aruku-interactive/ifm-smart-contracts

## Overview

This is a Soroban smart-contract template with sample admin, player-minting, public-transfer, and user-account functionality. Its visible mint flow checks for an existing player, stores a new player, and publishes a mint event; user transfer-count helpers read and update user records. The README describes the contract as the runtime entry point, but the available excerpts do not show its dispatch wiring. Several capabilities are represented by source paths named in the index but not inspected, so their internal relationships are omitted.

Main entry points: [`src/storage/player.rs`](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/player.rs) (Player storage), [`src/storage/user.rs`](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/user.rs) (User storage), [`src/events/player.rs`](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/events/player.rs) (Player event), [`src/methods/player/mint_player.rs`](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/player/mint_player.rs) (Mint player)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Contract entry"]
  node_contract["Contract API<br/>[contract.rs]"]
end

subgraph group_methods["Contract methods"]
  node_mint["Mint player<br/>[mint_player.rs]"]
  node_admin["Set admin<br/>[set_admin.rs]"]
  node_initialize["Initialize<br/>[initialize.rs]"]
  node_transfer["Transfer<br/>[transfer.rs]"]
  node_user_ops["User records<br/>[user.rs]"]
end

subgraph group_state["State and types"]
  node_admin_store["Admin storage<br/>[admin.rs]"]
  node_player_store["Player storage<br/>[player.rs]"]
  node_user_store["User storage<br/>[user.rs]"]
  node_keys["Storage keys<br/>[storage.rs]"]
  node_player_type["Player type<br/>[player.rs]"]
  node_user_type["User type<br/>[user.rs]"]
  node_errors["Contract errors<br/>[error.rs]"]
end

subgraph group_events["Events"]
  node_admin_event["Admin event<br/>[admin.rs]"]
  node_contract_events["Contract events<br/>[contract.rs]"]
  node_player_event["Player event<br/>[player.rs]"]
end

node_caller(("Contract caller"))
node_soroban_events{{"Soroban event host"}}

node_mint -->|"checks and stores"| node_player_store
node_mint -->|"publishes mint"| node_player_event
node_player_event -->|"publishes event"| node_soroban_events
node_admin_event -->|"publishes event"| node_soroban_events
node_user_ops -->|"reads and writes"| node_user_store
node_player_store -->|"uses player key"| node_keys
node_user_store -->|"uses user key"| node_keys
node_player_store -->|"stores player"| node_player_type
node_user_store -->|"stores user"| node_user_type
node_player_event -->|"publishes player data"| node_player_type

click node_contract "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/contract.rs"
click node_mint "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/player/mint_player.rs"
click node_admin "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/admin/set_admin.rs"
click node_initialize "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/public/initialize.rs"
click node_transfer "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/public/transfer.rs"
click node_user_ops "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/user/user.rs"
click node_admin_store "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/admin.rs"
click node_player_store "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/player.rs"
click node_user_store "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/user.rs"
click node_keys "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/types/storage.rs"
click node_player_type "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/types/player.rs"
click node_user_type "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/types/user.rs"
click node_errors "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/types/error.rs"
click node_admin_event "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/events/admin.rs"
click node_contract_events "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/events/contract.rs"
click node_player_event "https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/events/player.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_contract toneBlue
class node_mint,node_admin,node_initialize,node_transfer,node_user_ops toneAmber
class node_admin_store,node_player_store,node_user_store,node_keys,node_player_type,node_user_type,node_errors toneMint
class node_admin_event,node_contract_events,node_player_event toneRose
class node_caller,node_soroban_events toneIndigo
```

## Components

### Contract entry

- [Contract API](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/contract.rs): `src/contract.rs`

### Contract methods

- [Mint player](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/player/mint_player.rs): `src/methods/player/mint_player.rs`
- [Set admin](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/admin/set_admin.rs): `src/methods/admin/set_admin.rs`
- [Initialize](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/public/initialize.rs): `src/methods/public/initialize.rs`
- [Transfer](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/public/transfer.rs): `src/methods/public/transfer.rs`
- [User records](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/methods/user/user.rs): `src/methods/user/user.rs`

### State and types

- [Admin storage](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/admin.rs): `src/storage/admin.rs`
- [Player storage](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/player.rs): `src/storage/player.rs`
- [User storage](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/user.rs): `src/storage/user.rs`
- [Storage keys](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/types/storage.rs): `src/storage/types/storage.rs`
- [Player type](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/types/player.rs): `src/storage/types/player.rs`
- [User type](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/types/user.rs): `src/storage/types/user.rs`
- [Contract errors](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/storage/types/error.rs): `src/storage/types/error.rs`

### Events

- [Admin event](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/events/admin.rs): `src/events/admin.rs`
- [Contract events](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/events/contract.rs): `src/events/contract.rs`
- [Player event](https://github.com/aruku-interactive/ifm-smart-contracts/blob/main/src/events/player.rs): `src/events/player.rs`

### Other components

- **Contract caller**
- **Soroban event host**

## Connections

- Mint player → Player storage: checks and stores (evidence: `src/methods/player/mint_player.rs`)
- Mint player → Player event: publishes mint (evidence: `src/methods/player/mint_player.rs`)
- Player event → Soroban event host: publishes event (evidence: `src/events/player.rs`)
- Admin event → Soroban event host: publishes event (evidence: `src/events/admin.rs`)
- User records → User storage: reads and writes (evidence: `src/methods/user/user.rs`)
- Player storage → Storage keys: uses player key (evidence: `src/storage/player.rs`)
- User storage → Storage keys: uses user key (evidence: `src/storage/user.rs`)
- Player storage → Player type: stores player (evidence: `src/storage/player.rs`)
- User storage → User type: stores user (evidence: `src/storage/user.rs`)
- Player event → Player type: publishes player data (evidence: `src/events/player.rs`)
