Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Errors in daml codeForum ↗

Errors in daml code

App Development3 posts191 views1 likesLast activity Dec 2021
BE
Bels3OP
Dec 2021

What’s the best way to handle this error. I don’t seem to get hold of it. Any assistance will be appreciated attached is the screenshot.


BE
bernhard
Dec 2021

fetchByKey has type k -> Update (ContractId t, t), meaning you feed it a key of type k and it returns a tuple consisting of a ContractId and the contract arguments.

So you’d probably want (friendCid, friendArgs) <- fetchByKey @Account t_customer in line 28, and then create friend with balance = friendArgs.balance + t_points in line 33.

Note that you probably also want to archive the old accounts so add archive self and archive friendCid somewhere.

MW
mwangii_k
Dec 2021

I believe the code is trying to implement the sending of points from one person to another with the contract’s balance variable of both users being updated accordingly. Does anyone have an idea of how that can be implemented. Kindly.

← Back to Discussions