I'm new to Substrate and I'm creating a pallet in which the user can create contests by depositing a certain amount of assets. My idea is to send that amount to the PalletId account, but I'm having an error "Err(Token(CannotCreate))" when testing, and it's happening in the following function:
T::Assets::transfer(
prize_token_id,
&who,
&Self::account_id(),
prize_token_amount,
false
)?;
I didn't find it when I tried to see if anyone had something like this. I know the error is related to providers and consumers, but I couldn't relate it to my problem.
What could be happening to throw this error?
EDITED:
The repo is here: https://github.com/pablolteixeira/constests-unit-network/blob/main/substrate-node-unitchain/pallets/contests/src/lib.rs
On line 240, it's possible to find the "transfer" function that is panicking.
cargo test -p pallet-contests
is sufficient to see the error happening.