0
impl pallet_staking::Config for Runtime {
    type RewardRemainder = Treasury;
}

how can i give it to sudo account

1 Answer 1

0

RewardRemainder need an object that implement OnUnbalanced.

We can simply implement one for it. Put such code in your runtime/lib.rs:

use frame_support::traits::Imbalance;
pub type NegativeImbalanceOf =
    <Balances as frame_support::traits::Currency<AccountId>>::NegativeImbalance;
pub struct ToSudo;
impl frame_support::traits::OnUnbalanced<NegativeImbalanceOf> for ToSudo {
    fn on_nonzero_unbalanced(amount: NegativeImbalanceOf) {
        let numeric_amount = amount.peek();
        if let Some(k) = Sudo::key() {
            <Balances as frame_support::traits::Currency<AccountId>>::resolve_creating(&k, amount);
        } else {
            // TODO: handle no sudo key.
        }
    }
}

This code works for my Substrate version. You might need to make some tweak for your.

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.