Skip to content

Commit

Permalink
change multipliers to use return [Decimal] instead of claims (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgraham-da authored Jul 9, 2021
1 parent be88b90 commit 2b87e5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 5 additions & 2 deletions daml/Marketplace/Issuance/AssetDescription.daml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ template AssetDescription
do
return $ snd <$> payoffs (C.deserialize claims)

nonconsuming choice Multipliers : [Observation Date Decimal]
nonconsuming choice Multipliers : [Decimal]
with
party : Party
controller party
do
return $ fst <$> payoffs (C.deserialize claims)
let getConst : (Observation Date Decimal, b) -> [Decimal]
getConst (Const x, _) = [x]
getConst _ = []
return $ concatMap getConst $ payoffs (C.deserialize claims)

-- Used to do a reverse lookup of the version # given the claims (passed-in from the API)
template Index
Expand Down
7 changes: 3 additions & 4 deletions daml/Tests/Clearing/Setup.daml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Tests.Clearing.Setup where
import Daml.Script
import Common
import ContingentClaims.Claim (Claim(Zero))
import ContingentClaims.Observation (Observation(Const))
import DA.Assert ((===))
import DA.Finance.Types
import DA.Date (date, Month(..))
Expand Down Expand Up @@ -75,9 +74,9 @@ clearedTradingTest = do
(_,h2oQ322DerId) <- mkSimpleH2OFuture "H2OQ322" "H2O Q3 22" $ date 2022 Jul 1
(_,h2oQ422DerId) <- mkSimpleH2OFuture "H2OQ422" "H2O Q4 22" $ date 2022 Oct 1

(Some expiry) <- submit issuer.customer $ exerciseCmd q122Cid AssetDescription.Expiry with party = issuer.customer
(underlying::_) <- submit issuer.customer $ exerciseCmd q122Cid AssetDescription.Underlying with party = issuer.customer
((Const mult)::_) <- submit issuer.customer $ exerciseCmd q122Cid AssetDescription.Multipliers with party = issuer.customer
(Some expiry) <- submit issuer.customer $ exerciseCmd q122Cid AssetDescription.Expiry with party = issuer.customer
(underlying::_) <- submit issuer.customer $ exerciseCmd q122Cid AssetDescription.Underlying with party = issuer.customer
(mult::_) <- submit issuer.customer $ exerciseCmd q122Cid AssetDescription.Multipliers with party = issuer.customer

expiry === (date 2022 Jan 1)
underlying === h2oId
Expand Down

0 comments on commit 2b87e5d

Please sign in to comment.