diff --git a/pallets/dca/src/tests/mock.rs b/pallets/dca/src/tests/mock.rs index 49a6c5609..2d28bd6dc 100644 --- a/pallets/dca/src/tests/mock.rs +++ b/pallets/dca/src/tests/mock.rs @@ -378,8 +378,7 @@ impl pallet_route_executor::Config for Test { type EdToRefundCalculator = MockedEdCalculator; type OraclePriceProvider = PriceProviderMock; type OraclePeriod = RouteValidationOraclePeriod; - type BatchIdProvider = AmmSupport; - type OperationIdProvider = AmmSupport; + type AmmUnifiedEventSupport = AmmSupport; type WeightInfo = (); } diff --git a/pallets/omnipool/proptest-regressions/tests/invariants.txt b/pallets/omnipool/proptest-regressions/tests/invariants.txt deleted file mode 100644 index db60fd566..000000000 --- a/pallets/omnipool/proptest-regressions/tests/invariants.txt +++ /dev/null @@ -1,11 +0,0 @@ -#cc f8078da4f7e354090cbce1f1a7385338da411cfc9b8e31660d006c18b233ebafcc e6296fe0e28dc7b0e9fb030d015ffa1104b23979493073d03116e93da420ef6f # shrinks to amount = 2024942073354000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 3910846008399793737, price: FixedU128(1.632227559602352896) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000000036539132, price: FixedU128(0.388222853715546176) }, asset_fee = 1.3%, protocol_fee = 0.009%, imbalance = SimpleImbalance { value: 489292488996053, negative: true }cc 601a6a9695df7cd7f85426e6a59f455f3f5ce6350f61ff3bd30295e8923825a7 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000000243762059, price: FixedU128(1.925871849496510464) }, asset_fee = 0%, protocol_fee = 2.4%, imbalance = SimpleImbalance { value: 9024424855798144, negative: true } -cc 06cfb566dd8ff64790996cdd0d9375b4fd30f827063743b2fb04cb925b5e4508 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000003210303870, price: FixedU128(1.964999347026830592) }, asset_fee = 2.4%, protocol_fee = 0.13% -cc 3a77a4705302585b88b85d7871dddcb7f6855b17e99163936a9828ac094bfeb6 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000001205909582, price: FixedU128(1.375333091762539008) }, asset_fee = 0.013%, protocol_fee = 0.017% -cc 70e03e4225e3021cabf6b0e49a35085bb86b2d6944ee95919ffd6c20b1f7069e # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000000162914670, price: FixedU128(0.603279094613239552) } -cc 4576393644577b85ca338bc23bbd62654b67f2ec002f8b20aca5cbc777f71262 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000000278135672, price: FixedU128(1.100514086879039744) }, asset_fee = 0.21%, protocol_fee = 0.2%, imbalance = SimpleImbalance { value: 5028780583433078, negative: true } -cc 9c93a0fcb3f78b42d2bf75b1f971cc0a367264902e29cc35fca7b4d7b4317487 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000001282698657, price: FixedU128(1.083766836630893184) }, asset_fee = 2%, protocol_fee = 0.02% -cc 2d65c1f11dd2874cf4869c6bc28ed925478e57ed73a617b1d5dc1a8fe7d7ae59 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000000019336595, price: FixedU128(0.733249215167427072) }, asset_fee = 0.6%, protocol_fee = 0.004% -cc 5b0408b0d514dc33832f2a374aa9e3c479d0c84e58f4b88077c24387c4c8ef70 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000000597801771, price: FixedU128(1.458237645282841600) }, asset_fee = 0.28%, protocol_fee = 0.11%, buy_amount = 3276492019627632 -cc 47648d8c0c8f9c6b40fe9eefa80179540c1d386175531a36c3a825777402ce83 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000000000467280, price: FixedU128(0.943083786844469504) }, asset_fee = 0.17%, protocol_fee = 0.025%, buy_amount = 3545063556811621, min_withdraw_fee = 100%, (price_adjustment, denom, direction) = (4, 10000, false) -cc f1f5ebb8a88a3db4df5dcf4170496ef8dffffbb61bb6991226a597f95ae22ca5 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000000068367115, price: FixedU128(0.481724750982654144) }, asset_fee = 0.29%, protocol_fee = 0.03%, buy_amount = 986312481009315 -cc 2591d2b97991eebcad60c25b3d7ef318ad8651bf0e1f6f064eccee110d645305 # shrinks to amount = 1000, stable_price = FixedU128(0.100000000000000000), stable_reserve = 100000000000000000, native_reserve = 100000000000000000, token_1 = PoolToken { asset_id: 100, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_2 = PoolToken { asset_id: 200, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_3 = PoolToken { asset_id: 300, amount: 100000000000000000, price: FixedU128(0.100000000000000000) }, token_4 = PoolToken { asset_id: 400, amount: 100000000001763682, price: FixedU128(0.513377270830019968) } diff --git a/pallets/otc-settlements/src/mock.rs b/pallets/otc-settlements/src/mock.rs index fa0ea4461..0dffe9481 100644 --- a/pallets/otc-settlements/src/mock.rs +++ b/pallets/otc-settlements/src/mock.rs @@ -157,8 +157,7 @@ impl pallet_route_executor::Config for Test { type OraclePeriod = RouteValidationOraclePeriod; type DefaultRoutePoolType = DefaultRoutePoolType; type TechnicalOrigin = EnsureRoot; - type BatchIdProvider = AmmSupport; - type OperationIdProvider = AmmSupport; + type AmmUnifiedEventSupport = AmmSupport; type WeightInfo = (); } diff --git a/pallets/route-executor/src/lib.rs b/pallets/route-executor/src/lib.rs index 0a064c167..fb1ce8672 100644 --- a/pallets/route-executor/src/lib.rs +++ b/pallets/route-executor/src/lib.rs @@ -130,11 +130,8 @@ pub mod pallet { /// Origin able to set route without validation type TechnicalOrigin: EnsureOrigin; - /// Event id provider for unified events - type BatchIdProvider: IncrementalIdProvider; - - /// Operation id provider for unified events - type OperationIdProvider: ExecutionTypeStack; + /// AMM Unified event support + type AmmUnifiedEventSupport: IncrementalIdProvider + ExecutionTypeStack; /// Weight information for the extrinsics. type WeightInfo: AmmTradeWeights>; @@ -266,8 +263,8 @@ pub mod pallet { let route_length = route.len(); - let next_event_id = T::BatchIdProvider::next_id().map_err(|_| ArithmeticError::Overflow)?; - T::OperationIdProvider::push(ExecutionType::Router(next_event_id))?; + let next_event_id = T::AmmUnifiedEventSupport::next_id().map_err(|_| ArithmeticError::Overflow)?; + T::AmmUnifiedEventSupport::push(ExecutionType::Router(next_event_id))?; for (trade_index, (trade_amount, trade)) in trade_amounts.iter().rev().zip(route).enumerate() { Self::disable_ed_handling_for_insufficient_assets(route_length, trade_index, trade); @@ -311,7 +308,7 @@ pub mod pallet { event_id: next_event_id, }); - let _ = T::OperationIdProvider::pop()?; + let _ = T::AmmUnifiedEventSupport::pop()?; Ok(()) } @@ -504,8 +501,8 @@ impl Pallet { let route_length = route.len(); - let next_event_id = T::BatchIdProvider::next_id().map_err(|_| ArithmeticError::Overflow)?; - T::OperationIdProvider::push(ExecutionType::Router(next_event_id))?; + let next_event_id = T::AmmUnifiedEventSupport::next_id().map_err(|_| ArithmeticError::Overflow)?; + T::AmmUnifiedEventSupport::push(ExecutionType::Router(next_event_id))?; for (trade_index, (trade_amount, trade)) in trade_amounts.iter().zip(route.clone()).enumerate() { Self::disable_ed_handling_for_insufficient_assets(route_length, trade_index, trade); @@ -550,7 +547,7 @@ impl Pallet { event_id: next_event_id, }); - let _ = T::OperationIdProvider::pop()?; + let _ = T::AmmUnifiedEventSupport::pop()?; Ok(()) } diff --git a/pallets/route-executor/src/tests/mock.rs b/pallets/route-executor/src/tests/mock.rs index cc9d1c417..968fb6bfd 100644 --- a/pallets/route-executor/src/tests/mock.rs +++ b/pallets/route-executor/src/tests/mock.rs @@ -170,8 +170,7 @@ impl Config for Test { type OraclePeriod = RouteValidationOraclePeriod; type DefaultRoutePoolType = DefaultRoutePoolType; type TechnicalOrigin = EnsureRoot; - type BatchIdProvider = AmmSupport; - type OperationIdProvider = AmmSupport; + type AmmUnifiedEventSupport = AmmSupport; type WeightInfo = (); } diff --git a/runtime/adapters/src/tests/mock.rs b/runtime/adapters/src/tests/mock.rs index 0d773584d..59e4ad328 100644 --- a/runtime/adapters/src/tests/mock.rs +++ b/runtime/adapters/src/tests/mock.rs @@ -348,9 +348,8 @@ impl pallet_route_executor::Config for Test { type DefaultRoutePoolType = DefaultRoutePoolType; type TechnicalOrigin = EnsureRoot; type OraclePeriod = RouteValidationOraclePeriod; - type BatchIdProvider = AmmSupport; + type AmmUnifiedEventSupport = AmmSupport; type WeightInfo = (); - type OperationIdProvider = AmmSupport; } pub struct MockedEdCalculator; diff --git a/runtime/hydradx/src/assets.rs b/runtime/hydradx/src/assets.rs index 2e8162ba3..37abc8ffc 100644 --- a/runtime/hydradx/src/assets.rs +++ b/runtime/hydradx/src/assets.rs @@ -1215,9 +1215,8 @@ impl pallet_route_executor::Config for Runtime { type TechnicalOrigin = SuperMajorityTechCommittee; type EdToRefundCalculator = RefundAndLockedEdCalculator; type OraclePriceProvider = hydradx_adapters::OraclePriceProvider; - type BatchIdProvider = AmmSupport; type OraclePeriod = RouteValidationOraclePeriod; - type OperationIdProvider = AmmSupport; + type AmmUnifiedEventSupport = AmmSupport; } parameter_types! {