Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 149 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,19 @@ lazy val root: Project = (project in file("."))
`splice-validator-lifecycle-test-daml`,
`splice-api-token-metadata-v1-daml`,
`splice-api-token-holding-v1-daml`,
`splice-api-token-holding-v2-daml`,
`splice-api-token-transfer-instruction-v1-daml`,
`splice-api-token-transfer-instruction-v2-daml`,
`splice-api-token-allocation-v1-daml`,
`splice-api-token-allocation-v2-daml`,
`splice-api-token-allocation-request-v1-daml`,
`splice-api-token-allocation-request-v2-daml`,
`splice-api-token-allocation-instruction-v1-daml`,
`splice-api-token-allocation-instruction-v2-daml`,
`splice-api-token-burn-mint-v1-daml`,
`splice-api-token-utils-v2-daml`,
`splice-token-standard-test-daml`,
`splice-token-standard-test-v2-daml`,
`splice-token-test-dummy-holding-daml`,
`build-tools-dar-lock-checker`,
`canton-community-base`,
Expand Down Expand Up @@ -223,11 +230,17 @@ lazy val docs = project
(`splice-wallet-payments-daml` / Compile / damlBuild).value ++
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-request-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-request-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-instruction-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-burn-mint-v1-daml` / Compile / damlBuild).value
(`splice-api-token-allocation-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-burn-mint-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-utils-v2-daml` / Compile / damlBuild).value
cacheDamlDocs(
damlSources.toSet
).toSeq
Expand Down Expand Up @@ -316,6 +329,17 @@ lazy val `splice-api-token-holding-v1-daml` =
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-holding-v2-daml` =
project
.in(file("token-standard/splice-api-token-holding-v2"))
.enablePlugins(DamlPlugin)
.settings(
BuildCommon.damlSettings,
Compile / damlDependencies :=
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value,
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-transfer-instruction-v1-daml` =
project
.in(file("token-standard/splice-api-token-transfer-instruction-v1"))
Expand Down Expand Up @@ -347,6 +371,37 @@ lazy val `splice-api-token-transfer-instruction-v1-daml` =
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-transfer-instruction-v2-daml` =
project
.in(file("token-standard/splice-api-token-transfer-instruction-v2"))
.enablePlugins(DamlPlugin)
.settings(
BuildCommon.damlSettings,
Compile / damlDependencies :=
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v2-daml` / Compile / damlBuild).value,
templateDirectory := (`openapi-typescript-template` / patchTemplate).value,
Compile / sourceGenerators +=
Def.taskDyn {
val transferInstructionOpenApiFile =
baseDirectory.value / "openapi/transfer-instruction-v2.yaml"

val npmName = "transfer-instruction-openapi"

BuildCommon.TS.generateOpenApiClient(
npmName = npmName,
npmModuleName = npmName,
npmProjectName = npmName,
openApiSpec = "transfer-instruction-v2.yaml",
cacheFileDependencies = Set(transferInstructionOpenApiFile),
directory = "openapi-ts-client",
subPath = "openapi",
)
},
cleanFiles += { baseDirectory.value / "openapi-ts-client" },
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-allocation-v1-daml` =
project
.in(file("token-standard/splice-api-token-allocation-v1"))
Expand All @@ -355,7 +410,19 @@ lazy val `splice-api-token-allocation-v1-daml` =
BuildCommon.damlSettings,
Compile / damlDependencies :=
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v1-daml` / Compile / damlBuild).value,
(`splice-api-token-holding-v1-daml` / Compile / damlBuild).value,
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-allocation-v2-daml` =
project
.in(file("token-standard/splice-api-token-allocation-v2"))
.enablePlugins(DamlPlugin)
.settings(
BuildCommon.damlSettings,
Compile / damlDependencies :=
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v2-daml` / Compile / damlBuild).value,
)
.dependsOn(`canton-bindings-java`)

Expand All @@ -372,6 +439,19 @@ lazy val `splice-api-token-allocation-request-v1-daml` =
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-allocation-request-v2-daml` =
project
.in(file("token-standard/splice-api-token-allocation-request-v2"))
.enablePlugins(DamlPlugin)
.settings(
BuildCommon.damlSettings,
Compile / damlDependencies :=
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-v2-daml` / Compile / damlBuild).value,
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-allocation-instruction-v1-daml` =
project
.in(file("token-standard/splice-api-token-allocation-instruction-v1"))
Expand All @@ -385,6 +465,19 @@ lazy val `splice-api-token-allocation-instruction-v1-daml` =
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-allocation-instruction-v2-daml` =
project
.in(file("token-standard/splice-api-token-allocation-instruction-v2"))
.enablePlugins(DamlPlugin)
.settings(
BuildCommon.damlSettings,
Compile / damlDependencies :=
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-v2-daml` / Compile / damlBuild).value,
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-burn-mint-v1-daml` =
project
.in(file("token-standard/splice-api-token-burn-mint-v1"))
Expand All @@ -397,6 +490,25 @@ lazy val `splice-api-token-burn-mint-v1-daml` =
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-api-token-utils-v2-daml` =
project
.in(file("token-standard/splice-api-token-utils-v2"))
.enablePlugins(DamlPlugin)
.settings(
BuildCommon.damlSettings,
Compile / damlDependencies :=
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-instruction-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v2-daml` / Compile / damlBuild).value ,
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-token-standard-test-daml` =
project
.in(file("token-standard/splice-token-standard-test"))
Expand All @@ -415,6 +527,24 @@ lazy val `splice-token-standard-test-daml` =
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-token-standard-test-v2-daml` =
project
.in(file("token-standard/splice-token-standard-test-v2"))
.enablePlugins(DamlPlugin)
.settings(
BuildCommon.damlSettings,
Compile / damlDependencies :=
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-request-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-util-daml` / Compile / damlBuild).value ++
(`splice-amulet-daml` / Compile / damlBuild).value,
)
.dependsOn(`canton-bindings-java`)

lazy val `splice-token-test-dummy-holding-daml` =
project
.in(file("token-standard/examples/splice-token-test-dummy-holding"))
Expand Down Expand Up @@ -553,10 +683,16 @@ lazy val `splice-amulet-daml` =
(`splice-util-daml` / Compile / damlBuild).value ++
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-holding-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-request-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-request-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-instruction-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-utils-v2-daml` / Compile / damlBuild).value ++
(`splice-featured-app-api-v1-daml` / Compile / damlBuild).value,
)
.dependsOn(`canton-bindings-java`)
Expand Down Expand Up @@ -653,8 +789,9 @@ lazy val `splice-wallet-daml` =
(`splice-amulet-name-service-daml` / Compile / damlBuild).value ++
(`splice-util-daml` / Compile / damlBuild).value ++
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-request-v1-daml` / Compile / damlBuild).value,
(`splice-api-token-transfer-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-instruction-v2-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-request-v2-daml` / Compile / damlBuild).value,
)
.dependsOn(`canton-bindings-java`)

