4

I am trying to build something that will allow me to use unspent treasury funds as I don't understand the proposal system yet, but I won't be overloading this question with that. Here's the scenario:

The pallet_staking config has this type:

type Reward = (); // rewards are minted from the void

And is defined as :

 type Reward: OnUnbalanced<<<Self as Config>::Currency as Currency<<Self as Config>::AccountId>>::PositiveImbalance>;

I was wondering, how to wire this to the Treasury system. If the Treasury has some balance, that's not being used, instead of minting rewards from the void, use the treasury funds for era staking rewards payout.

How would one go about this? Do I need to write an implementation for OnUnbalanced for Treasury? If so, what should I be writing?

2
  • What would happen if the treasury does not have the funds to pay staking rewards?
    – Gav
    Commented Mar 25, 2022 at 11:16
  • @Gav Yes about that, I was thinking we could fallback to the default mechanism where we just mint from the void, ie, create some PositiveImbalance. Commented Mar 25, 2022 at 12:56

2 Answers 2

3

You can reimplement OnUnbalanced, draining the treasury account as long as it contains funds, and otherwise minting.

However the overall proposal contains some contention: spending (using the normal treasury governance) becomes effectively free in this model if the treasury under-runs. The treasury itself as a limiting factor on network spend thus becomes meaningless and the decision instead turns into a pure "spend it or lose it". E.g. if the treasury contains 1m tokens and there is 2m tokens of staking rewards to be paid, then the council can spend between 0 and 1m tokens from the treasury with no repercussions for the final balance of the treasury: in all cases, the treasury will be empty afterwards.

If this is a reasonable situation, then a more coherent (and easier to implement) alternative could be to always burn all or a large majority of funds in the treasury and always fund the rewards through minting. This would prevent the treasury from being used for much other than staking, but would be a simpler model without this strange artefact.

2

It looks like there's nothing preventing you to just implement your own OnUnbalanced that extracts funds from the treasury, and make minting as a fallback. Probably you can take a look at how OnUnbalanced for () is implemented.

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.