I'm trying to use a custom struct inside a Mapping, but I get many errors when trying to compile my code.
Here is the custom struct I want to use inside a Mapping:
#[ink::storage_item]
pub struct Transaction {
creator:AccountId,
approvers: Mapping<AccountId, Balance>,
number_of_approvals:Balance,
psp22_token_to_transfer:AccountId,
recipient:AccountId,
transaction_number:Balance
}
And this is how I try to use the Mapping inside the contract struct:
#[ink(storage)]
pub struct MultiSig {
deployer: AccountId,
wallet_participants: Vec<AccountId>,
number_of_participants: Balance,
number_of_transactions: Balance,
wallet_tokens: Mapping<AccountId,Balance>,
wallet_transactions: Mapping<Balance,(Transaction,Balance)>
}
The errors that I get are related to decode
and encode
and "StorableHint", here are some of the errors that I'm getting:
the trait `parity_scale_codec::Decode` is not implemented for `(multi_sig::Transaction, u128)`
the trait `Encode` is not implemented for `(multi_sig::Transaction, u128)`
the trait `StorableHint<()>` is not implemented for `ink::storage::Mapping<u128, (multi_sig::Transaction, u128)>`
I'm using the following documentation in order to implement a custom struct:
Thank you in advance :)