Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.canton.network/llms.txt

Use this file to discover all available pages before exploring further.

An example of how to build an OTC trading app for multi-leg standard token trades. Used as part of the testing infrastructure to test the DvP workflows based on the token standard.

Templates

template OTCTrade
Signatory: venue, tradingParties transferLegs
FieldTypeDescription
venueParty
transferLegsTextMap TransferLeg
tradeCidContractId OTCTradeProposal
createdAtTime
prepareUntilTime
settleBeforeTime
  • Choice Archive Controller: venue, tradingParties transferLegs Returns: () (no fields)
  • Choice OTCTrade_Cancel
    Controller: venue Returns: TextMap (Optional Allocation_CancelResult)
    FieldTypeDescription
    allocationsWithContextTextMap (ContractId Allocation, ExtraArgs)
  • Choice OTCTrade_Settle
    Controller: venue Returns: TextMap Allocation_ExecuteTransferResult
    FieldTypeDescription
    allocationsWithContextTextMap (ContractId Allocation, ExtraArgs)
  • interface instance AllocationRequest for OTCTrade
template OTCTradeProposal
Signatory: approvers
FieldTypeDescription
venueParty
tradeCidOptional (ContractId OTCTradeProposal)
transferLegsTextMap TransferLeg
approvers[Party]Parties that have approved the proposal
  • Choice Archive Controller: approvers Returns: () (no fields)
  • Choice OTCTradeProposal_Accept
    Controller: approver Returns: ContractId OTCTradeProposal
    FieldTypeDescription
    approverParty
  • Choice OTCTradeProposal_InitiateSettlement
    Controller: venue Returns: ContractId OTCTrade
    FieldTypeDescription
    prepareUntilTime
    settleBeforeTime
  • Choice OTCTradeProposal_Reject
    Controller: trader Returns: ()
    FieldTypeDescription
    traderParty

Functions

tradeAllocations : SettlementInfo -> TextMap TransferLeg -> TextMap AllocationSpecification
tradingParties : TextMap TransferLeg -> Set Party
require : CanAssert m => Text -> Bool -> m ()Check whether a required condition is true. If it’s not, abort the transaction with a message saying that the requirement was not met.
makeTradeRef : ContractId OTCTradeProposal -> Reference
zipTextMaps : TextMap a -> TextMap b -> TextMap (Optional a, Optional b)
forTextMapWithKey : Applicative f => TextMap a -> (Text -> a -> f b) -> f (TextMap b)