Errors in daml code
App Development3 posts191 views1 likesLast activity Dec 2021
BE
Bels3OP
Dec 2021BE
bernhard
Dec 2021fetchByKey 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 2021I 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.

