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
Commits
f357c9ec
Unverified
Commit
f357c9ec
authored
1 year ago
by
bgallois
Browse files
Options
Downloads
Patches
Plain Diff
add DustHandle
parent
df366830
No related branches found
No related tags found
No related merge requests found
Pipeline
#32366
failed
1 year ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
runtime/common/src/pallets_config.rs
+13
-1
13 additions, 1 deletion
runtime/common/src/pallets_config.rs
with
13 additions
and
1 deletion
runtime/common/src/pallets_config.rs
+
13
−
1
View file @
f357c9ec
...
...
@@ -147,7 +147,7 @@ macro_rules! pallets_config {
type
ReserveIdentifier
=
[
u8
;
8
];
/// The type for recording an account's balance.
type
Balance
=
Balance
;
type
DustRemoval
=
();
// TODO Treasury
;
type
DustRemoval
=
HandleDust
;
type
ExistentialDeposit
=
ExistentialDeposit
;
type
AccountStore
=
Account
;
type
HoldIdentifier
=
();
...
...
@@ -159,6 +159,18 @@ macro_rules! pallets_config {
type
WeightInfo
=
common_runtime
::
weights
::
pallet_balances
::
WeightInfo
<
Runtime
>
;
}
// Take Dust from Balances and put it in the Treasury pot
use
crate
::
sp_api_hidden_includes_construct_runtime
::
hidden_include
::
traits
::
Currency
;
use
crate
::
sp_api_hidden_includes_construct_runtime
::
hidden_include
::
traits
::
Imbalance
;
pub
struct
HandleDust
;
type
CreditOf
=
frame_support
::
traits
::
tokens
::
fungible
::
Credit
<
AccountId
,
Balances
>
;
impl
frame_support
::
traits
::
OnUnbalanced
<
CreditOf
>
for
HandleDust
{
fn
on_nonzero_unbalanced
(
amount
:
CreditOf
)
{
let
imbalance
=
NegativeImbalance
::
new
(
amount
.peek
());
Balances
::
resolve_creating
(
&
Treasury
::
account_id
(),
imbalance
);
}
}
pub
struct
HandleFees
;
type
NegativeImbalance
=
<
Balances
as
frame_support
::
traits
::
Currency
<
AccountId
>>
::
NegativeImbalance
;
impl
frame_support
::
traits
::
OnUnbalanced
<
NegativeImbalance
>
for
HandleFees
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment