I need some syntax help (I think), either that, or I am not supplying enough arguments.
I have setup a script in which I am supplying arguments to a template that in turn is referencing another template. I don’t know how to supply multiple arguments to it in terms of syntax which is why I think the script seems to be getting a parser error.
Here is my template in question.
template ProposalGuildApproval with
signedproposal: Proposal
approvingmember: [Party]
And the Proposal
template
template Proposal with
issuer: Party
investor: Party
guild: Guild
projectdescription: Text
unitsrequired: Int
marketingcost: Int
distributioncost: Int
additionalcost: Int
proposalId: Text -- Key
item: Item
And I believe this is the line where my script is resulting in a parser error on the submission
pending <- alice `submit` do
create ProposalGuildApproval with signedproposal; approvingmember = [alice]
The actual parser error is occurring with the following piece of code
guildapproval = script do
(under the “=” sign) which is why I suspect I am not supplying enough arguments but i am not sure what is missing.
Here is the full script code inspired by the documentation
-- RUN_SCRIPT_PROPOSAL --
alice <- allocateParty "Alice"
hakan <- allocateParty "Hakan"
martin <- allocateParty "Martin"
rita <- allocateParty "Rita"
john <- allocateParty "John"
michael <- allocateParty "Michael"
sam <- allocateParty "Sam"
james <- allocateParty "James"
guildapproval = script do
let signedproposal = Proposal with
issuer = alice
investor = hakan
guild = Guild with
guildName = "Martin's Guild"
creator = martin
members = [martin, rita, john, michael, sam, james]
projectdescription = "test"
unitsrequired = 5
marketingcost = 5
distributioncost = 10
additionalcost = 10
proposalId = "p1"
--- because this was a data declaration
item = Item with
unitdesignation = "kilos"
priceperunit = 5
-- Parties cannot create a contract already signed by someone else
initialFailTest <- alice `submitMustFail` do
create ProposalGuildApproval with signedproposal; approvingmember = [alice, hakan]
-- Any party can create a Pending contract provided they list themselves as the only signatory
pending <- alice `submit` do
create ProposalGuildApproval with signedproposal; approvingmember = [alice]
-- Each signatory of the finalContract can Sign the Pending contract
pending <- hakan `submit` do
exercise pending Approve with approver = hakan
pending <- martin `submit` do
exercise pending Approve with approver = martin
pending <- rita `submit` do
exercise pending Approve with approver = rita
pending <- john `submit` do
exercise pending Approve with approver = john
pending <- michael `submit` do
exercise pending Approve with approver = michael
pending <- sam `submit` do
exercise pending Approve with approver = sam
pending <- james `submit` do
exercise pending Approve with approver = james
-- A party can't sign the Pending contract twice
pendingFailTest <- martin `submitMustFail` do
exercise pending Approve with approver = martin
-- A party can't sign on behalf of someone else
pendingFailTest <- martin `submitMustFail` do
exercise pending Approve with approver = rita
alice `submit` do
exercise pending FinaliseApproval with approver = alice
-- END_SCRIPT --
It could be an indentation issue, but I did check indentation as well.