Skip to content

Commit

Permalink
Expose tokens_burnt (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaoticTempest authored Jul 20, 2022
1 parent 03724af commit e96ff0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions workspaces/src/network/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl TopLevelAccountCreator for Testnet {
logs: Vec::new(),
receipt_ids: Vec::new(),
gas_burnt: 0,
tokens_burnt: 0,
executor_id: "testnet".parse()?,
status: ExecutionStatusView::SuccessValue(String::new()),
},
Expand Down
7 changes: 6 additions & 1 deletion workspaces/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use near_primitives::views::{
FinalExecutionStatus,
};

use crate::types::{CryptoHash, Gas};
use crate::types::{Balance, CryptoHash, Gas};

/// Struct to hold a type we want to return along w/ the execution result view.
/// This view has extra info about the execution, such as gas usage and whether
Expand Down Expand Up @@ -240,6 +240,10 @@ pub struct ExecutionOutcome {
pub receipt_ids: Vec<CryptoHash>,
/// The amount of the gas burnt by the given transaction or receipt.
pub gas_burnt: Gas,
/// The amount of tokens burnt corresponding to the burnt gas amount.
/// This value doesn't always equal to the `gas_burnt` multiplied by the gas price, because
/// the prepaid gas price might be lower than the actual gas price and it creates a deficit.
pub tokens_burnt: Balance,
/// The id of the account on which the execution happens. For transaction this is signer_id,
/// for receipt this is receiver_id.
pub executor_id: AccountId,
Expand Down Expand Up @@ -303,6 +307,7 @@ impl From<ExecutionOutcomeWithIdView> for ExecutionOutcome {
.map(|c| CryptoHash(c.0))
.collect(),
gas_burnt: view.outcome.gas_burnt,
tokens_burnt: view.outcome.tokens_burnt,
executor_id: view.outcome.executor_id,
status: view.outcome.status,
}
Expand Down

0 comments on commit e96ff0f

Please sign in to comment.