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

Feat/crowdloan pallet #1503

Open
wants to merge 34 commits into
base: devnet-ready
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9914812
feat: logic for lending pool creation + tests
l0r1s Mar 27, 2025
a52b4ab
cargo clippy
l0r1s Mar 27, 2025
3a87101
cargo fmt
l0r1s Mar 27, 2025
db28624
refacto to crowdloan instead of lending pool
l0r1s Mar 28, 2025
f123607
wip move specific subnet crowdloan to a more generic crowdloan pallet
l0r1s Mar 31, 2025
5f34018
track crowdloan account id
l0r1s Mar 31, 2025
a70a1d0
contribute to crowdloan + tests
l0r1s Mar 31, 2025
8f3b883
cleanup crowdloan from subtensor pallet
l0r1s Mar 31, 2025
549724f
wip refacto + withdraw
l0r1s Mar 31, 2025
b5f9a21
added tests for withdraw
l0r1s Mar 31, 2025
d5be5ee
added refund logic + tests
l0r1s Apr 1, 2025
5c989a8
refacto + fix tests
l0r1s Apr 2, 2025
32b6171
wip finalize logic
l0r1s Apr 2, 2025
a7528bc
add finalize event
l0r1s Apr 2, 2025
5f4ef76
some fix + tests for finalize
l0r1s Apr 2, 2025
52c6ee1
refacto depositor to creator
l0r1s Apr 2, 2025
857615a
add missing test for insufficient balance from contributor
l0r1s Apr 2, 2025
87bd5af
add missing tests on bad origin (root/none)
l0r1s Apr 2, 2025
1d2b3bb
make it such we can't exceed the cap when contributing
l0r1s Apr 3, 2025
58fb6a2
fix rust
l0r1s Apr 3, 2025
0655c43
added test pallet to ensure crowdloan id is available in the dispatch…
l0r1s Apr 3, 2025
46024f1
added readme and docs to crowdloan pallet
l0r1s Apr 3, 2025
bd5d687
remove unused comments
l0r1s Apr 3, 2025
7e3faaa
fix crowdloan pallet docs
l0r1s Apr 3, 2025
c33239b
revert spaces in files
l0r1s Apr 3, 2025
2069831
fix rust
l0r1s Apr 3, 2025
b732b54
fix tests + move to mock
l0r1s Apr 7, 2025
db922ce
fix some tests
l0r1s Apr 7, 2025
e2c0c89
fix some tests + rename event
l0r1s Apr 8, 2025
f2b2607
include crowdloan pallet into runtime
l0r1s Apr 8, 2025
cca8443
wip benchmarking
l0r1s Apr 8, 2025
4d9904e
fix tests + benchmarking finalize
l0r1s Apr 8, 2025
0fc7c30
run benchmarking + add weights to extrinsic
l0r1s Apr 8, 2025
8a89914
fix min/max block duration for crowdloan
l0r1s Apr 8, 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
18 changes: 18 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pallet-admin-utils = { default-features = false, path = "pallets/admin-utils" }
pallet-collective = { default-features = false, path = "pallets/collective" }
pallet-commitments = { default-features = false, path = "pallets/commitments" }
pallet-registry = { default-features = false, path = "pallets/registry" }
pallet-crowdloan = { default-features = false, path = "pallets/crowdloan" }
pallet-subtensor = { default-features = false, path = "pallets/subtensor" }
subtensor-custom-rpc = { default-features = false, path = "pallets/subtensor/rpc" }
subtensor-custom-rpc-runtime-api = { default-features = false, path = "pallets/subtensor/runtime-api" }
Expand Down
55 changes: 55 additions & 0 deletions pallets/crowdloan/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[package]
name = "pallet-crowdloan"
version = "0.1.0"
edition = "2024"
authors = ["Bittensor Nucleus Team"]
license = "Apache-2.0"
homepage = "https://bittensor.com"
description = "FRAME crowdloan pallet"
publish = false
repository = "https://github.com/opentensor/subtensor"

[lints]
workspace = true

[dependencies]
subtensor-macros.workspace = true
scale-info = { workspace = true, features = ["derive"] }
codec = { workspace = true, features = ["max-encoded-len"] }
frame-benchmarking = { optional = true, workspace = true }
frame-support.workspace = true
frame-system.workspace = true
sp-runtime.workspace = true
sp-std.workspace = true

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

[features]
default = ["std"]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"sp-runtime/std",
"sp-std/std",
"sp-io/std",
"sp-core/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
"pallet-balances/try-runtime",
]
21 changes: 21 additions & 0 deletions pallets/crowdloan/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Crowdloan Pallet
A pallet allowing to create and manage generic crowdloans around a transfer of funds and a arbitrary call.

A user of this pallet can create a crowdloan by providing a deposit, a cap, an end block, a target address and a call.

Users will be able to contribute to the crowdloan by providing funds to the crowdloan they chose to contribute to.

Once the crowdloan is finalized, the funds will be transferred to the target address and the call will be dispatched with the current crowdloan id as a temporary storage item.

In case the crowdloan fails to raise the cap, the initial deposit will be returned to the creator and contributions will be returned to the contributors.

## Overview

## Interface

### Dispatchable Functions

[`Call`]: ./enum.Call.html
[`Config`]: ./trait.Config.html

License: Apache-2.0
Loading
Loading