Skip to content

Commit

Permalink
Add supply check to evm fee burning test
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianBorst committed Dec 24, 2024
1 parent 1e6bcf2 commit 5a9267d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mytestnet
coverage.txt
profile.out
tests/dockerfile/althea.tar.gz
test-ready-to-run

# Vagrant
.vagrant/
Expand Down
1 change: 0 additions & 1 deletion integration_tests/test_runner/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#[macro_use]
extern crate log;

use althea_proto::canto::erc20;
use deep_space::Contact;
use deep_space::PrivateKey;
use std::env;
Expand Down
23 changes: 7 additions & 16 deletions integration_tests/test_runner/src/tests/dex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ use std::time::Duration;

use crate::bootstrapping::DexAddresses;
use crate::dex_utils::{
ambient_liq_to_flows, croc_policy_ops_resolution, croc_policy_treasury_resolution,
croc_query_curve_tick, croc_query_dex, croc_query_pool_params, croc_query_pool_template,
croc_query_price, croc_query_range_position, dex_authority_transfer, dex_direct_protocol_cmd,
dex_mint_ambient_in_amount, dex_mint_ambient_pos, dex_mint_knockout_pos,
dex_mint_ranged_in_amount, dex_mint_ranged_pos, dex_query_authority, dex_query_safe_mode,
dex_swap, dex_user_cmd, size_ambient_liq, OpsResolutionArgs, ProtocolCmdArgs, SwapArgs,
UserCmdArgs, BOOT_PATH, COLD_PATH, MAX_PRICE, MIN_PRICE, WARM_PATH,
croc_policy_ops_resolution, croc_policy_treasury_resolution, croc_query_curve_tick,
croc_query_dex, croc_query_pool_params, croc_query_pool_template, croc_query_price,
croc_query_range_position, dex_authority_transfer, dex_direct_protocol_cmd,
dex_mint_ambient_pos, dex_mint_ranged_in_amount, dex_mint_ranged_pos, dex_query_authority,
dex_query_safe_mode, dex_swap, dex_user_cmd, size_ambient_liq, OpsResolutionArgs,
ProtocolCmdArgs, SwapArgs, UserCmdArgs, BOOT_PATH, COLD_PATH, MAX_PRICE, MIN_PRICE, WARM_PATH,
};
use crate::type_urls::{
COLLECT_TREASURY_PROPOSAL_TYPE_URL, HOT_PATH_OPEN_PROPOSAL_TYPE_URL, OPS_PROPOSAL_TYPE_URL,
Expand Down Expand Up @@ -243,14 +242,6 @@ pub async fn advanced_dex_test(
walthea,
)
.await;
let bb = web3
.get_erc20_balance(base, evm_user.eth_address)
.await
.unwrap();
let qb = web3
.get_erc20_balance(quote, evm_user.eth_address)
.await
.unwrap();
let ambient_qty = one_eth();
let price_root = croc_query_price(
web3,
Expand Down Expand Up @@ -755,7 +746,7 @@ async fn swap_many(
swaps: usize,
direction: Option<bool>,
) {
let mut is_buy = if let Some(d) = direction { d } else { true };
let mut is_buy = direction.unwrap_or(true);
let mut rng = rand::thread_rng();

for _ in 0..swaps {
Expand Down
15 changes: 15 additions & 0 deletions integration_tests/test_runner/src/tests/evm_fee_burning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ pub async fn evm_fee_burning_test(
info!("Set inflation to 0");
set_inflation_to_zero(contact, &validator_keys).await;

let pre_supply = contact
.query_supply_of(STAKING_TOKEN.clone())
.await
.expect("Unable to get aalthea supply")
.expect("No supply of aalthea?");
let pre_balances = snapshot_validator_rewards(contact, &validator_keys).await;

info!("Generating some fees");
Expand All @@ -47,6 +52,16 @@ pub async fn evm_fee_burning_test(
}

sleep(Duration::from_secs(10)).await;
let post_supply = contact
.query_supply_of(STAKING_TOKEN.clone())
.await
.expect("Unable to get aalthea supply")
.expect("No supply of aalthea?");
assert!(pre_supply.amount > post_supply.amount);
info!(
"Supply decreased by: {}",
pre_supply.amount - post_supply.amount
);
let post_balances = snapshot_validator_rewards(contact, &validator_keys).await;
assert_eq!(pre_balances, post_balances);

Expand Down

0 comments on commit 5a9267d

Please sign in to comment.