Pallet Indices (#7137)

This commit is contained in:
Shawn Tabrizi
2020-09-18 11:16:41 +02:00
committed by GitHub
parent a9c73113a8
commit a3080f27f1
6 changed files with 124 additions and 42 deletions
+7 -17
View File
@@ -32,9 +32,7 @@ benchmarks! {
_ { }
claim {
// Index being claimed
let i in 0 .. 1000;
let account_index = T::AccountIndex::from(i);
let account_index = T::AccountIndex::from(SEED);
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
}: _(RawOrigin::Signed(caller.clone()), account_index)
@@ -43,13 +41,11 @@ benchmarks! {
}
transfer {
// Index being claimed
let i in 0 .. 1000;
let account_index = T::AccountIndex::from(i);
let account_index = T::AccountIndex::from(SEED);
// Setup accounts
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let recipient: T::AccountId = account("recipient", i, SEED);
let recipient: T::AccountId = account("recipient", 0, SEED);
T::Currency::make_free_balance_be(&recipient, BalanceOf::<T>::max_value());
// Claim the index
Indices::<T>::claim(RawOrigin::Signed(caller.clone()).into(), account_index)?;
@@ -59,9 +55,7 @@ benchmarks! {
}
free {
// Index being claimed
let i in 0 .. 1000;
let account_index = T::AccountIndex::from(i);
let account_index = T::AccountIndex::from(SEED);
// Setup accounts
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
@@ -73,13 +67,11 @@ benchmarks! {
}
force_transfer {
// Index being claimed
let i in 0 .. 1000;
let account_index = T::AccountIndex::from(i);
let account_index = T::AccountIndex::from(SEED);
// Setup accounts
let original: T::AccountId = account("original", 0, SEED);
T::Currency::make_free_balance_be(&original, BalanceOf::<T>::max_value());
let recipient: T::AccountId = account("recipient", i, SEED);
let recipient: T::AccountId = account("recipient", 0, SEED);
T::Currency::make_free_balance_be(&recipient, BalanceOf::<T>::max_value());
// Claim the index
Indices::<T>::claim(RawOrigin::Signed(original).into(), account_index)?;
@@ -89,9 +81,7 @@ benchmarks! {
}
freeze {
// Index being claimed
let i in 0 .. 1000;
let account_index = T::AccountIndex::from(i);
let account_index = T::AccountIndex::from(SEED);
// Setup accounts
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());