2

I'm writing a chain-extension for a substrate pallet and one of the pallet's functions takes an input parameter which has type Permill. What would be the way to call such function from the contract/chain-extension?

pub fn mint_nft(
          // ---- snip ----

            royalty: Option<Permill>,

        ) -> DispatchResult {
0

1 Answer 1

1

As far as I'm experimenting, u32 works for it. In above example,

royalty: Option<u32>,

on ink! smart contract side.

If you look at Permill macro, u32 is used (at the third bottom arg of implement_per_thing_with_perthousand macro) for its type.

implement_per_thing_with_perthousand!(
    Permill,
    test_permill,
    test_permill_extra,
    [u32, u64, u128],
    1_000_000u32,
    u32,
    u64,
    "_Parts per Million_",
);

I also confirmed, if u32 value is more than million 1000000, decoding will fail on chainextension side.

macro definition

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.