Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
add todos for storage migrations
  • Loading branch information
Chralt98 committed Dec 12, 2024
commit 6db1a392c8c36137c4da27f7a6fc1dadec154613
2 changes: 1 addition & 1 deletion primitives/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ use serde::{Deserialize, Serialize};
pub enum Asset<MarketId> {
CategoricalOutcome(MarketId, CategoryIndex),
ScalarOutcome(MarketId, ScalarPosition),
// TODO: changed from `CombinatorialOutcome` to `CombinatorialToken(CombinatorialId)` => storage migration
CombinatorialToken(CombinatorialId),
PoolShare(PoolId),
#[default]
Ztg,
ForeignAsset(u32),
ParimutuelShare(MarketId, CategoryIndex),
}
// TODO Needs storage migration

#[cfg(feature = "runtime-benchmarks")]
impl<MarketId: MaxEncodedLen> ZeitgeistAssetEnumerator<MarketId> for Asset<MarketId> {
Expand Down
5 changes: 5 additions & 0 deletions zrml/neo-swaps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,17 @@ mod pallet {
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(PhantomData<T>);

// TODO: Pool struct fields changed => storage migration
// TODO: key changed from `MarketIdOf<T>` to `T::PoolId` (both u128 in the end) => storage migration ? check with try-runtime if necessary
#[pallet::storage]
pub(crate) type Pools<T: Config> = StorageMap<_, Twox64Concat, T::PoolId, PoolOf<T>>;

// TODO: `PoolCount` storage item was newly added => populate the number of pools in a storage migration
#[pallet::storage]
pub(crate) type PoolCount<T: Config> = StorageValue<_, T::PoolId, ValueQuery>;

// TODO: `MarketIdToPoolId` storage item was newly added => populate the mapping in a storage migration
// TODO: For key-value pair (k, v) of Pool, we need to add { k => k } to the MarketIdToPoolId map.
#[pallet::storage]
pub(crate) type MarketIdToPoolId<T: Config> =
StorageMap<_, Twox64Concat, MarketIdOf<T>, T::PoolId>;
Expand Down
4 changes: 4 additions & 0 deletions zrml/neo-swaps/src/types/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ where
S: Get<u32>,
{
pub account_id: T::AccountId,
// TODO: `assets` was newly added => storage migration
// TODO: One can find the assets in the keys of the reserves map
pub assets: BoundedVec<AssetOf<T>, S>,
pub reserves: BoundedBTreeMap<AssetOf<T>, BalanceOf<T>, S>,
pub collateral: AssetOf<T>,
pub liquidity_parameter: BalanceOf<T>,
pub liquidity_shares_manager: LSM,
pub swap_fee: BalanceOf<T>,
// TODO: `pool_type` was newly added => storage migration
// TODO: populate `PoolType::Standard(market_id)` for each existing pool, since no combinatorial pools existed before
pub pool_type: PoolType<MarketIdOf<T>, S>,
}

Expand Down