Skip to content

Commit

Permalink
better name
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Coats committed Mar 8, 2024
1 parent c12ae7a commit ddb0814
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl TransactionBuilder {
let total_generation_amount = self
.selected_inputs
.iter()
.map(|o| o.output.generation_amount(&self.protocol_parameters))
.map(|o| o.output.mana_generation_amount(&self.protocol_parameters))
.sum::<u64>();
let total_stored_mana = self.selected_inputs.iter().map(|o| o.output.mana()).sum::<u64>();
let slots_remaining = self.protocol_parameters.slots_until_generated(
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/types/block/output/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl AccountOutput {
creation_index: SlotIndex,
target_index: SlotIndex,
) -> Result<DecayedMana, OutputError> {
let generation_amount = self.generation_amount(protocol_parameters);
let generation_amount = self.mana_generation_amount(protocol_parameters);
let stored_mana = protocol_parameters.mana_with_decay(self.mana(), creation_index, target_index)?;
let potential_mana =
protocol_parameters.generate_mana_with_decay(generation_amount, creation_index, target_index)?;
Expand All @@ -440,8 +440,8 @@ impl AccountOutput {
})
}

/// Returns the generation amount of the output.
pub fn generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
/// Returns the mana generation amount of the output.
pub fn mana_generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
let min_deposit = self.minimum_amount(protocol_parameters.storage_score_parameters());
self.amount().saturating_sub(min_deposit)
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/types/block/output/anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl AnchorOutput {
creation_index: SlotIndex,
target_index: SlotIndex,
) -> Result<DecayedMana, OutputError> {
let generation_amount = self.generation_amount(protocol_parameters);
let generation_amount = self.mana_generation_amount(protocol_parameters);
let stored_mana = protocol_parameters.mana_with_decay(self.mana(), creation_index, target_index)?;
let potential_mana =
protocol_parameters.generate_mana_with_decay(generation_amount, creation_index, target_index)?;
Expand All @@ -497,8 +497,8 @@ impl AnchorOutput {
})
}

/// Returns the generation amount of the output.
pub fn generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
/// Returns the mana generation amount of the output.
pub fn mana_generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
let min_deposit = self.minimum_amount(protocol_parameters.storage_score_parameters());
self.amount().saturating_sub(min_deposit)
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/types/block/output/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl BasicOutput {
creation_index: SlotIndex,
target_index: SlotIndex,
) -> Result<DecayedMana, OutputError> {
let generation_amount = self.generation_amount(protocol_parameters);
let generation_amount = self.mana_generation_amount(protocol_parameters);
let stored_mana = protocol_parameters.mana_with_decay(self.mana(), creation_index, target_index)?;
let potential_mana =
protocol_parameters.generate_mana_with_decay(generation_amount, creation_index, target_index)?;
Expand All @@ -397,8 +397,8 @@ impl BasicOutput {
})
}

/// Returns the generation amount of the output.
pub fn generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
/// Returns the mana generation amount of the output.
pub fn mana_generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
let min_deposit = self.minimum_amount(protocol_parameters.storage_score_parameters());
self.amount().saturating_sub(min_deposit)
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/types/block/output/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ impl DelegationOutput {
creation_index: SlotIndex,
target_index: SlotIndex,
) -> Result<DecayedMana, OutputError> {
let generation_amount = self.generation_amount(protocol_parameters);
let generation_amount = self.mana_generation_amount(protocol_parameters);
let potential_mana =
protocol_parameters.generate_mana_with_decay(generation_amount, creation_index, target_index)?;

Expand All @@ -382,8 +382,8 @@ impl DelegationOutput {
})
}

/// Returns the generation amount of the output.
pub fn generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
/// Returns the mana generation amount of the output.
pub fn mana_generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
let min_deposit = self.minimum_amount(protocol_parameters.storage_score_parameters());
self.amount().saturating_sub(min_deposit)
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/types/block/output/foundry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ impl FoundryOutput {
creation_index: SlotIndex,
target_index: SlotIndex,
) -> Result<DecayedMana, OutputError> {
let generation_amount = self.generation_amount(protocol_parameters);
let generation_amount = self.mana_generation_amount(protocol_parameters);
let potential_mana =
protocol_parameters.generate_mana_with_decay(generation_amount, creation_index, target_index)?;

Expand All @@ -451,8 +451,8 @@ impl FoundryOutput {
})
}

/// Returns the generation amount of the output.
pub fn generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
/// Returns the mana generation amount of the output.
pub fn mana_generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
let min_deposit = self.minimum_amount(protocol_parameters.storage_score_parameters());
self.amount().saturating_sub(min_deposit)
}
Expand Down
16 changes: 8 additions & 8 deletions sdk/src/types/block/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ impl Output {
}
}

/// Returns the generation amount of the output.
pub fn generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
/// Returns the mana generation amount of the output.
pub fn mana_generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
match self {
Self::Basic(output) => output.generation_amount(protocol_parameters),
Self::Account(output) => output.generation_amount(protocol_parameters),
Self::Anchor(output) => output.generation_amount(protocol_parameters),
Self::Foundry(output) => output.generation_amount(protocol_parameters),
Self::Nft(output) => output.generation_amount(protocol_parameters),
Self::Delegation(output) => output.generation_amount(protocol_parameters),
Self::Basic(output) => output.mana_generation_amount(protocol_parameters),
Self::Account(output) => output.mana_generation_amount(protocol_parameters),
Self::Anchor(output) => output.mana_generation_amount(protocol_parameters),
Self::Foundry(output) => output.mana_generation_amount(protocol_parameters),
Self::Nft(output) => output.mana_generation_amount(protocol_parameters),
Self::Delegation(output) => output.mana_generation_amount(protocol_parameters),
}
}

Expand Down
6 changes: 3 additions & 3 deletions sdk/src/types/block/output/nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ impl NftOutput {
creation_index: SlotIndex,
target_index: SlotIndex,
) -> Result<DecayedMana, OutputError> {
let generation_amount = self.generation_amount(protocol_parameters);
let generation_amount = self.mana_generation_amount(protocol_parameters);
let stored_mana = protocol_parameters.mana_with_decay(self.mana(), creation_index, target_index)?;
let potential_mana =
protocol_parameters.generate_mana_with_decay(generation_amount, creation_index, target_index)?;
Expand All @@ -452,8 +452,8 @@ impl NftOutput {
})
}

/// Returns the generation amount of the output.
pub fn generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
/// Returns the mana generation amount of the output.
pub fn mana_generation_amount(&self, protocol_parameters: &ProtocolParameters) -> u64 {
let min_deposit = self.minimum_amount(protocol_parameters.storage_score_parameters());
self.amount().saturating_sub(min_deposit)
}
Expand Down

0 comments on commit ddb0814

Please sign in to comment.