-- This should be its own package! module Exercise3.Solutions.Modularized.Cash where import Exercise3.Solutions.Modularized.Interfaces template Cash with issuer : Party owner : Party quantity : Decimal obs : [Party] where signatory [issuer, owner] observer obs interface instance IAsset for Cash where view = VAsset with assetType = "Cash" .. set_obs newObs = toInterface (this with obs = newObs) set_owner newOwner = toInterface (this with owner = newOwner) set_quantity newQuantity = toInterface (this with quantity = newQuantity) transfer_for newOwner = toInterface $ CashTransferProposal with cash = this; .. -- Workaround for https://github.com/digital-asset/daml/issues/15459 myView = view template CashTransferProposal with newOwner : Party cash : Cash where signatory (signatory cash) observer newOwner interface instance IAssetTransferProposal for CashTransferProposal where view = VAssetTransferProposal with newOwner = newOwner vasset = myView (toInterface @IAsset cash) asset = toInterface @IAsset cash