Substrate extrinsic complex (struct) types

Viewed 160

I'm trying to use following struct in extrinsic parameter declaration:

pub struct PriceUpdate {
    pub source_currency: Vec<u8>,
    pub target_currency: Vec<u8>,
    pub provider: Vec<u8>,
    pub price: i64,
}

And here's the extrinsic declaration:

pub fn new_price(origin: OriginFor<T>, price_update: PriceUpdate) -> DispatchResult {

This results in compilation error:

^^^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `PriceUpdate`

Can someone explain as to what are requirements for extrinsic params in respect to complex types such as structs/vecs/vecs of structs/etc? I've seen WrapperTypeEncode docs https://docs.rs/parity-scale-codec/2.2.0/parity_scale_codec/trait.WrapperTypeEncode.html but they don't spell out such information.

Many thanks!

1 Answers
Related