Expand All @@ -664,7 +801,14 @@ lazy val `splice-wallet-test-daml` =
.enablePlugins(DamlPlugin)
.settings(
BuildCommon.damlSettings,
Compile / damlDependencies := (`splice-amulet-test-daml` / Compile / damlBuild).value ++ (`splice-wallet-daml` / Compile / damlBuild).value,
Compile / damlDependencies :=
(`splice-amulet-test-daml` / Compile / damlBuild).value ++
(`splice-api-token-transfer-instruction-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-instruction-v1-daml` / Compile / damlBuild).value ++
(`splice-api-token-allocation-request-v1-daml` / Compile / damlBuild).value ++
(`splice-token-standard-test-daml` / Compile / damlBuild).value ++
(`splice-token-standard-test-v2-daml` / Compile / damlBuild).value ++
(`splice-wallet-daml` / Compile / damlBuild).value,
Compile / damlEnableJavaCodegen := false,
)
.dependsOn(`canton-bindings-java`)
Expand Down
5 changes: 5 additions & 0 deletions daml/splice-amulet/daml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ dependencies:
data-dependencies:
- ../../token-standard/splice-api-token-metadata-v1/.daml/dist/splice-api-token-metadata-v1-current.dar
- ../../token-standard/splice-api-token-holding-v1/.daml/dist/splice-api-token-holding-v1-current.dar
- ../../token-standard/splice-api-token-holding-v2/.daml/dist/splice-api-token-holding-v2-current.dar
- ../../token-standard/splice-api-token-transfer-instruction-v1/.daml/dist/splice-api-token-transfer-instruction-v1-current.dar
- ../../token-standard/splice-api-token-transfer-instruction-v2/.daml/dist/splice-api-token-transfer-instruction-v2-current.dar
- ../../token-standard/splice-api-token-allocation-v1/.daml/dist/splice-api-token-allocation-v1-current.dar
- ../../token-standard/splice-api-token-allocation-v2/.daml/dist/splice-api-token-allocation-v2-current.dar
- ../../token-standard/splice-api-token-allocation-instruction-v1/.daml/dist/splice-api-token-allocation-instruction-v1-current.dar
- ../../token-standard/splice-api-token-allocation-instruction-v2/.daml/dist/splice-api-token-allocation-instruction-v2-current.dar
- ../splice-util/.daml/dist/splice-util-current.dar
- ../splice-api-featured-app-v1/.daml/dist/splice-api-featured-app-v1-current.dar
- ../../token-standard/splice-api-token-utils-v2/.daml/dist/splice-api-token-utils-v2-current.dar
build-options:
- --ghc-option=-Wunused-binds
- --ghc-option=-Wunused-matches
Expand Down
20 changes: 14 additions & 6 deletions daml/splice-amulet/daml/Splice/Amulet.daml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import DA.Optional (fromOptional)

