pub trait HookBase {
// Required methods
fn hook_type(&self) -> &str;
fn config(&self) -> &HookConfig;
fn on_before_add_liquidity(
&self,
kind: AddLiquidityKind,
max_amounts_in_scaled_18: &[BigInt],
min_bpt_amount_out: &BigInt,
balances_scaled_18: &[BigInt],
hook_state: &HookState,
) -> BeforeAddLiquidityResult;
fn on_after_add_liquidity(
&self,
kind: AddLiquidityKind,
amounts_in_scaled_18: &[BigInt],
amounts_in_raw: &[BigInt],
bpt_amount_out: &BigInt,
balances_scaled_18: &[BigInt],
hook_state: &HookState,
) -> AfterAddLiquidityResult;
fn on_before_remove_liquidity(
&self,
kind: RemoveLiquidityKind,
max_bpt_amount_in: &BigInt,
min_amounts_out_scaled_18: &[BigInt],
balances_scaled_18: &[BigInt],
hook_state: &HookState,
) -> BeforeRemoveLiquidityResult;
fn on_after_remove_liquidity(
&self,
kind: RemoveLiquidityKind,
bpt_amount_in: &BigInt,
amounts_out_scaled_18: &[BigInt],
amounts_out_raw: &[BigInt],
balances_scaled_18: &[BigInt],
hook_state: &HookState,
) -> AfterRemoveLiquidityResult;
fn on_before_swap(
&self,
swap_params: &SwapParams,
hook_state: &HookState,
) -> BeforeSwapResult;
fn on_after_swap(
&self,
after_swap_params: &AfterSwapParams,
hook_state: &HookState,
) -> AfterSwapResult;
fn on_compute_dynamic_swap_fee(
&self,
swap_params: &SwapParams,
static_swap_fee_percentage: &BigInt,
hook_state: &HookState,
) -> DynamicSwapFeeResult;
}
Expand description
Trait for pool hooks (matches Python HookBase interface exactly)
Required Methods§
Sourcefn config(&self) -> &HookConfig
fn config(&self) -> &HookConfig
Get the hook configuration
Sourcefn on_before_add_liquidity(
&self,
kind: AddLiquidityKind,
max_amounts_in_scaled_18: &[BigInt],
min_bpt_amount_out: &BigInt,
balances_scaled_18: &[BigInt],
hook_state: &HookState,
) -> BeforeAddLiquidityResult
fn on_before_add_liquidity( &self, kind: AddLiquidityKind, max_amounts_in_scaled_18: &[BigInt], min_bpt_amount_out: &BigInt, balances_scaled_18: &[BigInt], hook_state: &HookState, ) -> BeforeAddLiquidityResult
Process before add liquidity (matches Python on_before_add_liquidity)
Sourcefn on_after_add_liquidity(
&self,
kind: AddLiquidityKind,
amounts_in_scaled_18: &[BigInt],
amounts_in_raw: &[BigInt],
bpt_amount_out: &BigInt,
balances_scaled_18: &[BigInt],
hook_state: &HookState,
) -> AfterAddLiquidityResult
fn on_after_add_liquidity( &self, kind: AddLiquidityKind, amounts_in_scaled_18: &[BigInt], amounts_in_raw: &[BigInt], bpt_amount_out: &BigInt, balances_scaled_18: &[BigInt], hook_state: &HookState, ) -> AfterAddLiquidityResult
Process after add liquidity (matches Python on_after_add_liquidity)
Sourcefn on_before_remove_liquidity(
&self,
kind: RemoveLiquidityKind,
max_bpt_amount_in: &BigInt,
min_amounts_out_scaled_18: &[BigInt],
balances_scaled_18: &[BigInt],
hook_state: &HookState,
) -> BeforeRemoveLiquidityResult
fn on_before_remove_liquidity( &self, kind: RemoveLiquidityKind, max_bpt_amount_in: &BigInt, min_amounts_out_scaled_18: &[BigInt], balances_scaled_18: &[BigInt], hook_state: &HookState, ) -> BeforeRemoveLiquidityResult
Process before remove liquidity (matches Python on_before_remove_liquidity)
Sourcefn on_after_remove_liquidity(
&self,
kind: RemoveLiquidityKind,
bpt_amount_in: &BigInt,
amounts_out_scaled_18: &[BigInt],
amounts_out_raw: &[BigInt],
balances_scaled_18: &[BigInt],
hook_state: &HookState,
) -> AfterRemoveLiquidityResult
fn on_after_remove_liquidity( &self, kind: RemoveLiquidityKind, bpt_amount_in: &BigInt, amounts_out_scaled_18: &[BigInt], amounts_out_raw: &[BigInt], balances_scaled_18: &[BigInt], hook_state: &HookState, ) -> AfterRemoveLiquidityResult
Process after remove liquidity (matches Python on_after_remove_liquidity)
Sourcefn on_before_swap(
&self,
swap_params: &SwapParams,
hook_state: &HookState,
) -> BeforeSwapResult
fn on_before_swap( &self, swap_params: &SwapParams, hook_state: &HookState, ) -> BeforeSwapResult
Process before swap (matches Python on_before_swap)
Sourcefn on_after_swap(
&self,
after_swap_params: &AfterSwapParams,
hook_state: &HookState,
) -> AfterSwapResult
fn on_after_swap( &self, after_swap_params: &AfterSwapParams, hook_state: &HookState, ) -> AfterSwapResult
Process after swap (matches Python on_after_swap)
Sourcefn on_compute_dynamic_swap_fee(
&self,
swap_params: &SwapParams,
static_swap_fee_percentage: &BigInt,
hook_state: &HookState,
) -> DynamicSwapFeeResult
fn on_compute_dynamic_swap_fee( &self, swap_params: &SwapParams, static_swap_fee_percentage: &BigInt, hook_state: &HookState, ) -> DynamicSwapFeeResult
Compute dynamic swap fee (matches Python on_compute_dynamic_swap_fee)