Errors in daml code

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.


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.

1 Like

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.