Trait raiden_blockchain::transactions::Transaction
source · pub trait Transaction {
type Output: Send + Sync;
type Params: Clone + Send + Sync;
type Data: Clone + Send + Sync;
// Required methods
fn onchain_data<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<Self::Data, ProxyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn validate_preconditions<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
data: Self::Data,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn submit<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
data: Self::Data,
gas_estimate: U256,
gas_price: U256
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ProxyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn validate_postconditions<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ProxyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn estimate_gas<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
data: Self::Data
) -> Pin<Box<dyn Future<Output = Result<(U256, U256), ProxyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn execute_prerequisite<'life0, 'async_trait>(
&'life0 self,
_params: Self::Params,
_data: Self::Data
) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn execute<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ProxyError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn acquire_lock<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<RwLockWriteGuard<'_, bool>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
A trait to be implemented by on-chain transactions.
Required Associated Types§
Required Methods§
sourcefn onchain_data<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<Self::Data, ProxyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn onchain_data<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<Self::Data, ProxyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch data residing on-chain for validation prior / post execution.
sourcefn validate_preconditions<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
data: Self::Data,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn validate_preconditions<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
data: Self::Data,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Validate pre-conditions needed to execute the transaction.
sourcefn submit<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
data: Self::Data,
gas_estimate: U256,
gas_price: U256
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ProxyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
data: Self::Data,
gas_estimate: U256,
gas_price: U256
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ProxyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Submit transaction on-chain.
sourcefn validate_postconditions<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ProxyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn validate_postconditions<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ProxyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Validate conditions after the execution of the transaction in case the execution failed.
Provided Methods§
sourcefn execute_prerequisite<'life0, 'async_trait>(
&'life0 self,
_params: Self::Params,
_data: Self::Data
) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn execute_prerequisite<'life0, 'async_trait>(
&'life0 self,
_params: Self::Params,
_data: Self::Data
) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Execute transactions that are required prior to executing the current one.
Some transactions like deposit might need an approve call before.
sourcefn execute<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ProxyError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
params: Self::Params,
at_block_hash: H256
) -> Pin<Box<dyn Future<Output = Result<Self::Output, ProxyError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Validate preconditions, execute the transaction and if failed, validate post conditions.
sourcefn acquire_lock<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<RwLockWriteGuard<'_, bool>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn acquire_lock<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<RwLockWriteGuard<'_, bool>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Acquire lock, if needed.