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

Signal pallet from scratch #69

Merged
merged 8 commits into from
Aug 4, 2022
Merged

Signal pallet from scratch #69

merged 8 commits into from
Aug 4, 2022

Conversation

vovacha
Copy link
Contributor

@vovacha vovacha commented Jul 29, 2022

The Signal pallet was created from scratch #65

Interface changes:

  • One extrinsic for all proposal types.
  • One extrinsic for all voting types.

New features:

  • spending proposal #22
  • signal: add a deposit to proposal as collateral #62
  • Automated slashing.
  • Scheduled proposal activation, if start > current block (Created -> Activated).
  • Majority types (Simple, Relative, Absolute) General Proposal + determine Majority gamedao-haiku#108
  • Voting power: Unit (Person, Token), Scale (Linear, Quadratic).
  • Quorum.
  • Token weighted voting.
  • MultiCurrency support for Withdrawal and Spending proposals (Flow Campaigns still don't support it).
  • Early finalization: Absolute majority > 50% or everybody voted.
  • Add validation for voting: org members allowed for General or Spending proposals, and campaign contributors allowed for Withdrawal proposals.

Other changes:

  • Storage reduced from 27 to 6 items SBP: Signal #57
  • Naming changes for Events (I was inspired by FRAME pallets) - could be a discussion.
  • Types changes
  • Tests, mocks, benchmarks, weights.

Next steps:

  • Create documentation - in progress.
  • Flow pallet: add support for multiple currencies Add multi-currency support for Flow pallet #70
  • Testing approach should be reconsidered since its current implementation has too much of repeated code (create test framework, refactor, etc.).
  • on_finalize seems to be heavy. Find out the proper value for MaxProposalsPerBlock
  • Add docs. Some are missing.
  • Multiple options/choices voting - this is not ready yet. Medium size task up to 5 SP.

Extrinsics:

pub fn proposal(
	origin: OriginFor<T>,
	proposal_type: ProposalType,
	org_id: T::Hash,
	title: BoundedVec<u8, T::StringLimit>,
	cid: BoundedVec<u8, T::StringLimit>,
	expiry: T::BlockNumber,
	majority: Majority,
	unit: Unit,
	scale: Scale,
	// Optional params:
	start: Option<T::BlockNumber>,
	quorum: Option<Permill>,
	deposit: Option<T::Balance>,
	// Optional proposal specific params:
	campaign_id: Option<T::Hash>,
	amount: Option<T::Balance>,
	beneficiary: Option<T::AccountId>,
	currency_id: Option<T::CurrencyId>,
)

pub fn vote(
	origin: OriginFor<T>,
	proposal_id: T::Hash,
	approve: bool,
	deposit: Option<T::Balance>,
) 

@vovacha vovacha force-pushed the feature/governance branch from 7e83958 to f7dbd5b Compare July 29, 2022 00:38
@vovacha vovacha requested review from vayesy and 2075 July 29, 2022 01:41
@vovacha vovacha marked this pull request as ready for review July 29, 2022 01:41
@vovacha vovacha self-assigned this Jul 29, 2022
@vovacha
Copy link
Contributor Author

vovacha commented Jul 29, 2022

After the recent discussion, the Spending proposal logic should be changed.

  • remove Failed proposal status -> should be Finalized instead
  • add funds reserving on proposal start
  • transfer reserved funds at the end

I am switching PR to draft.

@vovacha vovacha marked this pull request as draft July 29, 2022 09:14
@vovacha vovacha marked this pull request as ready for review August 2, 2022 19:35
signal/src/lib.rs Outdated Show resolved Hide resolved
signal/src/lib.rs Outdated Show resolved Hide resolved
signal/src/lib.rs Show resolved Hide resolved
signal/src/lib.rs Outdated Show resolved Hide resolved
signal/src/lib.rs Show resolved Hide resolved
@vovacha vovacha requested a review from vayesy August 4, 2022 12:30
Copy link
Contributor

@vayesy vayesy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! 👍

@vayesy vayesy merged commit 9221578 into release-1.1.1 Aug 4, 2022
@vayesy vayesy deleted the feature/governance branch August 4, 2022 14:33
Copy link
Member

@2075 2075 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job 👌

vovacha added a commit that referenced this pull request Aug 5, 2022
vovacha added a commit that referenced this pull request Aug 5, 2022
@vovacha vovacha restored the feature/governance branch August 5, 2022 09:40
vovacha added a commit that referenced this pull request Aug 5, 2022
* Add governance pallet

* Finalize signal changes

* Remove redundant code

* Fix whitespace

* Fix whitespace

* Add token-weighted voting, fix spending proposal

* PR Review changes

* PR Review changes
@vovacha
Copy link
Contributor Author

vovacha commented Aug 5, 2022

Wrong target branch, changes reverted. New PR #79

vovacha added a commit that referenced this pull request Aug 5, 2022
vovacha added a commit that referenced this pull request Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants