-
Notifications
You must be signed in to change notification settings - Fork 115
Staked Roles #6
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
Staked Roles #6
Conversation
src/roles/actors.rs
Outdated
| pub min_stake: BalanceOf<T>, | ||
|
|
||
| // the maximum number of spots available to fill for a role | ||
| pub max_actors: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to swap a position: first min_actors, then max_actors.
It's easier for perception like in counting: from smaller to bigger.
src/roles/actors.rs
Outdated
| AvailableRoles get(available_roles) : Vec<Role>; // = vec![Role::Storage]; | ||
|
|
||
| /// Actors list | ||
| Actors get(actors) : Vec<T::AccountId>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this is a list of actors' account ids, not Actors
| Actors get(actors) : Vec<T::AccountId>; | |
| ActorIds get(actor_ids) : Vec<T::AccountId>; |
src/roles/actors.rs
Outdated
| Actors get(actors) : Vec<T::AccountId>; | ||
|
|
||
| /// actor accounts mapped to their actor | ||
| ActorsByAccountId get(actors_by_account_id) : map T::AccountId => Option<Actor<T>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actor, not Actors, because you return option of an actor, not a list of actors.
| ActorsByAccountId get(actors_by_account_id) : map T::AccountId => Option<Actor<T>>; | |
| ActorByAccountId get(actor_by_account_id) : map T::AccountId => Option<Actor<T>>; |
src/roles/actors.rs
Outdated
| ActorsByAccountId get(actors_by_account_id) : map T::AccountId => Option<Actor<T>>; | ||
|
|
||
| /// actor accounts associated with a role | ||
| AccountsByRole get(accounts_by_role) : map Role => Vec<T::AccountId>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| AccountsByRole get(accounts_by_role) : map Role => Vec<T::AccountId>; | |
| AccountIdsByRole get(account_ids_by_role) : map Role => Vec<T::AccountId>; |
src/roles/actors.rs
Outdated
| AccountsByRole get(accounts_by_role) : map Role => Vec<T::AccountId>; | ||
|
|
||
| /// actor accounts associated with a member id | ||
| AccountsByMember get(accounts_by_member) : map MemberId<T> => Vec<T::AccountId>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| AccountsByMember get(accounts_by_member) : map MemberId<T> => Vec<T::AccountId>; | |
| AccountIdsByMemberId get(account_ids_by_member_id) : map MemberId<T> => Vec<T::AccountId>; |
src/roles/actors.rs
Outdated
| } | ||
|
|
||
| impl<T: Trait> Module<T> { | ||
| fn role_is_available(role: Role) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fn role_is_available(role: Role) -> bool { | |
| fn is_role_available(role: Role) -> bool { |
|
|
||
| fn on_initialise(now: T::BlockNumber) { | ||
| // clear expired requests | ||
| if now % T::BlockNumber::sa(DEFAULT_REQUEST_CLEARING_INTERVAL) == T::BlockNumber::zero() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider creating an extra variable just to make code easier to read, then you can get rid of a comment:
| if now % T::BlockNumber::sa(DEFAULT_REQUEST_CLEARING_INTERVAL) == T::BlockNumber::zero() { | |
| let is_request_expired = now % T::BlockNumber::sa(DEFAULT_REQUEST_CLEARING_INTERVAL) == T::BlockNumber::zero() | |
| if is_request_expired { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you point in general, but in this exact case the that check is just a check to see if we reached the interval where we actually check each request.
New Grid component.
Revert "Bring all up to date."
* Add homepage URL * Allow deployment to gh-pages branch * Bump @polkadot/dev (with deploy:ghpages)
Fix channel agent permissions test cases for initialize/cancel channel transfer
…on-test fix: terminateLeads integraion-tests job in full scenario
Builds on membership module, #3
Some refactoring of council elections, and runtime upgrade proposals module to only allow members to participate.
Adding a simple staking mechanism to enter the new roles introduced in athens. It follows a similar mechanism to validator staking, but allows for using a separate account than will be associated with a members account. A member can enter a role (become an actor for a role) with these steps:
and there is enough balance in the actor account it will be bonded and role is entered into.
Still todo: