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 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3cd49b3
new start
ndkazu Dec 24, 2024
0a41d8f
Merge branch 'OPF' of github.com:ndkazu/polkadot-sdk into OPF
ndkazu Dec 24, 2024
859e6b3
New OPF pallet in work...
ndkazu Dec 24, 2024
788b33f
Added main extrinsics
ndkazu Dec 26, 2024
ba95275
Merge branch 'paritytech:master' into OPF
ndkazu Dec 29, 2024
1051e52
Merge branch 'paritytech:master' into OPF
ndkazu Dec 30, 2024
0f6bd3d
extrinsic #0 added
ndkazu Dec 30, 2024
54701b7
Added some helpers and extrinsic_#1
ndkazu Dec 30, 2024
e09ff11
Remove unneedded storage
ndkazu Dec 30, 2024
a52879a
prdoc
ndkazu Dec 30, 2024
e023fef
cargo fmt
ndkazu Dec 30, 2024
c5104d7
Claim_reward conditions
ndkazu Dec 30, 2024
f440a8e
cargo fmt
ndkazu Dec 30, 2024
4b3ea70
Merge branch 'paritytech:master' into OPF
ndkazu Dec 31, 2024
27f9107
Hook on_idle added
ndkazu Dec 31, 2024
57f751d
Adding some errors
ndkazu Jan 1, 2025
b639990
Re-factored the code
ndkazu Jan 1, 2025
757d7a4
Listing/unlisting reserved to Root
ndkazu Jan 1, 2025
bf03902
Add pallet-referenda
ndkazu Jan 2, 2025
64be231
Merge branch 'paritytech:master' into OPF
ndkazu Jan 3, 2025
e50dd8c
Merge branch 'paritytech:master' into OPF
ndkazu Jan 4, 2025
9ad6f98
Applied some corrections
ndkazu Jan 4, 2025
2d39b0c
Custom Origin
ndkazu Jan 4, 2025
21a3169
Batch registration
ndkazu Jan 5, 2025
dddba9f
Merge branch 'master' into OPF
ndkazu Jan 7, 2025
78454bc
Correction
ndkazu Jan 7, 2025
367d7bb
Using pallet democracy instead of pallet referenda
ndkazu Jan 7, 2025
d3b9928
Referendums started on project batch submission
ndkazu Jan 7, 2025
5aa92ec
Merge branch 'master' into OPF
ndkazu Jan 9, 2025
1e317a5
Remove unused variable
ndkazu Jan 9, 2025
fb17973
Merge branch 'master' into OPF
ndkazu Jan 10, 2025
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