Expand description

Exports very commonly used items into the prelude glob

Re-exports

Macros

  • Construct an ad-hoc error from a string or existing non-anyhow error value.
  • Makes it easy to create a Response where all the values are attributes, like a HashMap.
  • Return early with an error.
  • This version only logs if the given flag is in DEBUG_LOG_FLAGS (will not log if log_print feature is disabled, in that case it’s a no-op)
  • This version will always log (except if log_print feature is not enabled, it’s a no-op)
  • Generate a PerpError and then wrap it up in an anyhow error
  • Like perp_anyhow but accepts optional extra data
  • Return early with the given perp error
  • Like perp_bail but takes extra optional data
  • Ensure a condition is true, otherwise returns from the function with an error.
  • Generate a PerpError value
  • Generate a PerpError value with additional optional data

Structs

  • A human readable address.
  • A fixed-point decimal value with 18 fractional digits, i.e. Decimal256(1_000_000_000_000_000_000) == 1.0
  • Item stores one typed item at the given key. This is an analog of Singleton. It functions the same way as Path does but doesn’t use a Vec and thus has a const fn constructor.
  • A raw address passed in via JSON.
  • Helper data type, following builder pattern, for constructing a [Response].
  • A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.

Enums

  • Check that an addr satisfies auth checks
  • Bound is used to define the two ends of a range. None means that we don’t limit that side of the range at all. Inclusive means we use the given value as a limit and include anything at that exact key. Exclusive means we use the given value as a limit and exclude anything at that exact key.
  • What was the user doing when they hit the congestion error message?
  • An error type for known market errors with potentially special error handling.
  • Was the price provided by the trader too high or too low?
  • What type of price trigger occurred?

Traits

  • Api are callbacks to system functions implemented outside of the wasm modules. Currently it just supports address conversion but we could add eg. crypto functions here.
  • Provides the context method for Result.
  • Format trait for an empty format, {}.
  • Parse a value from a string
  • Storage provides read and write access to a persistent storage. If you only want to provide read access, provide &Storage

Functions

Type Aliases

Attribute Macros