0

In my contract I want to store addresses of all users who called a specific function of the contract. For that purpose I use

    #[ink(storage)]
    #[derive(SpreadAllocate)]
    pub struct Postbox {
        --snip--
        // Accounts of members;
        members: Vec<AccountId>,
        --snip--
    }

storage struct.

But at compile time it throws about 30 errors like:

error[E0277]: the size for values of type `__ink_EventBase` cannot be known at compilation time

   |
8  | #[ink::contract]
   | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `__ink_EventBase`

I figured out that this members vector was causing it. I've changed contained type from AccountId to just i32 and the error was still there.
Does it mean that I can't use Vec in storage? Why?
What should I use instead then?

1 Answer 1

3

Ah, I just had to explicitely import ink_prelude::vec::Vec for that.

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.