Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Oct 9, 2023
1 parent 375f0d8 commit 22aa2d0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
12 changes: 7 additions & 5 deletions lib/ethpy/ethpy/hyperdrive/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""Tests for hyperdrive/api.py"""
# fixtures require redefining the import name and unused import
# pylint: disable=redefined-outer-name
# pylint: disable=unused-import
from __future__ import annotations

from typing import cast
Expand All @@ -11,8 +14,6 @@
from fixedpointmath import FixedPoint
from web3 import HTTPProvider

# pylint: disable=too-many-locals


class TestHyperdriveInterface:
"""Tests for the HyperdriveInterface api class."""
Expand Down Expand Up @@ -68,10 +69,11 @@ def test_spot_price_and_fixed_rate(self, local_hyperdrive_pool: DeployedHyperdri
"""
uri: URI | None = cast(HTTPProvider, local_hyperdrive_pool.web3.provider).endpoint_uri
rpc_uri = uri if uri else URI("http://localhost:8545")
abi_dir = "./packages/hyperdrive/src/abis"
hyperdrive_contract_addresses: HyperdriveAddresses = local_hyperdrive_pool.hyperdrive_contract_addresses
eth_config = EthConfig(artifacts_uri="not used", rpc_uri=rpc_uri, abi_dir=abi_dir)
hyperdrive = HyperdriveInterface(eth_config, addresses=hyperdrive_contract_addresses)
hyperdrive = HyperdriveInterface(
eth_config=EthConfig(artifacts_uri="not used", rpc_uri=rpc_uri, abi_dir="./packages/hyperdrive/src/abis"),
addresses=hyperdrive_contract_addresses,
)
# get pool config variables
pool_config = hyperdrive.pool_config
init_share_price: FixedPoint = pool_config["initialSharePrice"]
Expand Down
3 changes: 3 additions & 0 deletions lib/ethpy/ethpy/hyperdrive/interface_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""Tests for hyperdrive/api.py"""
# fixtures require redefining the import name and unused import
# pylint: disable=redefined-outer-name
# pylint: disable=unused-import
from __future__ import annotations

from typing import cast
Expand Down
6 changes: 3 additions & 3 deletions tests/bot_load_state_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class TestBotToDb:
# pylint: disable=too-many-locals, too-many-statements
def test_bot_to_db(
self,
local_hyperdrive_chain: DeployedHyperdrivePool,
local_hyperdrive_pool: DeployedHyperdrivePool,
db_session: Session,
db_api: str,
):
Expand All @@ -120,9 +120,9 @@ def test_bot_to_db(
os.environ["DEVELOP"] = "true"

# Get hyperdrive chain info
uri: URI | None = cast(HTTPProvider, local_hyperdrive_chain.web3.provider).endpoint_uri
uri: URI | None = cast(HTTPProvider, local_hyperdrive_pool.web3.provider).endpoint_uri
rpc_uri = uri if uri else URI("http://localhost:8545")
hyperdrive_contract_addresses: HyperdriveAddresses = local_hyperdrive_chain.hyperdrive_contract_addresses
hyperdrive_contract_addresses: HyperdriveAddresses = local_hyperdrive_pool.hyperdrive_contract_addresses

# Build environment config
env_config = EnvironmentConfig(
Expand Down
8 changes: 4 additions & 4 deletions tests/bot_to_db_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TestBotToDb:
# pylint: disable=too-many-locals, too-many-statements
def test_bot_to_db(
self,
local_hyperdrive_chain: DeployedHyperdrivePool,
local_hyperdrive_pool: DeployedHyperdrivePool,
cycle_trade_policy: Type[BasePolicy],
db_session: Session,
db_api: str,
Expand All @@ -54,10 +54,10 @@ def test_bot_to_db(
# Run this test with develop mode on
os.environ["DEVELOP"] = "true"
# Get hyperdrive chain info
uri: URI | None = cast(HTTPProvider, local_hyperdrive_chain.web3.provider).endpoint_uri
uri: URI | None = cast(HTTPProvider, local_hyperdrive_pool.web3.provider).endpoint_uri
rpc_uri = uri if uri else URI("http://localhost:8545")
deploy_account: LocalAccount = local_hyperdrive_chain.deploy_account
hyperdrive_contract_addresses: HyperdriveAddresses = local_hyperdrive_chain.hyperdrive_contract_addresses
deploy_account: LocalAccount = local_hyperdrive_pool.deploy_account
hyperdrive_contract_addresses: HyperdriveAddresses = local_hyperdrive_pool.hyperdrive_contract_addresses

# Build environment config
env_config = EnvironmentConfig(
Expand Down
8 changes: 4 additions & 4 deletions tests/multi_trade_per_block_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ class TestMultiTradePerBlock:
# pylint: disable=too-many-locals, too-many-statements
def test_bot_to_db(
self,
local_hyperdrive_chain: DeployedHyperdrivePool,
local_hyperdrive_pool: DeployedHyperdrivePool,
db_session: Session,
db_api: str,
):
"""Runs the entire pipeline and checks the database at the end.
All arguments are fixtures.
"""
# TODO local_hyperdrive_chain is currently being run with automining. Hence, multiple trades
# TODO local_hyperdrive_pool is currently being run with automining. Hence, multiple trades
# per block can't be tested until we can parameterize anvil running without automining.
# For now, this is simply testing that the introduction of async trades doesn't break
# when automining.
Expand All @@ -132,9 +132,9 @@ def test_bot_to_db(
os.environ["DEVELOP"] = "true"

# Get hyperdrive chain info
uri: URI | None = cast(HTTPProvider, local_hyperdrive_chain.web3.provider).endpoint_uri
uri: URI | None = cast(HTTPProvider, local_hyperdrive_pool.web3.provider).endpoint_uri
rpc_uri = uri if uri else URI("http://localhost:8545")
hyperdrive_contract_addresses: HyperdriveAddresses = local_hyperdrive_chain.hyperdrive_contract_addresses
hyperdrive_contract_addresses: HyperdriveAddresses = local_hyperdrive_pool.hyperdrive_contract_addresses

# Build environment config
env_config = EnvironmentConfig(
Expand Down

0 comments on commit 22aa2d0

Please sign in to comment.