MAP Docs
MARKET

Internals

Crate path, key types, adjacent protocols for MARKET.

MARKET (Multi-Agent Registry for Economic Trading) lives in protocols/market-lib. This page covers where to find the implementation, the key Rust types, and how it composes with adjacent protocols.

Source

PathContains
protocols/market-lib/src/lib.rsProtocolModule impl, operation dispatch
protocols/market-lib/src/protocol.rscore protocol logic
protocols/market-lib/src/types.rsrequest/response types (derive schemars::JsonSchema)
protocols/market-lib/tests/unit + integration tests
schemas/market/v1/published JSON Schemas

ProtocolModule contract

impl ProtocolModule for MarketProtocol {
    fn protocol_name(&self) -> &'static str { "MARKET" }
    fn version(&self) -> &'static str { "v1.0.0" }

    fn operations(&self) -> Vec<&'static str> {
        vec![
            "asset_genesis",
            "create_order",
            "modify_order",
            "cancel_order",
            "create_bounty",
            "query_orderbook",
            "execute_trade",
            "trade_history",
        ]
    }

    async fn invoke(&self, op: &str, payload: Value, ctx: &InvokeContext)
        -> Result<Response, ProtocolError>
    {
        match op {
            "asset_genesis" => self.asset_genesis(payload, ctx).await,
            "create_order" => self.create_order(payload, ctx).await,
            "modify_order" => self.modify_order(payload, ctx).await,
            "cancel_order" => self.cancel_order(payload, ctx).await,
            "create_bounty" => self.create_bounty(payload, ctx).await,
            "query_orderbook" => self.query_orderbook(payload, ctx).await,
            "execute_trade" => self.execute_trade(payload, ctx).await,
            "trade_history" => self.trade_history(payload, ctx).await,
            _ => Err(ProtocolError::UnknownOperation(op.into())),
        }
    }
}

Adjacent

RelationMembers
Consults
Records toMAX · MOTET · MOMENT
Subject toMAXIM · MOAT (cross-org) · MOOT (disputes)
Settled withMEAL · MANA · MADE

Status

Implemented · production-grade.

Tests

cargo test -p market-lib --all-features

See also

On this page