> ## 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.

> ## Agent Instructions
> If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md.

# Splice.Tests.TestAmuletTokenDvP

> Documentation for 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](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932) | |
> > | bob | [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932) | |
> > | provider | [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932) | |
> > | providerBeneficiary1 | [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932) | |
> > | providerBeneficiary2 | [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932) | |
> > | providerBeneficiaries | \[([Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932), [Decimal](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-ghc-types-decimal-18135))] | |
> > | registry | AmuletRegistry | |
> > | otcTradeCid | [ContractId](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-contractid-95282) OTCTrade | |
> > | otcTrade | OTCTrade | |
> > | amuletId | InstrumentId | |
>
> **instance** [Eq](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#class-ghc-classes-eq-22713) AllocatedOTCTrade
>
> **instance** [Show](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#class-ghc-show-show-65360) AllocatedOTCTrade
>
> **instance** GetField "alice" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **instance** GetField "amuletId" AllocatedOTCTrade InstrumentId
>
> **instance** GetField "bob" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **instance** GetField "otcTrade" AllocatedOTCTrade OTCTrade
>
> **instance** GetField "otcTradeCid" AllocatedOTCTrade ([ContractId](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-contractid-95282) OTCTrade)
>
> **instance** GetField "provider" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **instance** GetField "providerBeneficiaries" AllocatedOTCTrade \[([Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932), [Decimal](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-ghc-types-decimal-18135))]
>
> **instance** GetField "providerBeneficiary1" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **instance** GetField "providerBeneficiary2" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **instance** GetField "registry" AllocatedOTCTrade AmuletRegistry
>
> **instance** SetField "alice" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **instance** SetField "amuletId" AllocatedOTCTrade InstrumentId
>
> **instance** SetField "bob" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **instance** SetField "otcTrade" AllocatedOTCTrade OTCTrade
>
> **instance** SetField "otcTradeCid" AllocatedOTCTrade ([ContractId](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-contractid-95282) OTCTrade)
>
> **instance** SetField "provider" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **instance** SetField "providerBeneficiaries" AllocatedOTCTrade \[([Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932), [Decimal](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-ghc-types-decimal-18135))]
>
> **instance** SetField "providerBeneficiary1" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **instance** SetField "providerBeneficiary2" AllocatedOTCTrade [Party](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932)
>
> **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](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-party-57932) -> Reference -> Script ([TextMap](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-textmap-11691) ([ContractId](https://docs.canton.network/appdev/reference/daml-standard-library/prelude.md#type-da-internal-lf-contractid-95282) 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.

expectNoBurn
: Metadata -> Script ()
