Daml.Finance.Interface.Instrument.Base.Instrument

Interfaces

interface Instrument

Base interface for all instruments. This interface does not define any lifecycling logic.

viewtype V

  • Choice Archive

    Controller: Signatories of implementing template

    Returns: ()

    (no fields)

  • Choice GetView

    Retrieves the interface view.

    Controller: viewer

    Returns: V

    Field Type Description
    viewer Party The party retrieving the view.
  • Method getKey : InstrumentKey

    Get the unique key for the Instrument.

Data Types

type I

= Instrument

Type synonym for Instrument.

instance HasExerciseByKey Reference InstrumentKey GetCid (ContractId I)

type Q

= Quantity InstrumentKey Decimal

Instrument quantity.

type R

= Reference

Type synonym for Reference. This type is currently used as a work-around given the lack of interface keys.

instance HasExerciseByKey Reference InstrumentKey SetCid (ContractId R)

instance HasExerciseByKey Reference InstrumentKey SetObservers (ContractId R)

type V

= View

Type synonym for View.

instance HasFromAnyView Instrument V

data View

View for Instrument.

View

Field Type Description
issuer Party The instrument’s issuer.
depository Party The instrument’s depository.
id Id The instrument’s identifier.
version Text A textual instrument version.
description Text A human readable description of the instrument.
validAsOf Time Timestamp as of which the instrument is valid. This usually coincides with the timestamp of the event that creates the instrument. It usually does not coincide with ledger time. This is required for lifecycling of some instruments, in order to keep track of the last time the instrument was lifecycled. For instruments where this is not applicable, it can be set to the current time.

instance Eq View

instance Show View

Functions

getKey
: Instrument -> InstrumentKey
exerciseInterfaceByKey

: (HasInterfaceTypeRep i, HasExercise i d r) => InstrumentKey -> Party -> d -> Update r

Exercise interface by key. This method can be used to exercise a choice on an Instrument given its InstrumentKey. Requires as input the InstrumentKey, the actor fetching the instrument and the choice arguments. For example:

toKey

: V -> InstrumentKey

Convert the instrument’s View to its key.

fetchInstrument

: HasToInterface t I => t -> Update I

Fetch instrument from holding.

qty

: Decimal -> InstrumentKey -> Q

Wraps an amount and an instrument key into an instrument quantity.

scale

: Decimal -> Q -> Q

Scale Quantity by the provided factor.