Hello everyone, happy new year! I am working on contracts to sell assets. I am trying to test the code but it’s unclear to me how to recall the data included in “Asset” and to get the test of SellAsset done. I know it’s banal for you all, but there are a few concepts that I am struggling to understand by reading the documentation. Could someone with some free time and patience explain this to me? I have copied my code below.
module SellAsset where import Asset type SellAssetId = ContractId SellAsset template SellAsset with asset : Asset newOwnerSolicitor:Party newOwner:Party notes: Text where signatory asset.ownerSolicitor observer asset.owner, newOwner, asset.auctionHouse choice AssetDocOffer_GetAsset : Asset controller asset.ownerSolicitor do (_, asset') <- fetchByKey @Asset (key asset) return asset
And this is the test:
module Main_I where import Asset import SellAsset import Daml.Script sell_asset_test : Script SellAssetId sell_asset_test = script do cms <- allocatePartyWithHint "CMS" (PartyIdHint "CMS") claudia <- allocatePartyWithHint "Claudia" (PartyIdHint "Claudia") christie<- allocatePartyWithHint "Christie" (PartyIdHint "Christie") claudia_Budha <- allocatePartyWithHint "Claudia_Budha" (PartyIdHint "Claudia_Budha") mishconDeReya <- allocatePartyWithHint "MishconDeReya" (PartyIdHint "MishconDeReya") silvia <- allocatePartyWithHint "Silvia" (PartyIdHint "Silvia") time <- getTime submit cms do createCmd SellAsset with asset = asset.Asset newOwnerSolicitor = mishconDeReya newOwner = silvia notes = "Questa villa e' stata venduta"
Thank you ever so much if someone has a bit of time to help!