import Splice.Api.Token.MetadataV1 qualified as Api.Token.MetadataV1
import Splice.Api.Token.HoldingV1 qualified as Api.Token.HoldingV1
import Splice.Api.Token.HoldingV2 qualified as Api.Token.HoldingV2
import Splice.Api.Token.UtilsV2

import Splice.Amulet.TokenApiUtils
import Splice.Expiry
Expand Down Expand Up @@ -104,14 +106,17 @@ template Amulet
meta = Some (simpleHoldingTxMeta TxKind_ExpireDust None (Some amount.initialAmount))
..

interface instance Api.Token.HoldingV1.Holding for Amulet where
view = Api.Token.HoldingV1.HoldingView with
interface instance Api.Token.HoldingV2.Holding for Amulet where
view = Api.Token.HoldingV2.HoldingView with
owner
instrumentId = amuletInstrumentId dso
amount = amount.initialAmount
lock = None
meta = amuletMetadata this

interface instance Api.Token.HoldingV1.Holding for Amulet where
view = holding_v2_to_v1 (view (toInterface @Api.Token.HoldingV2.Holding this))

amuletMetadata : Amulet -> Api.Token.MetadataV1.Metadata
amuletMetadata Amulet{..} =
Api.Token.MetadataV1.Metadata with
Expand All @@ -126,19 +131,22 @@ template LockedAmulet
lock : TimeLock
where
signatory lock.holders, signatory amulet

interface instance Api.Token.HoldingV1.Holding for LockedAmulet where
view = Api.Token.HoldingV1.HoldingView with
interface instance Api.Token.HoldingV2.Holding for LockedAmulet where
view = Api.Token.HoldingV2.HoldingView with
owner = amulet.owner
instrumentId = amuletInstrumentId amulet.dso
amount = amulet.amount.initialAmount
lock = Some Api.Token.HoldingV1.Lock with
lock = Some Api.Token.HoldingV2.Lock with
holders = lock.holders
expiresAt = Some lock.expiresAt
expiresAfter = None
context = lock.optContext
meta = amuletMetadata amulet

interface instance Api.Token.HoldingV1.Holding for LockedAmulet where
view = holding_v2_to_v1 (view (toInterface @Api.Token.HoldingV2.Holding this))

choice LockedAmulet_Unlock : LockedAmulet_UnlockResult
with
openRoundCid : ContractId OpenMiningRound
Expand Down
6 changes: 3 additions & 3 deletions daml/splice-amulet/daml/Splice/Amulet/TokenApiUtils.daml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import DA.Text qualified as T

import Splice.Api.Token.MetadataV1
import Splice.Api.FeaturedAppRightV1
import Splice.Api.Token.HoldingV1 qualified as Api.Token.HoldingV1
import Splice.Api.Token.HoldingV2 qualified as Api.Token.HoldingV2


splicePrefix : Text
Expand All @@ -24,9 +24,9 @@ amuletPrefix : Text
amuletPrefix = "amulet." <> splicePrefix

-- | Shared definition of the instrument-id used for amulets.
amuletInstrumentId : Party -> Api.Token.HoldingV1.InstrumentId
amuletInstrumentId : Party -> Api.Token.HoldingV2.InstrumentId
amuletInstrumentId dso =
Api.Token.HoldingV1.InstrumentId with admin = dso; id = "Amulet"
Api.Token.HoldingV2.InstrumentId with admin = dso; id = "Amulet"

-- | Add an optional metadata entry.
optionalMetadata : Text -> (a -> Text) -> Optional a -> TextMap Text -> TextMap Text
Expand Down
Loading
Loading