Skip to content

Commit

Permalink
feat: update condition & threshold to alert (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrsirapop authored Aug 1, 2024
1 parent 8dc7e3b commit e514fc9
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions config/tvl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@
mainnet:
percent_diff_escrow_supply_threshold: 5.0
percent_diff_total_supply_threshold: 5.0
alert_asset_escrow_value_threshold: 200000
alert_asset_escrow_value_threshold: 800000
alert_asset_value_threshold: 3000000



testnet:
percent_diff_escrow_supply_threshold: 5.0
percent_diff_total_supply_threshold: 5.0
alert_asset_escrow_value_threshold: 200000
alert_asset_escrow_value_threshold: 800000
alert_asset_value_threshold: 3000000



stagenet:
percent_diff_escrow_supply_threshold: 5.0
percent_diff_total_supply_threshold: 5.0
alert_asset_escrow_value_threshold: 200000
alert_asset_escrow_value_threshold: 800000
alert_asset_value_threshold: 3000000



devnet-amplifier:
percent_diff_escrow_supply_threshold: 5.0
percent_diff_total_supply_threshold: 5.0
alert_asset_escrow_value_threshold: 200000
alert_asset_escrow_value_threshold: 800000
alert_asset_value_threshold: 3000000



devnet-verifiers:
percent_diff_escrow_supply_threshold: 5.0
percent_diff_total_supply_threshold: 5.0
alert_asset_escrow_value_threshold: 200000
alert_asset_escrow_value_threshold: 800000
alert_asset_value_threshold: 3000000
6 changes: 3 additions & 3 deletions methods/tvl/getTVLAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = async params => {
if (data.length > 0) {
const assetsData = await getAssetsList();
details = await Promise.all(data.map(d => new Promise(async resolve => {
const { asset, price, is_abnormal_supply, percent_diff_supply, total, value, total_on_evm, total_on_cosmos, evm_escrow_address, evm_escrow_balance, evm_escrow_address_urls, tvl } = { ...d };
const { asset, price, is_abnormal_supply, percent_diff_supply, total, value_diff, total_on_evm, total_on_cosmos, evm_escrow_address, evm_escrow_balance, evm_escrow_address_urls, tvl } = { ...d };
const { native_chain, symbol, addresses } = { ...await getAssetData(asset, assetsData) };
const { chain_type } = { ...getChainData(native_chain) };
const app = getAppURL();
Expand All @@ -54,7 +54,7 @@ module.exports = async params => {
resolve({
asset, symbol, price,
native_chain, native_on: chain_type,
...(is_abnormal_supply && value > alert_asset_value_threshold ?
...(is_abnormal_supply && value_diff > alert_asset_value_threshold ?
{
percent_diff_supply,
total, total_on_evm, total_on_cosmos,
Expand Down Expand Up @@ -87,7 +87,7 @@ module.exports = async params => {
})));

native_on_evm_total_status = details.findIndex(d => d.native_on === 'evm' && isNumber(d.percent_diff_supply)) > -1 ? 'alert' : 'ok';
native_on_evm_escrow_status = details.findIndex(d => d.native_on === 'evm' && toArray(d.chains).findIndex(_d => isNumber(_d.percent_diff_supply)) > -1) ? 'alert' : 'ok';
native_on_evm_escrow_status = details.findIndex(d => d.native_on === 'evm' && toArray(d.chains).findIndex(_d => isNumber(_d.percent_diff_supply)) > -1) > -1 ? 'alert' : 'ok';
native_on_cosmos_evm_escrow_status = details.findIndex(d => d.native_on === 'cosmos' && isNumber(d.percent_diff_supply)) > -1 ? 'alert' : 'ok';
native_on_cosmos_escrow_status = details.findIndex(d => d.native_on === 'cosmos' && toArray(d.chains).findIndex(_d => isNumber(_d.percent_diff_supply)) > -1) > -1 ? 'alert' : 'ok';

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axelarscan-api",
"version": "0.0.48",
"version": "0.0.49",
"description": "Axelarscan API",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion terraform/devnet-amplifier/variables.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ variable "log_level" {

variable "app_version" {
description = "App version, same as docker image version"
default = "0.0.48"
default = "0.0.49"
validation {
error_message = "Must be valid semantic version. $Major.$Minor.$Patch"
condition = can(regex("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", var.app_version))
Expand Down
2 changes: 1 addition & 1 deletion terraform/devnet-verifiers/variables.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ variable "log_level" {

variable "app_version" {
description = "App version, same as docker image version"
default = "0.0.48"
default = "0.0.49"
validation {
error_message = "Must be valid semantic version. $Major.$Minor.$Patch"
condition = can(regex("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", var.app_version))
Expand Down
2 changes: 1 addition & 1 deletion terraform/mainnet/variables.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ variable "log_level" {

variable "app_version" {
description = "App version, same as docker image version"
default = "0.0.48"
default = "0.0.49"
validation {
error_message = "Must be valid semantic version. $Major.$Minor.$Patch"
condition = can(regex("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", var.app_version))
Expand Down
2 changes: 1 addition & 1 deletion terraform/stagenet/variables.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ variable "log_level" {

variable "app_version" {
description = "App version, same as docker image version"
default = "0.0.48"
default = "0.0.49"
validation {
error_message = "Must be valid semantic version. $Major.$Minor.$Patch"
condition = can(regex("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", var.app_version))
Expand Down
2 changes: 1 addition & 1 deletion terraform/testnet/variables.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ variable "log_level" {

variable "app_version" {
description = "App version, same as docker image version"
default = "0.0.48"
default = "0.0.49"
validation {
error_message = "Must be valid semantic version. $Major.$Minor.$Patch"
condition = can(regex("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", var.app_version))
Expand Down

0 comments on commit e514fc9

Please sign in to comment.