Hello, I’m using a script to migrate some contracts to an updated version 2 (in this specific case the V1 and V2 contract templates are identical) where the newAdmin is the upgraded version of V1 admin; however, I’m getting an INVALID_ARGUMENT: DAML_AUTHORIZATION_ERROR in the lookupByKey of the V2 contract where it requires authorizers TreeSet(“participant”) for lookup by key, but it only has TreeSet(“platform”,“admin”) ((actual ids aren’t given for simplicity, and the log ends in the middle of the “admin” id so I’m not sure if there is a third authorizer without assuming)). How can I make sure that V2.Contacts.Contact is given the correct authorizers, any help would be much appreciated!
The script is:
submitMulti [issuer, newAdmin] [issuer, newAdmin] do exerciseByKeyCmd @UpgradeContactProposal(issuer) UpgradeContact with certId = cert._1, admin = newAdmin
with the Upgrade Proposal:
template UpgradeContactProposal
with
issuer : Party
where
signatory issuer
key issuer : Party
maintainer key
nonconsuming choice UpgradeContact : ContractId V2.Contacts.Contact
with
certId : ContractId V1.Participants.Contact
admin: Party
controller issuer, admin
do cert <- fetch certId
assert (cert.platform == issuer)
newContractOpt <- lookupByKey @V2.Contacts.Contact (cert.contact, cert.admin, admin)
case newContractOpt of
None -> do
create V2.Contacts.Contact with
contact = cert.contact
platform = cert.platform
admin = admin
participant = cert.admin
Some contractId -> do
return contractId
and V2 Contract:
template Contact
with
contact: Party
platform: Party
admin: Party
participant: Party
where
signatory platform, participant
observer contact, admin
key (contact, participant, admin): (Party, Party, Party)
maintainer key._2