Skip to content

Commit

Permalink
SUP and Quants
Browse files Browse the repository at this point in the history
  • Loading branch information
so-kkroy22 committed Sep 27, 2024
1 parent c01caeb commit f11de3b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ module supra_framework::transaction_fee {
/// charge, while the break down is merely informational.
/// - gas charge for execution (CPU time): `execution_gas_units`
/// - gas charge for IO (storage random access): `io_gas_units`
/// - storage fee charge (storage space): `storage_fee_octas`, to be included in
/// - storage fee charge (storage space): `storage_fee_quants`, to be included in
/// `total_charge_gas_unit`, this number is converted to gas units according to the user
/// specified `gas_unit_price` on the transaction.
/// - storage deletion refund: `storage_fee_refund_octas`, this is not included in `gas_used` or
/// - storage deletion refund: `storage_fee_refund_quants`, this is not included in `gas_used` or
/// `total_charge_gas_units`, the net charge / refund is calculated by
/// `total_charge_gas_units` * `gas_unit_price` - `storage_fee_refund_octas`.
/// `total_charge_gas_units` * `gas_unit_price` - `storage_fee_refund_quants`.
///
/// This is meant to emitted as a module event.
struct FeeStatement has drop, store {
Expand All @@ -80,9 +80,9 @@ module supra_framework::transaction_fee {
/// IO gas charge.
io_gas_units: u64,
/// Storage fee charge.
storage_fee_octas: u64,
storage_fee_quants: u64,
/// Storage fee refund.
storage_fee_refund_octas: u64,
storage_fee_refund_quants: u64,
}

/// Initializes the resource storing information about gas fees collection and
Expand Down
10 changes: 5 additions & 5 deletions crates/aptos/src/common/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1460,9 +1460,9 @@ impl FaucetOptions {
pub struct GasOptions {
/// Gas multiplier per unit of gas
///
/// The amount of Octas (10^-8 APT) used for a transaction is equal
/// The amount of Quants (10^-8 SUP) used for a transaction is equal
/// to (gas unit price * gas used). The gas_unit_price can
/// be used as a multiplier for the amount of Octas willing
/// be used as a multiplier for the amount of Quants willing
/// to be paid for a transaction. This will prioritize the
/// transaction with a higher gas unit price.
///
Expand All @@ -1472,12 +1472,12 @@ pub struct GasOptions {
/// Maximum amount of gas units to be used to send this transaction
///
/// The maximum amount of gas units willing to pay for the transaction.
/// This is the (max gas in Octas / gas unit price).
/// This is the (max gas in Quants / gas unit price).
///
/// For example if I wanted to pay a maximum of 100 Octas, I may have the
/// For example if I wanted to pay a maximum of 100 Quants, I may have the
/// max gas set to 100 if the gas unit price is 1. If I want it to have a
/// gas unit price of 2, the max gas would need to be 50 to still only have
/// a maximum price of 100 Octas.
/// a maximum price of 100 Quants.
///
/// Without a value, it will determine the price based on simulating the current transaction
#[clap(long)]
Expand Down
10 changes: 5 additions & 5 deletions crates/supra/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ pub struct RestOptions {
pub struct GasOptions {
/// Gas multiplier per unit of gas
///
/// The amount of Octas (10^-8 APT) used for a transaction is equal
/// The amount of Quants (10^-8 SUP) used for a transaction is equal
/// to (gas unit price * gas used). The gas_unit_price can
/// be used as a multiplier for the amount of Octas willing
/// be used as a multiplier for the amount of Quants willing
/// to be paid for a transaction. This will prioritize the
/// transaction with a higher gas unit price.
///
Expand All @@ -47,12 +47,12 @@ pub struct GasOptions {
/// Maximum amount of gas units to be used to send this transaction
///
/// The maximum amount of gas units willing to pay for the transaction.
/// This is the (max gas in Octas / gas unit price).
/// This is the (max gas in Quants / gas unit price).
///
/// For example if I wanted to pay a maximum of 100 Octas, I may have the
/// For example if I wanted to pay a maximum of 100 Quants, I may have the
/// max gas set to 100 if the gas unit price is 1. If I want it to have a
/// gas unit price of 2, the max gas would need to be 50 to still only have
/// a maximum price of 100 Octas.
/// a maximum price of 100 Quants.
///
/// Without a value, it will determine the price based on simulating the current transaction
pub max_gas: Option<u64>,
Expand Down
32 changes: 16 additions & 16 deletions types/src/fee_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ use serde::{Deserialize, Serialize};
/// charge, while the break down is merely informational.
/// - gas charge for execution (CPU time): `execution_gas_units`
/// - gas charge for IO (storage random access): `io_gas_units`
/// - storage fee charge (storage space): `storage_fee_octas`, to be included in
/// - storage fee charge (storage space): `storage_fee_quants`, to be included in
/// `total_charge_gas_unit`, this number is converted to gas units according to the user
/// specified `gas_unit_price` on the transaction.
/// - storage deletion refund: `storage_fee_refund_octas`, this is not included in `gas_used` or
/// - storage deletion refund: `storage_fee_refund_quants`, this is not included in `gas_used` or
/// `total_charge_gas_units`, the net charge / refund is calculated by
/// `total_charge_gas_units` * `gas_unit_price` - `storage_fee_refund_octas`.
/// `total_charge_gas_units` * `gas_unit_price` - `storage_fee_refund_quants`.
///
/// This is meant to emitted as a module event.
///
Expand All @@ -33,9 +33,9 @@ pub struct FeeStatement {
/// IO gas charge.
io_gas_units: u64,
/// Storage fee charge.
storage_fee_octas: u64,
storage_fee_quants: u64,
/// Storage fee refund.
storage_fee_refund_octas: u64,
storage_fee_refund_quants: u64,
}

impl FeeStatement {
Expand All @@ -44,29 +44,29 @@ impl FeeStatement {
total_charge_gas_units: 0,
execution_gas_units: 0,
io_gas_units: 0,
storage_fee_octas: 0,
storage_fee_refund_octas: 0,
storage_fee_quants: 0,
storage_fee_refund_quants: 0,
}
}

pub fn new(
total_charge_gas_units: u64,
execution_gas_units: u64,
io_gas_units: u64,
storage_fee_octas: u64,
storage_fee_refund_octas: u64,
storage_fee_quants: u64,
storage_fee_refund_quants: u64,
) -> Self {
Self {
total_charge_gas_units,
execution_gas_units,
io_gas_units,
storage_fee_octas,
storage_fee_refund_octas,
storage_fee_quants,
storage_fee_refund_quants,
}
}

pub fn clear_refunds(&mut self) {
self.storage_fee_refund_octas = 0;
self.storage_fee_refund_quants = 0;
}

pub fn gas_used(&self) -> u64 {
Expand All @@ -82,18 +82,18 @@ impl FeeStatement {
}

pub fn storage_fee_used(&self) -> u64 {
self.storage_fee_octas
self.storage_fee_quants
}

pub fn storage_fee_refund(&self) -> u64 {
self.storage_fee_refund_octas
self.storage_fee_refund_quants
}

pub fn add_fee_statement(&mut self, other: &FeeStatement) {
self.total_charge_gas_units += other.total_charge_gas_units;
self.execution_gas_units += other.execution_gas_units;
self.io_gas_units += other.io_gas_units;
self.storage_fee_octas += other.storage_fee_octas;
self.storage_fee_refund_octas += other.storage_fee_refund_octas;
self.storage_fee_quants += other.storage_fee_quants;
self.storage_fee_refund_quants += other.storage_fee_refund_quants;
}
}

0 comments on commit f11de3b

Please sign in to comment.