add remove liquidity benchmark
@@ -103,6 +103,46 @@ benchmarks! {
}: _(RawOrigin::Signed(lp_provider), token_id, liquidity_added)
verify {
}
+
+ remove_liquidity{
+ // Initialize pool
+ let stable_amount: T::Balance = T::Balance::from(1_000_000_000_000_000u128);
+ let native_amount: T::Balance = T::Balance::from(1_000_000_000_000_000u128);
+ let stable_price: FixedU128= FixedU128::from((1,2));
+ let native_price: FixedU128= FixedU128::from(1);
+
+ crate::Pallet::<T>::initialize_pool(RawOrigin::Root.into(), stable_amount,native_amount,stable_price,native_price)?;
+
+ // Register new asset in asset registry
+ let token_id = T::AssetRegistry::create_asset(&b"FCK".to_vec(), T::Balance::from(1u128))?;
+
+ // Create account for token provider and set balance
+ let caller = funded_account::<T>("caller", 0);
+
+ let token_price = FixedU128::from((1,5));
+ let token_amount = T::Balance::from(200_000_000_000_000u128);
+
+ T::Currency::update_balance(token_id, &caller, 500_000_000_000_000i128)?;
+
+ // Add the token to the pool
+ crate::Pallet::<T>::add_token(RawOrigin::Signed(caller).into(), token_id,token_amount, token_price)?;
+
+ // Create LP provider account with correct balance aand add some liquidity
+ let lp_provider = funded_account::<T>("provider", 1);
+ T::Currency::update_balance(token_id, &lp_provider, 500_000_000_000_000i128)?;
+
+ let liquidity_added = T::Balance::from(300_000_000_000_000u128);
+
+ let current_position_id = <PositionInstanceSequencer<T>>::get();
+
+ crate::Pallet::<T>::add_liquidity(RawOrigin::Signed(lp_provider.clone()).into(), token_id, liquidity_added)?;
+
+
+ }: _(RawOrigin::Signed(lp_provider), current_position_id, liquidity_added)
+ verify {
+ // Ensre NFT instance was burned
+ assert!(<Positions<T>>::get(current_position_id).is_none());
+ }
}
#[cfg(test)]
