Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimistic Project Funding #6994

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 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
27 changes: 27 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ members = [
"substrate/frame/nomination-pools/test-transfer-stake",
"substrate/frame/offences",
"substrate/frame/offences/benchmarking",
"substrate/frame/opf",
"substrate/frame/paged-list",
"substrate/frame/paged-list/fuzzer",
"substrate/frame/parameters",
Expand Down Expand Up @@ -963,6 +964,7 @@ pallet-nomination-pools-benchmarking = { path = "substrate/frame/nomination-pool
pallet-nomination-pools-runtime-api = { path = "substrate/frame/nomination-pools/runtime-api", default-features = false }
pallet-offences = { path = "substrate/frame/offences", default-features = false }
pallet-offences-benchmarking = { path = "substrate/frame/offences/benchmarking", default-features = false }
pallet-opf = { path = "substrate/frame/opf", default-features = false }
pallet-paged-list = { path = "substrate/frame/paged-list", default-features = false }
pallet-parachain-template = { path = "templates/parachain/pallets/template", default-features = false }
pallet-parameters = { path = "substrate/frame/parameters", default-features = false }
Expand Down
49 changes: 49 additions & 0 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,51 @@ impl pallet_offences::Config for Runtime {
type OnOffenceHandler = Staking;
}


parameter_types! {
// Id of the treasury
pub const PotId: PalletId = PalletId(*b"py/potid");
pub const VotingPeriod:BlockNumber = 30 * DAYS;
pub const ClaimingPeriod: BlockNumber = 7 * DAYS;
pub const VoteValidityPeriod: BlockNumber = 7 * DAYS;
pub const MaxProjects:u32 = 50;


}
impl pallet_opf::Config for Runtime {
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;

type NativeBalance = Balances;

/// Pot PalletId
type PotId = PotId;

/// Maximum number of whitelisted projects
type MaxProjects = MaxProjects;

/// Time period in which people can vote.
/// After the period has ended, the votes are counted (STOP THE COUNT)
/// and then the funds are distributed into Spends.
type VotingPeriod = VotingPeriod;

/// Time for claiming a Spend.
/// After the period has passed, a spend is thrown away
/// and the funds are available again for distribution in the pot.
type ClaimingPeriod = ClaimingPeriod;

/// Period after which all the votes are resetted.
type VoteValidityPeriod = VoteValidityPeriod;

type BlockNumberProvider = System;

type Preimages = Preimage;

type Scheduler = Scheduler;

type WeightInfo = (); //pallet_opf::weights::SubstrateWeight<Runtime>;
}

impl pallet_authority_discovery::Config for Runtime {
type MaxAuthorities = MaxAuthorities;
}
Expand Down Expand Up @@ -2634,6 +2679,9 @@ mod runtime {

#[runtime::pallet_index(81)]
pub type VerifySignature = pallet_verify_signature::Pallet<Runtime>;

#[runtime::pallet_index(82)]
pub type Opf = pallet_opf::Pallet<Runtime>;
}

impl TryFrom<RuntimeCall> for pallet_revive::Call<Runtime> {
Expand Down Expand Up @@ -2894,6 +2942,7 @@ mod benches {
[pallet_example_mbm, PalletExampleMbms]
[pallet_asset_conversion_ops, AssetConversionMigration]
[pallet_verify_signature, VerifySignature]
[pallet_opf, Opf]
);
}

Expand Down
95 changes: 95 additions & 0 deletions substrate/frame/opf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
[package]
authors.workspace = true
description = "Optimist Project Funding - pallet allowing users to nominate projects to be funded, by locking their DOTS."
edition.workspace = true
homepage = "https://substrate.io"
license = "Apache-2.0"
name = "pallet-opf"
readme = "README.md"
repository.workspace = true
version = "0.1.0"

[lints]
workspace = true

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

[dependencies]
codec = { workspace = true, default-features = false }
frame-benchmarking = { optional = true, workspace = true, default-features = false }
frame-support = { workspace = true, default-features = false }
frame-system = { workspace = true, default-features = false }
log = { workspace = true }
pallet-conviction-voting = { workspace = true, default-features = false }
pallet-scheduler = { workspace = true, default-features = false }
scale-info = { features = [
"derive",
], workspace = true, default-features = false }
serde = { optional = true, workspace = true, default-features = true }
sp-core = { workspace = true, default-features = false }
sp-io = { workspace = true, default-features = false }
sp-runtime = { workspace = true, default-features = false }
sp-std = { workspace = true, default-features = true }

[dev-dependencies]
pallet-assets = { workspace = true, default-features = true }
pallet-balances = { workspace = true, default-features = true }
pallet-preimage = { workspace = true, default-features = true }
pallet-scheduler = { workspace = true, default-features = true }
pallet-sudo = { workspace = true, default-features = true }
pallet-timestamp = { workspace = true, default-features = true }
pallet-transaction-payment = { workspace = true, default-features = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true, default-features = true }

[features]
default = ["std"]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-conviction-voting/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks",
"scale-info/std",
"serde",
"sp-runtime/runtime-benchmarks",
]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
"pallet-assets/std",
"pallet-balances/std",
"pallet-conviction-voting/std",
"pallet-preimage/std",
"pallet-scheduler/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-assets/try-runtime",
"pallet-balances/try-runtime",
"pallet-conviction-voting/try-runtime",
"pallet-preimage/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"sp-runtime/try-runtime",
]
ndkazu marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
Loading
Loading