Skip to content

Commit

Permalink
feat: more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rachit77 committed Sep 20, 2024
1 parent 38d79db commit 76e5afc
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ jobs:
pip3 install yq
yq --version
- name: Install polycli
run: |
tmp_dir=$(mktemp -d) && curl -L https://github.com/0xPolygon/polygon-cli/releases/download/v0.1.48/polycli_v0.1.48_linux_amd64.tar.gz | tar -xz -C "$tmp_dir" && mv "$tmp_dir"/* /usr/local/bin/polycli && rm -rf "$tmp_dir"
sudo chmod +x /usr/local/bin/polycli
/usr/local/bin/polycli version
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1

Expand Down
44 changes: 43 additions & 1 deletion test/basic-e2e.bats
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ setup() {
# Attempt transfer of excessive amount from address_A to address_B
local tranferFnSig="transfer(address,uint256)"
run sendTx "$address_A_private_key" "$contract_addr" "$tranferFnSig" "$address_B" "$excessive_amount"
#assert_failure
assert_failure

# Verify balance of address_A after failed transaction
run queryContract "$contract_addr" "$balanceOfFnSig" "$address_A"
Expand All @@ -131,3 +131,45 @@ setup() {
local address_A_final_nonce=$(cast nonce "$address_A" --rpc-url "$rpc_url") || return 1
assert_equal "$address_A_final_nonce" "$address_A_initial_nonce"
}


@test "Deploy and test UniswapV3 contract" {
run polycli loadtest uniswapv3 --legacy --rpc-url $rpc_url --private-key $sender_private_key

assert_success

# Check if the WETH9 contract were deployed
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=WETH9"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=UniswapV3Factory"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=UniswapInterfaceMulticall"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=ProxyAdmin"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=TickLens"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=NFTDescriptor"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=NonfungibleTokenPositionDescriptor"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=TransparentUpgradeableProxy"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=NonfungiblePositionManager"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=V3Migrator"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=UniswapV3Staker"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=QuoterV2"
assert_output --regexp "Contract deployed address=0x[a-fA-F0-9]{40} name=SwapRouter02"

assert_output --regexp "UniswapV3 deployed addresses={\"FactoryV3\":\"0x[a-fA-F0-9]{40}\".*}"

# Check if ERC20 tokens were minted
assert_output --regexp "Minted tokens amount=[0-9]+ recipient=0x[a-fA-F0-9]{40} token=SwapperA"
assert_output --regexp "Minted tokens amount=[0-9]+ recipient=0x[a-fA-F0-9]{40} token=SwapperB"

# Check if liquidity pool was created and initialized
assert_output --regexp "Pool created and initialized fees=[0-9]+"

# Check if liquidity was provided to the pool
assert_output --regexp "Liquidity provided to the pool liquidity=[0-9]+"

# Check if transaction got executed successfully
assert_output --regexp "Starting main load test loop currentNonce=[0-9]+"
assert_output --regexp "Finished main load test loop lastNonce=[0-9]+ startNonce=[0-9]+"
assert_output --regexp "Got final block number currentNonce=[0-9]+ final block number=[0-9]+"
assert_output --regexp "Num errors numErrors=0"
assert_output --regexp "Finished"
}

0 comments on commit 76e5afc

Please sign in to comment.