Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/stable-asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,40 @@ scale-info = { version = "2.1", default-features = false, features = ["derive"]
[dependencies.frame-support]
default-features = false
git = "https://github.com/paritytech/substrate"
branch = "polkadot-v0.9.22"
branch = "polkadot-v0.9.25"

[dependencies.frame-system]
default-features = false
git = "https://github.com/paritytech/substrate"
branch = "polkadot-v0.9.22"
branch = "polkadot-v0.9.25"

[dev-dependencies]
serde = { version = "1.0.101" }

[dev-dependencies.sp-core]
default-features = false
git = "https://github.com/paritytech/substrate"
branch = "polkadot-v0.9.22"
branch = "polkadot-v0.9.25"

[dev-dependencies.sp-io]
default-features = false
git = "https://github.com/paritytech/substrate"
branch = "polkadot-v0.9.22"
branch = "polkadot-v0.9.25"

[dependencies.sp-std]
default-features = false
git = "https://github.com/paritytech/substrate"
branch = "polkadot-v0.9.22"
branch = "polkadot-v0.9.25"

[dependencies.sp-runtime]
default-features = false
git = "https://github.com/paritytech/substrate"
branch = "polkadot-v0.9.22"
branch = "polkadot-v0.9.25"

[dev-dependencies.pallet-balances]
default-features = false
git = "https://github.com/paritytech/substrate"
branch = "polkadot-v0.9.22"
branch = "polkadot-v0.9.25"

[features]
default = ["std"]
Expand Down
13 changes: 3 additions & 10 deletions lib/stable-asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ pub mod pallet {
dispatch::{Codec, DispatchResult},
pallet_prelude::*,
traits::EnsureOrigin,
transactional, PalletId,
PalletId,
};
use frame_system::pallet_prelude::*;
use sp_runtime::traits::{CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, One, Zero};
Expand Down Expand Up @@ -527,7 +527,6 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::weight(T::WeightInfo::create_pool())]
#[transactional]
pub fn create_pool(
origin: OriginFor<T>,
pool_asset: T::AssetId,
Expand Down Expand Up @@ -558,7 +557,6 @@ pub mod pallet {
}

#[pallet::weight(T::WeightInfo::mint(amounts.len() as u32))]
#[transactional]
pub fn mint(
origin: OriginFor<T>,
pool_id: StableAssetPoolId,
Expand All @@ -570,7 +568,6 @@ pub mod pallet {
}

#[pallet::weight(T::WeightInfo::swap(*asset_length))]
#[transactional]
pub fn swap(
origin: OriginFor<T>,
pool_id: StableAssetPoolId,
Expand All @@ -586,7 +583,6 @@ pub mod pallet {
}

#[pallet::weight(T::WeightInfo::redeem_proportion(min_redeem_amounts.len() as u32))]
#[transactional]
pub fn redeem_proportion(
origin: OriginFor<T>,
pool_id: StableAssetPoolId,
Expand All @@ -598,7 +594,6 @@ pub mod pallet {
}

#[pallet::weight(T::WeightInfo::redeem_single(*asset_length))]
#[transactional]
pub fn redeem_single(
origin: OriginFor<T>,
pool_id: StableAssetPoolId,
Expand All @@ -612,7 +607,6 @@ pub mod pallet {
}

#[pallet::weight(T::WeightInfo::redeem_multi(amounts.len() as u32))]
#[transactional]
pub fn redeem_multi(
origin: OriginFor<T>,
pool_id: StableAssetPoolId,
Expand All @@ -624,7 +618,6 @@ pub mod pallet {
}

#[pallet::weight(T::WeightInfo::modify_a())]
#[transactional]
pub fn modify_a(
origin: OriginFor<T>,
pool_id: StableAssetPoolId,
Expand Down Expand Up @@ -1387,7 +1380,7 @@ impl<T: Config> StableAsset for Pallet<T> {
ensure!(assets.len() == precisions.len(), Error::<T>::ArgumentsMismatch);
PoolCount::<T>::try_mutate(|pool_count| -> DispatchResult {
let pool_id = *pool_count;
let swap_id: T::AccountId = T::PalletId::get().into_sub_account(pool_id);
let swap_id: T::AccountId = T::PalletId::get().into_sub_account_truncating(pool_id);
Pools::<T>::try_mutate_exists(pool_id, |maybe_pool_info| -> DispatchResult {
ensure!(maybe_pool_info.is_none(), Error::<T>::InconsistentStorage);

Expand Down Expand Up @@ -1422,7 +1415,7 @@ impl<T: Config> StableAsset for Pallet<T> {
pool_id,
swap_id,
a: initial_a,
pallet_id: T::PalletId::get().into_account(),
pallet_id: T::PalletId::get().into_account_truncating(),
});
Ok(())
})
Expand Down