Skip to content

Commit

Permalink
fix: 🐛 test
Browse files Browse the repository at this point in the history
  • Loading branch information
yooml committed Dec 17, 2024
1 parent 232e77a commit 193c8a1
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions pallets/buy-back/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ impl bb_bnc::Config for Runtime {
type FarmingInfo = ();
type FourYears = MaxBlock;
type OneYear = OneYear;
type BlockNumberProvider = System;
}

pub struct ExtBuilder {
Expand Down
10 changes: 8 additions & 2 deletions pallets/buy-back/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,11 @@ fn on_initialize_no_burn_should_work() {
Some(buyback_account.clone()),
);
assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000));
System::set_block_number(1);
BuyBack::on_initialize(1);
System::set_block_number(2);
BuyBack::on_initialize(2);
System::set_block_number(3);
BuyBack::on_initialize(3);
assert_eq!(Currencies::free_balance(VKSM, &buyback_account), 9000);
assert_eq!(
Expand Down Expand Up @@ -301,10 +304,10 @@ fn on_initialize_with_burn_should_work() {
Some(buyback_account.clone()),
);
assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000));
BuyBack::on_initialize(<frame_system::Pallet<Runtime>>::block_number() + 1);
System::set_block_number(System::block_number() + 1);
BuyBack::on_initialize(<frame_system::Pallet<Runtime>>::block_number() + 1);
BuyBack::on_initialize(0);
System::set_block_number(System::block_number() + 1);
BuyBack::on_initialize(0);
assert_eq!(Currencies::free_balance(VKSM, &buyback_account), 9000);
assert_eq!(
Currencies::free_balance(VKSM, &zenlink_pair_account_id),
Expand Down Expand Up @@ -360,6 +363,7 @@ fn on_initialize_with_bias_should_work() {
Some(buyback_account.clone()),
);
assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000));
System::set_block_number(1);
BuyBack::on_initialize(1);
let path = vec![
AssetId::try_convert_from(VKSM, PARAID).unwrap(),
Expand All @@ -374,7 +378,9 @@ fn on_initialize_with_bias_should_work() {
<frame_system::Pallet<Runtime>>::block_number()
+ BlockNumberFor::<Runtime>::from(1u32)
));
System::set_block_number(2);
BuyBack::on_initialize(2);
System::set_block_number(3);
BuyBack::on_initialize(3);
assert_eq!(Currencies::free_balance(VKSM, &buyback_account), 9000);
assert_eq!(
Expand Down
1 change: 1 addition & 0 deletions pallets/clouds-convert/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ impl bb_bnc::Config for Runtime {
type FarmingInfo = ();
type FourYears = MaxBlock;
type OneYear = OneYear;
type BlockNumberProvider = System;
}

pub struct ExtBuilder {
Expand Down
1 change: 1 addition & 0 deletions pallets/farming/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ impl bb_bnc::Config for Runtime {
type FarmingInfo = Farming;
type FourYears = MaxBlock;
type OneYear = OneYear;
type BlockNumberProvider = System;
}

ord_parameter_types! {
Expand Down
2 changes: 2 additions & 0 deletions pallets/leverage-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ impl bifrost_stable_asset::Config for Test {
type WeightInfo = ();
type ListingOrigin = EnsureSignedBy<One, u128>;
type EnsurePoolAssetId = EnsurePoolAssetId;
type BlockNumberProvider = System;
}

impl bifrost_stable_pool::Config for Test {
Expand Down Expand Up @@ -454,6 +455,7 @@ impl lend_market::Config for Test {
type RewardAssetId = RewardAssetId;
type LiquidationFreeAssetId = LiquidationFreeAssetId;
type MaxLengthLimit = MaxLengthLimit;
type BlockNumberProvider = System;
}

impl pallet_prices::Config for Test {
Expand Down
1 change: 1 addition & 0 deletions pallets/slp/src/mocks/mock_kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ impl bifrost_stable_asset::Config for Runtime {
type WeightInfo = ();
type ListingOrigin = EnsureSignedBy<One, AccountId>;
type EnsurePoolAssetId = EnsurePoolAssetId;
type BlockNumberProvider = System;
}

parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions pallets/stable-pool/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ impl bifrost_stable_asset::Config for Test {
type WeightInfo = ();
type ListingOrigin = EnsureSignedBy<One, u128>;
type EnsurePoolAssetId = EnsurePoolAssetId;
type BlockNumberProvider = System;
}

impl bifrost_stable_pool::Config for Test {
Expand Down
1 change: 1 addition & 0 deletions pallets/system-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ impl bifrost_farming::Config for Runtime {
type BlockNumberToBalance = ConvertInto;
type WhitelistMaximumLimit = WhitelistMaximumLimit;
type GaugeRewardIssuer = FarmingGaugeRewardIssuerPalletId;
type BlockNumberProvider = System;
}

parameter_types! {
Expand Down

0 comments on commit 193c8a1

Please sign in to comment.