Skip to content

Commit

Permalink
Update fee share (#1418)
Browse files Browse the repository at this point in the history
* refactor: 💡 for review

* fix: 🐛 mv storage

* fix: 🐛 bench

* refactor: 💡 fmt

---------

Co-authored-by: Edwin <lark930@gmail.com>
  • Loading branch information
yooml and ark930 authored Sep 10, 2024
1 parent b30fab0 commit 8e2b7c5
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 122 deletions.
44 changes: 22 additions & 22 deletions pallets/fee-share/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,41 @@ edition = "2021"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
log = { workspace = true }
parity-scale-codec = { workspace = true, features = ["derive"] }
scale-info = { workspace = true, features = ["derive"] }
bifrost-primitives = { workspace = true }
bifrost-slp = { workspace = true }
bifrost-vtoken-minting = { workspace = true }
cumulus-primitives-core = { workspace = true }
frame-benchmarking = { workspace = true, optional = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
frame-benchmarking = { workspace = true, optional = true }
bifrost-primitives = { workspace = true }
orml-traits = { workspace = true }
sp-std = { workspace = true }
hex-literal = { workspace = true }
log = { workspace = true }
orml-traits = { workspace = true }
pallet-balances = { workspace = true }
pallet-traits = { workspace = true }
parity-scale-codec = { workspace = true, features = ["derive"] }
scale-info = { workspace = true, features = ["derive"] }
sp-arithmetic = { workspace = true }
sp-core = { workspace = true }
sp-std = { workspace = true }
xcm = { workspace = true }
bifrost-vtoken-minting = { workspace = true }
zenlink-protocol = { workspace = true }
bifrost-slp = { workspace = true }
cumulus-primitives-core = { workspace = true }
pallet-traits = { workspace = true }

[dev-dependencies]
bifrost-asset-registry = { workspace = true }
bifrost-currencies = { workspace = true }
env_logger = { workspace = true }
orml-oracle = { workspace = true }
orml-tokens = { workspace = true }
orml-xtokens = { workspace = true }
orml-traits = { workspace = true }
bifrost-currencies = { workspace = true }
xcm-executor = { workspace = true }
xcm-builder = { workspace = true }
orml-xtokens = { workspace = true }
pallet-prices = { workspace = true }
pallet-xcm = { workspace = true }
sp-io = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
bifrost-asset-registry = { workspace = true }
pallet-prices = { workspace = true }
orml-oracle = { workspace = true }
env_logger = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }

[features]
default = ["std"]
Expand All @@ -55,7 +55,7 @@ std = [
"bifrost-primitives/std",
"orml-xtokens/std",
"orml-traits/std",
"bifrost-vtoken-minting/std",
"bifrost-vtoken-minting/std",
"zenlink-protocol/std",
"bifrost-slp/std",
"bifrost-asset-registry/std",
Expand All @@ -65,6 +65,6 @@ std = [

runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks"
"frame-benchmarking/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
22 changes: 11 additions & 11 deletions pallets/fee-share/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ benchmarks! {
const KSM: CurrencyId = CurrencyId::Token(TokenSymbol::KSM);
let token_type = vec![KSM];
}: _(RawOrigin::Root,
token_type.clone(),
tokens_proportion.clone(),
BoundedVec::try_from(token_type.clone()).unwrap(),
BoundedVec::try_from(tokens_proportion.clone()).unwrap(),
true)

edit_distribution {
Expand All @@ -47,14 +47,14 @@ benchmarks! {
let token_type = vec![KSM];
assert_ok!(FeeShare::<T>::create_distribution(
RawOrigin::Root.into(),
vec![KSM],
tokens_proportion.clone(),
BoundedVec::try_from(vec![KSM]).unwrap(),
BoundedVec::try_from(tokens_proportion.clone()).unwrap(),
true,
));
}: _(RawOrigin::Root,
0,
None,
Some(tokens_proportion.clone()),
Some(BoundedVec::try_from(tokens_proportion.clone()).unwrap()),
Some(true))
set_era_length {}: _(RawOrigin::Root,BlockNumberFor::<T>::from(10u32))
execute_distribute {
Expand All @@ -64,8 +64,8 @@ benchmarks! {
let token_type = vec![KSM];
assert_ok!(FeeShare::<T>::create_distribution(
RawOrigin::Root.into(),
vec![KSM],
tokens_proportion.clone(),
BoundedVec::try_from(vec![KSM]).unwrap(),
BoundedVec::try_from(tokens_proportion.clone()).unwrap(),
true,
));
}: _(RawOrigin::Root,0)
Expand All @@ -76,8 +76,8 @@ benchmarks! {
let token_type = vec![KSM];
assert_ok!(FeeShare::<T>::create_distribution(
RawOrigin::Root.into(),
vec![KSM],
tokens_proportion.clone(),
BoundedVec::try_from(vec![KSM]).unwrap(),
BoundedVec::try_from(tokens_proportion.clone()).unwrap(),
true,
));
}: _(RawOrigin::Root,0)
Expand All @@ -88,8 +88,8 @@ benchmarks! {
let token_type = vec![KSM];
assert_ok!(FeeShare::<T>::create_distribution(
RawOrigin::Root.into(),
vec![KSM],
tokens_proportion.clone(),
BoundedVec::try_from(vec![KSM]).unwrap(),
BoundedVec::try_from(tokens_proportion.clone()).unwrap(),
true,
));
}: _(RawOrigin::Root,
Expand Down
Loading

0 comments on commit 8e2b7c5

Please sign in to comment.