move icon indicating copy to clipboard operation
move copied to clipboard

[Bug]chap 5 : address with no value + missing acquires annotation

Open 0xZangetsudev opened this issue 4 years ago • 1 comments

Hello, when I run the move test for the chap 5 solutions, so basically the same code as in the repo, I get some errors:

  ┌─ ./sources/BasicCoin.move:1:8
  │
1 │ module NamedAddr::BasicCoin {
  │        ^^^^^^^^^ address 'NamedAddr' is not assigned a value. Try assigning it a value when calling the compiler

I get multiples address with no value "address 'NamedAddr' is not assigned a value. Try assigning it a value when calling the compiler" so if I change it by @0x3 for example it works but I would like to know how we can "assigning it a value when calling the compiler" ? Maybe with const NamedAddr = @0x3 ?

  • the others errors are these :
   ┌─ ./sources/BasicCoin.move:60:17
   │
38 │     public fun balance_of(owner: address): u64 acquires Balance {
   │                                                         ------- The call acquires 'NamedAddr::BasicCoin::Balance', but the 'acquires' list for the current function does not contain this type. It must be present in the calling context's acquires list
   ·
60 │         let balance = balance_of(addr);
   │                       ^^^^^^^^^^^^^^^^ Invalid call to 'NamedAddr::BasicCoin::balance_of'

So "missing aquires annotation" for each acquires Balance, but Balance is a struct with a key to Coin so I don't get it

Thank you!

0xZangetsudev avatar Aug 30 '22 12:08 0xZangetsudev

Ok I think I understood for the namedaddr but not for the acquires yet

0xZangetsudev avatar Aug 30 '22 13:08 0xZangetsudev