singular-registry
LicenseApache-2.0
Safe HaskellNone
LanguageGHC2021

Singular.Registry.Wire.State

Description

What the cage holds: the eight-field token state with its codec and policy-byte accessors, and the cage datum — a pending request, a state, or the refund-only custody of an absent token. Reads Singular.Registry.Wire.Primitive and Singular.Registry.Wire.Request; nothing here is importable by a caller — the public surface is the Singular.Registry.Types facade.

Synopsis

On-chain token state

data OnChainTokenState Source #

On-chain token state. Matches Aiken types/State (#157 state-datum-fields: eight fields, replacing the six). consumer_pin is deleted with the pinned consumer; representative_policy is renamed active_policy; the application, absent and terminal policies are new. All four policies are set at genesis and preserved by every Modify.

Constructors

OnChainTokenState 

Fields

  • stateRoot :: !OnChainRoot

    Current Merkle root of the token's trie

  • stateMaxFee :: !Integer

    Oracle tip (lovelace) charged per request

  • stateProcessTime :: !Integer

    Oracle processing window duration (ms)

  • stateRetractTime :: !Integer

    Requester retract window duration (ms)

  • stateAppPolicy :: !BuiltinByteString

    The application policy that certifies requests (#157 tree-edge-admission-by-approval): a request whose operation changes the trie is folded only if its UTxO carries one asset under this policy whose name is the request's approval binding.

  • stateActivePolicy :: !BuiltinByteString

    The policy that mints the ACTIVE token (renamed from the representative policy). Under it the asset name is the registry key itself (#157 token-name-is-registry-key).

  • stateAbsentPolicy :: !BuiltinByteString

    The policy that mints the ABSENT token, held in the cage's own custody beside the inserter's refund address.

  • stateTerminalPolicy :: !BuiltinByteString

    The policy that mints the TERMINAL token: a name is over, forever.

Instances

Instances details
Show OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

showsPrec :: Int -> OnChainTokenState -> ShowS Source #

show :: OnChainTokenState -> String Source #

showList :: [OnChainTokenState] -> ShowS Source #

Eq OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

(==) :: OnChainTokenState -> OnChainTokenState -> Bool Source #

(/=) :: OnChainTokenState -> OnChainTokenState -> Bool Source #

FromData OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

fromBuiltinData :: BuiltinData -> Maybe OnChainTokenState

ToData OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

toBuiltinData :: OnChainTokenState -> BuiltinData

UnsafeFromData OnChainTokenState Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

unsafeFromBuiltinData :: BuiltinData -> OnChainTokenState

stateActivePolicyBytes :: OnChainTokenState -> ByteString Source #

The active-token policy as plain bytes (issue #77 E-001, renamed by #157 state-datum-fields): unwraps the BuiltinByteString for hex comparison in verifiers. Named for the field it reads — no alias of the representative policy survives.

stateAppPolicyBytes :: OnChainTokenState -> ByteString Source #

The application policy as plain bytes (#157 tree-edge-admission-by-approval).

stateAbsentPolicyBytes :: OnChainTokenState -> ByteString Source #

The absent-token policy as plain bytes (#157 mint-matches-edge-deltas).

stateTerminalPolicyBytes :: OnChainTokenState -> ByteString Source #

The terminal-token policy as plain bytes (#157 mint-matches-edge-deltas).

Cage datum

data CageDatum Source #

Cage datum: either a pending request or a token state. Matches Aiken types/CageDatum.

Constructors

RequestDatum !OnChainRequest

A pending operation request (Constr 0)

StateDatum !OnChainTokenState

Current token state (Constr 1)

AbsentCustody !ByteString

The cage's own custody of an absent token (Constr 2, #157 absent-custody-datum; appended, so 0 and 1 never move): the address the inserter named for the refund. The registry key is the sole non-ADA asset carried by the output.

Instances

Instances details
Show CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

showsPrec :: Int -> CageDatum -> ShowS Source #

show :: CageDatum -> String Source #

showList :: [CageDatum] -> ShowS Source #

Eq CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

(==) :: CageDatum -> CageDatum -> Bool Source #

(/=) :: CageDatum -> CageDatum -> Bool Source #

FromData CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

fromBuiltinData :: BuiltinData -> Maybe CageDatum

ToData CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

toBuiltinData :: CageDatum -> BuiltinData

UnsafeFromData CageDatum Source # 
Instance details

Defined in Singular.Registry.Wire.State

Methods

unsafeFromBuiltinData :: BuiltinData -> CageDatum