Skip to content

Commit

Permalink
Add pallet-alliance
Browse files Browse the repository at this point in the history
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
  • Loading branch information
koushiro committed Sep 17, 2021
1 parent ba153b9 commit 2369417
Show file tree
Hide file tree
Showing 11 changed files with 2,628 additions and 142 deletions.
90 changes: 84 additions & 6 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 @@ -62,6 +62,7 @@ members = [
"client/transaction-pool",
"client/transaction-pool/api",
"client/utils",
"frame/alliance",
"frame/assets",
"frame/atomic-swap",
"frame/aura",
Expand Down
63 changes: 63 additions & 0 deletions frame/alliance/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[package]
name = "pallet-alliance"
version = "4.0.0-dev"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "Apache-2.0"
homepage = "https://substrate.dev"
repository = "https://github.com/paritytech/substrate/"
description = "Collective system: Members of a set of account IDs can make their collective feelings known through dispatched calls from one of two specialized origins."
readme = "README.md"

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

[dependencies]
cid = { git = "https://github.com/patractlabs/rust-cid", branch = "alliance", default-features = false, features = ["scale-codec","scale-info"] }
log = { version = "0.4.14", default-features = false }

codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }

sp-std = { version = "4.0.0-dev", default-features = false, path = "../../primitives/std" }
sp-core = { version = "4.0.0-dev", default-features = false, path = "../../primitives/core" }
sp-io = { version = "4.0.0-dev", default-features = false, path = "../../primitives/io" }
sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../primitives/runtime" }

frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../benchmarking", optional = true }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }

[dev-dependencies]
cid = { git = "https://github.com/patractlabs/rust-cid", branch = "alliance" }
hex-literal = "0.3.1"
multihash = "0.14.0"
pallet-balances = { version = "4.0.0-dev", path = "../balances" }
pallet-collective = { version = "4.0.0-dev", path = "../collective" }

[features]
default = ["std"]
std = [
"cid/std",
"log/std",
"codec/std",
"scale-info/std",
"sp-std/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"frame-support/std",
"frame-system/std",
]
runtime-benchmarks = [
"frame-benchmarking",
"sp-runtime/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
]
74 changes: 74 additions & 0 deletions frame/alliance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Alliance Pallet

The Alliance Pallet provides a DAO to form an industry group that does two main things:

- provide a set of ethics against bad behaviors.
- provide recognition and influence for those teams that contribute something back to the ecosystem.

## Overview

The Alliance first needs to initialize the Founders with sudo permissions.
After that, anyone with an approved identity and website can apply to become a Candidate.
Members will initiate a motion to determine whether a Candidate can join the Alliance or not.
The motion requires the approval of over 2/3 majority.
The Alliance can also maintain a blacklist list about accounts and websites.
Members can also vote to update the alliance's rule and make announcements.

### Terminology

- Rule: The IPFS Hash of the Alliance Rule for the community to read
and the alliance members to enforce for the management.

- Announcement: An IPFS hash of some content that the Alliance want to announce.

- Member: An account which is already in the group of the Alliance,
including three types: Founder, Fellow, Ally.
Member can also be kicked by super majority motion or retire by itself.

- Founder: An account who is initiated by sudo with normal voting rights for basic motions
and special veto rights for rule change and ally elevation motions.

- Fellow: An account who is elevated from Ally by Founders and other Fellows from Ally.

- Ally: An account who is approved by Founders and Fellows from Candidate.
An Ally doesn't have voting rights.

- Candidate: An account who is trying to become a member.
The applicant should already have an approved identity with website.
The application should be submitted by the account itself with some token as deposit,
or be nominated by an existing Founder or Fellow for free.

- Blacklist: A list of bad websites and addresses, and can be added or removed items by Founders and Fellows.

## Interface

### Dispatchable Functions

#### For General Users
- `submit_candidacy` - Submit the application to become a candidate with deposit.

#### For Members (All)
- `retire` - Member retire to out of the Alliance and release its deposit.

#### For Members (Founders/Fellows)

- `propose` - Propose a motion.
- `vote` - Vote on a motion.
- `close` - Close a motion with enough votes or expired.
- `set_rule` - Initialize or update the alliance's rule by IPFS hash.
- `announce` - Make announcement by IPFS hash.
- `nominate_candidacy` - Nominate a non-member to become a Candidate for free.
- `approve_candidate` - Approve a candidate to become an Ally.
- `reject_candidate` - Reject a candidate and slash its deposit.
- `elevate_ally` - Approve an ally to become a Fellow.
- `kick_member` - Kick a member and slash its deposit.
- `add_blacklist` - Add some items of account and website in the blacklist.
- `remove_blacklist` - Remove some items of account and website from the blacklist.

#### For Members (Only Founders)
- `veto` - Veto on a motion about `set_rule` and `elevate_ally`.

#### For Super Users
- `init_founders` - Initialize the founding members.

License: Apache-2.0
Loading

0 comments on commit 2369417

Please sign in to comment.