DoubleDown.Contract.Dispatch.Types (double_down v0.60.0)

Copy Markdown View Source

Shared type definitions for DoubleDown dispatch.

Used by HandlerMeta, CanonicalHandlerState, and other dispatch modules to avoid duplicating function type signatures.

Summary

Types

A stateful handler function — either 4-arity (own state) or 5-arity (own state + cross-contract state snapshot).

A stateless handler function: fn contract, operation, args -> result end.

Types

stateful_fun()

@type stateful_fun() ::
  (module(), atom(), [term()], term() -> {term(), term()})
  | (module(), atom(), [term()], term(), map() -> {term(), term()})

A stateful handler function — either 4-arity (own state) or 5-arity (own state + cross-contract state snapshot).

  • 4-arity: fn contract, operation, args, state -> {result, new_state} end
  • 5-arity: fn contract, operation, args, state, all_states -> {result, new_state} end

stateless_fun()

@type stateless_fun() :: (module(), atom(), [term()] -> term())

A stateless handler function: fn contract, operation, args -> result end.