-
Notifications
You must be signed in to change notification settings - Fork 41
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
Extend neo-swaps tests and clean up math.rs
#1238
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1238 +/- ##
==========================================
+ Coverage 92.74% 92.75% +0.01%
==========================================
Files 135 135
Lines 32151 32176 +25
==========================================
+ Hits 29817 29845 +28
+ Misses 2334 2331 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@Mergifyio update |
✅ Branch has been successfully updated |
@Mergifyio requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
* Merge release v0.4.2 (#1174) * Update versions (#1168) * Add updated weights from reference machine (#1169) * Add license header Co-authored-by: Chralt <[email protected]> --------- Co-authored-by: Chralt <[email protected]> * Remove migrations (#1180) * Filter admin functions for main-net (#1190) filter admin functions for main-net * Add debug assertions for slashes and reserves (#1188) * add debug assertions for missing slashes * place debug_assert for unreserves * Add some verify checks to court (#1187) add some verify checks to court * Bypass battery stations contracts call filter for court, parimutuel, order book markets (#1185) update contracts call filter * Fix failing court benchmark (#1191) * fix court assertion for resolve_at * remove unnecessary variable * mirror mock and actual impl for DisputeResolution * Implement trusted market close (#1184) * implement trusted market close * remove unnecessary benchmark helper function * Update zrml/prediction-markets/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * remove unnecessary function * check market end * check auto close * add invalid market status test --------- Co-authored-by: Malte Kliemann <[email protected]> * Modify court events for indexer (#1182) * modify events for indexer * gracefully handle panicers * handle binary search by key error * improve style * Ensure MinBetSize after fee (#1193) * handle own existential deposit errors * use require_transactional * correct benchmark and test min bet size amounts * Replace fixed math operations with traited versions (#1149) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Update primitives/src/math/fixed.rs Co-authored-by: Harald Heckmann <[email protected]> --------- Co-authored-by: Harald Heckmann <[email protected]> * Add env_logger and add force-debug feature (#1205) * add env_logger and add force-debug feature * taplo fmt, fix copyrights * Update zrml/styx/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/rikiddo/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * update comment to clarify logging --------- Co-authored-by: Malte Kliemann <[email protected]> * Inflate defensively (#1195) * inflate defensively * add tests * Update zrml/court/src/tests.rs Co-authored-by: Malte Kliemann <[email protected]> * fix test * fix test name --------- Co-authored-by: Malte Kliemann <[email protected]> * Maintain order book (#1183) * integrate market creator fees into orderbook * edit tests * update tests * modify tests * avoid order side * Update primitives/src/traits/distribute_fees.rs Co-authored-by: Malte Kliemann <[email protected]> * remove asset and account from get_fee api call * take base asset fees from fill_order * adjust orderbook for taking fees in fill_order * adjust without order side for fill_order * adapt to avoid concept of order side * adapt benchmarks, tests and weights, restructure * use DispatchResult * remove unused import * do not adjust maker amount for place_order * correct fuzz of orderbook * check if maker_amount is zero * fix order book name in benchmarks * use remove instead of cancel order book * correct order book test names * update READMEs * fmt * add tests * use minimum balance as min order size * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * prettier orderbook md * remove comments from benchmarks * fix tests and benchmarks readibility * use order book instead of orderbook * clarify error message * clarify comments * rename is to ensure * error for repatriate * fix unnecessary clone * correct mocks behaviour * improve test * improve test of near full fill error * use turbofish syntax * add filled_maker_amount to event * split tests * combine two functions, add docs * abandon get_fees * fix order book tests and mock * remove check for impossible behaviour * fix toml and benchs * prepare migration * add migration for order structure * return zero fees if transfer fails * delete unnecessary assert * fix naming * fix naming the second * fix maker fill description * add scoring rule check to remove order * fix post_upgrade * fix terminology * Update zrml/orderbook/src/migrations.rs Co-authored-by: Malte Kliemann <[email protected]> * use storage root check in migration test * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * delete debug_assert --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement AMM 2.0 (#1173) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Update zrml/neo-swaps/docs/docs.tex Co-authored-by: Harald Heckmann <[email protected]> * Apply suggestions from code review Co-authored-by: Harald Heckmann <[email protected]> * Rename `Fixed` and clean up * Hotfix exponential function and extend tests * Complete math test suite * Fix broken sentence * Remove unused imports * Extend `ln` test cases * Merge & fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement Liquidity Tree (#1178) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Add liquidity tree draft * Fix compiler error in draft * Clean up `propagate_fees` * Add docs * Reorganize * Clean up, add max iterations * Remove migrations * Prepare switch to bounded vector * Use `BoundedVec` * Use bounded `BTreeMap` and insert `LiquidityTree` into neo-swaps * Resolve TODO * Clean up tests * Add migration and fix clippy errors * Make tree depth a generic * Make tree depth a config parameter * Update runtime complexities * Add benchmarking utilities * Fix runtime complexity for `deploy_pool` * Add missing lazy propagation * Fix comment * Fix error type * Add `join` benchmarking and fix a bug in `LiquidityTree` * Clean up benchmarks * Fix clippy issues * Remove unnecessary type hint * Fix bugs in liquidity tree * Fix comments * Some fixes in benchmarks * Implement `BenchmarkHelper` * Update benchmarks to use the LT * Clean up and format * Add testing framework for liquidity trees * Add first extensive test and fix a bug * Add more tests * Clean up test * Add news tests and use better numerics for ratio calculations * Make docs more explicit * Add tests for `exit` * Add tests for deposit fees * Add tests for getters * Clean up tests some more * Finalize liquidity tree tests * Clean up comments * Introduce exit fees * Rewrite `exit_works` * Fix liquidity parameter calculation * Make test a bit more complex * Test liquidity shares * Clean up tests * Update test for destruction * Enhance `exit_destroys_pool` test * More cleanup * Add test for full tree * Add tests for `join` * Improve test * Test withdrawal * Clean up the test * Add test for noop * Add minimum relative liquidity * Verify that buys deduct the correct amount of fees * Add last tests * Add notes about the liquidity tree * Fix benchmarks * Fix clippy errors * Fix benchmarks * Do more work on benchmarks * Fix benchmarks, deduce max tree depth * Remove already solved TODO * Document macros * Remove TODO (not a good idea to edit LaTeX docs now) * Fix `bmul_bdiv` * Make `bmul_bdiv_*` not implemented * Double-check that there's a non-zero check for `ratio` * Fix formatting * Fix taplo formatting * Remove TODO * Remove TODOs and fix documents * Update primitives/src/math/fixed.rs Co-authored-by: Chralt <[email protected]> * Mark `SoloLp` as deprecated * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Make `bmul_bdiv` a little more idiomatic * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Rewrite and format `README.md` * Fix comment about existential deposit * Remove FIXME * Add a check against misconfiguration of the pallet * Fix field docstrings * Add comment about `assert_ok_with_transaction` * Update zrml/neo-swaps/src/mock.rs Co-authored-by: Chralt <[email protected]> * Format code * Fix comment * Prettify extrinsic calls in benchmarks * Improve code quality of `assert_pool_state!` * Extend comment about order of abandoned nodes * Clarify the meaning of "leaf" in `is_leaf` * Rename `index_maybe` to `opt_index` * Add unexpected storage overflow error for bounded objects * Rename `UnclaimedFees` to `UnwithdrawnFees` * Fix documentation * Use enum to signal update direction in `update_descendant_stake` * Add verification to `join_*` benchmarks * Improve documentation * Use builtin log * Remove illegal token from `README.md` * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix unintentional doctest * Improve `mutate_children` * Add helpful comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix migration * Fix balances in parachain mock * use PartialEqNoBound and CloneNoBound for tree * Fix formatting * Make `debug_assert!` more clear * Redesign node assignment * Clean up comments * Add some storage overflow errors * Introduce `LiquidityTreeChildIndices` * Remove outdated docs * Rename `update_descendant_stake` * Remove `Default` usage * Make liquidity tree types `pub(crate)` where possible * Make all fields of `Node` only `pub(crate)` * Make `Node<T>` an associated type of `LiquidityTreeHelper` * Update zrml/neo-swaps/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix tests * Prettify `path_to_node` * Add max iterations to `path_to_node` * Add test for complex liquidity tree interactions * Improve documentation of `LiquidityTreeChildIndices` * Reorganize crate structure * Update weights and fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Improve XCM fee handling (#1225) * Fix padding of foreign fees in Zeitgeist runtime * Fix padding of foreign fees in Battery Station runtime * Format * Update copyright * Use adjusted_balance function * Remove court and global disputes from call filter for the main-net (#1226) * remove from call filter * update copyright * Sunset old AMMs and their pools (#1197) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Remove `pool_*_subsidy` * Remove `distribute_pool_share_rewards` * Remove `end_subsidy_phase` * Remove `destroy_pool_in_subsidy_phase` * Remove `MinSubsidy*` * Remove `SubsidyProviders` * Remove `start_subsidy` * Rewrite `create_pool` * Rewrite `swap_exact_amount_in` * Rewrite `swap_exact_amount_out` * Rewrite utility functions * Remove Rikiddo from weight calculation * Remove Rikiddo from zrml-swaps * Remove unused errors * Remove `ScoringRule::Rikiddo...` * Remove `*SubsidyPeriod` * Remove Rikiddo-related storage and events * Remove automatic opening of pools * Remove `open_pool` from prediction-markets * Remove `Swaps::close_pool` from prediction-markets * Remove `clean_up_pool` from prediction-markets * Remove `clean_up_pool` from `Swaps` trait * Remove CPMM deployment from prediction-markets * Remove automatic arbitrage * Move `market_account` back to prediction-markets * Remove unused market states * Fix fuzz tests * Implement market migration * Minor changes * Fix migration behavior * Remove creator fees from swaps * Fix try-runtime * Fix clippy issues * Remove `LiquidityMining` from swaps * Fix `get_spot_prices` * Take first step to remove `MarketCommons` from swaps * Remove `MarketCommons` from swaps * Rewrite `PoolStatus` * Move `Pool*` to swaps * Use `Bounded*` types in `Pool` * Finish swaps migration * Add missing files * Fix formatting and clippy errors * Remove `pool_status.rs` * Ignore doctests * Fix fuzz tests * Add prediciton-markets migration * Test prediction-markets migration * Finish tests of the market-commons migration * Add migrations to runtime and fix various errors * Clean up * Clean up * Format code * Fix pool migration behavior * Remove `MarketId` from swaps * Fix formatting * Fix formatting * Remove `CPMM` and allow other scoring rules on Battery Station * Update macros/Cargo.toml Co-authored-by: Harald Heckmann <[email protected]> * Update primitives/src/traits/zeitgeist_asset.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Clean up TODOs/FIXMEs * Update changelog * Make more changes to changelog * Clear zrml-swaps storage * Remove cfg-if dependency * Fix formatting * Trigger CI * Update copyright notices * Update docs/changelog_for_devs.md Co-authored-by: Chralt <[email protected]> * Make benchmark helper only available if feature flags are set * Remove `ZeitgeistAsset` trait * Remove preliminary benchmarks with more steps * Format code * Fix copyright notice --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Merge release v0.4.3 (#1211) * Use hotfixed `exp` * Reorganize tests * Fix formatting * Bump versions to v0.4.3 * Update spec versions * Add missing version bumps * Format * Update licenses --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reduce `market_status_manager` aka `on_initialize` iterations (#1160) * remove dangerous loop * limit iterations of dangerous loop * reintegrate last time frame storage item * wip * benchmark manual close and open * fix stall test * emit event and log for recovery time frame * add tests * add trailing comma * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * change should_be_closed condition * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * change recursion limit line * regard period not started yet * add error tests * correct benchmarks * fix after merge and clippy * use turbofish, add test checks * remove manually open broken market * correct errors and call index * correct wrong error name * correct position of call index * correct error position * update copyrights * fix after merge * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * set market end for manual close --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Update style guide to streamline reviews (#1228) * Reduce benchmark runs of Zeitgeist pallets (#1233) Reduce bencharm runs of Zeitgeist pallets Running benchmarks of Zeitgeist pallets on the Zeitgeist reference machine currently takes four days. * Set inflation to more than zero for a full benchmark of handle_inflation (#1234) Update benchmarks.rs * Implement `force_pool_exit` and disable other zrml-swaps functions (#1235) * Abstract `pool_exit` business logic into `do_*` function * Add `force_pool_exit` and test * Install call filters for zrml-swaps * Implement and test `bmul_bdiv_*`; use in zrml-orderbook and zrml-parimutuel (#1223) * Implement and test `bmul_bdiv_*` * Use `bmul_bdiv_*` in pallets * Update copyright * Utilize Merigify's Merge Queue (#1243) ci(Mergify): configuration update Signed-off-by: Harald Heckmann <[email protected]> * Set in-progress when needed and rerun CI in merge queue (#1244) * Set in-progress when need and rerun CI in merge queue --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Avoid mergify dequeue (#1245) * Avoid mergify deque * Set review needed only shortly after Mergify commit * Extend neo-swaps tests and clean up `math.rs` (#1238) * Add tests to neo-swaps that check large buy/sell amounts at high liquidity * Use new implementation of HydraDX's `exp` * Add failure tests to neo-swaps's `math.rs` * Fix formatting * Update copyright notices --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Remove migrations and dead code (#1241) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reorganize prediction-market tests (#1242) * Rename `tests.rs` to `old_tests.rs` to avoid naming conflicts * Move `buy_complete_set` tests to new tests * Clean up `buy_complete_set` tests * Extract `sell_complete_set_tests` * Clean up `sell_complete_set` tests * Extract `admin_move_market_to_closed` tests * Extract `create_market` tests * Extract `admin_move_market_to_resolved` tests * Remove superfluous test * Extract more `create_market` tests * Extract `approve_market` tests * Extract `edit_market` tests * Extract `edit_market` tests * Add `on_market_close` tests * Extract `manually_close_market` tests * Extract `on_initialize` tests * Extract `report` tests * Extract `dispute` tests * Extract `schedule_early_close` tests * Extract `dispute_early_close` tests * Extract `reject_early_close` tests * Extract more `dispute` tests * Extract `close_trusted_market` tests * Extract `start_global_dispute` tests * Extract `redeem_shares` tests and add missing tests * Extract `on_resolution` and additional `redeem_shares` tests * Move integration tests into new test module * Automatically set block to `1` at the start of test * Replace `crate::Config` with `Config` * Access constant through `Config` * Add TODOs for missing execution paths * Fix formatting --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Improve fee payment management (#1246) * Improve fee payment management * Make code compileable * Do not remit TX fees for redeem_shares Co-authored-by: Malte Kliemann <[email protected]> --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix Rust and Discord badge (#1247) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix neo-swaps doc strings (#1250) * Improve `SellExecuted` documentation * Clean up math in comments and doc strings * Fix formatting * Adjust style guide (loops) and add unreachable macro (#1252) * Adjust style guide (loops) and add unreachable macro * Add macros module to lib.rs * Update docs/STYLE_GUIDE.md Co-authored-by: Malte Kliemann <[email protected]> * Move macro to zeitgeist-macros and add examples --------- Co-authored-by: Malte Kliemann <[email protected]> * Merge Old* and New* asset variants * Partially integrate lazy migration routing * Integrate lazy migration routing * Fix ExistentialDeposit mapping & Satisfy Clippy * Remove primitives/macros * Filter certain asset destroy calls (they're managed) * Integrate asset destruction into prediction markets * Add BaseAssetClass * Update prediction-markets & market-commons * Update authorized * Update liquidity-mining * Update simple-disputes * Update parimutuels (wip) * Move functions into market struct and properly delete assets * Add ParimutuelAssetClass * Add parimutuel.rs * Remove duplicate code * Adjust asset type and managed destroy after refund in parimutuels * Add MarketTransitionApi This will allow prediction-markets to signal other pallets that state transitions happened * Add MarketTransitionApi * Implement MarketTransitionApi for Parimutuels * Partially implement asset creation/destruction in parimutuels * Add all asset creation / destruction tests to parimutuels * Adjust Court * Update global-disputes * Update swaps * Update neo-swaps * Integrate OnStateTransition hooks into prediction-markets * Use proper state transition weights * Make cargo check succeed * Partially update orderbook * Update orderbook * Update orderbook * Finalize orderbook update * Improve style * Add XcmAssetClass * Add sub asset classes, extend Market, provide market transition trait * Update asset-router * Integrate asset system into prediction-market, market-commons and parimutuel - Market commons now uses the BaseAsset class for base assets - Prediction markets now creates and destroys MarketAssets only if market.is_redeemable - Prediction markets now calls OnStateTransition when transitioning it's state - Parimutuel markets now implements StateTransitionApi - Parimutuel markets now properly creates and destroys ParimutuelShares * Implement support for non-reservable assets in orderbook * Integrate new asset system into Battery Station XCM * Integrate new asset system into Zeitgeist XCM * Fix conditional import * Format * Fix unfillable / unremovable order bug Co-authored-by: Chralt <[email protected]> * Make compileable * Resolve one merge conflict * Format * Satisfy Clippy --------- Signed-off-by: Harald Heckmann <[email protected]> Co-authored-by: Chralt <[email protected]> Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Merge release v0.4.2 (#1174) * Update versions (#1168) * Add updated weights from reference machine (#1169) * Add license header Co-authored-by: Chralt <[email protected]> --------- Co-authored-by: Chralt <[email protected]> * Remove migrations (#1180) * Filter admin functions for main-net (#1190) filter admin functions for main-net * Add debug assertions for slashes and reserves (#1188) * add debug assertions for missing slashes * place debug_assert for unreserves * Add some verify checks to court (#1187) add some verify checks to court * Bypass battery stations contracts call filter for court, parimutuel, order book markets (#1185) update contracts call filter * Fix failing court benchmark (#1191) * fix court assertion for resolve_at * remove unnecessary variable * mirror mock and actual impl for DisputeResolution * Implement trusted market close (#1184) * implement trusted market close * remove unnecessary benchmark helper function * Update zrml/prediction-markets/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * remove unnecessary function * check market end * check auto close * add invalid market status test --------- Co-authored-by: Malte Kliemann <[email protected]> * Modify court events for indexer (#1182) * modify events for indexer * gracefully handle panicers * handle binary search by key error * improve style * Ensure MinBetSize after fee (#1193) * handle own existential deposit errors * use require_transactional * correct benchmark and test min bet size amounts * Replace fixed math operations with traited versions (#1149) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Update primitives/src/math/fixed.rs Co-authored-by: Harald Heckmann <[email protected]> --------- Co-authored-by: Harald Heckmann <[email protected]> * Add env_logger and add force-debug feature (#1205) * add env_logger and add force-debug feature * taplo fmt, fix copyrights * Update zrml/styx/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/rikiddo/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * update comment to clarify logging --------- Co-authored-by: Malte Kliemann <[email protected]> * Inflate defensively (#1195) * inflate defensively * add tests * Update zrml/court/src/tests.rs Co-authored-by: Malte Kliemann <[email protected]> * fix test * fix test name --------- Co-authored-by: Malte Kliemann <[email protected]> * Maintain order book (#1183) * integrate market creator fees into orderbook * edit tests * update tests * modify tests * avoid order side * Update primitives/src/traits/distribute_fees.rs Co-authored-by: Malte Kliemann <[email protected]> * remove asset and account from get_fee api call * take base asset fees from fill_order * adjust orderbook for taking fees in fill_order * adjust without order side for fill_order * adapt to avoid concept of order side * adapt benchmarks, tests and weights, restructure * use DispatchResult * remove unused import * do not adjust maker amount for place_order * correct fuzz of orderbook * check if maker_amount is zero * fix order book name in benchmarks * use remove instead of cancel order book * correct order book test names * update READMEs * fmt * add tests * use minimum balance as min order size * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * prettier orderbook md * remove comments from benchmarks * fix tests and benchmarks readibility * use order book instead of orderbook * clarify error message * clarify comments * rename is to ensure * error for repatriate * fix unnecessary clone * correct mocks behaviour * improve test * improve test of near full fill error * use turbofish syntax * add filled_maker_amount to event * split tests * combine two functions, add docs * abandon get_fees * fix order book tests and mock * remove check for impossible behaviour * fix toml and benchs * prepare migration * add migration for order structure * return zero fees if transfer fails * delete unnecessary assert * fix naming * fix naming the second * fix maker fill description * add scoring rule check to remove order * fix post_upgrade * fix terminology * Update zrml/orderbook/src/migrations.rs Co-authored-by: Malte Kliemann <[email protected]> * use storage root check in migration test * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * delete debug_assert --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement AMM 2.0 (#1173) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Update zrml/neo-swaps/docs/docs.tex Co-authored-by: Harald Heckmann <[email protected]> * Apply suggestions from code review Co-authored-by: Harald Heckmann <[email protected]> * Rename `Fixed` and clean up * Hotfix exponential function and extend tests * Complete math test suite * Fix broken sentence * Remove unused imports * Extend `ln` test cases * Merge & fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement Liquidity Tree (#1178) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Add liquidity tree draft * Fix compiler error in draft * Clean up `propagate_fees` * Add docs * Reorganize * Clean up, add max iterations * Remove migrations * Prepare switch to bounded vector * Use `BoundedVec` * Use bounded `BTreeMap` and insert `LiquidityTree` into neo-swaps * Resolve TODO * Clean up tests * Add migration and fix clippy errors * Make tree depth a generic * Make tree depth a config parameter * Update runtime complexities * Add benchmarking utilities * Fix runtime complexity for `deploy_pool` * Add missing lazy propagation * Fix comment * Fix error type * Add `join` benchmarking and fix a bug in `LiquidityTree` * Clean up benchmarks * Fix clippy issues * Remove unnecessary type hint * Fix bugs in liquidity tree * Fix comments * Some fixes in benchmarks * Implement `BenchmarkHelper` * Update benchmarks to use the LT * Clean up and format * Add testing framework for liquidity trees * Add first extensive test and fix a bug * Add more tests * Clean up test * Add news tests and use better numerics for ratio calculations * Make docs more explicit * Add tests for `exit` * Add tests for deposit fees * Add tests for getters * Clean up tests some more * Finalize liquidity tree tests * Clean up comments * Introduce exit fees * Rewrite `exit_works` * Fix liquidity parameter calculation * Make test a bit more complex * Test liquidity shares * Clean up tests * Update test for destruction * Enhance `exit_destroys_pool` test * More cleanup * Add test for full tree * Add tests for `join` * Improve test * Test withdrawal * Clean up the test * Add test for noop * Add minimum relative liquidity * Verify that buys deduct the correct amount of fees * Add last tests * Add notes about the liquidity tree * Fix benchmarks * Fix clippy errors * Fix benchmarks * Do more work on benchmarks * Fix benchmarks, deduce max tree depth * Remove already solved TODO * Document macros * Remove TODO (not a good idea to edit LaTeX docs now) * Fix `bmul_bdiv` * Make `bmul_bdiv_*` not implemented * Double-check that there's a non-zero check for `ratio` * Fix formatting * Fix taplo formatting * Remove TODO * Remove TODOs and fix documents * Update primitives/src/math/fixed.rs Co-authored-by: Chralt <[email protected]> * Mark `SoloLp` as deprecated * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Make `bmul_bdiv` a little more idiomatic * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Rewrite and format `README.md` * Fix comment about existential deposit * Remove FIXME * Add a check against misconfiguration of the pallet * Fix field docstrings * Add comment about `assert_ok_with_transaction` * Update zrml/neo-swaps/src/mock.rs Co-authored-by: Chralt <[email protected]> * Format code * Fix comment * Prettify extrinsic calls in benchmarks * Improve code quality of `assert_pool_state!` * Extend comment about order of abandoned nodes * Clarify the meaning of "leaf" in `is_leaf` * Rename `index_maybe` to `opt_index` * Add unexpected storage overflow error for bounded objects * Rename `UnclaimedFees` to `UnwithdrawnFees` * Fix documentation * Use enum to signal update direction in `update_descendant_stake` * Add verification to `join_*` benchmarks * Improve documentation * Use builtin log * Remove illegal token from `README.md` * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix unintentional doctest * Improve `mutate_children` * Add helpful comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix migration * Fix balances in parachain mock * use PartialEqNoBound and CloneNoBound for tree * Fix formatting * Make `debug_assert!` more clear * Redesign node assignment * Clean up comments * Add some storage overflow errors * Introduce `LiquidityTreeChildIndices` * Remove outdated docs * Rename `update_descendant_stake` * Remove `Default` usage * Make liquidity tree types `pub(crate)` where possible * Make all fields of `Node` only `pub(crate)` * Make `Node<T>` an associated type of `LiquidityTreeHelper` * Update zrml/neo-swaps/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix tests * Prettify `path_to_node` * Add max iterations to `path_to_node` * Add test for complex liquidity tree interactions * Improve documentation of `LiquidityTreeChildIndices` * Reorganize crate structure * Update weights and fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Improve XCM fee handling (#1225) * Fix padding of foreign fees in Zeitgeist runtime * Fix padding of foreign fees in Battery Station runtime * Format * Update copyright * Use adjusted_balance function * Remove court and global disputes from call filter for the main-net (#1226) * remove from call filter * update copyright * Sunset old AMMs and their pools (#1197) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Remove `pool_*_subsidy` * Remove `distribute_pool_share_rewards` * Remove `end_subsidy_phase` * Remove `destroy_pool_in_subsidy_phase` * Remove `MinSubsidy*` * Remove `SubsidyProviders` * Remove `start_subsidy` * Rewrite `create_pool` * Rewrite `swap_exact_amount_in` * Rewrite `swap_exact_amount_out` * Rewrite utility functions * Remove Rikiddo from weight calculation * Remove Rikiddo from zrml-swaps * Remove unused errors * Remove `ScoringRule::Rikiddo...` * Remove `*SubsidyPeriod` * Remove Rikiddo-related storage and events * Remove automatic opening of pools * Remove `open_pool` from prediction-markets * Remove `Swaps::close_pool` from prediction-markets * Remove `clean_up_pool` from prediction-markets * Remove `clean_up_pool` from `Swaps` trait * Remove CPMM deployment from prediction-markets * Remove automatic arbitrage * Move `market_account` back to prediction-markets * Remove unused market states * Fix fuzz tests * Implement market migration * Minor changes * Fix migration behavior * Remove creator fees from swaps * Fix try-runtime * Fix clippy issues * Remove `LiquidityMining` from swaps * Fix `get_spot_prices` * Take first step to remove `MarketCommons` from swaps * Remove `MarketCommons` from swaps * Rewrite `PoolStatus` * Move `Pool*` to swaps * Use `Bounded*` types in `Pool` * Finish swaps migration * Add missing files * Fix formatting and clippy errors * Remove `pool_status.rs` * Ignore doctests * Fix fuzz tests * Add prediciton-markets migration * Test prediction-markets migration * Finish tests of the market-commons migration * Add migrations to runtime and fix various errors * Clean up * Clean up * Format code * Fix pool migration behavior * Remove `MarketId` from swaps * Fix formatting * Fix formatting * Remove `CPMM` and allow other scoring rules on Battery Station * Update macros/Cargo.toml Co-authored-by: Harald Heckmann <[email protected]> * Update primitives/src/traits/zeitgeist_asset.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Clean up TODOs/FIXMEs * Update changelog * Make more changes to changelog * Clear zrml-swaps storage * Remove cfg-if dependency * Fix formatting * Trigger CI * Update copyright notices * Update docs/changelog_for_devs.md Co-authored-by: Chralt <[email protected]> * Make benchmark helper only available if feature flags are set * Remove `ZeitgeistAsset` trait * Remove preliminary benchmarks with more steps * Format code * Fix copyright notice --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Merge release v0.4.3 (#1211) * Use hotfixed `exp` * Reorganize tests * Fix formatting * Bump versions to v0.4.3 * Update spec versions * Add missing version bumps * Format * Update licenses --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reduce `market_status_manager` aka `on_initialize` iterations (#1160) * remove dangerous loop * limit iterations of dangerous loop * reintegrate last time frame storage item * wip * benchmark manual close and open * fix stall test * emit event and log for recovery time frame * add tests * add trailing comma * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * change should_be_closed condition * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * change recursion limit line * regard period not started yet * add error tests * correct benchmarks * fix after merge and clippy * use turbofish, add test checks * remove manually open broken market * correct errors and call index * correct wrong error name * correct position of call index * correct error position * update copyrights * fix after merge * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * set market end for manual close --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Update style guide to streamline reviews (#1228) * Reduce benchmark runs of Zeitgeist pallets (#1233) Reduce bencharm runs of Zeitgeist pallets Running benchmarks of Zeitgeist pallets on the Zeitgeist reference machine currently takes four days. * Set inflation to more than zero for a full benchmark of handle_inflation (#1234) Update benchmarks.rs * Implement `force_pool_exit` and disable other zrml-swaps functions (#1235) * Abstract `pool_exit` business logic into `do_*` function * Add `force_pool_exit` and test * Install call filters for zrml-swaps * Implement and test `bmul_bdiv_*`; use in zrml-orderbook and zrml-parimutuel (#1223) * Implement and test `bmul_bdiv_*` * Use `bmul_bdiv_*` in pallets * Update copyright * Utilize Merigify's Merge Queue (#1243) ci(Mergify): configuration update Signed-off-by: Harald Heckmann <[email protected]> * Set in-progress when needed and rerun CI in merge queue (#1244) * Set in-progress when need and rerun CI in merge queue --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Avoid mergify dequeue (#1245) * Avoid mergify deque * Set review needed only shortly after Mergify commit * Extend neo-swaps tests and clean up `math.rs` (#1238) * Add tests to neo-swaps that check large buy/sell amounts at high liquidity * Use new implementation of HydraDX's `exp` * Add failure tests to neo-swaps's `math.rs` * Fix formatting * Update copyright notices --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Remove migrations and dead code (#1241) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reorganize prediction-market tests (#1242) * Rename `tests.rs` to `old_tests.rs` to avoid naming conflicts * Move `buy_complete_set` tests to new tests * Clean up `buy_complete_set` tests * Extract `sell_complete_set_tests` * Clean up `sell_complete_set` tests * Extract `admin_move_market_to_closed` tests * Extract `create_market` tests * Extract `admin_move_market_to_resolved` tests * Remove superfluous test * Extract more `create_market` tests * Extract `approve_market` tests * Extract `edit_market` tests * Extract `edit_market` tests * Add `on_market_close` tests * Extract `manually_close_market` tests * Extract `on_initialize` tests * Extract `report` tests * Extract `dispute` tests * Extract `schedule_early_close` tests * Extract `dispute_early_close` tests * Extract `reject_early_close` tests * Extract more `dispute` tests * Extract `close_trusted_market` tests * Extract `start_global_dispute` tests * Extract `redeem_shares` tests and add missing tests * Extract `on_resolution` and additional `redeem_shares` tests * Move integration tests into new test module * Automatically set block to `1` at the start of test * Replace `crate::Config` with `Config` * Access constant through `Config` * Add TODOs for missing execution paths * Fix formatting --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Improve fee payment management (#1246) * Improve fee payment management * Make code compileable * Do not remit TX fees for redeem_shares Co-authored-by: Malte Kliemann <[email protected]> --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix Rust and Discord badge (#1247) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix neo-swaps doc strings (#1250) * Improve `SellExecuted` documentation * Clean up math in comments and doc strings * Fix formatting * Adjust style guide (loops) and add unreachable macro (#1252) * Adjust style guide (loops) and add unreachable macro * Add macros module to lib.rs * Update docs/STYLE_GUIDE.md Co-authored-by: Malte Kliemann <[email protected]> * Move macro to zeitgeist-macros and add examples --------- Co-authored-by: Malte Kliemann <[email protected]> * Merge Old* and New* asset variants * Partially integrate lazy migration routing * Integrate lazy migration routing * Fix ExistentialDeposit mapping & Satisfy Clippy * Remove primitives/macros * Filter certain asset destroy calls (they're managed) * Integrate asset destruction into prediction markets * Add BaseAssetClass * Update prediction-markets & market-commons * Update authorized * Update liquidity-mining * Update simple-disputes * Update parimutuels (wip) * Move functions into market struct and properly delete assets * Add ParimutuelAssetClass * Add parimutuel.rs * Remove duplicate code * Adjust asset type and managed destroy after refund in parimutuels * Add MarketTransitionApi This will allow prediction-markets to signal other pallets that state transitions happened * Add MarketTransitionApi * Implement MarketTransitionApi for Parimutuels * Partially implement asset creation/destruction in parimutuels * Add all asset creation / destruction tests to parimutuels * Adjust Court * Update global-disputes * Update swaps * Update neo-swaps * Integrate OnStateTransition hooks into prediction-markets * Use proper state transition weights * Make cargo check succeed * Partially update orderbook * Update orderbook * Update orderbook * Finalize orderbook update * Improve style * Add XcmAssetClass * Add sub asset classes, extend Market, provide market transition trait * Update asset-router * Integrate asset system into prediction-market, market-commons and parimutuel - Market commons now uses the BaseAsset class for base assets - Prediction markets now creates and destroys MarketAssets only if market.is_redeemable - Prediction markets now calls OnStateTransition when transitioning it's state - Parimutuel markets now implements StateTransitionApi - Parimutuel markets now properly creates and destroys ParimutuelShares * Implement support for non-reservable assets in orderbook * Integrate new asset system into Battery Station XCM * Integrate new asset system into Zeitgeist XCM * Implement Unbalanced for asset-router * Enable fee payment for campaign assets * Fix conditional import * Format * Fix unfillable / unremovable order bug Co-authored-by: Chralt <[email protected]> * Add tests for Unbalanced impl * Implement fee charging tests * Undo unnecessray change * Undo last commit * Better case-distinction and explicitly drop campaign asset fee Co-authored-by: Chralt <[email protected]> * Use is_foreign_asset() * Avoid panic * Format * Fix CI --------- Signed-off-by: Harald Heckmann <[email protected]> Co-authored-by: Chralt <[email protected]> Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Merge release v0.4.2 (#1174) * Update versions (#1168) * Add updated weights from reference machine (#1169) * Add license header Co-authored-by: Chralt <[email protected]> --------- Co-authored-by: Chralt <[email protected]> * Remove migrations (#1180) * Filter admin functions for main-net (#1190) filter admin functions for main-net * Add debug assertions for slashes and reserves (#1188) * add debug assertions for missing slashes * place debug_assert for unreserves * Add some verify checks to court (#1187) add some verify checks to court * Bypass battery stations contracts call filter for court, parimutuel, order book markets (#1185) update contracts call filter * Fix failing court benchmark (#1191) * fix court assertion for resolve_at * remove unnecessary variable * mirror mock and actual impl for DisputeResolution * Implement trusted market close (#1184) * implement trusted market close * remove unnecessary benchmark helper function * Update zrml/prediction-markets/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * remove unnecessary function * check market end * check auto close * add invalid market status test --------- Co-authored-by: Malte Kliemann <[email protected]> * Modify court events for indexer (#1182) * modify events for indexer * gracefully handle panicers * handle binary search by key error * improve style * Ensure MinBetSize after fee (#1193) * handle own existential deposit errors * use require_transactional * correct benchmark and test min bet size amounts * Replace fixed math operations with traited versions (#1149) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Update primitives/src/math/fixed.rs Co-authored-by: Harald Heckmann <[email protected]> --------- Co-authored-by: Harald Heckmann <[email protected]> * Add env_logger and add force-debug feature (#1205) * add env_logger and add force-debug feature * taplo fmt, fix copyrights * Update zrml/styx/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/rikiddo/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * update comment to clarify logging --------- Co-authored-by: Malte Kliemann <[email protected]> * Inflate defensively (#1195) * inflate defensively * add tests * Update zrml/court/src/tests.rs Co-authored-by: Malte Kliemann <[email protected]> * fix test * fix test name --------- Co-authored-by: Malte Kliemann <[email protected]> * Maintain order book (#1183) * integrate market creator fees into orderbook * edit tests * update tests * modify tests * avoid order side * Update primitives/src/traits/distribute_fees.rs Co-authored-by: Malte Kliemann <[email protected]> * remove asset and account from get_fee api call * take base asset fees from fill_order * adjust orderbook for taking fees in fill_order * adjust without order side for fill_order * adapt to avoid concept of order side * adapt benchmarks, tests and weights, restructure * use DispatchResult * remove unused import * do not adjust maker amount for place_order * correct fuzz of orderbook * check if maker_amount is zero * fix order book name in benchmarks * use remove instead of cancel order book * correct order book test names * update READMEs * fmt * add tests * use minimum balance as min order size * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * prettier orderbook md * remove comments from benchmarks * fix tests and benchmarks readibility * use order book instead of orderbook * clarify error message * clarify comments * rename is to ensure * error for repatriate * fix unnecessary clone * correct mocks behaviour * improve test * improve test of near full fill error * use turbofish syntax * add filled_maker_amount to event * split tests * combine two functions, add docs * abandon get_fees * fix order book tests and mock * remove check for impossible behaviour * fix toml and benchs * prepare migration * add migration for order structure * return zero fees if transfer fails * delete unnecessary assert * fix naming * fix naming the second * fix maker fill description * add scoring rule check to remove order * fix post_upgrade * fix terminology * Update zrml/orderbook/src/migrations.rs Co-authored-by: Malte Kliemann <[email protected]> * use storage root check in migration test * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * delete debug_assert --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement AMM 2.0 (#1173) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Update zrml/neo-swaps/docs/docs.tex Co-authored-by: Harald Heckmann <[email protected]> * Apply suggestions from code review Co-authored-by: Harald Heckmann <[email protected]> * Rename `Fixed` and clean up * Hotfix exponential function and extend tests * Complete math test suite * Fix broken sentence * Remove unused imports * Extend `ln` test cases * Merge & fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement Liquidity Tree (#1178) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Add liquidity tree draft * Fix compiler error in draft * Clean up `propagate_fees` * Add docs * Reorganize * Clean up, add max iterations * Remove migrations * Prepare switch to bounded vector * Use `BoundedVec` * Use bounded `BTreeMap` and insert `LiquidityTree` into neo-swaps * Resolve TODO * Clean up tests * Add migration and fix clippy errors * Make tree depth a generic * Make tree depth a config parameter * Update runtime complexities * Add benchmarking utilities * Fix runtime complexity for `deploy_pool` * Add missing lazy propagation * Fix comment * Fix error type * Add `join` benchmarking and fix a bug in `LiquidityTree` * Clean up benchmarks * Fix clippy issues * Remove unnecessary type hint * Fix bugs in liquidity tree * Fix comments * Some fixes in benchmarks * Implement `BenchmarkHelper` * Update benchmarks to use the LT * Clean up and format * Add testing framework for liquidity trees * Add first extensive test and fix a bug * Add more tests * Clean up test * Add news tests and use better numerics for ratio calculations * Make docs more explicit * Add tests for `exit` * Add tests for deposit fees * Add tests for getters * Clean up tests some more * Finalize liquidity tree tests * Clean up comments * Introduce exit fees * Rewrite `exit_works` * Fix liquidity parameter calculation * Make test a bit more complex * Test liquidity shares * Clean up tests * Update test for destruction * Enhance `exit_destroys_pool` test * More cleanup * Add test for full tree * Add tests for `join` * Improve test * Test withdrawal * Clean up the test * Add test for noop * Add minimum relative liquidity * Verify that buys deduct the correct amount of fees * Add last tests * Add notes about the liquidity tree * Fix benchmarks * Fix clippy errors * Fix benchmarks * Do more work on benchmarks * Fix benchmarks, deduce max tree depth * Remove already solved TODO * Document macros * Remove TODO (not a good idea to edit LaTeX docs now) * Fix `bmul_bdiv` * Make `bmul_bdiv_*` not implemented * Double-check that there's a non-zero check for `ratio` * Fix formatting * Fix taplo formatting * Remove TODO * Remove TODOs and fix documents * Update primitives/src/math/fixed.rs Co-authored-by: Chralt <[email protected]> * Mark `SoloLp` as deprecated * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Make `bmul_bdiv` a little more idiomatic * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Rewrite and format `README.md` * Fix comment about existential deposit * Remove FIXME * Add a check against misconfiguration of the pallet * Fix field docstrings * Add comment about `assert_ok_with_transaction` * Update zrml/neo-swaps/src/mock.rs Co-authored-by: Chralt <[email protected]> * Format code * Fix comment * Prettify extrinsic calls in benchmarks * Improve code quality of `assert_pool_state!` * Extend comment about order of abandoned nodes * Clarify the meaning of "leaf" in `is_leaf` * Rename `index_maybe` to `opt_index` * Add unexpected storage overflow error for bounded objects * Rename `UnclaimedFees` to `UnwithdrawnFees` * Fix documentation * Use enum to signal update direction in `update_descendant_stake` * Add verification to `join_*` benchmarks * Improve documentation * Use builtin log * Remove illegal token from `README.md` * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix unintentional doctest * Improve `mutate_children` * Add helpful comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix migration * Fix balances in parachain mock * use PartialEqNoBound and CloneNoBound for tree * Fix formatting * Make `debug_assert!` more clear * Redesign node assignment * Clean up comments * Add some storage overflow errors * Introduce `LiquidityTreeChildIndices` * Remove outdated docs * Rename `update_descendant_stake` * Remove `Default` usage * Make liquidity tree types `pub(crate)` where possible * Make all fields of `Node` only `pub(crate)` * Make `Node<T>` an associated type of `LiquidityTreeHelper` * Update zrml/neo-swaps/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix tests * Prettify `path_to_node` * Add max iterations to `path_to_node` * Add test for complex liquidity tree interactions * Improve documentation of `LiquidityTreeChildIndices` * Reorganize crate structure * Update weights and fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Improve XCM fee handling (#1225) * Fix padding of foreign fees in Zeitgeist runtime * Fix padding of foreign fees in Battery Station runtime * Format * Update copyright * Use adjusted_balance function * Remove court and global disputes from call filter for the main-net (#1226) * remove from call filter * update copyright * Sunset old AMMs and their pools (#1197) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Remove `pool_*_subsidy` * Remove `distribute_pool_share_rewards` * Remove `end_subsidy_phase` * Remove `destroy_pool_in_subsidy_phase` * Remove `MinSubsidy*` * Remove `SubsidyProviders` * Remove `start_subsidy` * Rewrite `create_pool` * Rewrite `swap_exact_amount_in` * Rewrite `swap_exact_amount_out` * Rewrite utility functions * Remove Rikiddo from weight calculation * Remove Rikiddo from zrml-swaps * Remove unused errors * Remove `ScoringRule::Rikiddo...` * Remove `*SubsidyPeriod` * Remove Rikiddo-related storage and events * Remove automatic opening of pools * Remove `open_pool` from prediction-markets * Remove `Swaps::close_pool` from prediction-markets * Remove `clean_up_pool` from prediction-markets * Remove `clean_up_pool` from `Swaps` trait * Remove CPMM deployment from prediction-markets * Remove automatic arbitrage * Move `market_account` back to prediction-markets * Remove unused market states * Fix fuzz tests * Implement market migration * Minor changes * Fix migration behavior * Remove creator fees from swaps * Fix try-runtime * Fix clippy issues * Remove `LiquidityMining` from swaps * Fix `get_spot_prices` * Take first step to remove `MarketCommons` from swaps * Remove `MarketCommons` from swaps * Rewrite `PoolStatus` * Move `Pool*` to swaps * Use `Bounded*` types in `Pool` * Finish swaps migration * Add missing files * Fix formatting and clippy errors * Remove `pool_status.rs` * Ignore doctests * Fix fuzz tests * Add prediciton-markets migration * Test prediction-markets migration * Finish tests of the market-commons migration * Add migrations to runtime and fix various errors * Clean up * Clean up * Format code * Fix pool migration behavior * Remove `MarketId` from swaps * Fix formatting * Fix formatting * Remove `CPMM` and allow other scoring rules on Battery Station * Update macros/Cargo.toml Co-authored-by: Harald Heckmann <[email protected]> * Update primitives/src/traits/zeitgeist_asset.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Clean up TODOs/FIXMEs * Update changelog * Make more changes to changelog * Clear zrml-swaps storage * Remove cfg-if dependency * Fix formatting * Trigger CI * Update copyright notices * Update docs/changelog_for_devs.md Co-authored-by: Chralt <[email protected]> * Make benchmark helper only available if feature flags are set * Remove `ZeitgeistAsset` trait * Remove preliminary benchmarks with more steps * Format code * Fix copyright notice --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Merge release v0.4.3 (#1211) * Use hotfixed `exp` * Reorganize tests * Fix formatting * Bump versions to v0.4.3 * Update spec versions * Add missing version bumps * Format * Update licenses --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reduce `market_status_manager` aka `on_initialize` iterations (#1160) * remove dangerous loop * limit iterations of dangerous loop * reintegrate last time frame storage item * wip * benchmark manual close and open * fix stall test * emit event and log for recovery time frame * add tests * add trailing comma * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * change should_be_closed condition * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * change recursion limit line * regard period not started yet * add error tests * correct benchmarks * fix after merge and clippy * use turbofish, add test checks * remove manually open broken market * correct errors and call index * correct wrong error name * correct position of call index * correct error position * update copyrights * fix after merge * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * set market end for manual close --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Update style guide to streamline reviews (#1228) * Reduce benchmark runs of Zeitgeist pallets (#1233) Reduce bencharm runs of Zeitgeist pallets Running benchmarks of Zeitgeist pallets on the Zeitgeist reference machine currently takes four days. * Set inflation to more than zero for a full benchmark of handle_inflation (#1234) Update benchmarks.rs * Implement `force_pool_exit` and disable other zrml-swaps functions (#1235) * Abstract `pool_exit` business logic into `do_*` function * Add `force_pool_exit` and test * Install call filters for zrml-swaps * Implement and test `bmul_bdiv_*`; use in zrml-orderbook and zrml-parimutuel (#1223) * Implement and test `bmul_bdiv_*` * Use `bmul_bdiv_*` in pallets * Update copyright * Utilize Merigify's Merge Queue (#1243) ci(Mergify): configuration update Signed-off-by: Harald Heckmann <[email protected]> * Set in-progress when needed and rerun CI in merge queue (#1244) * Set in-progress when need and rerun CI in merge queue --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Avoid mergify dequeue (#1245) * Avoid mergify deque * Set review needed only shortly after Mergify commit * Extend neo-swaps tests and clean up `math.rs` (#1238) * Add tests to neo-swaps that check large buy/sell amounts at high liquidity * Use new implementation of HydraDX's `exp` * Add failure tests to neo-swaps's `math.rs` * Fix formatting * Update copyright notices --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Remove migrations and dead code (#1241) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reorganize prediction-market tests (#1242) * Rename `tests.rs` to `old_tests.rs` to avoid naming conflicts * Move `buy_complete_set` tests to new tests * Clean up `buy_complete_set` tests * Extract `sell_complete_set_tests` * Clean up `sell_complete_set` tests * Extract `admin_move_market_to_closed` tests * Extract `create_market` tests * Extract `admin_move_market_to_resolved` tests * Remove superfluous test * Extract more `create_market` tests * Extract `approve_market` tests * Extract `edit_market` tests * Extract `edit_market` tests * Add `on_market_close` tests * Extract `manually_close_market` tests * Extract `on_initialize` tests * Extract `report` tests * Extract `dispute` tests * Extract `schedule_early_close` tests * Extract `dispute_early_close` tests * Extract `reject_early_close` tests * Extract more `dispute` tests * Extract `close_trusted_market` tests * Extract `start_global_dispute` tests * Extract `redeem_shares` tests and add missing tests * Extract `on_resolution` and additional `redeem_shares` tests * Move integration tests into new test module * Automatically set block to `1` at the start of test * Replace `crate::Config` with `Config` * Access constant through `Config` * Add TODOs for missing execution paths * Fix formatting --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Improve fee payment management (#1246) * Improve fee payment management * Make code compileable * Do not remit TX fees for redeem_shares Co-authored-by: Malte Kliemann <[email protected]> --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix Rust and Discord badge (#1247) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix neo-swaps doc strings (#1250) * Improve `SellExecuted` documentation * Clean up math in comments and doc strings * Fix formatting * Adjust style guide (loops) and add unreachable macro (#1252) * Adjust style guide (loops) and add unreachable macro * Add macros module to lib.rs * Update docs/STYLE_GUIDE.md Co-authored-by: Malte Kliemann <[email protected]> * Move macro to zeitgeist-macros and add examples --------- Co-authored-by: Malte Kliemann <[email protected]> * Merge Old* and New* asset variants * Partially integrate lazy migration routing * Integrate lazy migration routing * Fix ExistentialDeposit mapping & Satisfy Clippy * Integrate Moonwall (#1192) * modify integration tests * wip * correct typescript to be utilized by zndsl * integrate moonwall * use faster pnpm package manager * get moonwall network running * add scripts folder * add moonwall readme * update readme * add runtime upgrade integration tests * update readme * wip chopticks runtime upgrade test * prepare chopsticks battery station upgrade test * add chopsticks and sqlite3 * chopsticks runs locally after python installation * battery station rt-upgrade works, but not main-net * fix zeitgeist chopsticks upgrade test * add zndsl test to workflow * update integration test workflow * wip * update download polkadot * wip * wip * wip * wip * wip * wip * use artifact storage in github actions * use release instead of debug * update ci * update ci * update ci * correct CI * avoid creating zeitgeist folder * download to target/release * add executive permission * dump chopsticks * log chopsticks * increase timeouts for CI workflows * resolve ws port conflict, add xcm transfer test * add xcm tests to ci * fix log print for chopsticks * use polkadot v1.1.0 for it-tests * add xcm test to post rt upgrade suite * correct ci * manually increase blocks for hydradx * divide main and test-net it tests * avoid port conflict for parallel chopsticks jobs * fix CI and typescript errors * update ci * exit cat command in ci * update CI to stop immediately * restructure jobs * update CI to only show logs for failure * update readme * update readme * delete outdated test instruction * delete unused files * add license to integration tests * add copyright * add copyrights * add copyrights * mkdir integration-tests/tmp * update integration test readme * Update integration-tests/scripts/download-polkadot.sh Co-authored-by: Harald Heckmann <[email protected]> * update gitignore * update download polkadot comment * build node for deploy-zombienet script * remove mkdir * Update integration-tests/scripts/download-polkadot.sh Co-authored-by: Harald Heckmann <[email protected]> * Update integration-tests/scripts/download-polkadot.sh Co-authored-by: Harald Heckmann <[email protected]> * Update .github/workflows/integration-tests.yml Co-authored-by: Harald Heckmann <[email protected]> * build node in non CI environments * change integration test execution directory * remove CI run for this branch --------- Co-authored-by: Harald Heckmann <[email protected]> * Use `Balance` instead of `u128` as type for Balancer weights (#1251) * Replace hard-coded `u128` fo weights with balance types * Replace modulo operator with `checked_rem_res` * Update copyright notices * Revert changes to modulo operations * Remove primitives/macros * Filter certain asset destroy calls (they're managed) * Remove unchecked modulo operations from production (#1254) * Remove unchecked modulo operations from production * Update copyright * Refactor swaps (#1255) * First pass fixing docs, comments and code style * Fix typos * Use `do_*` pattern, fix docs, remove unnecessary clippy exceptions * Replace `slash` with `withdraw` * Replace `slash` with `withdraw` * Remove reference to CPMM from weight function names * Hard-code `Max*Ratio` * Clean up, fix formatting * Fix `pool_exit` behavior * Remove unnecessary clones * Clean up events * Fix `pool_exit` behavior on odd pools and add a test * Fix test * Update copyright notices * Update docs * Update primitives/src/traits/swaps.rs Co-authored-by: Harald Heckmann <[email protected]> * Update primitives/src/traits/swaps.rs Co-authored-by: Harald Heckmann <[email protected]> * Remove fixed TODO * Fix merge --------- Co-authored-by: Harald Heckmann <[email protected]> * Integrate asset destruction into prediction markets * Add BaseAssetClass * Update prediction-markets & market-commons * Update authorized * Update liquidity-mining * Update simple-disputes * Update parimutuels (wip) * Merge release v0.5.0 into main (#1262) * Update versions (#1227) * Update weights (#1232) * Update copyright years * Revert Court handle_inflation() weight * Move functions into market struct and properly delete assets * Add ParimutuelAssetClass * Add parimutuel.rs * Remove duplicate code * Adjust asset type and managed destroy after refund in parimutuels * Add MarketTransitionApi This will allow prediction-markets to signal other pallets that state transitions happened * Add MarketTransitionApi * Implement MarketTransitionApi for Parimutuels * Only run copyright CI when merging into `main` (#1263) * Bring README up to date (#1264) * Update proxy types (#1259) * Replace `Swaps` with `NeoSwaps` proxy types * Add `withdraw_fees` to liquidity-related proxies * Update toolchain to fix codecov and fuzz errors (#1269) * Update toolchain * Fix formatting and linter errors * Update copyright notices * Fix copyright notice * Use GitHub action to free up space (#1271) * Use GitHub action to freee up space * Try deleting tool-cache as well * Add missing free disk calls; don't remove tool-cache * Remove unused dependencies (#1270) * License checker: Replace incorrect `push` with `append` (#1268) Replace incorrect `push` with `append` Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Partially implement asset creation/destruction in parimutuels * Add all asset creation / destruction tests to parimutuels * Adjust Court * Update global-disputes * Update swaps * Update neo-swaps * Integrate OnStateTransition hooks into prediction-markets * Use proper state transition weights * Make cargo check succeed * Partially update orderbook * Update orderbook * Update orderbook * Finalize orderbook update * Improve style * Add XcmAssetClass * Add sub asset classes, extend Market, provide market transition trait * Update asset-router * Integrate asset system into prediction-market, market-commons and parimutuel - Market commons now uses the BaseAsset class for base assets - Prediction markets now creates and destroys MarketAssets only if market.is_redeemable - Prediction markets now calls OnStateTransition when transitioning it's state - Parimutuel markets now implements StateTransitionApi - Parimutuel markets now properly creates and destroys ParimutuelShares * Implement support for non-reservable assets in orderbook * Update Codeowners (#1286) * Integrate new asset system into Battery Station XCM * Integrate new asset system into Zeitgeist XCM * Implement Unbalanced for asset-router * Enable fee payment for campaign assets * Fix conditional import * Format * Fix unfillable / unremovable order bug Co-authored-by: Chralt <[email protected]> * Add tests for Unbalanced impl * Implement fee charging tests * Undo unnecessray change * Undo last commit * Add previous stake information after rejoin (#1285) * update joined_at after rejoin * Add additional fields to CourtPoolItem struct, refactor * complete tests * add migration * revert benchmark verify check * remove migration comment * satisfy clippy * implement different approach * adopt uneligble stake and index info * update benchmark * apply review comments * correct current period index calculation * apply review suggestions * Update zrml/court/src/tests.rs Co-authored-by: Harald Heckmann <[email protected]> * shorten test * add try-runtime checks --------- Co-authored-by: Harald Heckmann <[email protected]> * Update asset-router readme * Extended changelog for devs * Remove deprecated ExistentialDeposits type --------- Signed-off-by: Harald Heckmann <[email protected]> Co-authored-by: Chralt <[email protected]> Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* New asset system - Separate asset types and add pallet-assets instances to runtime (#1177) * Add new asset types * Add custom assets to runtime * Add market assets to runtime * Add pallet_assets benchmark and weights * Expose MarketAssets call enum * Update todo comment to incluse issue number * Add campaign assets instance to runtime * Cargo fmt * Taplo fmt * Fix comments Co-authored-by: Malte Kliemann <[email protected]> * Adjust ForceOrigins * Fix typo * Update primitives/src/types.rs Co-authored-by: Chralt <[email protected]> * Remove CombinatorialOutcome from PredictionMarketAsset --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Chralt <[email protected]> * New Asset System - Prepare extension of Asset Manager (#1181) * Add new asset types * Add custom assets to runtime * Add market assets to runtime * Add pallet_assets benchmark and weights * Expose MarketAssets call enum * Update todo comment to incluse issue number * Add campaign assets instance to runtime * Cargo fmt * Taplo fmt * Refine asset class types * Use efficient asset types * Add all variants to overarching Asset enum * Make MarketId compactable * Adjust SerdeWrapper Soon to be deprecated * Make Battery Station compileable * Make Zeitgeist compileable * Cleanup code * Remove NewForeignAsset Conversion to compact encoding implies massive migration effort * Implement asset type conversions * Add Currency asset class * Remove deprecated SerdeWrapper * Add Currencies asset class Also renames existing CurrencyId to Assets * Add scale codec index matching tests * Add asset conversion tests * Update docstring * Improve assets module structure * Update license * Update copyright * Repair errorneous merge * Update license * Remove CombinatorialOutcome * Improve tests * Improve variable names * Prettify code Co-authored-by: Malte Kliemann <[email protected]> * Fix conversion CampaignAssetId <> CampaignAssetClass * Reorder asset enum variants * Update runtime/zeitgeist/src/parameters.rs Co-authored-by: Chralt <[email protected]> * Improve CurrencyClass docstring Co-authored-by: Malte Kliemann <[email protected]> --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Chralt <[email protected]> * New Asset System - Implement asset-router (#1189) * Add new asset types * Add custom assets to runtime * Add market assets to runtime * Add pallet_assets benchmark and weights * Expose MarketAssets call enum * Update todo comment to incluse issue number * Add campaign assets instance to runtime * Cargo fmt * Taplo fmt * Refine asset class types * Use efficient asset types * Add all variants to overarching Asset enum * Make MarketId compactable * Adjust SerdeWrapper Soon to be deprecated * Make Battery Station compileable * Make Zeitgeist compileable * Cleanup code * Remove NewForeignAsset Conversion to compact encoding implies massive migration effort * Implement asset type conversions * Add Currency asset class * Remove deprecated SerdeWrapper * Add Currencies asset class Also renames existing CurrencyId to Assets * Add scale codec index matching tests * Add asset conversion tests * Update docstring * Improve assets module structure * Update license * Create asset-router pallet scaffold * Start implementing all traits * Implement MultiCurrency partially for asset-router * Implement MultiCurrency for asset-router * Implement MultiCurrencyExtended * MultiLockableCurrency * Implement MultiReservableCurrency * Implement NamedMultiReservableCurrency * Fix runtime * Integrate asset-router in runtime * Fix a couple of bugs * Prepare asset-router test environment * Start MultiCurrency test impl * Complete MultiCurrency tests * Add MultiCurrencyExtended tests * Implement MultiReserveableCurrency tests * Implement NamedMultiReserveableCurrency tests * Implement MultiLockableCurrency tests * Improve test structure * Undo unnecessary change * Format code * Implement fungibles::{Create, Destroy, Inspect} * Remove comment * Add tests for Inspect impl * Add tests for Create impl * Add tests for Destroy impl * Make asset types configurable * Use less restricitve traits for pm AssetManager * Make project compilable * Merge branch 'sea212-new-asset-system' into sea212-new-asset-system-part-3 * Update licenses * Repair tests partially * Comment out irrelevant test * Partially satisfy Clippy * Adjust XCM to use Currencies * Adjust XCM to use Currencies (zeitgeist runtime) * Adjust prediction markets tests * Adjust neo-swaps mock * Satisfy Clippy * Format code * Update licenses * Remove pallet-asset benchmark helper from mock * Format code * Repair tests with runtime-benchmarks * Format code * Remove TODO comment * Implement log for unhandled errors in asset-router * Use log target * Improve and prettify readmes * Use assert_noop! in favor of asset_err! Co-authored-by: Malte Kliemann <[email protected]> * Make sea212 codeowner of zrml/asset-router * Fix typo * Rename variable * Better abs() overflow handling * Check Bob's balance in MultiCurrency tests * Fix Create test for Currencies * Improve test precision * Verify total issuance via direct pallet invocation * Implement Inspect for Currencies * Satisfy Clippy --------- Co-authored-by: Malte Kliemann <[email protected]> * New Asset System - Add managed asset destruction (#1201) * Add new asset types * Add custom assets to runtime * Add market assets to runtime * Add pallet_assets benchmark and weights * Expose MarketAssets call enum * Update todo comment to incluse issue number * Add campaign assets instance to runtime * Cargo fmt * Taplo fmt * Refine asset class types * Use efficient asset types * Add all variants to overarching Asset enum * Make MarketId compactable * Adjust SerdeWrapper Soon to be deprecated * Make Battery Station compileable * Make Zeitgeist compileable * Cleanup code * Remove NewForeignAsset Conversion to compact encoding implies massive migration effort * Implement asset type conversions * Add Currency asset class * Remove deprecated SerdeWrapper * Add Currencies asset class Also renames existing CurrencyId to Assets * Add scale codec index matching tests * Add asset conversion tests * Update docstring * Improve assets module structure * Update license * Create asset-router pallet scaffold * Start implementing all traits * Implement MultiCurrency partially for asset-router * Implement MultiCurrency for asset-router * Implement MultiCurrencyExtended * MultiLockableCurrency * Implement MultiReservableCurrency * Implement NamedMultiReservableCurrency * Fix runtime * Integrate asset-router in runtime * Fix a couple of bugs * Prepare asset-router test environment * Start MultiCurrency test impl * Complete MultiCurrency tests * Add MultiCurrencyExtended tests * Implement MultiReserveableCurrency tests * Implement NamedMultiReserveableCurrency tests * Implement MultiLockableCurrency tests * Improve test structure * Undo unnecessary change * Format code * Implement fungibles::{Create, Destroy, Inspect} * Remove comment * Add tests for Inspect impl * Add tests for Create impl * Add tests for Destroy impl * Make asset types configurable * Use less restricitve traits for pm AssetManager * Make project compilable * Create volatile assets in PM * Start adjustment of PM tests * Add ManagedDestroy trait * Implement managed_destroy in asset-router * Implement ManagedDestroy trait * Implement on_idle asset destruction * Finalize managed asset destruction * Finalize managed asset destruction * Handle duplicate destruction attempts * Fix reverse logic * Add managed destroy add asset test * Add managed destroy multi add asset test * Add destroy all assets on_idle tests * Complete managed destroy tests * Update AssetRouter config in runtime * Repair PM mock * Satisfy Clippy * Use modified pallet-assets * Use modified pallet-assets The modified variant provides an additional trait and Config type, that are used to automate asset destruction * Remove comments * Remove empty line * Mostly improve asset destruction code * Finalize on_idle hook and adjust tests * Improve project structure * Rename files * Add tests for custom types * Satisfy CI * Apply suggestions from code review Co-authored-by: Chralt <[email protected]> * Use common function for impl ManagedDestroy * Improve AssetInDestruction ordering & add test * Format code * Use require_transactional * Use ensure! * Use AssetIndestructible error and fix tests * Don't execute on_idle if weight not enough to read storage * Use DestroyApprovalWeight for approval destruction Co-authored-by: Malte Kliemann <[email protected]> * Reduce available weight to 0 when destroying accounts/approvals errors. Co-authored-by: Malte Kliemann <[email protected]> * Use more precise return type for handle_destroy functions * Fix destruction state machine loop condition Co-authored-by: Malte Kliemann <[email protected]> * Log warning / test assert when loop safety guard is triggered * Add outer asset destruction loop safety guard * Revert loop condition overwrite * Elaborate on managed asset destruction in readme * Improved weight guards + tests Also reduce the maximum storage proof size required, as it previously was 1/8 of the maximum PoV size per block on Polkadot * Test that approvals are also destroyed * Use constant for min extra computation time in on_idle * Add more tests * Add and use unreachable_non_terminating macro * Refractor code * Satisfy Clippy * Fix unreachable_non_terminating macro --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Malte Kliemann <[email protected]> * New Asset System - Move lazy migration into asset-router (#1256) * Merge Old* and New* asset variants * Partially integrate lazy migration routing * Integrate lazy migration routing * Fix ExistentialDeposit mapping & Satisfy Clippy * Improve code style Co-authored-by: Chralt <[email protected]> * Improve style Co-authored-by: Malte Kliemann <[email protected]> * Improve style Co-authored-by: Malte Kliemann <[email protected]> * Add frame-support/try-runtime to asset-router * Rename multicurrency* files to multi_currency* * Test old-outcome currency branch * Use reserved_balance_named in tests * Including duplicate asset routing info in readme * Update readme --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Malte Kliemann <[email protected]> * New asset system - Merge main (#1258) * New Asset System - Add Sub Asset Classes and extended Market functionality (#1281) * Add sub asset classes, extend Market, provide market transition trait * Update asset-router * Correct ParimutuelAssetClass docstring * Add more docstrings to Market impl * Add tests for MarketTransitionApi * Implement try_into failure tests for assets * Fix typo * Add docstring to public func of Market struct * New Asset System - Integrate into Prediction Markets and Parimutuel (#1282) * Add sub asset classes, extend Market, provide market transition trait * Update asset-router * Integrate asset system into prediction-market, market-commons and parimutuel - Market commons now uses the BaseAsset class for base assets - Prediction markets now creates and destroys MarketAssets only if market.is_redeemable - Prediction markets now calls OnStateTransition when transitioning it's state - Parimutuel markets now implements StateTransitionApi - Parimutuel markets now properly creates and destroys ParimutuelShares * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * Use workspace for impl-trait-for-tuples * Add on_activation and on_resolution weight to parimutuel * Fix typo * Prepare OnStateTransition tests * Add OnStateTransition tests * Update zrml/parimutuel/src/lib.rs Co-authored-by: Chralt <[email protected]> --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Chralt <[email protected]> * New Asset System - Integrate into remaining pallets (#1284) * Add sub asset classes, extend Market, provide market transition trait * Update asset-router * Integrate asset system into prediction-market, market-commons and parimutuel - Market commons now uses the BaseAsset class for base assets - Prediction markets now creates and destroys MarketAssets only if market.is_redeemable - Prediction markets now calls OnStateTransition when transitioning it's state - Parimutuel markets now implements StateTransitionApi - Parimutuel markets now properly creates and destroys ParimutuelShares * Integrate new asset system into remaining pallets * Update zrml/neo-swaps/src/tests/join.rs Co-authored-by: Malte Kliemann <[email protected]> --------- Co-authored-by: Malte Kliemann <[email protected]> * New Asset System - Integrate into Orderbook/Court/GlobalDisputes (#1283) * Add sub asset classes, extend Market, provide market transition trait * Update asset-router * Integrate asset system into prediction-market, market-commons and parimutuel - Market commons now uses the BaseAsset class for base assets - Prediction markets now creates and destroys MarketAssets only if market.is_redeemable - Prediction markets now calls OnStateTransition when transitioning it's state - Parimutuel markets now implements StateTransitionApi - Parimutuel markets now properly creates and destroys ParimutuelShares * Implement support for non-reservable assets in orderbook * Format * Fix unfillable / unremovable order bug Co-authored-by: Chralt <[email protected]> * Check reserved balanced named * Log when reserve is less than expected --------- Co-authored-by: Chralt <[email protected]> * New Asset System - Integrate into XCM (#1287) * Merge release v0.4.2 (#1174) * Update versions (#1168) * Add updated weights from reference machine (#1169) * Add license header Co-authored-by: Chralt <[email protected]> --------- Co-authored-by: Chralt <[email protected]> * Remove migrations (#1180) * Filter admin functions for main-net (#1190) filter admin functions for main-net * Add debug assertions for slashes and reserves (#1188) * add debug assertions for missing slashes * place debug_assert for unreserves * Add some verify checks to court (#1187) add some verify checks to court * Bypass battery stations contracts call filter for court, parimutuel, order book markets (#1185) update contracts call filter * Fix failing court benchmark (#1191) * fix court assertion for resolve_at * remove unnecessary variable * mirror mock and actual impl for DisputeResolution * Implement trusted market close (#1184) * implement trusted market close * remove unnecessary benchmark helper function * Update zrml/prediction-markets/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * remove unnecessary function * check market end * check auto close * add invalid market status test --------- Co-authored-by: Malte Kliemann <[email protected]> * Modify court events for indexer (#1182) * modify events for indexer * gracefully handle panicers * handle binary search by key error * improve style * Ensure MinBetSize after fee (#1193) * handle own existential deposit errors * use require_transactional * correct benchmark and test min bet size amounts * Replace fixed math operations with traited versions (#1149) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Update primitives/src/math/fixed.rs Co-authored-by: Harald Heckmann <[email protected]> --------- Co-authored-by: Harald Heckmann <[email protected]> * Add env_logger and add force-debug feature (#1205) * add env_logger and add force-debug feature * taplo fmt, fix copyrights * Update zrml/styx/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/rikiddo/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * update comment to clarify logging --------- Co-authored-by: Malte Kliemann <[email protected]> * Inflate defensively (#1195) * inflate defensively * add tests * Update zrml/court/src/tests.rs Co-authored-by: Malte Kliemann <[email protected]> * fix test * fix test name --------- Co-authored-by: Malte Kliemann <[email protected]> * Maintain order book (#1183) * integrate market creator fees into orderbook * edit tests * update tests * modify tests * avoid order side * Update primitives/src/traits/distribute_fees.rs Co-authored-by: Malte Kliemann <[email protected]> * remove asset and account from get_fee api call * take base asset fees from fill_order * adjust orderbook for taking fees in fill_order * adjust without order side for fill_order * adapt to avoid concept of order side * adapt benchmarks, tests and weights, restructure * use DispatchResult * remove unused import * do not adjust maker amount for place_order * correct fuzz of orderbook * check if maker_amount is zero * fix order book name in benchmarks * use remove instead of cancel order book * correct order book test names * update READMEs * fmt * add tests * use minimum balance as min order size * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * prettier orderbook md * remove comments from benchmarks * fix tests and benchmarks readibility * use order book instead of orderbook * clarify error message * clarify comments * rename is to ensure * error for repatriate * fix unnecessary clone * correct mocks behaviour * improve test * improve test of near full fill error * use turbofish syntax * add filled_maker_amount to event * split tests * combine two functions, add docs * abandon get_fees * fix order book tests and mock * remove check for impossible behaviour * fix toml and benchs * prepare migration * add migration for order structure * return zero fees if transfer fails * delete unnecessary assert * fix naming * fix naming the second * fix maker fill description * add scoring rule check to remove order * fix post_upgrade * fix terminology * Update zrml/orderbook/src/migrations.rs Co-authored-by: Malte Kliemann <[email protected]> * use storage root check in migration test * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * delete debug_assert --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement AMM 2.0 (#1173) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Update zrml/neo-swaps/docs/docs.tex Co-authored-by: Harald Heckmann <[email protected]> * Apply suggestions from code review Co-authored-by: Harald Heckmann <[email protected]> * Rename `Fixed` and clean up * Hotfix exponential function and extend tests * Complete math test suite * Fix broken sentence * Remove unused imports * Extend `ln` test cases * Merge & fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement Liquidity Tree (#1178) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Add liquidity tree draft * Fix compiler error in draft * Clean up `propagate_fees` * Add docs * Reorganize * Clean up, add max iterations * Remove migrations * Prepare switch to bounded vector * Use `BoundedVec` * Use bounded `BTreeMap` and insert `LiquidityTree` into neo-swaps * Resolve TODO * Clean up tests * Add migration and fix clippy errors * Make tree depth a generic * Make tree depth a config parameter * Update runtime complexities * Add benchmarking utilities * Fix runtime complexity for `deploy_pool` * Add missing lazy propagation * Fix comment * Fix error type * Add `join` benchmarking and fix a bug in `LiquidityTree` * Clean up benchmarks * Fix clippy issues * Remove unnecessary type hint * Fix bugs in liquidity tree * Fix comments * Some fixes in benchmarks * Implement `BenchmarkHelper` * Update benchmarks to use the LT * Clean up and format * Add testing framework for liquidity trees * Add first extensive test and fix a bug * Add more tests * Clean up test * Add news tests and use better numerics for ratio calculations * Make docs more explicit * Add tests for `exit` * Add tests for deposit fees * Add tests for getters * Clean up tests some more * Finalize liquidity tree tests * Clean up comments * Introduce exit fees * Rewrite `exit_works` * Fix liquidity parameter calculation * Make test a bit more complex * Test liquidity shares * Clean up tests * Update test for destruction * Enhance `exit_destroys_pool` test * More cleanup * Add test for full tree * Add tests for `join` * Improve test * Test withdrawal * Clean up the test * Add test for noop * Add minimum relative liquidity * Verify that buys deduct the correct amount of fees * Add last tests * Add notes about the liquidity tree * Fix benchmarks * Fix clippy errors * Fix benchmarks * Do more work on benchmarks * Fix benchmarks, deduce max tree depth * Remove already solved TODO * Document macros * Remove TODO (not a good idea to edit LaTeX docs now) * Fix `bmul_bdiv` * Make `bmul_bdiv_*` not implemented * Double-check that there's a non-zero check for `ratio` * Fix formatting * Fix taplo formatting * Remove TODO * Remove TODOs and fix documents * Update primitives/src/math/fixed.rs Co-authored-by: Chralt <[email protected]> * Mark `SoloLp` as deprecated * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Make `bmul_bdiv` a little more idiomatic * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Rewrite and format `README.md` * Fix comment about existential deposit * Remove FIXME * Add a check against misconfiguration of the pallet * Fix field docstrings * Add comment about `assert_ok_with_transaction` * Update zrml/neo-swaps/src/mock.rs Co-authored-by: Chralt <[email protected]> * Format code * Fix comment * Prettify extrinsic calls in benchmarks * Improve code quality of `assert_pool_state!` * Extend comment about order of abandoned nodes * Clarify the meaning of "leaf" in `is_leaf` * Rename `index_maybe` to `opt_index` * Add unexpected storage overflow error for bounded objects * Rename `UnclaimedFees` to `UnwithdrawnFees` * Fix documentation * Use enum to signal update direction in `update_descendant_stake` * Add verification to `join_*` benchmarks * Improve documentation * Use builtin log * Remove illegal token from `README.md` * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix unintentional doctest * Improve `mutate_children` * Add helpful comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix migration * Fix balances in parachain mock * use PartialEqNoBound and CloneNoBound for tree * Fix formatting * Make `debug_assert!` more clear * Redesign node assignment * Clean up comments * Add some storage overflow errors * Introduce `LiquidityTreeChildIndices` * Remove outdated docs * Rename `update_descendant_stake` * Remove `Default` usage * Make liquidity tree types `pub(crate)` where possible * Make all fields of `Node` only `pub(crate)` * Make `Node<T>` an associated type of `LiquidityTreeHelper` * Update zrml/neo-swaps/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix tests * Prettify `path_to_node` * Add max iterations to `path_to_node` * Add test for complex liquidity tree interactions * Improve documentation of `LiquidityTreeChildIndices` * Reorganize crate structure * Update weights and fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Improve XCM fee handling (#1225) * Fix padding of foreign fees in Zeitgeist runtime * Fix padding of foreign fees in Battery Station runtime * Format * Update copyright * Use adjusted_balance function * Remove court and global disputes from call filter for the main-net (#1226) * remove from call filter * update copyright * Sunset old AMMs and their pools (#1197) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Remove `pool_*_subsidy` * Remove `distribute_pool_share_rewards` * Remove `end_subsidy_phase` * Remove `destroy_pool_in_subsidy_phase` * Remove `MinSubsidy*` * Remove `SubsidyProviders` * Remove `start_subsidy` * Rewrite `create_pool` * Rewrite `swap_exact_amount_in` * Rewrite `swap_exact_amount_out` * Rewrite utility functions * Remove Rikiddo from weight calculation * Remove Rikiddo from zrml-swaps * Remove unused errors * Remove `ScoringRule::Rikiddo...` * Remove `*SubsidyPeriod` * Remove Rikiddo-related storage and events * Remove automatic opening of pools * Remove `open_pool` from prediction-markets * Remove `Swaps::close_pool` from prediction-markets * Remove `clean_up_pool` from prediction-markets * Remove `clean_up_pool` from `Swaps` trait * Remove CPMM deployment from prediction-markets * Remove automatic arbitrage * Move `market_account` back to prediction-markets * Remove unused market states * Fix fuzz tests * Implement market migration * Minor changes * Fix migration behavior * Remove creator fees from swaps * Fix try-runtime * Fix clippy issues * Remove `LiquidityMining` from swaps * Fix `get_spot_prices` * Take first step to remove `MarketCommons` from swaps * Remove `MarketCommons` from swaps * Rewrite `PoolStatus` * Move `Pool*` to swaps * Use `Bounded*` types in `Pool` * Finish swaps migration * Add missing files * Fix formatting and clippy errors * Remove `pool_status.rs` * Ignore doctests * Fix fuzz tests * Add prediciton-markets migration * Test prediction-markets migration * Finish tests of the market-commons migration * Add migrations to runtime and fix various errors * Clean up * Clean up * Format code * Fix pool migration behavior * Remove `MarketId` from swaps * Fix formatting * Fix formatting * Remove `CPMM` and allow other scoring rules on Battery Station * Update macros/Cargo.toml Co-authored-by: Harald Heckmann <[email protected]> * Update primitives/src/traits/zeitgeist_asset.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Clean up TODOs/FIXMEs * Update changelog * Make more changes to changelog * Clear zrml-swaps storage * Remove cfg-if dependency * Fix formatting * Trigger CI * Update copyright notices * Update docs/changelog_for_devs.md Co-authored-by: Chralt <[email protected]> * Make benchmark helper only available if feature flags are set * Remove `ZeitgeistAsset` trait * Remove preliminary benchmarks with more steps * Format code * Fix copyright notice --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Merge release v0.4.3 (#1211) * Use hotfixed `exp` * Reorganize tests * Fix formatting * Bump versions to v0.4.3 * Update spec versions * Add missing version bumps * Format * Update licenses --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reduce `market_status_manager` aka `on_initialize` iterations (#1160) * remove dangerous loop * limit iterations of dangerous loop * reintegrate last time frame storage item * wip * benchmark manual close and open * fix stall test * emit event and log for recovery time frame * add tests * add trailing comma * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * change should_be_closed condition * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * change recursion limit line * regard period not started yet * add error tests * correct benchmarks * fix after merge and clippy * use turbofish, add test checks * remove manually open broken market * correct errors and call index * correct wrong error name * correct position of call index * correct error position * update copyrights * fix after merge * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * set market end for manual close --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Update style guide to streamline reviews (#1228) * Reduce benchmark runs of Zeitgeist pallets (#1233) Reduce bencharm runs of Zeitgeist pallets Running benchmarks of Zeitgeist pallets on the Zeitgeist reference machine currently takes four days. * Set inflation to more than zero for a full benchmark of handle_inflation (#1234) Update benchmarks.rs * Implement `force_pool_exit` and disable other zrml-swaps functions (#1235) * Abstract `pool_exit` business logic into `do_*` function * Add `force_pool_exit` and test * Install call filters for zrml-swaps * Implement and test `bmul_bdiv_*`; use in zrml-orderbook and zrml-parimutuel (#1223) * Implement and test `bmul_bdiv_*` * Use `bmul_bdiv_*` in pallets * Update copyright * Utilize Merigify's Merge Queue (#1243) ci(Mergify): configuration update Signed-off-by: Harald Heckmann <[email protected]> * Set in-progress when needed and rerun CI in merge queue (#1244) * Set in-progress when need and rerun CI in merge queue --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Avoid mergify dequeue (#1245) * Avoid mergify deque * Set review needed only shortly after Mergify commit * Extend neo-swaps tests and clean up `math.rs` (#1238) * Add tests to neo-swaps that check large buy/sell amounts at high liquidity * Use new implementation of HydraDX's `exp` * Add failure tests to neo-swaps's `math.rs` * Fix formatting * Update copyright notices --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Remove migrations and dead code (#1241) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reorganize prediction-market tests (#1242) * Rename `tests.rs` to `old_tests.rs` to avoid naming conflicts * Move `buy_complete_set` tests to new tests * Clean up `buy_complete_set` tests * Extract `sell_complete_set_tests` * Clean up `sell_complete_set` tests * Extract `admin_move_market_to_closed` tests * Extract `create_market` tests * Extract `admin_move_market_to_resolved` tests * Remove superfluous test * Extract more `create_market` tests * Extract `approve_market` tests * Extract `edit_market` tests * Extract `edit_market` tests * Add `on_market_close` tests * Extract `manually_close_market` tests * Extract `on_initialize` tests * Extract `report` tests * Extract `dispute` tests * Extract `schedule_early_close` tests * Extract `dispute_early_close` tests * Extract `reject_early_close` tests * Extract more `dispute` tests * Extract `close_trusted_market` tests * Extract `start_global_dispute` tests * Extract `redeem_shares` tests and add missing tests * Extract `on_resolution` and additional `redeem_shares` tests * Move integration tests into new test module * Automatically set block to `1` at the start of test * Replace `crate::Config` with `Config` * Access constant through `Config` * Add TODOs for missing execution paths * Fix formatting --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Improve fee payment management (#1246) * Improve fee payment management * Make code compileable * Do not remit TX fees for redeem_shares Co-authored-by: Malte Kliemann <[email protected]> --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix Rust and Discord badge (#1247) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix neo-swaps doc strings (#1250) * Improve `SellExecuted` documentation * Clean up math in comments and doc strings * Fix formatting * Adjust style guide (loops) and add unreachable macro (#1252) * Adjust style guide (loops) and add unreachable macro * Add macros module to lib.rs * Update docs/STYLE_GUIDE.md Co-authored-by: Malte Kliemann <[email protected]> * Move macro to zeitgeist-macros and add examples --------- Co-authored-by: Malte Kliemann <[email protected]> * Merge Old* and New* asset variants * Partially integrate lazy migration routing * Integrate lazy migration routing * Fix ExistentialDeposit mapping & Satisfy Clippy * Remove primitives/macros * Filter certain asset destroy calls (they're managed) * Integrate asset destruction into prediction markets * Add BaseAssetClass * Update prediction-markets & market-commons * Update authorized * Update liquidity-mining * Update simple-disputes * Update parimutuels (wip) * Move functions into market struct and properly delete assets * Add ParimutuelAssetClass * Add parimutuel.rs * Remove duplicate code * Adjust asset type and managed destroy after refund in parimutuels * Add MarketTransitionApi This will allow prediction-markets to signal other pallets that state transitions happened * Add MarketTransitionApi * Implement MarketTransitionApi for Parimutuels * Partially implement asset creation/destruction in parimutuels * Add all asset creation / destruction tests to parimutuels * Adjust Court * Update global-disputes * Update swaps * Update neo-swaps * Integrate OnStateTransition hooks into prediction-markets * Use proper state transition weights * Make cargo check succeed * Partially update orderbook * Update orderbook * Update orderbook * Finalize orderbook update * Improve style * Add XcmAssetClass * Add sub asset classes, extend Market, provide market transition trait * Update asset-router * Integrate asset system into prediction-market, market-commons and parimutuel - Market commons now uses the BaseAsset class for base assets - Prediction markets now creates and destroys MarketAssets only if market.is_redeemable - Prediction markets now calls OnStateTransition when transitioning it's state - Parimutuel markets now implements StateTransitionApi - Parimutuel markets now properly creates and destroys ParimutuelShares * Implement support for non-reservable assets in orderbook * Integrate new asset system into Battery Station XCM * Integrate new asset system into Zeitgeist XCM * Fix conditional import * Format * Fix unfillable / unremovable order bug Co-authored-by: Chralt <[email protected]> * Make compileable * Resolve one merge conflict * Format * Satisfy Clippy --------- Signed-off-by: Harald Heckmann <[email protected]> Co-authored-by: Chralt <[email protected]> Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * New Asset System - Enable fee payment for CampaignAssets (#1289) * Merge release v0.4.2 (#1174) * Update versions (#1168) * Add updated weights from reference machine (#1169) * Add license header Co-authored-by: Chralt <[email protected]> --------- Co-authored-by: Chralt <[email protected]> * Remove migrations (#1180) * Filter admin functions for main-net (#1190) filter admin functions for main-net * Add debug assertions for slashes and reserves (#1188) * add debug assertions for missing slashes * place debug_assert for unreserves * Add some verify checks to court (#1187) add some verify checks to court * Bypass battery stations contracts call filter for court, parimutuel, order book markets (#1185) update contracts call filter * Fix failing court benchmark (#1191) * fix court assertion for resolve_at * remove unnecessary variable * mirror mock and actual impl for DisputeResolution * Implement trusted market close (#1184) * implement trusted market close * remove unnecessary benchmark helper function * Update zrml/prediction-markets/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * remove unnecessary function * check market end * check auto close * add invalid market status test --------- Co-authored-by: Malte Kliemann <[email protected]> * Modify court events for indexer (#1182) * modify events for indexer * gracefully handle panicers * handle binary search by key error * improve style * Ensure MinBetSize after fee (#1193) * handle own existential deposit errors * use require_transactional * correct benchmark and test min bet size amounts * Replace fixed math operations with traited versions (#1149) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Update primitives/src/math/fixed.rs Co-authored-by: Harald Heckmann <[email protected]> --------- Co-authored-by: Harald Heckmann <[email protected]> * Add env_logger and add force-debug feature (#1205) * add env_logger and add force-debug feature * taplo fmt, fix copyrights * Update zrml/styx/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/rikiddo/src/mock.rs Co-authored-by: Malte Kliemann <[email protected]> * update comment to clarify logging --------- Co-authored-by: Malte Kliemann <[email protected]> * Inflate defensively (#1195) * inflate defensively * add tests * Update zrml/court/src/tests.rs Co-authored-by: Malte Kliemann <[email protected]> * fix test * fix test name --------- Co-authored-by: Malte Kliemann <[email protected]> * Maintain order book (#1183) * integrate market creator fees into orderbook * edit tests * update tests * modify tests * avoid order side * Update primitives/src/traits/distribute_fees.rs Co-authored-by: Malte Kliemann <[email protected]> * remove asset and account from get_fee api call * take base asset fees from fill_order * adjust orderbook for taking fees in fill_order * adjust without order side for fill_order * adapt to avoid concept of order side * adapt benchmarks, tests and weights, restructure * use DispatchResult * remove unused import * do not adjust maker amount for place_order * correct fuzz of orderbook * check if maker_amount is zero * fix order book name in benchmarks * use remove instead of cancel order book * correct order book test names * update READMEs * fmt * add tests * use minimum balance as min order size * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/orderbook/README.md Co-authored-by: Malte Kliemann <[email protected]> * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * prettier orderbook md * remove comments from benchmarks * fix tests and benchmarks readibility * use order book instead of orderbook * clarify error message * clarify comments * rename is to ensure * error for repatriate * fix unnecessary clone * correct mocks behaviour * improve test * improve test of near full fill error * use turbofish syntax * add filled_maker_amount to event * split tests * combine two functions, add docs * abandon get_fees * fix order book tests and mock * remove check for impossible behaviour * fix toml and benchs * prepare migration * add migration for order structure * return zero fees if transfer fails * delete unnecessary assert * fix naming * fix naming the second * fix maker fill description * add scoring rule check to remove order * fix post_upgrade * fix terminology * Update zrml/orderbook/src/migrations.rs Co-authored-by: Malte Kliemann <[email protected]> * use storage root check in migration test * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/orderbook/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * delete debug_assert --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement AMM 2.0 (#1173) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Update zrml/neo-swaps/docs/docs.tex Co-authored-by: Harald Heckmann <[email protected]> * Apply suggestions from code review Co-authored-by: Harald Heckmann <[email protected]> * Rename `Fixed` and clean up * Hotfix exponential function and extend tests * Complete math test suite * Fix broken sentence * Remove unused imports * Extend `ln` test cases * Merge & fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Implement Liquidity Tree (#1178) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * Add liquidity tree draft * Fix compiler error in draft * Clean up `propagate_fees` * Add docs * Reorganize * Clean up, add max iterations * Remove migrations * Prepare switch to bounded vector * Use `BoundedVec` * Use bounded `BTreeMap` and insert `LiquidityTree` into neo-swaps * Resolve TODO * Clean up tests * Add migration and fix clippy errors * Make tree depth a generic * Make tree depth a config parameter * Update runtime complexities * Add benchmarking utilities * Fix runtime complexity for `deploy_pool` * Add missing lazy propagation * Fix comment * Fix error type * Add `join` benchmarking and fix a bug in `LiquidityTree` * Clean up benchmarks * Fix clippy issues * Remove unnecessary type hint * Fix bugs in liquidity tree * Fix comments * Some fixes in benchmarks * Implement `BenchmarkHelper` * Update benchmarks to use the LT * Clean up and format * Add testing framework for liquidity trees * Add first extensive test and fix a bug * Add more tests * Clean up test * Add news tests and use better numerics for ratio calculations * Make docs more explicit * Add tests for `exit` * Add tests for deposit fees * Add tests for getters * Clean up tests some more * Finalize liquidity tree tests * Clean up comments * Introduce exit fees * Rewrite `exit_works` * Fix liquidity parameter calculation * Make test a bit more complex * Test liquidity shares * Clean up tests * Update test for destruction * Enhance `exit_destroys_pool` test * More cleanup * Add test for full tree * Add tests for `join` * Improve test * Test withdrawal * Clean up the test * Add test for noop * Add minimum relative liquidity * Verify that buys deduct the correct amount of fees * Add last tests * Add notes about the liquidity tree * Fix benchmarks * Fix clippy errors * Fix benchmarks * Do more work on benchmarks * Fix benchmarks, deduce max tree depth * Remove already solved TODO * Document macros * Remove TODO (not a good idea to edit LaTeX docs now) * Fix `bmul_bdiv` * Make `bmul_bdiv_*` not implemented * Double-check that there's a non-zero check for `ratio` * Fix formatting * Fix taplo formatting * Remove TODO * Remove TODOs and fix documents * Update primitives/src/math/fixed.rs Co-authored-by: Chralt <[email protected]> * Mark `SoloLp` as deprecated * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Make `bmul_bdiv` a little more idiomatic * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Update zrml/neo-swaps/README.md Co-authored-by: Chralt <[email protected]> * Rewrite and format `README.md` * Fix comment about existential deposit * Remove FIXME * Add a check against misconfiguration of the pallet * Fix field docstrings * Add comment about `assert_ok_with_transaction` * Update zrml/neo-swaps/src/mock.rs Co-authored-by: Chralt <[email protected]> * Format code * Fix comment * Prettify extrinsic calls in benchmarks * Improve code quality of `assert_pool_state!` * Extend comment about order of abandoned nodes * Clarify the meaning of "leaf" in `is_leaf` * Rename `index_maybe` to `opt_index` * Add unexpected storage overflow error for bounded objects * Rename `UnclaimedFees` to `UnwithdrawnFees` * Fix documentation * Use enum to signal update direction in `update_descendant_stake` * Add verification to `join_*` benchmarks * Improve documentation * Use builtin log * Remove illegal token from `README.md` * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix unintentional doctest * Improve `mutate_children` * Add helpful comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Chralt <[email protected]> * Fix migration * Fix balances in parachain mock * use PartialEqNoBound and CloneNoBound for tree * Fix formatting * Make `debug_assert!` more clear * Redesign node assignment * Clean up comments * Add some storage overflow errors * Introduce `LiquidityTreeChildIndices` * Remove outdated docs * Rename `update_descendant_stake` * Remove `Default` usage * Make liquidity tree types `pub(crate)` where possible * Make all fields of `Node` only `pub(crate)` * Make `Node<T>` an associated type of `LiquidityTreeHelper` * Update zrml/neo-swaps/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix comment * Update zrml/neo-swaps/src/types/liquidity_tree.rs Co-authored-by: Harald Heckmann <[email protected]> * Fix tests * Prettify `path_to_node` * Add max iterations to `path_to_node` * Add test for complex liquidity tree interactions * Improve documentation of `LiquidityTreeChildIndices` * Reorganize crate structure * Update weights and fix formatting --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Chralt98 <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Improve XCM fee handling (#1225) * Fix padding of foreign fees in Zeitgeist runtime * Fix padding of foreign fees in Battery Station runtime * Format * Update copyright * Use adjusted_balance function * Remove court and global disputes from call filter for the main-net (#1226) * remove from call filter * update copyright * Sunset old AMMs and their pools (#1197) * Replace `bmul` and `bdiv` with traited versions * Restructure directories * Replace `saturating_*` from neo-swaps * Fix formatting * Restructure zrml-swaps math * Implement and test `b*` * Fix formatting * Use new math in orderbook-v1 * Replace checked multiplication with new math * Use correct rounding in neo-swaps * Add docs * Update licenses * Remove `fixed` module from `primitives` * Fix formatting * . * Rewrite math functions * Remove training wheels * Fix docs.pdf * Fix quotes * Add tests for buying * Add tests for selling and improve error names * Update docs * Check adjusted amount in for numerical bounds * Remove unused implementations * Adjust docs * Add stress test exploring various scenarios * Add swap fees to stress test * Add underscore separators * Clean up * Benchmark `buy` as function of `asset_count` * Update benchmarks * Clippy fix * Fix benchmark tests * Update benchmarks of zrml-prediction-markets * Fix broken comment * Add comment explaining benchmark spot prices * Use clearer constants for `amount_in` in tests * Update zrml/neo-swaps/src/traits/pool_operations.rs Co-authored-by: Chralt <[email protected]> * Fix botched merge * Fix merge * Update benchmarks * Remove `pool_*_subsidy` * Remove `distribute_pool_share_rewards` * Remove `end_subsidy_phase` * Remove `destroy_pool_in_subsidy_phase` * Remove `MinSubsidy*` * Remove `SubsidyProviders` * Remove `start_subsidy` * Rewrite `create_pool` * Rewrite `swap_exact_amount_in` * Rewrite `swap_exact_amount_out` * Rewrite utility functions * Remove Rikiddo from weight calculation * Remove Rikiddo from zrml-swaps * Remove unused errors * Remove `ScoringRule::Rikiddo...` * Remove `*SubsidyPeriod` * Remove Rikiddo-related storage and events * Remove automatic opening of pools * Remove `open_pool` from prediction-markets * Remove `Swaps::close_pool` from prediction-markets * Remove `clean_up_pool` from prediction-markets * Remove `clean_up_pool` from `Swaps` trait * Remove CPMM deployment from prediction-markets * Remove automatic arbitrage * Move `market_account` back to prediction-markets * Remove unused market states * Fix fuzz tests * Implement market migration * Minor changes * Fix migration behavior * Remove creator fees from swaps * Fix try-runtime * Fix clippy issues * Remove `LiquidityMining` from swaps * Fix `get_spot_prices` * Take first step to remove `MarketCommons` from swaps * Remove `MarketCommons` from swaps * Rewrite `PoolStatus` * Move `Pool*` to swaps * Use `Bounded*` types in `Pool` * Finish swaps migration * Add missing files * Fix formatting and clippy errors * Remove `pool_status.rs` * Ignore doctests * Fix fuzz tests * Add prediciton-markets migration * Test prediction-markets migration * Finish tests of the market-commons migration * Add migrations to runtime and fix various errors * Clean up * Clean up * Format code * Fix pool migration behavior * Remove `MarketId` from swaps * Fix formatting * Fix formatting * Remove `CPMM` and allow other scoring rules on Battery Station * Update macros/Cargo.toml Co-authored-by: Harald Heckmann <[email protected]> * Update primitives/src/traits/zeitgeist_asset.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/swaps/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/market-commons/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Clean up TODOs/FIXMEs * Update changelog * Make more changes to changelog * Clear zrml-swaps storage * Remove cfg-if dependency * Fix formatting * Trigger CI * Update copyright notices * Update docs/changelog_for_devs.md Co-authored-by: Chralt <[email protected]> * Make benchmark helper only available if feature flags are set * Remove `ZeitgeistAsset` trait * Remove preliminary benchmarks with more steps * Format code * Fix copyright notice --------- Co-authored-by: Chralt <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * Merge release v0.4.3 (#1211) * Use hotfixed `exp` * Reorganize tests * Fix formatting * Bump versions to v0.4.3 * Update spec versions * Add missing version bumps * Format * Update licenses --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reduce `market_status_manager` aka `on_initialize` iterations (#1160) * remove dangerous loop * limit iterations of dangerous loop * reintegrate last time frame storage item * wip * benchmark manual close and open * fix stall test * emit event and log for recovery time frame * add tests * add trailing comma * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * change should_be_closed condition * Apply suggestions from code review Co-authored-by: Malte Kliemann <[email protected]> * change recursion limit line * regard period not started yet * add error tests * correct benchmarks * fix after merge and clippy * use turbofish, add test checks * remove manually open broken market * correct errors and call index * correct wrong error name * correct position of call index * correct error position * update copyrights * fix after merge * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Malte Kliemann <[email protected]> * set market end for manual close --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Update style guide to streamline reviews (#1228) * Reduce benchmark runs of Zeitgeist pallets (#1233) Reduce bencharm runs of Zeitgeist pallets Running benchmarks of Zeitgeist pallets on the Zeitgeist reference machine currently takes four days. * Set inflation to more than zero for a full benchmark of handle_inflation (#1234) Update benchmarks.rs * Implement `force_pool_exit` and disable other zrml-swaps functions (#1235) * Abstract `pool_exit` business logic into `do_*` function * Add `force_pool_exit` and test * Install call filters for zrml-swaps * Implement and test `bmul_bdiv_*`; use in zrml-orderbook and zrml-parimutuel (#1223) * Implement and test `bmul_bdiv_*` * Use `bmul_bdiv_*` in pallets * Update copyright * Utilize Merigify's Merge Queue (#1243) ci(Mergify): configuration update Signed-off-by: Harald Heckmann <[email protected]> * Set in-progress when needed and rerun CI in merge queue (#1244) * Set in-progress when need and rerun CI in merge queue --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Avoid mergify dequeue (#1245) * Avoid mergify deque * Set review needed only shortly after Mergify commit * Extend neo-swaps tests and clean up `math.rs` (#1238) * Add tests to neo-swaps that check large buy/sell amounts at high liquidity * Use new implementation of HydraDX's `exp` * Add failure tests to neo-swaps's `math.rs` * Fix formatting * Update copyright notices --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Remove migrations and dead code (#1241) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Reorganize prediction-market tests (#1242) * Rename `tests.rs` to `old_tests.rs` to avoid naming conflicts * Move `buy_complete_set` tests to new tests * Clean up `buy_complete_set` tests * Extract `sell_complete_set_tests` * Clean up `sell_complete_set` tests * Extract `admin_move_market_to_closed` tests * Extract `create_market` tests * Extract `admin_move_market_to_resolved` tests * Remove superfluous test * Extract more `create_market` tests * Extract `approve_market` tests * Extract `edit_market` tests * Extract `edit_market` tests * Add…
What does it do?
exp
implementation and uses Hydra's fixedexp
insteadmath.rs
math.rs
works with large numbersWhat important points should reviewers know?
Is there something left for follow-up PRs?
What alternative implementations were considered?
Are there relevant PRs or issues?
References