0

Sorry for the rudimentary question, I'm new to Rust and ink!

I get a lot of errors when I run cargo +nightly contract test. I have checked the official site for the usage of ink_storage::Mapping, but am I implementing it properly?

error[E0614]: type `u128` cannot be dereferenced
   --> lib.rs:102:26
    |
102 |             let token1 = *self.token1Balance.get(&caller).unwrap_or(0);
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

enter image description here

repo is bellow:https://github.com/tnkshuuhei/WasmAMMcontract/lib.rs

1 Answer 1

1

IMO, this is a pure-rust question. You'd better ask at https://stackoverflow.com/questions/tagged/rust.

Check https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html.

Remove the * before the expression.

u128 is can not be dereferenced.

You only need to do that if the type is &u128.

1
  • Indeed, I will use it with Stackoverflow. Anyway, I did as you advised and the error disappeared. Thank you very much!!
    – Steve
    Oct 9, 2022 at 11:31

Your Answer

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

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