Skip to main content

ChainReadTicketOperations

Trait ChainReadTicketOperations 

pub trait ChainReadTicketOperations {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn incoming_ticket_values(
        &self,
    ) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error>;

    // Provided method
    fn outgoing_ticket_values(
        &self,
        configured_wp: Option<WinningProbability>,
        configured_price: Option<Balance<WxHOPR>>,
    ) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error> { ... }
}
Expand description

On-chain operations to read values related to tickets.

These operations are used in critical packet processing pipelines, and therefore, should not query the chain information directly, and they MUST NOT block.

Required Associated Types§

type Error: Error + Send + Sync + 'static

Required Methods§

fn incoming_ticket_values( &self, ) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error>

Retrieves the expected minimum winning probability and ticket price for incoming tickets.

This operation MUST not block, as it is typically used within the critical packet processing pipeline.

Provided Methods§

fn outgoing_ticket_values( &self, configured_wp: Option<WinningProbability>, configured_price: Option<Balance<WxHOPR>>, ) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error>

Retrieves the winning probability and ticket price for outgoing tickets, with respect to the optionally pre-configured values.

The caller, not the implementation, should make sure that the configured values (if provided) are not less than the expected values for incoming tickets.

This operation MUST not block, as it is typically used within the critical packet processing pipeline.

The default implementation calls the incoming_ticket_values method and uses the incoming values unless the configured values are provided.

Implementations on Foreign Types§

§

impl<'a, T> ChainReadTicketOperations for &'a T

§

impl<T> ChainReadTicketOperations for Box<T>

§

impl<T> ChainReadTicketOperations for Arc<T>

Implementors§