Skip to content

Commit

Permalink
Fix random 1delta error
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuh25 committed Jul 23, 2024
1 parent 05f0a40 commit 423d93b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions eth_defi/enzyme/generic_adapter_vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

def _get_chain_slug(web3: Web3) -> str:
return {
31337: "anvil", # only for testing
1: "ethereum",
137: "polygon",
42161: "arbitrum",
Expand Down
2 changes: 1 addition & 1 deletion tests/guard/test_guard_simple_vault_aave_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def anvil_polygon_chain_fork(request, large_usdc_holder) -> str:
launch = fork_network_anvil(
mainnet_rpc,
unlocked_addresses=[large_usdc_holder],
fork_block_number=51_000_000,
fork_block_number=58_000_000,
)
try:
yield launch.json_rpc_url
Expand Down
6 changes: 6 additions & 0 deletions tests/guard/test_guard_simple_vault_one_delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ def test_guard_can_short(
tx_hash = vault.functions.performCall(target, call_data).transact({"from": asset_manager})
assert_transaction_success_with_explanation(web3, tx_hash, tracing=True)

mine(web3)

# we should have some vWETH in the vault
assert vweth.functions.balanceOf(vault.address).call() == pytest.approx(weth_amount_to_short)
assert ausdc.functions.balanceOf(vault.address).call() == pytest.approx(12233287803)
Expand All @@ -346,6 +348,8 @@ def test_guard_can_short(
tx_hash = vault.functions.performCall(target, call_data).transact({"from": asset_manager})
assert_transaction_success_with_explanation(web3, tx_hash, tracing=True)

mine(web3)

# check new position size
assert vweth.functions.balanceOf(vault.address).call() == pytest.approx(weth_amount_to_short * 2)
assert ausdc.functions.balanceOf(vault.address).call() == pytest.approx(24462991693)
Expand All @@ -369,6 +373,8 @@ def test_guard_can_short(
tx_hash = vault.functions.performCall(target, call_data).transact({"from": asset_manager})
assert_transaction_success_with_explanation(web3, tx_hash, tracing=True)

mine(web3)

# check new position size
assert vweth.functions.balanceOf(vault.address).call() == pytest.approx(weth_amount_to_short)
assert ausdc.functions.balanceOf(vault.address).call() == pytest.approx(22219843923)
Expand Down

0 comments on commit 423d93b

Please sign in to comment.