pub struct DaoCalculator<'a, DL> { /* private fields */ }
Expand description
Dao field calculator
DaoCalculator
is a facade to calculate the dao field.
Implementations§
Source§impl<'a, DL: CellDataProvider + EpochProvider + HeaderProvider> DaoCalculator<'a, DL>
impl<'a, DL: CellDataProvider + EpochProvider + HeaderProvider> DaoCalculator<'a, DL>
Sourcepub fn primary_block_reward(
&self,
target: &HeaderView,
) -> Result<Capacity, DaoError>
pub fn primary_block_reward( &self, target: &HeaderView, ) -> Result<Capacity, DaoError>
Returns the primary block reward for target
block.
Sourcepub fn secondary_block_reward(
&self,
target: &HeaderView,
) -> Result<Capacity, DaoError>
pub fn secondary_block_reward( &self, target: &HeaderView, ) -> Result<Capacity, DaoError>
Returns the secondary block reward for target
block.
Sourcepub fn dao_field_with_current_epoch(
&self,
rtxs: impl Iterator<Item = &'a ResolvedTransaction> + Clone,
parent: &HeaderView,
current_block_epoch: &EpochExt,
) -> Result<Byte32, DaoError>
pub fn dao_field_with_current_epoch( &self, rtxs: impl Iterator<Item = &'a ResolvedTransaction> + Clone, parent: &HeaderView, current_block_epoch: &EpochExt, ) -> Result<Byte32, DaoError>
Calculates the new dao field with specified EpochExt
.
Sourcepub fn dao_field(
&self,
rtxs: impl Iterator<Item = &'a ResolvedTransaction> + Clone,
parent: &HeaderView,
) -> Result<Byte32, DaoError>
pub fn dao_field( &self, rtxs: impl Iterator<Item = &'a ResolvedTransaction> + Clone, parent: &HeaderView, ) -> Result<Byte32, DaoError>
Calculates the new dao field after packaging these transactions. It returns the dao field in Byte32
format. Please see extract_dao_data
if you intend to see the detailed content.
Sourcepub fn transaction_fee(
&self,
rtx: &ResolvedTransaction,
) -> Result<Capacity, DaoError>
pub fn transaction_fee( &self, rtx: &ResolvedTransaction, ) -> Result<Capacity, DaoError>
Returns the total transactions fee of rtx
.
Sourcepub fn calculate_maximum_withdraw(
&self,
output: &CellOutput,
output_data_capacity: Capacity,
deposit_header_hash: &Byte32,
withdrawing_header_hash: &Byte32,
) -> Result<Capacity, DaoError>
pub fn calculate_maximum_withdraw( &self, output: &CellOutput, output_data_capacity: Capacity, deposit_header_hash: &Byte32, withdrawing_header_hash: &Byte32, ) -> Result<Capacity, DaoError>
Calculate maximum withdraw capacity of a deposited dao output
Auto Trait Implementations§
impl<'a, DL> Freeze for DaoCalculator<'a, DL>
impl<'a, DL> RefUnwindSafe for DaoCalculator<'a, DL>where
DL: RefUnwindSafe,
impl<'a, DL> Send for DaoCalculator<'a, DL>where
DL: Sync,
impl<'a, DL> Sync for DaoCalculator<'a, DL>where
DL: Sync,
impl<'a, DL> Unpin for DaoCalculator<'a, DL>
impl<'a, DL> UnwindSafe for DaoCalculator<'a, DL>where
DL: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more