Struct sui_sdk_types::types::GasCostSummary
source · pub struct GasCostSummary {
pub computation_cost: u64,
pub storage_cost: u64,
pub storage_rebate: u64,
pub non_refundable_storage_fee: u64,
}
Expand description
Summary of gas charges.
Storage is charged independently of computation.
There are 3 parts to the storage charges:
storage_cost
: it is the charge of storage at the time the transaction is executed.
The cost of storage is the number of bytes of the objects being mutated
multiplied by a variable storage cost per byte
storage_rebate
: this is the amount a user gets back when manipulating an object.
The storage_rebate
is the storage_cost
for an object minus fees.
non_refundable_storage_fee
: not all the value of the object storage cost is
given back to user and there is a small fraction that
is kept by the system. This value tracks that charge.
When looking at a gas cost summary the amount charged to the user is
computation_cost + storage_cost - storage_rebate
and that is the amount that is deducted from the gas coins.
non_refundable_storage_fee
is collected from the objects being mutated/deleted
and it is tracked by the system in storage funds.
Objects deleted, including the older versions of objects mutated, have the storage field
on the objects added up to a pool of “potential rebate”. This rebate then is reduced
by the “nonrefundable rate” such that:
potential_rebate(storage cost of deleted/mutated objects) = storage_rebate + non_refundable_storage_fee
Fields§
§computation_cost: u64
Cost of computation/execution
storage_cost: u64
Storage cost, it’s the sum of all storage cost for all objects created or mutated.
storage_rebate: u64
The amount of storage cost refunded to the user for all objects deleted or mutated in the transaction.
non_refundable_storage_fee: u64
The fee for the rebate. The portion of the storage rebate kept by the system.
Implementations§
Trait Implementations§
source§impl Clone for GasCostSummary
impl Clone for GasCostSummary
source§fn clone(&self) -> GasCostSummary
fn clone(&self) -> GasCostSummary
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GasCostSummary
impl Debug for GasCostSummary
source§impl Default for GasCostSummary
impl Default for GasCostSummary
source§fn default() -> GasCostSummary
fn default() -> GasCostSummary
source§impl<'de> Deserialize<'de> for GasCostSummary
impl<'de> Deserialize<'de> for GasCostSummary
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Display for GasCostSummary
impl Display for GasCostSummary
source§impl JsonSchema for GasCostSummary
impl JsonSchema for GasCostSummary
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl PartialEq for GasCostSummary
impl PartialEq for GasCostSummary
source§impl Serialize for GasCostSummary
impl Serialize for GasCostSummary
impl Eq for GasCostSummary
impl StructuralPartialEq for GasCostSummary
Auto Trait Implementations§
impl Freeze for GasCostSummary
impl RefUnwindSafe for GasCostSummary
impl Send for GasCostSummary
impl Sync for GasCostSummary
impl Unpin for GasCostSummary
impl UnwindSafe for GasCostSummary
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)