Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Merge requests
!286
Refactore Runtime handlers and providers
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Refactore Runtime handlers and providers
refactore-handlers
into
master
Overview
1
Commits
4
Pipelines
10
Changes
6
Merged
Benjamin Gallois
requested to merge
refactore-handlers
into
master
5 months ago
Overview
1
Commits
4
Pipelines
10
Changes
6
Expand
Move all handlers to
handlers.rs
Move all providers to
providers.rs
Make
Treasury::account_id()
a constant
Edited
5 months ago
by
Benjamin Gallois
0
0
Merge request reports
Compare
master
version 4
86c015e1
5 months ago
version 3
effd4a97
5 months ago
version 2
e88b9a4b
5 months ago
version 1
40404150
5 months ago
master (base)
and
latest version
latest version
88c83a4f
4 commits,
5 months ago
version 4
86c015e1
4 commits,
5 months ago
version 3
effd4a97
3 commits,
5 months ago
version 2
e88b9a4b
2 commits,
5 months ago
version 1
40404150
1 commit,
5 months ago
6 files
+
67
−
68
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
runtime/common/src/handlers.rs
+
27
−
2
Options
@@ -15,7 +15,10 @@
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use
super
::{
entities
::
*
,
AccountId
,
IdtyIndex
};
use
frame_support
::{
pallet_prelude
::
Weight
,
traits
::
UnfilteredDispatchable
};
use
frame_support
::{
pallet_prelude
::
Weight
,
traits
::{
Imbalance
,
UnfilteredDispatchable
},
};
use
pallet_smith_members
::
SmithRemovalReason
;
use
sp_core
::
Get
;
@@ -97,7 +100,7 @@ impl<
/// done at the handler level.
pub
struct
OnRemoveMembershipHandler
<
Runtime
>
(
core
::
marker
::
PhantomData
<
Runtime
>
);
impl
<
Runtime
:
frame_system
::
Config
<
AccountId
=
AccountId
>
Runtime
:
frame_system
::
Config
+
pallet_identity
::
Config
<
IdtyData
=
IdtyData
,
IdtyIndex
=
IdtyIndex
>
+
pallet_smith_members
::
Config
<
IdtyIndex
=
IdtyIndex
>
+
pallet_duniter_wot
::
Config
@@ -178,3 +181,25 @@ impl<
!
pallet_authority_members
::
Pallet
::
<
Runtime
>
::
online
()
.contains
(
idty_index
)
}
}
/// Runtime handler for managing fee handling by transferring unbalanced amounts to a treasury account.
pub
struct
HandleFees
<
TreasuryAccount
,
Balances
>
(
frame_support
::
pallet_prelude
::
PhantomData
<
TreasuryAccount
>
,
frame_support
::
pallet_prelude
::
PhantomData
<
Balances
>
,
);
type
CreditOf
<
Balances
>
=
frame_support
::
traits
::
tokens
::
fungible
::
Credit
<
AccountId
,
Balances
>
;
impl
<
TreasuryAccount
,
Balances
>
frame_support
::
traits
::
OnUnbalanced
<
CreditOf
<
Balances
>>
for
HandleFees
<
TreasuryAccount
,
Balances
>
where
TreasuryAccount
:
Get
<
AccountId
>
,
Balances
:
frame_support
::
traits
::
fungible
::
Balanced
<
AccountId
>
,
{
fn
on_nonzero_unbalanced
(
amount
:
CreditOf
<
Balances
>
)
{
// fee is moved to treasury
let
_
=
Balances
::
deposit
(
&
TreasuryAccount
::
get
(),
amount
.peek
(),
frame_support
::
traits
::
tokens
::
Precision
::
Exact
,
);
}
}
Loading