Skip to content

brainy-bots/frontier-market

Repository files navigation

Frontier Market

A vending machine for EVE Frontier smart storage units, powered by ef_guard access control.

What it does

Frontier Market turns any Smart Storage Unit into a player-operated shop:

  • Owner stocks items and sets prices per item type
  • Customers buy items by paying with a configured currency (e.g. Transaction Chips)
  • Access control is delegated to ef_guard — only players who pass the policy can buy
  • Revenue (payments) stays in the SSU for the owner to withdraw

How it uses ef_guard

Frontier Market demonstrates ef_guard as middleware. The market contract doesn't implement its own access control — it calls ef_guard::assembly_binding::resolve_role() before allowing a purchase:

Player wants to buy
  → Frontier Market calls ef_guard::resolve_role(binding, ssu_id, char_game_id, tribe_id)
  → ef_guard evaluates rules: tribe membership, character ID, blocklist
  → Allow → proceed with purchase
  → Deny  → abort transaction

This separation means:

  • The market focuses on trade logic (prices, inventory, payments)
  • ef_guard handles who can trade (tribes, characters, blocklist)
  • The owner configures both independently

Architecture

┌─────────────────────────────────────────┐
│           Frontier Market               │
│  ┌───────────┐  ┌────────────────────┐  │
│  │ MarketConfig │  │ Prices (dynamic │  │
│  │ - ssu_id     │  │ fields per      │  │
│  │ - binding_id │  │ item type)      │  │
│  │ - currency   │  │                 │  │
│  └───────────┘  └────────────────────┘  │
│         │                               │
│         ▼                               │
│  ┌─────────────────┐                    │
│  │ buy() / stock() │                    │
│  └────────┬────────┘                    │
│           │                             │
└───────────┼─────────────────────────────┘
            │ resolve_role()
            ▼
┌─────────────────────────────────────────┐
│           ef_guard                      │
│  AssemblyBinding → Policy → Rules       │
│  Blocklist check → first-match-wins     │
└─────────────────────────────────────────┘
            │
            ▼
┌─────────────────────────────────────────┐
│       EVE Frontier World Contracts      │
│  StorageUnit.deposit_item<Auth>()       │
│  StorageUnit.withdraw_item<Auth>()      │
└─────────────────────────────────────────┘

Project structure

Based on the EVE Frontier builder-scaffold.

Area Purpose
move-contracts/frontier_market/ Sui Move contract: market logic, prices, ef_guard integration
dapps/ DApp for customers to browse and buy items (TODO)
ts-scripts/ TypeScript scripts for deployment and interaction
docker/ Dev container for local Sui node

Prerequisites

  • Sui CLI (via suiup)
  • Node.js 22+ and pnpm
  • ef_guard cloned as a sibling directory

Quick start

Build & test

cd move-contracts/frontier_market
sui move build
sui move test

Deploy

# After deploying ef_guard and world-contracts:
cd move-contracts/frontier_market
sui client publish

Move API

market::create_market(ssu, owner_cap, binding_id, currency_type_id, ctx)

Creates a market on an SSU. Returns (MarketConfig, MarketAdminCap). Share the config, keep the cap.

market::set_price(config, cap, item_type_id, amount)

Set or update the price for an item type. amount is in units of the currency per item.

market::remove_price(config, cap, item_type_id)

Remove the price — item becomes unbuyable.

market::buy(config, binding, ssu, character, payment, item_type_id, quantity, ctx)

Customer buys items. Checks ef_guard access, validates payment, deposits payment, withdraws items.

market::stock(config, cap, ssu, character, item, ctx)

Admin deposits items into the market SSU.

market::withdraw_revenue(config, cap, ssu, character, type_id, quantity, ctx)

Admin withdraws collected payments from the SSU.

Test coverage

Test What it verifies
set_and_get_price Price CRUD: set, read, update, remove
multiple_prices_independent Multiple item types with independent prices
set_price_with_wrong_cap_aborts Admin auth: wrong MarketAdminCap rejected
get_price_without_setting_aborts Error: reading unset price aborts
config_accessors_return_correct_values Config fields match constructor args
ef_guard_resolve_role_allows_tribe_member ef_guard allows tribe member, denies others
ef_guard_blocklist_overrides_tribe_allow ef_guard blocklist overrides tribe allow rule
remove_price_on_nonexistent_is_noop Removing unset price doesn't abort

EVE Frontier Hackathon 2026

Built for the EVE Frontier x Sui Hackathon 2026 — "A Toolkit for Civilization."

Demonstrates ef_guard as reusable access control middleware for any EVE Frontier smart assembly extension.

License

MIT

About

A vending machine for EVE Frontier smart storage units, powered by ef_guard access control

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors