Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ members = [
"pallets/qpow",
"pallets/reversible-transfers",
"pallets/scheduler",
"pallets/treasury",
"pallets/wormhole",
"primitives/consensus/pow",
"primitives/consensus/qpow",
Expand Down Expand Up @@ -59,6 +60,7 @@ futures-timer = { version = "3.0.2" }
hash-db = { version = "0.16.0", default-features = false }
hashbrown = "0.15.3"
hex = { version = "0.4.3", default-features = false }
impl-trait-for-tuples = { version = "0.2.2", default-features = false }
ip_network = { version = "0.4.1" }
itertools = { version = "0.11" }
jsonrpsee = { version = "0.24.3" }
Expand Down Expand Up @@ -124,6 +126,7 @@ pallet-mining-rewards = { path = "./pallets/mining-rewards", default-features =
pallet-qpow = { path = "./pallets/qpow", default-features = false }
pallet-reversible-transfers = { path = "./pallets/reversible-transfers", default-features = false }
pallet-scheduler = { path = "./pallets/scheduler", default-features = false }
pallet-treasury = { path = "./pallets/treasury", default-features = false }
pallet-wormhole = { path = "./pallets/wormhole", default-features = false }
qp-dilithium-crypto = { path = "./primitives/dilithium-crypto", version = "0.1.3", default-features = false }
qp-scheduler = { path = "./primitives/scheduler", default-features = false }
Expand Down Expand Up @@ -171,7 +174,7 @@ pallet-timestamp = { version = "40.0.0", default-features = false }
pallet-transaction-payment = { version = "41.0.0", default-features = false }
pallet-transaction-payment-rpc = { version = "44.0.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { version = "41.0.0", default-features = false }
pallet-treasury = { version = "40.0.0", default-features = false }
#pallet-treasury = { version = "40.0.0", default-features = false }
pallet-utility = { version = "41.0.0", default-features = false }
pallet-vesting = { version = "41.0.0", default-features = false }
prometheus-endpoint = { version = "0.17.2", default-features = false, package = "substrate-prometheus-endpoint" }
Expand Down
62 changes: 62 additions & 0 deletions pallets/treasury/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[package]
authors.workspace = true
description = "FRAME pallet to manage treasury"
edition.workspace = true
homepage.workspace = true
license = "Apache-2.0"
name = "pallet-treasury"
readme = "README.md"
repository.workspace = true
version = "40.0.0"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { features = ["derive", "max-encoded-len"], workspace = true }
docify = { workspace = true }
frame-benchmarking = { optional = true, workspace = true }
frame-support.workspace = true
frame-system.workspace = true
impl-trait-for-tuples = { workspace = true }
log = { workspace = true }
pallet-balances.workspace = true
scale-info = { features = ["derive"], workspace = true }
serde = { features = ["derive"], optional = true, workspace = true, default-features = true }
sp-core = { optional = true, workspace = true }
sp-runtime.workspace = true

[dev-dependencies]
pallet-utility = { default-features = true, workspace = true }
sp-io = { default-features = true, workspace = true }

[features]
default = ["std"]
runtime-benchmarks = [
"dep:sp-core",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
"pallet-balances/std",
"scale-info/std",
"serde",
"sp-core?/std",
"sp-runtime/std",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"pallet-utility/try-runtime",
"sp-runtime/try-runtime",
]
39 changes: 39 additions & 0 deletions pallets/treasury/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Treasury Pallet

The Treasury pallet provides a "pot" of funds that can be managed by stakeholders in the system and
a structure for making spending proposals from this pot.

## Overview

The Treasury Pallet itself provides the pot to store funds, and a means for stakeholders to propose,
approve, and deny expenditures. The chain will need to provide a method (e.g.inflation, fees) for
collecting funds.

By way of example, the Council could vote to fund the Treasury with a portion of the block reward
and use the funds to pay developers.

### Terminology

- **Proposal:** A suggestion to allocate funds from the pot to a beneficiary.
- **Beneficiary:** An account who will receive the funds from a proposal if the proposal is
approved.
- **Deposit:** Funds that a proposer must lock when making a proposal. The deposit will be returned
or slashed if the proposal is approved or rejected respectively.
- **Pot:** Unspent funds accumulated by the treasury pallet.

## Interface

### Dispatchable Functions

General spending/proposal protocol:
- `spend_local` - Propose and approve a spend of treasury funds, enables the
creation of spends using the native currency of the chain, utilizing the funds
stored in the pot
- `spend` - Propose and approve a spend of treasury funds, allows spending any
asset kind managed by the treasury
- `remove_approval` - Force a previously approved proposal to be removed from
the approval queue
- `payout` - Claim a spend
- `check_status` - Check the status of the spend and remove it from the storage
if processed
- `void_spend` - Void previously approved spend
Loading
Loading