Skip to main content

MeteredProtocolSim

Trait MeteredProtocolSim 

Source
pub trait MeteredProtocolSim {
    // Required method
    fn get_amount_out_metered(
        &self,
        component_id: &ComponentId,
        stage: StageLabel,
        amount_in: BigUint,
        token_in: &Token,
        token_out: &Token,
    ) -> Result<GetAmountOutResult, SimulationError>;
}
Expand description

Extension trait adding metered, panic-guarded simulation calls to every ProtocolSim.

Wraps GuardedProtocolSim::get_amount_out_guarded and books the call against the component that served it, which the guard alone cannot do — it sees only the state and the two tokens.

Required Methods§

Source

fn get_amount_out_metered( &self, component_id: &ComponentId, stage: StageLabel, amount_in: BigUint, token_in: &Token, token_out: &Token, ) -> Result<GetAmountOutResult, SimulationError>

Calls the panic-guarded get_amount_out and records it against component_id and stage.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§