Daml.Finance.Interface.Util.Lockable

Interfaces

interface Lockable

An interface for managing locking of contracts. Locking is a mechanism to temporarily encumber contracts by adding third-party lockers as additional signatories.

viewtype V

  • Choice Acquire

    Lock a contract.

    Controller: (DA.Internal.Record.getField @"controllers" (view this)), newLockers

    Returns: ContractId Lockable

    Field Type Description
    newLockers Parties Parties which restrain the contract’s ability to perform specified actions.
    context Text Reason for acquiring a lock.
    lockType LockType Type of lock to acquire.
  • 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.
  • Choice Release

    Unlock a locked contract.

    Controller: getLockers this

    Returns: ContractId Lockable

    Field Type Description
    context Text  
  • Method acquire : Acquire -> Update (ContractId Lockable)

    Implementation of the Acquire choice.

  • Method release : Release -> Update (ContractId Lockable)

    Implementation of the Release choice.

Data Types

type I

= Lockable

Type synonym for Lockable.

data Lock

Locking details.

Lock

Field Type Description
lockers Parties Parties which are locking the contract.
context Set Text Context of the lock, explaining why this lock is held by the locking parties. If the lock is reentrant, there may be more than one locking context for the set of lockers.
lockType LockType The type of lock applied.

instance Eq Lock

instance Show Lock

data LockType

Type of lock held.

Semaphore

A one time only lock.

Reentrant

A mutual exclusion lock where the same lockers may lock a contract multiple times.

instance Eq LockType

instance Show LockType

type V

= View

Type synonym for View.

instance HasFromAnyView Lockable V

data View

View for Lockable.

View

Field Type Description
lock Optional Lock An optional lock, indicating if it is locked or not.
controllers Parties All parties whose authorization is required to acquire a lock.

instance Eq View

instance Show View

Functions

acquire
: Lockable -> Acquire -> Update (ContractId Lockable)
release
: Lockable -> Release -> Update (ContractId Lockable)
getLockers

: HasToInterface t Lockable => t -> Parties

Retrieves the lockers of a Lockable.

mustNotBeLocked

: HasToInterface i Lockable => i -> Update ()

Asserts that a lockable is not locked.