balancer_maths_rust/common/
pool_base.rs1use crate::common::errors::PoolError;
4use crate::common::types::*;
5use alloy_primitives::U256;
6
7pub trait PoolBase {
9 fn on_swap(&self, swap_params: &SwapParams) -> Result<U256, PoolError>;
11
12 fn compute_invariant(
14 &self,
15 balances_live_scaled_18: &[U256],
16 rounding: Rounding,
17 ) -> Result<U256, PoolError>;
18
19 fn compute_balance(
21 &self,
22 balances_live_scaled_18: &[U256],
23 token_in_index: usize,
24 invariant_ratio: &U256,
25 ) -> Result<U256, PoolError>;
26
27 fn get_maximum_invariant_ratio(&self) -> U256;
29
30 fn get_minimum_invariant_ratio(&self) -> U256;
32}