Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[swaps] Improve error handling in zrml-swaps #723

Open
maltekliemann opened this issue Jul 27, 2022 · 0 comments
Open

[swaps] Improve error handling in zrml-swaps #723

maltekliemann opened this issue Jul 27, 2022 · 0 comments
Labels
p:low Low priority, resolution of this issue can wait t:enhancement The issue described an enhancement

Comments

@maltekliemann
Copy link
Contributor

maltekliemann commented Jul 27, 2022

The swaps pallet currently raises some questionable errors, for example MathApproximation. These seem very uninformative.

For example, if I call pool_join with a small amount of liquidity (in comparison to what's already in the pool), then ratio ends up being zero, and I get a MathApproximation error:

let ratio: BalanceOf<T> =
bdiv(p.pool_amount.saturated_into(), total_issuance.saturated_into())?.saturated_into();
Pallet::<T>::check_provided_values_len_must_equal_assets_len(&p.pool.assets, &p.asset_bounds)?;
ensure!(ratio != Zero::zero(), Error::<T>::MathApproximation);

How am I supposed to know what happened?

@maltekliemann maltekliemann added p:low Low priority, resolution of this issue can wait t:enhancement The issue described an enhancement labels Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:low Low priority, resolution of this issue can wait t:enhancement The issue described an enhancement
Projects
None yet
Development

No branches or pull requests

1 participant