Active Contracts is not showing when i do daml start

Here is my templets looks like

module Example where
import Daml.Script
template Onboarding
  with
    csd : Party
    issuer : Party
    globalCustodian : Party
    localCustodian : Party
    servicesProvider :Party
    votingParty : Party
    
 
  where
    signatory issuer
    observer csd
    controller issuer can
      CreateMeeting : ContractId Meeting
        with
         title : Text
         details : Text
         regulator : Party
        do
         create Meeting
          with
            globalCustodian
            localCustodian
            csd
            issuer
            title
            details
            observers = [regulator, csd, votingParty]
 
template Meeting
  with
    globalCustodian: Party
    localCustodian: Party
    issuer : Party
    csd : Party
    title : Text
    details : Text
    observers : [Party]
    --nameOfVoter :Text
  where 
    signatory issuer
    --key (issuer, title) : AccountKey
   -- maintainer key._1
    observer observers
    controller csd can
    
            nonconsuming  SendEntitlementNotification : ContractId EntitlementNotification
                 with   
                 votingParty : Party
                 noOfVotes : Int
                 regulator : Party
                 nameOfVoter : Text
                do
                  create EntitlementNotification with
                    globalCustodian
                    regulator
                    meeting = this
                    votingParty
                    noOfVotes
                    nameOfVoter
                    observers= [regulator, localCustodian, globalCustodian, votingParty]
    controller issuer can                
             nonconsuming SendMeetingResults: ContractId MeetingResults
                  with
                  results: Text
                  --localCustodian: Party
                  regulator: Party
                do 
                   create MeetingResults with
                     meeting = this
                     results
                     observers = [regulator, localCustodian, globalCustodian]
                     voters=[]
                      
                       
template  EntitlementNotification
  with
   
         globalCustodian: Party
         regulator: Party
         meeting :  Meeting
         votingParty : Party
         noOfVotes : Int
         observers : [Party]
         nameOfVoter : Text
   where
          signatory meeting.csd
          key (votingParty, nameOfVoter) : (Party, Text)
          maintainer key._1
          observer observers
          controller votingParty can
            SendMeetingInstructions : ContractId MeetingInstructions
             with 
               instructions : Text
               localCustodian : Party
               nameofvoter : Text
             do 
              create MeetingInstructions with 
                 globalCustodian
                 regulator
                 meeting 
                 votingParty 
                 localCustodian 
                 instructions 
                 nameOfVoter
                 noOfVotes              
                 observers =[localCustodian, votingParty, regulator]
 
template MeetingInstructions
   with
       nameOfVoter : Text
       noOfVotes : Int
       globalCustodian: Party
       regulator: Party
       meeting : Meeting
       votingParty : Party
       localCustodian : Party
       instructions : Text                
       observers : [Party]      
    
    where
          signatory votingParty
          observer observers
          controller localCustodian can
           VoteExecution : ContractId ExecuteVote 
            do
              create ExecuteVote with
               nameOfVoter
               noOfVotes
               instructions
               globalCustodian
               localCustodian
               meeting
               regulator
               observers = [localCustodian, globalCustodian, votingParty, regulator]
               
               
template ExecuteVote
 with
  nameOfVoter : Text
  noOfVotes : Int
  instructions : Text
  regulator: Party
  meeting : Meeting
  localCustodian : Party
  globalCustodian: Party
  observers : [Party]
  
 where
  signatory localCustodian
  observer observers
  controller meeting.issuer can
    AcceptVote: ContractId VoteAcceptance
     do 
      create VoteAcceptance with
       nameOfVoter
       noOfVotes
       instructions
       globalCustodian
       regulator
       observers= [localCustodian, globalCustodian, regulator]
       meeting
 
template VoteAcceptance
  with
   nameOfVoter : Text
   noOfVotes : Int
   instructions : Text
   globalCustodian: Party
   meeting : Meeting
   regulator: Party
   observers :[Party]
  where
   signatory meeting.issuer
   observer observers

       
 
template MeetingResults
 with
  meeting: Meeting
  observers :[Party]
  results: Text
  voters: [Party]
 where
  signatory meeting.issuer
  observer observers
                 

setup = script do
  csd <- allocateParty "CSD"
  compx <- allocateParty "Compx"
  local <- allocateParty "Local"
  global <- allocateParty "Global"
 -- regu <- allocateParty "SEBI"
  sp <- allocateParty "ServiceProvider"
  joh <- allocateParty "Vp"

  poff <- submit compx do
      createCmd Onboarding with
        csd = csd
        issuer = compx
        localCustodian = local
        globalCustodian = global
        servicesProvider = sp
        votingParty = joh
  pure ()
      

The script result is shows 1 active contract but when i do the command daml start i unable to view this contract
This is my **daml.yaml ** looks like

# for config file options, refer to
# https://docs.daml.com/tools/assistant.html#project-config-file-daml-yaml

sdk-version: 1.13.1
name: DEMO_2
version: 0.1.0
source: daml
init-script: Example:setup
parties:
  - Compx
  - CSD
  - SEBI
  - Global
  - Local
  - ServiceProvider
  - Vp
  

version: 0.0.1
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-trigger
  - daml-script
  
sandbox-options:
  - --wall-clock-time

Any quick suggestions?

2 Likes

allocateParty creates a party with a more or less random party id with the given display name. So you are logging in with a different party and don’t see the contracts.

Try allocatePartyWithHint "CSD" (PartyIdHint "CSD") (and similar for other parties) which (on Sandbox) will create a party with exactly the id specified in the hint.

2 Likes

Another approach is to delete the parties from your daml.yaml (just tested it myself).

In this way, Navigator will automatically pick up the parties that you allocate in your setup script.

Thanks for the extended repro, it’s very useful to spot issues. :bowing_man:

1 Like

To clarify, the issue is that, with your given code & YAML configuration, you end up with two parties that have displayName: "Compx", and the one the navigator logs in as is not the one your init script uses to create the contract.

2 Likes

That’s not quite right. The parties from your daml.yaml are not allocated on daml start. What happens is the following:

  1. daml start runs the init script which creates a party with display name CompX and a random party id.
  2. daml start starts navigator and offers the choice to log in as the parties specified in your daml.yaml with the parties field being a list of party ids not display names. Logging in still won’t allocate that party. Submitting a command will via implicit party allocation but with an empty display name afaik.
4 Likes

thanks for your piece of help

2 Likes