| License | Apache-2.0 |
|---|---|
| Safe Haskell | None |
| Language | GHC2021 |
Singular.State.Preimage
Description
Every hashed name of the Singular state is the blake2b-256 hash of a preimage,
and the preimage is the Plutus Data serialisation of a structured value with
one constructor per role. The constructors are numbered as the model's
Preimage, so two roles never share a preimage even when they carry the same
fields.
The bytes are pinned by the vectors in
test/fixtures/preimage-vectors.json, which the on-chain functions of
singular_state/preimage.ak reproduce as well. Nothing here builds a
transaction.
Synopsis
- data Preimage
- = State TxIn
- | Active RegistryIdentity ByteString
- | ApplicationConfiguration RegistryIdentity
- | RegistrationApproval RegistryIdentity ByteString Address DatumHash Lovelace
- | TerminationApproval RegistryIdentity ByteString
- encodePreimage :: Preimage -> ByteString
- roleName :: Preimage -> AssetName
- stateTokenName :: TxIn -> AssetName
- activeTokenName :: RegistryIdentity -> ByteString -> AssetName
- configurationTokenName :: RegistryIdentity -> AssetName
- registrationPreimage :: ByteString -> RegistryIdentity -> Address -> DatumHash -> Lovelace -> ByteString
- terminationPreimage :: ByteString -> RegistryIdentity -> ByteString
- approvalName :: ByteString -> AssetName
- initialDatumHash :: Data -> DatumHash
- seedData :: TxIn -> Data
The roles
The structured value hashed into a name, one constructor per role,
numbered as the model's Preimage.
Constructors
| State TxIn | The registry created by spending the seed. |
| Active RegistryIdentity ByteString | The token that stands for a key in a registry. |
| ApplicationConfiguration RegistryIdentity | The registry's application configuration. |
| RegistrationApproval RegistryIdentity ByteString Address DatumHash Lovelace | The approval of one registration: registry, key, the address the holding sits at, the hash of the holding's initial datum and the deposit it holds. |
| TerminationApproval RegistryIdentity ByteString | The approval of the termination of a key. |
Instances
| Show Preimage Source # | |
Defined in Singular.State.Preimage | |
| Eq Preimage Source # | |
Defined in Singular.State.Preimage | |
encodePreimage :: Preimage -> ByteString Source #
The Plutus Data serialisation of a preimage.
The names the line builds
stateTokenName :: TxIn -> AssetName Source #
The name of the state token of the registry created by spending the seed.
activeTokenName :: RegistryIdentity -> ByteString -> AssetName Source #
The name of the token that stands for a key in a registry.
configurationTokenName :: RegistryIdentity -> AssetName Source #
The name of the token of the configuration record of a registry.
registrationPreimage :: ByteString -> RegistryIdentity -> Address -> DatumHash -> Lovelace -> ByteString Source #
The Plutus Data serialisation of the registration approval preimage: the key, the registry, the address the holding sits at, the hash of the holding's initial datum and the deposit.
terminationPreimage :: ByteString -> RegistryIdentity -> ByteString Source #
The Plutus Data serialisation of the termination approval preimage: the registry and the key.
approvalName :: ByteString -> AssetName Source #
The name of the approval token whose preimage is the given bytes.
initialDatumHash :: Data -> DatumHash Source #
The hash a registration approval commits for the datum a holding starts with: the blake2b-256 hash of its Plutus Data serialisation.