Skip to content

Commit

Permalink
The Ambassador Program (#291)
Browse files Browse the repository at this point in the history
### The Ambassador Program on Polkadot Collectives Parachain

Closes #264
Reflects https://polkadot.polkassembly.io/referenda/487

### On Chain Structure
The on-chain program consists of three ranks:
- Ambassadors (rank 1);
- Senior Ambassadors (rank 2);
- Head Ambassadors (rank 3);

Each rank has a corresponding Origin (`Ambassador`, `SeniorAmbassador`,
`HeadAmbassador`), which represents the collective voice of members of
that rank and above.

### Referendum

The `AmbassadorReferenda` instance of [referenda
pallet](https://docs.rs/pallet-referenda/latest/pallet_referenda/)
consists of three tracks, each corresponding to an Origin. A referendum
taken on `senior ambassador` track invites all members from rank 2 or
above to vote and commands `SeniorAmbassadors` Origin. The referendum
proposal can be submitted by any member from first rank or above.

### Membership Management

Both `Root` and `FellowshipAdmin` Origins, commanded via public Polkadot
referendum, can promote or demote members to and from any rank. Members
themselves hold the power to promote or demote via program's referendum
pallet instance. Senior members can promote candidates to the first
rank, while head members can promote all members up to the second rank.
Any member of the program can induct a new member to the collective as a
candidate (0 rank). Promotion to the Head Ambassador or demotion from
can be made with Polkadot OpenGov.

### Sub-Treasury
The program operates its own sub-treasury, managed by OpenGov or Senior
and Head Ambassadors. Members can spend up to 1k DOT on Senior
Ambassador track and up to 10k DOT on Head Ambassadors track.

### Additional Functionality

The `AmbassadorCore` instance of [core fellowship
pallet](https://docs.rs/pallet-core-fellowship/latest/pallet_core_fellowship/)
decorates the ranked collectives pallet with features like salary
determination, activity/passivity registration, and the handling of
promotion and demotion periods. Those parameters can be set by OpenGov
or Head Ambassadors.

Periodic salaries in USDt, payable on Asset Hub, are introduced through
the [salary
pallet](https://docs.rs/pallet-salary/latest/pallet_salary/). The total
monthly budget is set to ( 10k * 21 ) USDt.

### Rules that are not enforced on chain
- 21 members at Head Ambassador rank;
- candidates wont be removed automatically in 6 month;
- collectives with less than 10 HA can onboard new members;

Source:
https://polkadot.polkassembly.io/referenda/487cccccbegbjkdfhkrgekidfrhvkvilnbcvuitgnrcnkrr

---------

Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: joepetrowski <[email protected]>
  • Loading branch information
3 people authored May 20, 2024
1 parent b6f99f2 commit b0a3eff
Show file tree
Hide file tree
Showing 22 changed files with 2,283 additions and 220 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add `pallet-vesting` to Asset Hubs ([polkadot-fellows/runtimes#269](https://github.com/polkadot-fellows/runtimes/pull/269))
- Add Pay Salary Collectives test ([polkadot-fellows/runtimes#260](https://github.com/polkadot-fellows/runtimes/pull/260))
- Add `pallet-xcm::transfer_assets_using_type_and_then()` for complex asset transfers ([polkadot-fellows/runtimes#311](https://github.com/polkadot-fellows/runtimes/pull/311))
- The Ambassador Program ([polkadot-fellows/runtimes#291](https://github.com/polkadot-fellows/runtimes/pull/291))

### Removed

Expand Down
28 changes: 28 additions & 0 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,32 @@ impl Contains<Location> for FellowshipEntities {
}
}

pub struct AmbassadorEntities;
impl Contains<Location> for AmbassadorEntities {
fn contains(location: &Location) -> bool {
matches!(
location.unpack(),
(
1,
[
Parachain(system_parachain::COLLECTIVES_ID),
PalletInstance(
collectives_polkadot_runtime_constants::AMBASSADOR_SALARY_PALLET_INDEX
)
]
) | (
1,
[
Parachain(system_parachain::COLLECTIVES_ID),
PalletInstance(
collectives_polkadot_runtime_constants::AMBASSADOR_TREASURY_PALLET_INDEX
)
]
)
)
}
}

pub struct ParentOrParentsPlurality;
impl Contains<Location> for ParentOrParentsPlurality {
fn contains(location: &Location) -> bool {
Expand Down Expand Up @@ -289,6 +315,7 @@ pub type Barrier = TrailingSetTopicAsId<
FellowshipEntities,
Equals<RelayTreasuryLocation>,
Equals<bridging::SiblingBridgeHub>,
AmbassadorEntities,
)>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
Expand All @@ -314,6 +341,7 @@ pub type WaivedLocations = (
RelayOrOtherSystemParachains<AllSiblingSystemParachains, Runtime>,
Equals<RelayTreasuryLocation>,
FellowshipEntities,
AmbassadorEntities,
);

/// Cases where a remote origin is accepted as trusted Teleporter for a given asset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@

#![no_std]

/// Polkadot Collectives Salary pallet instance.
/// Polkadot Fellowship Salary pallet instance.
pub const FELLOWSHIP_SALARY_PALLET_INDEX: u8 = 64;

/// Polkadot Collectives Treasury pallet instance.
/// Polkadot Fellowship Treasury pallet instance.
pub const FELLOWSHIP_TREASURY_PALLET_INDEX: u8 = 65;

/// Polkadot Ambassador Salary pallet instance.
pub const AMBASSADOR_SALARY_PALLET_INDEX: u8 = 74;

/// Polkadot Ambassador Treasury pallet instance.
pub const AMBASSADOR_TREASURY_PALLET_INDEX: u8 = 75;
Loading

0 comments on commit b0a3eff

Please sign in to comment.