pub fn check_forced_transfer(
        &self,
        payment_purse_balance: Motes,
        gas_price: u64,
    ) -> Option<ForcedTransferResult> {
        let payment_result_cost = match Motes::from_gas(self.cost(), gas_price) {
            Some(cost) => cost,
            None => return Some(ForcedTransferResult::GasConversionOverflow),
        };
        // payment_code_spec_3_b_ii: if (balance of handle payment pay purse) < (gas spent during
        // payment code execution) * gas_price, no session
        let insufficient_balance_to_continue = payment_purse_balance < payment_result_cost;

        match self {
            ExecutionResult::Success { .. } if insufficient_balance_to_continue => {
                // payment_code_spec_4: insufficient payment
                Some(ForcedTransferResult::InsufficientPayment)
            }
            ExecutionResult::Success { .. } => {
                // payment_code_spec_3_b_ii: continue execution
                None
            }
            ExecutionResult::Failure { .. } => {
                // payment_code_spec_3_a: report payment error in the deploy response
                Some(ForcedTransferResult::PaymentFailure)
            }
        }
    }
/// Checks the transfer status of a payment code.
///
/// This method converts the gas cost of the execution result into motes using supplied
/// `gas_price`, and then a check is made to ensure that user deposited enough funds in the
/// payment purse (in motes) to cover the execution of a payment code.
///
/// Returns `None` if user deposited enough funds in payment purse and the execution result was
/// a success variant, otherwise a wrapped [`ForcedTransferResult`] that indicates an error
/// codition.
Checks the transfer status of a payment code.
This method converts the gas cost of the execution result into motes using supplied
`gas_price`, and then a check is made to ensure that user deposited enough funds in the
payment purse (in motes) to cover the execution of a payment code.

Returns `None` if user deposited enough funds in payment purse and the execution result was
a success variant, otherwise a wrapped [`ForcedTransferResult`] that indicates an error
codition.
Checks the transfer status of a payment code . This method converts the gas cost of the execution result into motes using supplied ` gas_price ` and then a check is made to ensure that user deposited enough funds in the payment purse ( in motes ) to cover the execution of a payment code . Returns ` None ` if user deposited enough funds in payment purse and the execution result was a success variant otherwise a wrapped [ ` ForcedTransferResult ` ] that indicates an error codition .
pub fn check_forced_transfer(
        &self,
        payment_purse_balance: Motes,
        gas_price: u64,
    ) -> Option<ForcedTransferResult> {
        let payment_result_cost = match Motes::from_gas(self.cost(), gas_price) {
            Some(cost) => cost,
            None => return Some(ForcedTransferResult::GasConversionOverflow),
        };
        // payment_code_spec_3_b_ii: if (balance of handle payment pay purse) < (gas spent during
        // payment code execution) * gas_price, no session
        let insufficient_balance_to_continue = payment_purse_balance < payment_result_cost;
        match self {
            ExecutionResult::Success { .. } if insufficient_balance_to_continue => {
                // payment_code_spec_4: insufficient payment
                Some(ForcedTransferResult::InsufficientPayment)
            }
            ExecutionResult::Success { .. } => {
                // payment_code_spec_3_b_ii: continue execution
                None
            }
            ExecutionResult::Failure { .. } => {
                // payment_code_spec_3_a: report payment error in the deploy response
                Some(ForcedTransferResult::PaymentFailure)
            }
        }
    }
pub fn check_forced_transfer ( & self , payment_purse_balance : Motes , gas_price : u64 , ) -> Option < ForcedTransferResult > { let payment_result_cost = match Motes :: from_gas ( self . cost ( ) , gas_price ) { Some ( cost ) => cost , None => return Some ( ForcedTransferResult :: GasConversionOverflow ) , } ; // payment_code_spec_3_b_ii: if (balance of handle payment pay purse) < (gas spent during // payment code execution) * gas_price, no session let insufficient_balance_to_continue = payment_purse_balance < payment_result_cost ; match self { ExecutionResult :: Success { .. } if insufficient_balance_to_continue => { // payment_code_spec_4: insufficient payment Some ( ForcedTransferResult :: InsufficientPayment ) } ExecutionResult :: Success { .. } => { // payment_code_spec_3_b_ii: continue execution None } ExecutionResult :: Failure { .. } => { // payment_code_spec_3_a: report payment error in the deploy response Some ( ForcedTransferResult :: PaymentFailure ) } } }
Checks the transfer status of a payment code.
Checks the transfer status of a payment code .
&self
payment_purse_balance
Motes
gas_price
u64
&self
payment_purse_balance
Motes
gas_price
u64