pub trait PostExecutionHandler {
type Context;
type Error;
type ExecResult;
type Output;
// Required methods
fn refund(
&self,
context: &mut Self::Context,
exec_result: &mut Self::ExecResult,
eip7702_refund: i64,
);
fn reimburse_caller(
&self,
context: &mut Self::Context,
exec_result: &mut Self::ExecResult,
) -> Result<(), Self::Error>;
fn reward_beneficiary(
&self,
context: &mut Self::Context,
exec_result: &mut Self::ExecResult,
) -> Result<(), Self::Error>;
fn output(
&self,
context: &mut Self::Context,
result: Self::ExecResult,
) -> Result<Self::Output, Self::Error>;
fn clear(&self, context: &mut Self::Context);
// Provided method
fn end(
&self,
_context: &mut Self::Context,
end_output: Result<Self::Output, Self::Error>,
) -> Result<Self::Output, Self::Error> { ... }
}
Required Associated Types§
Required Methods§
Sourcefn refund(
&self,
context: &mut Self::Context,
exec_result: &mut Self::ExecResult,
eip7702_refund: i64,
)
fn refund( &self, context: &mut Self::Context, exec_result: &mut Self::ExecResult, eip7702_refund: i64, )
Calculate final refund
Sourcefn reimburse_caller(
&self,
context: &mut Self::Context,
exec_result: &mut Self::ExecResult,
) -> Result<(), Self::Error>
fn reimburse_caller( &self, context: &mut Self::Context, exec_result: &mut Self::ExecResult, ) -> Result<(), Self::Error>
Reimburse the caller with balance it didn’t spent.
Sourcefn reward_beneficiary(
&self,
context: &mut Self::Context,
exec_result: &mut Self::ExecResult,
) -> Result<(), Self::Error>
fn reward_beneficiary( &self, context: &mut Self::Context, exec_result: &mut Self::ExecResult, ) -> Result<(), Self::Error>
Reward beneficiary with transaction rewards.
Sourcefn output(
&self,
context: &mut Self::Context,
result: Self::ExecResult,
) -> Result<Self::Output, Self::Error>
fn output( &self, context: &mut Self::Context, result: Self::ExecResult, ) -> Result<Self::Output, Self::Error>
Main return handle, takes state from journal and transforms internal result to PostExecutionHandler::Output
.
Provided Methods§
Sourcefn end(
&self,
_context: &mut Self::Context,
end_output: Result<Self::Output, Self::Error>,
) -> Result<Self::Output, Self::Error>
fn end( &self, _context: &mut Self::Context, end_output: Result<Self::Output, Self::Error>, ) -> Result<Self::Output, Self::Error>
Called when execution ends.
End handle in comparison to output handle will be called every time after execution.
While PostExecutionHandler::output
will be omitted in case of the error.