-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from ergoplatform/i286-oracle-total-count-metric
Add oracle_total_count metric to Prometheus and REST API
- Loading branch information
Showing
7 changed files
with
148 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ mod serde; | |
mod spec_token; | ||
mod state; | ||
mod templates; | ||
mod util; | ||
mod wallet; | ||
|
||
#[cfg(test)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use ergo_lib::ergotree_ir::chain::ergo_box::ErgoBox; | ||
use ergo_lib::ergotree_ir::chain::token::TokenId; | ||
use ergo_lib::wallet::box_selector::ErgoBoxAssets; | ||
|
||
pub fn get_token_count(b: ErgoBox, token_id: TokenId) -> u64 { | ||
let mut count = 0; | ||
if let Some(tokens) = b.tokens() { | ||
for token in tokens { | ||
if token.token_id == token_id { | ||
count += token.amount.as_u64(); | ||
} | ||
} | ||
} | ||
count | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters