Skip to content

Commit

Permalink
remove unused pallet
Browse files Browse the repository at this point in the history
  • Loading branch information
1xstj committed Oct 9, 2024
1 parent fc044d7 commit 1089d87
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 42 deletions.
30 changes: 5 additions & 25 deletions pallets/tangle-lst/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,27 +1352,6 @@ pub mod pallet {
Ok(())
}
}

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
#[cfg(feature = "try-runtime")]
fn try_state(_n: BlockNumberFor<T>) -> Result<(), TryRuntimeError> {
Self::do_try_state(u8::MAX)
}

fn integrity_test() {
assert!(
T::MaxPointsToBalance::get() > 0,
"Minimum points to balance ratio must be greater than 0"
);
assert!(
T::Staking::bonding_duration() < TotalUnbondingPools::<T>::get(),
"There must be more unbonding pools then the bonding duration /
so a slash can be applied to relevant unboding pools. (We assume /
the bonding duration > slash deffer duration.",
);
}
}
}

impl<T: Config> Pallet<T> {
Expand All @@ -1384,10 +1363,11 @@ impl<T: Config> Pallet<T> {
/// It is essentially `max { MinNominatorBond, MinCreateBond, MinJoinBond }`, where the former
/// is coming from the staking pallet and the latter two are configured in this pallet.
pub fn depositor_min_bond() -> BalanceOf<T> {
T::Staking::minimum_nominator_bond()
.max(MinCreateBond::<T>::get())
.max(MinJoinBond::<T>::get())
.max(T::Currency::minimum_balance())
// T::Staking::minimum_nominator_bond()
// .max(MinCreateBond::<T>::get())
// .max(MinJoinBond::<T>::get())
// .max(T::Currency::minimum_balance())
Default::default()
}
/// Remove everything related to the given bonded pool.
///
Expand Down
19 changes: 10 additions & 9 deletions pallets/tangle-lst/src/types/bonded_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,16 @@ impl<T: Config> BondedPool<T> {
// ratio will be wrong.
let points_issued = self.issue(amount);

match ty {
BondType::Create => {
T::Staking::bond(&bonded_account, amount, &self.reward_account(), self.id.into())?
},
// The pool should always be created in such a way its in a state to bond extra, but if
// the active balance is slashed below the minimum bonded or the account cannot be
// found, we exit early.
BondType::Later => T::Staking::bond_extra(&bonded_account, amount, self.id.into())?,
}
// match ty {
// BondType::Create => {
// T::Staking::bond(&bonded_account, amount, &self.reward_account(), self.id.into())?
// },
// // The pool should always be created in such a way its in a state to bond extra, but if
// // the active balance is slashed below the minimum bonded or the account cannot be
// // found, we exit early.
// BondType::Later => T::Staking::bond_extra(&bonded_account, amount, self.id.into())?,
// }

TotalValueLocked::<T>::mutate(|tvl| {
tvl.saturating_accrue(amount);
});
Expand Down
8 changes: 4 additions & 4 deletions runtime/polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ tangle-currencies = { workspace = true }
tangle-primitives = { workspace = true }
tangle-runtime-common = { workspace = true }
tangle-slp = { workspace = true }
tangle-lst-minting = { workspace = true }
# tangle-lst-minting = { workspace = true }
tangle-xcm-interface = { workspace = true }
tangle-parachain-staking = { workspace = true }

Expand Down Expand Up @@ -220,7 +220,7 @@ std = [
"tangle-currencies/std",
"tangle-runtime-common/std",
"tangle-slp/std",
"tangle-lst-minting/std",
# "tangle-lst-minting/std",
"tangle-parachain-staking/std",
"tangle-xcm-interface/std",
"pallet-asset-rate/std",
Expand Down Expand Up @@ -252,7 +252,7 @@ runtime-benchmarks = [
"pallet-whitelist/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"tangle-lst-minting/runtime-benchmarks",
# "tangle-lst-minting/runtime-benchmarks",
"tangle-slp/runtime-benchmarks",
"tangle-asset-registry/runtime-benchmarks",
"tangle-parachain-staking/runtime-benchmarks",
Expand Down Expand Up @@ -312,7 +312,7 @@ try-runtime = [
"zenlink-stable-amm/try-runtime",
"zenlink-swap-router/try-runtime",
"tangle-asset-registry/try-runtime",
"tangle-lst-minting/try-runtime",
# "tangle-lst-minting/try-runtime",
"tangle-slp/try-runtime",
"tangle-xcm-interface/try-runtime",
]
Expand Down
8 changes: 4 additions & 4 deletions runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ tangle-currencies = { workspace = true }
tangle-primitives = { workspace = true }
tangle-runtime-common = { workspace = true }
tangle-slp = { workspace = true }
tangle-lst-minting = { workspace = true }
# tangle-lst-minting = { workspace = true }
tangle-xcm-interface = { workspace = true }
tangle-parachain-staking = { workspace = true }

Expand Down Expand Up @@ -220,7 +220,7 @@ std = [
"tangle-currencies/std",
"tangle-runtime-common/std",
"tangle-slp/std",
"tangle-lst-minting/std",
# "tangle-lst-minting/std",
"tangle-parachain-staking/std",
"tangle-xcm-interface/std",
"pallet-asset-rate/std",
Expand Down Expand Up @@ -252,7 +252,7 @@ runtime-benchmarks = [
"pallet-whitelist/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"tangle-lst-minting/runtime-benchmarks",
# "tangle-lst-minting/runtime-benchmarks",
"tangle-slp/runtime-benchmarks",
"tangle-asset-registry/runtime-benchmarks",
"tangle-parachain-staking/runtime-benchmarks",
Expand Down Expand Up @@ -312,7 +312,7 @@ try-runtime = [
"zenlink-stable-amm/try-runtime",
"zenlink-swap-router/try-runtime",
"tangle-asset-registry/try-runtime",
"tangle-lst-minting/try-runtime",
# "tangle-lst-minting/try-runtime",
"tangle-slp/try-runtime",
"tangle-xcm-interface/try-runtime",
]
Expand Down

0 comments on commit 1089d87

Please sign in to comment.