Skip to content

Commit 072962e

Browse files
committed
Merge branch 'develop' into 'main'
develop See merge request papers/acurast/acurast-substrate!362
2 parents 93d3c26 + ef0684f commit 072962e

File tree

25 files changed

+1351
-113
lines changed

25 files changed

+1351
-113
lines changed

Cargo.lock

Lines changed: 19 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ members = [
1515
[workspace.package]
1616
authors = ["Papers AG"]
1717
repository = "https://github.com/acurast"
18-
version = "0.23.14"
18+
version = "0.23.16"
1919
edition = "2021"
2020

2121
[workspace.dependencies]

pallets/token-claim/src/benchmarking.rs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use frame_benchmarking::v2::*;
22
use frame_support::{
33
pallet_prelude::*,
44
sp_runtime::traits::{IdentifyAccount, StaticLookup, Verify},
5-
traits::{Currency, VestedTransfer},
5+
traits::Currency,
66
};
77
use frame_system::RawOrigin;
88
use sp_std::prelude::*;
@@ -24,10 +24,9 @@ mod benches {
2424

2525
// helper inside the benchmark module so `T` is injected by the macro
2626
fn mint_to<T: Config>(who: &T::AccountId, amount: BalanceFor<T>) {
27-
let _ = <<<T as crate::Config>::VestedTransferer as VestedTransfer<T::AccountId>>::Currency as Currency<T::AccountId>>::deposit_into_existing(who, amount);
27+
let _ = <T::Currency as Currency<T::AccountId>>::deposit_into_existing(who, amount);
2828
}
2929

30-
/// convert
3130
#[benchmark]
3231
fn claim() -> Result<(), BenchmarkError> {
3332
let caller: T::AccountId = account("origin", 0, 0);
@@ -38,10 +37,34 @@ mod benches {
3837
let amount: BalanceFor<T> = 100_000_000_000_000u128.into();
3938
let proof = ClaimProofFor::<T>::new(amount, T::BenchmarkHelper::dummy_signature());
4039

41-
// measured extrinsic call — **bare** call expression, first arg must be origin
4240
#[extrinsic_call]
4341
_(RawOrigin::Signed(caller.clone()), proof, caller.clone().into().into());
4442

4543
Ok(())
4644
}
45+
46+
#[benchmark]
47+
fn vest() -> Result<(), BenchmarkError> {
48+
let caller: T::AccountId = account("origin", 0, 0);
49+
let initial_funds: BalanceFor<T> = 1_000_000_000_000_000u128.into();
50+
51+
mint_to::<T>(&T::Funder::get(), initial_funds);
52+
53+
// First create a claim to set up vesting
54+
let amount: BalanceFor<T> = 100_000_000_000_000u128.into();
55+
let proof = ClaimProofFor::<T>::new(amount, T::BenchmarkHelper::dummy_signature());
56+
Pallet::<T>::claim(
57+
RawOrigin::Signed(caller.clone()).into(),
58+
proof,
59+
caller.clone().into().into(),
60+
)?;
61+
62+
// Move forward in time to have something to vest
63+
frame_system::Pallet::<T>::set_block_number(1000u32.into());
64+
65+
#[extrinsic_call]
66+
_(RawOrigin::Signed(caller.clone()), None, None);
67+
68+
Ok(())
69+
}
4770
}

0 commit comments

Comments
 (0)