From 7b62db1fe14dc73162b021cee36ce05ecfed8675 Mon Sep 17 00:00:00 2001 From: alecps Date: Wed, 6 Dec 2023 11:07:28 -0500 Subject: [PATCH] calculate expected balance change, test passing --- e2e_test/test_base_fee_recipient.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/e2e_test/test_base_fee_recipient.sh b/e2e_test/test_base_fee_recipient.sh index 6da1203f67..f64ba01eff 100755 --- a/e2e_test/test_base_fee_recipient.sh +++ b/e2e_test/test_base_fee_recipient.sh @@ -8,12 +8,10 @@ source shared.sh # Send token and check balance balance_before=$(cast balance $FEE_HANDLER) tx_json=$(cast send --json --private-key $ACC_PRIVKEY $TOKEN_ADDR 'transfer(address to, uint256 value) returns (bool)' 0x000000000000000000000000000000000000dEaD 100) -echo "tx json: $tx_json" -tx_hash=$(echo $tx_json | jq -r '.transactionHash') -echo "tx hash: $tx_hash" -cast tx $tx_hash -cast receipt $tx_hash +gas_used=$(echo $tx_json | jq -r '.gasUsed') +block_number=$(echo $tx_json | jq -r '.blockNumber') +base_fee=$(cast base-fee $block_number) +expected_balance_change=$((base_fee * gas_used)) balance_after=$(cast balance $FEE_HANDLER) echo "Balance change: $balance_before -> $balance_after" -# TODO(Alec) calculate expected balance change -[[ $((balance_before + 100)) -eq $balance_after ]] || (echo "Balance did not change as expected"; exit 1) \ No newline at end of file +[[ $((balance_before + expected_balance_change)) -eq $balance_after ]] || (echo "Balance did not change as expected"; exit 1) \ No newline at end of file