Skip to content

Commit

Permalink
Update 1delta quoter address
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuh25 committed May 5, 2024
1 parent 8b95bdf commit 9f50a7a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/guard/test_guard_simple_vault_one_delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def one_delta_deployment(web3) -> OneDeltaDeployment:
web3,
flash_aggregator_address="0x74E95F3Ec71372756a01eB9317864e3fdde1AC53",
broker_proxy_address="0x74E95F3Ec71372756a01eB9317864e3fdde1AC53",
quoter_address="0x62CF92A2dBbc4436ee508f4923e6Aa8dfF2A5E0c",
quoter_address="0x36de3876ad1ef477e8f6d98EE9a162926f00463A",
)


Expand Down
2 changes: 1 addition & 1 deletion tests/one_delta/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def one_delta_deployment(web3) -> OneDeltaDeployment:
web3,
flash_aggregator_address="0x74E95F3Ec71372756a01eB9317864e3fdde1AC53",
broker_proxy_address="0x74E95F3Ec71372756a01eB9317864e3fdde1AC53",
quoter_address="0x62CF92A2dBbc4436ee508f4923e6Aa8dfF2A5E0c",
quoter_address="0x36de3876ad1ef477e8f6d98EE9a162926f00463A",
)


Expand Down
25 changes: 13 additions & 12 deletions tests/one_delta/test_one_delta_price.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Uniswap v3 price calculation."""

import logging
import os
import shutil
Expand Down Expand Up @@ -71,9 +72,9 @@ def test_price_helper(

# test amount out
for slippage, expected_amount_out in [
(0, 2_234_040_896),
(5 * 100, 2_127_657_996),
(50 * 100, 1_489_360_597),
(0, 2233287804),
(5 * 100, 2126940765),
(50 * 100, 1488858536),
]:
amount_out = price_helper.get_amount_out(
1 * 10**18,
Expand All @@ -89,9 +90,9 @@ def test_price_helper(

# test amount in
for slippage, expected_amount_in in [
(0, 2_250_551_091),
(5 * 100, 2_363_078_645),
(50 * 100, 3_375_826_636),
(0, 2250367818),
(5 * 100, 2362886208),
(50 * 100, 3375551727),
]:
amount_in = price_helper.get_amount_in(
1 * 10**18,
Expand Down Expand Up @@ -124,11 +125,11 @@ def test_estimate_buy_price_for_cash(
3000,
)

assert eth_received / 10**18 == pytest.approx(1.3327059176760288)
assert eth_received / 10**18 == pytest.approx(1.3327575201582416)

# Calculate price of ETH as $ for our purchase
price = usdc_amount_to_spend * 10 ** (18 - 6) / eth_received
assert price == pytest.approx(2251.0592623700486)
assert price == pytest.approx(2250.9721045459214)

# test verbose mode
eth_received, block_number = estimate_buy_received_amount(
Expand All @@ -140,7 +141,7 @@ def test_estimate_buy_price_for_cash(
verbose=True,
)

assert eth_received / 10**18 == pytest.approx(1.3327059176760288)
assert eth_received / 10**18 == pytest.approx(1.3327575201582416)
assert block_number == 51_000_000


Expand All @@ -162,11 +163,11 @@ def test_estimate_sell_received_cash(
3000,
)

assert usdc_received / 10**6 == pytest.approx(107392.782653)
assert usdc_received / 10**6 == pytest.approx(105560.633339)

# Calculate price of ETH as $ for our purchase
price = usdc_received * 10 ** (18 - 6) / eth_amount_to_sell
assert price == pytest.approx(2147.85565306)
assert price == pytest.approx(2111.21266678)

# test verbose mode
usdc_received, block_number = estimate_sell_received_amount(
Expand All @@ -177,5 +178,5 @@ def test_estimate_sell_received_cash(
3000,
verbose=True,
)
assert usdc_received / 1e6 == pytest.approx(107392.782653)
assert usdc_received / 1e6 == pytest.approx(105560.633339)
assert block_number == 51_000_000

0 comments on commit 9f50a7a

Please sign in to comment.