conformance
Safe HaskellNone
LanguageGHC2021

Conformance.Observe.Payments

Description

The payments an accepted exit made, read off its transaction.

The chain settles a fold per payee. A fold that delivers a token pays the deposit with it: the output carrying the token holds at least the deposit. A fold that delivers nothing, and a reject, pay the request's owner: the owner is credited the summed lovelace of every output at the owner's payment key that carries no token the fold delivers. An absent insertion locks the deposit in the custody output it creates. A spent custody's refund address is credited the summed lovelace of every output at that address carrying no delivered token. A retraction returns what the request held through one output at the owner's key whose inline datum is the retracted request's own output reference: the largest such output is what the chain reads, never a sum of fragments. Every amount is read as the chain paid it, never selected by the amount the model expects, so a short or surplus payment reaches the comparison. This module reads those payments in the chain's own terms — addresses, keys and lovelace — and leaves their translation to model identities to the live runner, which allocated them.

Synopsis

Documentation

data FoldOutput Source #

One output of the fold's transaction, reduced to what settlement reads.

Constructors

FoldOutput 

Fields

  • outputAddress :: ByteString

    the serialised address

  • outputKey :: ByteString

    the payment key hash; empty for a script credential

  • outputLovelace :: Integer
     
  • outputCarrier :: Bool

    holds a token this fold delivers

  • outputDatum :: Text

    the datum form the output presents: none, hashed or inline

  • outputApprovals :: [Text]

    the hex names of the application-policy assets it holds

  • outputCustody :: Bool

    holds an absent custody datum at the cage

  • outputReference :: Maybe Text

    the output reference its inline datum presents, if it presents one

Instances

Instances details
Show FoldOutput Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

show :: FoldOutput -> String Source #

showList :: [FoldOutput] -> ShowS Source #

Eq FoldOutput Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

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

data ExitFacts Source #

What the chain records about the exit beside its outputs.

Constructors

ExitFacts 

Fields

Instances

Instances details
Show ExitFacts Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

show :: ExitFacts -> String Source #

showList :: [ExitFacts] -> ShowS Source #

Eq ExitFacts Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

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

data Payee Source #

Who a payment reached, in the chain's terms.

Constructors

Custody

the cage's custody

Destination ByteString

the address holding the delivered token

Owner ByteString

the request owner's payment key

Refund ByteString

the refund address a spent custody recorded

Instances

Instances details
Show Payee Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

show :: Payee -> String Source #

showList :: [Payee] -> ShowS Source #

Eq Payee Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

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

data Payment Source #

A payment the fold made: its payee and the lovelace that reached it.

Constructors

Payment 

Fields

Instances

Instances details
Show Payment Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

show :: Payment -> String Source #

showList :: [Payment] -> ShowS Source #

Eq Payment Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

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

foldPayments :: ExitFacts -> [FoldOutput] -> Either String [Payment] Source #

The payments of one accepted fold, in the order the model states them: what the fold owes for its request, then the custody refund it pays.

What is owed is reported as the chain paid it, however much that is, so a short payment reaches the comparison as a value below the model's floor. What cannot be read as a payment at all — a delivered token no single output carries, a custody lock that is not there, a spent custody whose source was not observed — is refused rather than reported.

creditsOwner :: ByteString -> FoldOutput -> Bool Source #

Whether the chain credits an output to an owner's key: it sits at that payment key and carries no token the fold delivers.

data OwnerReading Source #

The owner output as the ledger outputs crediting the owner present it.

Constructors

OwnerReading 

Fields

Instances

Instances details
Show OwnerReading Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

show :: OwnerReading -> String Source #

showList :: [OwnerReading] -> ShowS Source #

Eq OwnerReading Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

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

readOwner :: ByteString -> [FoldOutput] -> Either String (Maybe OwnerReading) Source #

Read the owner output off the outputs crediting the owner's key, or nothing when no output credits it. Outputs presenting different datum forms cannot be read as one owner output, and are refused.

readBound :: ByteString -> Text -> [FoldOutput] -> Either String (Maybe OwnerReading) Source #

Read a retraction's return off the outputs crediting the owner's key and bound to the output reference the request sat at, or nothing when no output is bound to it. The chain settles a retraction by one sufficient bound output, so the return is read as the largest of them, never a sum; whether it is enough is the judgement's, not the reader's.

ownerOutputObservation :: Integer -> (Text -> Either String Integer) -> [Value] -> Integer -> Maybe Integer -> OwnerReading -> Either String Value Source #

The observed owner output, in the model's vocabulary: the owner's identity, the lovelace and datum form read, the registry tokens and state tokens it holds, the approval it returns, named by approvalOf — the run's own binding of each booked approval to its model name, which refuses a name no booking established. Whichever approval the ledger returns is the one reported, so another request's approval differs from the model's commitment. The output reference its datum presents, if any, arrives as its identity.

data OwedPayee Source #

Whom an exit owes its request's payment, and so which outputs pay it.

owedPayee :: ExitFacts -> OwedPayee Source #

Whom this exit owes its request's payment: the model's rule, by edge for a fold; a reject owes the owner, a retraction the owner through a bound output.

owedOutputs :: ExitFacts -> [FoldOutput] -> [Int] Source #

The positions of the outputs through which the chain settles what an exit owes for its request: the custody output an absent insertion locks, the outputs carrying a token the fold delivers, for a fold delivering nothing and a reject every output crediting the owner's key, and for a retraction every output crediting it bound to the retracted request.

data OutputEdit Source #

A change to one output of the fold's transaction, by position.

Constructors

Readdress Int

send the output to another address, value unchanged

Relovelace Int Integer

give the output this lovelace

Rebind Int

bind the output to another output reference

SpendState

spend the registry's state beside the request

Instances

Instances details
Show OutputEdit Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

show :: OutputEdit -> String Source #

showList :: [OutputEdit] -> ShowS Source #

Eq OutputEdit Source # 
Instance details

Defined in Conformance.Observe.Payments

Methods

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

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

tamperEdits :: Tamper -> ExitFacts -> [FoldOutput] -> Either String [OutputEdit] Source #

The edits a tamper makes to the payment an exit owes, read off the exit's own outputs. OtherAddress sends every output paying it elsewhere. ShortByOne leaves the payee credited one lovelace less than the first output paying it holds: that output loses one lovelace, every other output paying it goes elsewhere, and the lovelace taken goes to the transaction's last output, its change. OtherReference binds every output returning a retracted request to another output reference, and StateSpent spends the registry's state beside the retraction; neither applies to another exit. ExtraSigner changes no output.