Splice.Tests.TestAmuletTokenDvP

Daml script tests showing that the token standard can be used to execute DvP settlements of Amulet tokens; and how to do so.

See this test and the ‘Splice.Testing.TradingApp’ module for an example of how to integrate with the allocation APIs of the token standard to execute DvP settlements.

Note also that the delivery part of a DvP settelement can be both another token implementing the standard, as well as the creation of on-ledger state specific to your registry; e.g., a license contract.

Data Types

data AllocatedOTCTrade

AllocatedOTCTrade

Field

Type

Description

alice

Party

bob

Party

provider

Party

providerBeneficiary1

Party

providerBeneficiary2

Party

providerBeneficiaries

[(Party, Decimal)]

registry

AmuletRegistry

otcTradeCid

ContractId OTCTrade

otcTrade

OTCTrade

amuletId

InstrumentId

instance Eq AllocatedOTCTrade

instance Show AllocatedOTCTrade

instance GetField "alice" AllocatedOTCTrade Party

instance GetField "amuletId" AllocatedOTCTrade InstrumentId

instance GetField "bob" AllocatedOTCTrade Party

instance GetField "otcTrade" AllocatedOTCTrade OTCTrade

instance GetField "otcTradeCid" AllocatedOTCTrade (ContractId OTCTrade)

instance GetField "provider" AllocatedOTCTrade Party

instance GetField "providerBeneficiaries" AllocatedOTCTrade [(Party, Decimal)]

instance GetField "providerBeneficiary1" AllocatedOTCTrade Party

instance GetField "providerBeneficiary2" AllocatedOTCTrade Party

instance GetField "registry" AllocatedOTCTrade AmuletRegistry

instance SetField "alice" AllocatedOTCTrade Party

instance SetField "amuletId" AllocatedOTCTrade InstrumentId

instance SetField "bob" AllocatedOTCTrade Party

instance SetField "otcTrade" AllocatedOTCTrade OTCTrade

instance SetField "otcTradeCid" AllocatedOTCTrade (ContractId OTCTrade)

instance SetField "provider" AllocatedOTCTrade Party

instance SetField "providerBeneficiaries" AllocatedOTCTrade [(Party, Decimal)]

instance SetField "providerBeneficiary1" AllocatedOTCTrade Party

instance SetField "providerBeneficiary2" AllocatedOTCTrade Party

instance SetField "registry" AllocatedOTCTrade AmuletRegistry

Functions

setupOtcTrade

: Script AllocatedOTCTrade

testDvP

: Script ()

Test that a DvP settlement of an OTC trade works when using Amulet via the token standard.

appBackendListAllocations

: Party -> Reference -> Script (TextMap (ContractId Allocation, AllocationView))

List all allocations matching a particular settlement reference, sorted by their tradeLeg id. This function would be run on the trading app provider’s backend as part of an automation loop.

expectBurn

: Metadata -> Script ()

Comments