From 5ba9739a723245659e268124350af8e2e97837bf Mon Sep 17 00:00:00 2001 From: Brian W Bush Date: Tue, 26 Sep 2023 18:37:39 -0600 Subject: [PATCH] PLT-7111 Web and Tx api changes supporting open roles. --- .../Marlowe/Runtime/Web/Server/DTO.hs | 7 +- .../src/Language/Marlowe/Runtime/Web/Types.hs | 60 ++++++++- marlowe-runtime-web/test/Spec.hs | 1 + .../.golden/Job MarloweTxCommand/golden | 116 ++++++++++-------- .../Marlowe/Runtime/Transaction/Gen.hs | 24 +++- .../Transaction/BuildConstraintsSpec.hs | 17 ++- .../Marlowe/Runtime/Transaction/Api.hs | 18 ++- .../Runtime/Transaction/BuildConstraints.hs | 9 +- 8 files changed, 181 insertions(+), 71 deletions(-) diff --git a/marlowe-runtime-web/server/Language/Marlowe/Runtime/Web/Server/DTO.hs b/marlowe-runtime-web/server/Language/Marlowe/Runtime/Web/Server/DTO.hs index a74da54cfa..ec686736b0 100644 --- a/marlowe-runtime-web/server/Language/Marlowe/Runtime/Web/Server/DTO.hs +++ b/marlowe-runtime-web/server/Language/Marlowe/Runtime/Web/Server/DTO.hs @@ -791,6 +791,7 @@ instance FromDTO Tx.RoleTokensConfig where fromDTO = \case Nothing -> pure Tx.RoleTokensNone Just (Web.UsePolicy policy) -> Tx.RoleTokensUsePolicy <$> fromDTO policy + Just (Web.UsePolicyWithOpenRoles policy openRoleNames) -> Tx.RoleTokensUsePolicyWithOpenRoles <$> fromDTO policy <*> fromDTO openRoleNames Just (Web.Mint mint) -> Tx.RoleTokensMint <$> fromDTO mint instance HasDTO Tx.Mint where @@ -804,11 +805,13 @@ instance FromDTO Tx.Mint where . Map.toList where convertConfig = \case - Web.RoleTokenSimple address -> (,Nothing) <$> fromDTO address + Web.RoleTokenSimple address -> (,Nothing) . Tx.ToAddress <$> fromDTO address Web.RoleTokenAdvanced address metadata -> - curry (second Just) + curry (second Just) . Tx.ToAddress <$> fromDTO address <*> fromDTO metadata + Web.OpenRoleTokenSimple -> pure (Tx.ToScript Tx.OpenRoleScript, Nothing) + Web.OpenRoleTokenAdvanced metadata -> (Tx.ToScript Tx.OpenRoleScript,) . Just <$> fromDTO metadata instance HasDTO Tx.RoleTokenMetadata where type DTO Tx.RoleTokenMetadata = Web.TokenMetadata diff --git a/marlowe-runtime-web/src/Language/Marlowe/Runtime/Web/Types.hs b/marlowe-runtime-web/src/Language/Marlowe/Runtime/Web/Types.hs index f4ba8eba07..260d929f17 100644 --- a/marlowe-runtime-web/src/Language/Marlowe/Runtime/Web/Types.hs +++ b/marlowe-runtime-web/src/Language/Marlowe/Runtime/Web/Types.hs @@ -12,8 +12,9 @@ -- | Web API. module Language.Marlowe.Runtime.Web.Types where +import Control.Applicative ((<|>)) import Control.Lens hiding ((.=)) -import Control.Monad ((<=<)) +import Control.Monad (guard, (<=<)) import Data.Aeson import Data.Aeson.Text (encodeToLazyText) import Data.Aeson.Types (Parser, parseFail, toJSONKeyText) @@ -772,6 +773,7 @@ data PostContractsRequest = PostContractsRequest , metadata :: Map Word64 Metadata , version :: MarloweVersion , roles :: Maybe RolesConfig + , threadTokenName :: Maybe String , contract :: ContractOrSourceId , minUTxODeposit :: Word64 } @@ -807,15 +809,34 @@ instance ToSchema ContractOrSourceId where data RolesConfig = UsePolicy PolicyId + | UsePolicyWithOpenRoles PolicyId [Text] | Mint (Map Text RoleTokenConfig) deriving (Show, Eq, Ord, Generic) instance FromJSON RolesConfig where parseJSON (String s) = UsePolicy <$> parseJSON (String s) - parseJSON value = Mint <$> parseJSON value + parseJSON value = + withObject + "RoleConfig" + ( \obj -> + let parseMint = Mint <$> parseJSON value + parseOpen = + do + script <- obj .: "script" + guard $ script == ("OpenRole" :: String) + UsePolicyWithOpenRoles <$> obj .: "policyId" <*> obj .: "openRoleNames" + in parseOpen <|> parseMint + ) + value instance ToJSON RolesConfig where toJSON (UsePolicy policy) = toJSON policy + toJSON (UsePolicyWithOpenRoles policy openRoleNames) = + object + [ "script" .= ("OpenRole" :: String) + , "policyId" .= policy + , "openRoleNames" .= openRoleNames + ] toJSON (Mint configs) = toJSON configs instance ToSchema RolesConfig where @@ -830,6 +851,8 @@ instance ToSchema RolesConfig where data RoleTokenConfig = RoleTokenSimple Address | RoleTokenAdvanced Address TokenMetadata + | OpenRoleTokenSimple + | OpenRoleTokenAdvanced TokenMetadata deriving (Show, Eq, Ord, Generic) instance FromJSON RoleTokenConfig where @@ -837,7 +860,15 @@ instance FromJSON RoleTokenConfig where parseJSON value = withObject "RoleTokenConfig" - (\obj -> RoleTokenAdvanced <$> obj .: "address" <*> obj .: "metadata") + ( \obj -> + let parseAdvanced = RoleTokenAdvanced <$> obj .: "address" <*> obj .: "metadata" + parseOpen = + do + script <- obj .: "script" + guard $ script == ("OpenRole" :: String) + OpenRoleTokenAdvanced <$> obj .: "metadata" <|> pure OpenRoleTokenSimple + in parseAdvanced <|> parseOpen + ) value instance ToJSON RoleTokenConfig where @@ -847,6 +878,14 @@ instance ToJSON RoleTokenConfig where [ ("address", toJSON address) , ("metadata", toJSON config) ] + toJSON OpenRoleTokenSimple = + object + [("script", "OpenRole")] + toJSON (OpenRoleTokenAdvanced config) = + object + [ ("script", "OpenRole") + , ("metadata", toJSON config) + ] instance ToSchema RoleTokenConfig where declareNamedSchema _ = do @@ -860,10 +899,23 @@ instance ToSchema RoleTokenConfig where .~ [ ("address", simpleSchema) , ("metadata", metadataSchema) ] + scriptSchema = + mempty + & type_ ?~ OpenApiString + & OpenApi.description ?~ "The type of script receiving the role token." + & enum_ ?~ ["OpenRole"] + openSchema = + mempty + & type_ ?~ OpenApiObject + & required .~ ["script"] + & properties + .~ [ ("script", Inline scriptSchema) + , ("metadata", metadataSchema) + ] pure $ NamedSchema (Just "RoleTokenConfig") $ mempty - & oneOf ?~ [simpleSchema, Inline advancedSchema] + & oneOf ?~ [simpleSchema, Inline advancedSchema, Inline openSchema] data TokenMetadata = TokenMetadata { name :: Text diff --git a/marlowe-runtime-web/test/Spec.hs b/marlowe-runtime-web/test/Spec.hs index a7180f34a0..b97f4f983e 100644 --- a/marlowe-runtime-web/test/Spec.hs +++ b/marlowe-runtime-web/test/Spec.hs @@ -207,6 +207,7 @@ instance Arbitrary Web.PostContractsRequest where <*> arbitrary <*> arbitrary <*> arbitrary + <*> arbitrary -- size of 6 will result in a 1-layer deep contract being generated (this is -- all we care about for the purposes of schema checking). <*> arbitrary diff --git a/marlowe-runtime/.golden/Job MarloweTxCommand/golden b/marlowe-runtime/.golden/Job MarloweTxCommand/golden index 718e6fdb36..5a3946220d 100644 --- a/marlowe-runtime/.golden/Job MarloweTxCommand/golden +++ b/marlowe-runtime/.golden/Job MarloweTxCommand/golden @@ -934,64 +934,76 @@ Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", ex Binary: 010100000001000000000000000000000000000000000000000000000000010000000000000000000100000000000000000000000000000000010000 Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList [TxOutRef {txId = "61", txIx = TxIx {unTxIx = 1}}]}) RoleTokensNone (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) Binary: 01010000000100000000000000000000000000000000000000000000000001000000000000000161000100000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Just text/plain, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000a746578742f706c61696e000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Just "", files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Just "a", files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001610000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = //a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000100000000000000000000000000000000000000000000000161000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = //a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000100000000000000000000000000000001610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = //a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000100000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = //}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000000000000000000000000000000000000000000000000000161000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000000000000000000000000000000000001610000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000000000000000000016100000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = }]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "a", mediaType = text/plain, src = }]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000161000000000000000a746578742f706c61696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = //, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000001000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = //a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = //a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000100000000000000000000000000000000010000000000000000000000000000000161000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = //a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000100000000000000000000000000000000010000000000000001610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000016100000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000161000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000100000000000000000000000000000000000000000000000001610000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "", image = a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000100000000000000000000000000000001610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Just (RoleTokenMetadata {name = "a", image = , mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000100000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("",Nothing))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",("61",Nothing))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000016100000000000000000000000000000000010000 -Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("a",("",Nothing))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) -Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000161000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Just text/plain, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000a746578742f706c61696e000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Just "", files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Just "a", files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001610000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = //a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000100000000000000000000000000000000000000000000000161000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = //a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000100000000000000000000000000000001610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = //a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000100000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = //}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000000000000000000000000000000000000000000000000000161000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000000000000000000000000000000000001610000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000000000000000000000016100000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = a}]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e00000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "", mediaType = text/plain, src = }]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000200000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000a746578742f706c61696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = [NFTMetadataFile {name = "a", mediaType = text/plain, src = }]})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000161000000000000000a746578742f706c61696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = , mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = //, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000001000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = //a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000000100000000000000000000000000000000010000000000000000000000000000000000000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = //a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000000100000000000000000000000000000000010000000000000000000000000000000161000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = //a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000000100000000000000000000000000000000010000000000000001610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000016100000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000161000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000000100000000000000000000000000000000000000000000000001610000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "", image = a, mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000000100000000000000000000000000000001610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Just (RoleTokenMetadata {name = "a", image = , mediaType = Nothing, description = Nothing, files = []})))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000000100000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "",Nothing))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000001000000000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToAddress "61",Nothing))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000016100000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToScript OpenRoleScript,Nothing))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000200000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("",(ToSelf,Nothing))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000000100000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList [("a",(ToAddress "",Nothing))]})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000002000000000000000100000000000000016100000000000000000000000000000000000000000000000000010000 Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensMint (Mint {unMint = fromList []})) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) Binary: 01010000000100000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000010000 Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensUsePolicy "") (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) Binary: 01010000000100000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000010000 Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensUsePolicy "61") (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) Binary: 0101000000010000000000000000000000000000000000000000000000000001000000000000000161000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensUsePolicyWithOpenRoles "" [""]) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 0101000000010000000000000000000000000000000000000000000000000003000000000000000000000000000000010000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensUsePolicyWithOpenRoles "" ["a"]) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000300000000000000000000000000000001000000000000000161000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensUsePolicyWithOpenRoles "" []) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 010100000001000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000 +Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) (RoleTokensUsePolicyWithOpenRoles "61" []) (MarloweTransactionMetadata {marloweMetadata = Nothing, transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) +Binary: 01010000000100000000000000000000000000000000000000000000000000030000000000000001610000000000000000000000000000000000000000000000010000 Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) RoleTokensNone (MarloweTransactionMetadata {marloweMetadata = Just (MarloweMetadata {tags = fromList [("",Just (MetadataBytes ""))], continuations = Nothing}), transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) Binary: 01010000000100000000000000000000000000000000000000000000000000000000000000000001000000000000061c01000000000000000202000000000201000000000000000101000000000000000204000000000000000003000000000000000000000000000000010000 Show: MsgExec (Create Nothing MarloweV1 (WalletAddresses {changeAddress = "", extraAddresses = fromList [], collateralUtxos = fromList []}) RoleTokensNone (MarloweTransactionMetadata {marloweMetadata = Just (MarloweMetadata {tags = fromList [("",Just (MetadataBytes "a"))], continuations = Nothing}), transactionMetadata = TransactionMetadata {unTransactionMetadata = fromList []}}) (Lovelace {unLovelace = 1}) (Left Close)) diff --git a/marlowe-runtime/gen/Language/Marlowe/Runtime/Transaction/Gen.hs b/marlowe-runtime/gen/Language/Marlowe/Runtime/Transaction/Gen.hs index 3d522b806a..4d480ec901 100644 --- a/marlowe-runtime/gen/Language/Marlowe/Runtime/Transaction/Gen.hs +++ b/marlowe-runtime/gen/Language/Marlowe/Runtime/Transaction/Gen.hs @@ -102,16 +102,32 @@ instance Arbitrary RoleTokenMetadata where <*> arbitrary shrink = genericShrink +instance Arbitrary HelperScript where + arbitrary = pure OpenRoleScript + shrink = genericShrink + +instance Arbitrary Destination where + arbitrary = + frequency + [ (30, ToAddress <$> arbitrary) + , (2, pure ToSelf) + , (1, ToScript <$> arbitrary) + ] + shrink (ToAddress address) = ToAddress <$> genericShrink address + shrink ToSelf = [] + shrink (ToScript script) = ToScript <$> genericShrink script + instance Arbitrary Mint where arbitrary = mkMint <$> arbitrary shrink = genericShrink instance Arbitrary RoleTokensConfig where arbitrary = - oneof - [ pure RoleTokensNone - , RoleTokensUsePolicy <$> arbitrary - , RoleTokensMint <$> arbitrary + frequency + [ (10, pure RoleTokensNone) + , (10, RoleTokensUsePolicy <$> arbitrary) + , (10, RoleTokensMint <$> arbitrary) + , (1, RoleTokensUsePolicyWithOpenRoles <$> arbitrary <*> arbitrary) ] shrink = genericShrink diff --git a/marlowe-runtime/test/Language/Marlowe/Runtime/Transaction/BuildConstraintsSpec.hs b/marlowe-runtime/test/Language/Marlowe/Runtime/Transaction/BuildConstraintsSpec.hs index 1509a0cf69..cd56770b5d 100644 --- a/marlowe-runtime/test/Language/Marlowe/Runtime/Transaction/BuildConstraintsSpec.hs +++ b/marlowe-runtime/test/Language/Marlowe/Runtime/Transaction/BuildConstraintsSpec.hs @@ -47,6 +47,7 @@ import Language.Marlowe.Runtime.Transaction.Api ( ApplyInputsConstraintsBuildupError (..), ApplyInputsError (..), CreateError, + Destination (ToAddress), RoleTokensConfig (..), mkMint, unMint, @@ -89,6 +90,7 @@ import Test.QuickCheck ( discard, elements, forAllShrink, + frequency, genericShrink, listOf, listOf1, @@ -126,7 +128,10 @@ createSpec = Hspec.describe "buildCreateConstraints" do Hspec.QuickCheck.prop "sends minted role tokens" \(SomeCreateArgs args) -> case roleTokensConfig args of RoleTokensMint mint -> - let result = extractSentRoleTokens <$> runBuildCreateConstraints args + let result = + -- FIXME: PLT-7111 + Map.map Transaction.Api.ToAddress . extractSentRoleTokens + <$> runBuildCreateConstraints args expected = fst <$> unMint mint in case version args of MarloweV1 -> result === Right expected @@ -246,15 +251,17 @@ instance Arbitrary WalletContext where instance Arbitrary RoleTokensConfig where arbitrary = - oneof - [ pure RoleTokensNone - , RoleTokensUsePolicy . Chain.PolicyId <$> byteStringGen - , RoleTokensMint . mkMint . NE.fromList <$> listOf1 ((,) <$> genRole <*> ((,Nothing) <$> arbitrary)) + frequency + [ (10, pure RoleTokensNone) + , (10, RoleTokensUsePolicy . Chain.PolicyId <$> byteStringGen) + , (10, RoleTokensMint . mkMint . NE.fromList <$> listOf1 ((,) <$> genRole <*> ((,Nothing) . ToAddress <$> arbitrary))) + , (1, RoleTokensUsePolicyWithOpenRoles . Chain.PolicyId <$> byteStringGen <*> arbitrary) ] shrink = \case RoleTokensNone -> [] RoleTokensUsePolicy _ -> [RoleTokensNone] RoleTokensMint _ -> [RoleTokensNone] + RoleTokensUsePolicyWithOpenRoles _ _ -> [RoleTokensNone] notEmptyWalletContext :: WalletContext -> Bool notEmptyWalletContext WalletContext{..} = not $ null $ toUTxOsList availableUtxos diff --git a/marlowe-runtime/tx-api/Language/Marlowe/Runtime/Transaction/Api.hs b/marlowe-runtime/tx-api/Language/Marlowe/Runtime/Transaction/Api.hs index d886d28760..c495adb80f 100644 --- a/marlowe-runtime/tx-api/Language/Marlowe/Runtime/Transaction/Api.hs +++ b/marlowe-runtime/tx-api/Language/Marlowe/Runtime/Transaction/Api.hs @@ -23,6 +23,8 @@ module Language.Marlowe.Runtime.Transaction.Api ( LoadMarloweContextError (..), MarloweTxCommand (..), Mint (unMint), + Destination (..), + HelperScript (..), NFTMetadataFile (..), RoleTokenMetadata (..), RoleTokensConfig (..), @@ -263,18 +265,30 @@ encodeRoleTokenMetadata = encodeNFTMetadataDetails encodeText :: Text -> Metadata encodeText = MetadataList . fmap MetadataText . Text.chunksOf 64 +data HelperScript = OpenRoleScript + deriving stock (Show, Eq, Ord, Generic) + deriving anyclass (Binary, ToJSON, Variations) + +data Destination + = ToAddress Address + | ToSelf + | ToScript HelperScript + deriving stock (Show, Eq, Ord, Generic) + deriving anyclass (Binary, ToJSON, Variations) + -- | Non empty mint request. -newtype Mint = Mint {unMint :: Map TokenName (Address, Maybe RoleTokenMetadata)} +newtype Mint = Mint {unMint :: Map TokenName (Destination, Maybe RoleTokenMetadata)} deriving stock (Show, Eq, Ord, Generic) deriving newtype (Binary, Semigroup, Monoid, ToJSON, Variations) -mkMint :: NonEmpty (TokenName, (Address, Maybe RoleTokenMetadata)) -> Mint +mkMint :: NonEmpty (TokenName, (Destination, Maybe RoleTokenMetadata)) -> Mint mkMint = Mint . Map.fromList . NonEmpty.toList data RoleTokensConfig = RoleTokensNone | RoleTokensUsePolicy PolicyId | RoleTokensMint Mint + | RoleTokensUsePolicyWithOpenRoles PolicyId [TokenName] deriving stock (Show, Eq, Ord, Generic) deriving anyclass (Binary, ToJSON, Variations) diff --git a/marlowe-runtime/tx/Language/Marlowe/Runtime/Transaction/BuildConstraints.hs b/marlowe-runtime/tx/Language/Marlowe/Runtime/Transaction/BuildConstraints.hs index 7c19a5f982..1e679de535 100644 --- a/marlowe-runtime/tx/Language/Marlowe/Runtime/Transaction/BuildConstraints.hs +++ b/marlowe-runtime/tx/Language/Marlowe/Runtime/Transaction/BuildConstraints.hs @@ -86,6 +86,7 @@ import Language.Marlowe.Runtime.Transaction.Api ( ApplyInputsError (..), CreateBuildupError (AddressDecodingFailed, MintingScriptDecodingFailed, MintingUtxoSelectionFailed), CreateError (..), + Destination (..), Mint (unMint), RoleTokensConfig (..), WithdrawError (..), @@ -251,6 +252,7 @@ buildCreateConstraintsV1 mkRoleTokenMintingPolicy era walletCtx roles metadata m mintRoleTokens :: TxConstraintsBuilderM CreateError era 'V1 m PolicyId mintRoleTokens = case roles of RoleTokensUsePolicy policyId -> pure policyId + RoleTokensUsePolicyWithOpenRoles policyId _ -> pure policyId RoleTokensMint (unMint -> minting) -> do let WalletContext{availableUtxos} = walletCtx txLovelaceRequirementEstimate = @@ -285,8 +287,11 @@ buildCreateConstraintsV1 mkRoleTokenMintingPolicy era walletCtx roles metadata m (C.ExecutionUnits 0 0) policyId = PolicyId . unScriptHash $ scriptHash - for_ (Map.toList minting) \(tokenName, (address, _)) -> - tell $ mustMintRoleToken txOutRef witness (AssetId policyId tokenName) address + for_ (Map.toList minting) \(tokenName, (destination, _)) -> + case destination of + ToAddress address -> tell $ mustMintRoleToken txOutRef witness (AssetId policyId tokenName) address + ToSelf -> pure () + ToScript _ -> pure () pure policyId RoleTokensNone -> do let -- We use ADA currency symbol as a placeholder which