Skip to content

Commit

Permalink
calculate expected balance change, test passing
Browse files Browse the repository at this point in the history
  • Loading branch information
alecps authored and karlb committed Dec 6, 2023
1 parent 463e338 commit 7b62db1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions e2e_test/test_base_fee_recipient.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
[[ $((balance_before + expected_balance_change)) -eq $balance_after ]] || (echo "Balance did not change as expected"; exit 1)

0 comments on commit 7b62db1

Please sign in to comment.