Skip to content

Commit

Permalink
Merge pull request #7 from mangata-finance/feature/empty-pool
Browse files Browse the repository at this point in the history
empty pool destructon added
  • Loading branch information
gleb-urvanov authored Dec 17, 2020
2 parents 0742714 + 468c460 commit 0c6be47
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions pallets/xyk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ decl_module! {

fn deposit_event() = default;

#[weight = 10_000]
fn set_vault_id(origin) -> DispatchResult{
let sender = ensure_signed(origin)?;
ensure!(
!<VaultId<T>>::exists(),
Error::<T>::VaultAlreadySet,
);
<VaultId<T>>::put(sender);

Ok(())
}
// #[weight = 10_000]
// fn set_vault_id(origin) -> DispatchResult{
// let sender = ensure_signed(origin)?;
// ensure!(
// !<VaultId<T>>::exists(),
// Error::<T>::VaultAlreadySet,
// );
// <VaultId<T>>::put(sender);
//
// Ok(())
// }

#[weight = 10_000]
fn create_pool(
Expand Down Expand Up @@ -384,6 +384,12 @@ decl_module! {
second_asset_reserve - second_asset_amount,
);

if (first_asset_reserve - first_asset_amount == 0.saturated_into::<T::Balance>())
|| (second_asset_reserve - second_asset_amount == 0.saturated_into::<T::Balance>()) {
<Pools<T>>::remove((first_asset_id, second_asset_id));
<Pools<T>>::remove((second_asset_id, first_asset_id));
}

//TODO burn_free of liqudity_pool_id asset to sender in an amount of += liquidity_assets_minted
//TODO introduce burn function to only portion of holder's tokens
//<generic_asset::Module<T>>::burn_free(
Expand Down

0 comments on commit 0c6be47

Please sign in to comment.