This is how we write code to add fund to a user in anchor solana project:


Why is the "**" operator used here?

1 Answer 1


If you look at the signature of try_borrow_mut_lamports()?, it returns a RefMut<.., &mut u64). The first * unwraps RefMut and the 2nd one de-references the &mut so you can mutate the underlying value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.