Skip to content

Commit

Permalink
test: update tests to use new mock
Browse files Browse the repository at this point in the history
also removed weth as it's not relevant for testing anymore since the latest version of the pool doesn't wrap/unwrap weth anymore
  • Loading branch information
AlbertoCentonze committed Feb 11, 2025
1 parent 2d1d942 commit be6b966
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
18 changes: 6 additions & 12 deletions tests/fixtures/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,40 @@
import pytest


@pytest.fixture(scope="module")
def weth(deployer):
with boa.env.prank(deployer):
return boa.load("contracts/mocks/WETH.vy")


@pytest.fixture(scope="module")
def usd(deployer):
with boa.env.prank(deployer):
return boa.load("contracts/mocks/ERC20Mock.vy", "USD", "USD", 18)
return boa.load("tests/mocks/MockERC20.vy", "USD", "USD", 18)


@pytest.fixture(scope="module")
def btc(deployer):
with boa.env.prank(deployer):
return boa.load("contracts/mocks/ERC20Mock.vy", "BTC", "BTC", 18)
return boa.load("tests/mocks/MockERC20.vy", "BTC", "BTC", 18)


@pytest.fixture(scope="module")
def stg(deployer):
with boa.env.prank(deployer):
return boa.load("contracts/mocks/ERC20Mock.vy", "STG", "STG", 18)
return boa.load("tests/mocks/MockERC20.vy", "STG", "STG", 18)


@pytest.fixture(scope="module")
def usdt(deployer):
with boa.env.prank(deployer):
return boa.load("contracts/mocks/ERC20Mock.vy", "USDT", "USDT", 6)
return boa.load("tests/mocks/MockERC20.vy", "USDT", "USDT", 6)


@pytest.fixture(scope="module")
def usdc(deployer):
with boa.env.prank(deployer):
return boa.load("contracts/mocks/ERC20Mock.vy", "USDC", "USDC", 6)
return boa.load("tests/mocks/MockERC20.vy", "USDC", "USDC", 6)


@pytest.fixture(scope="module")
def dai(deployer):
with boa.env.prank(deployer):
return boa.load("contracts/mocks/ERC20Mock.vy", "DAI", "DAI", 18)
return boa.load("tests/mocks/MockERC20.vy", "DAI", "DAI", 18)


@pytest.fixture(scope="module")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_create2_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def factory(

@pytest.fixture(scope="module")
def coins():
erc20_mock = boa.load_partial("./contracts/mocks/ERC20Mock.vy")
erc20_mock = boa.load_partial("./tests/mocks/MockERC20.vy")
return [
erc20_mock.at("0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E"),
erc20_mock.at("0xD533a949740bb3306d119CC777fa900bA034cd52"),
Expand Down
4 changes: 2 additions & 2 deletions tests/profiling/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def _deposit_initial_liquidity(pool, tokens):
@pytest.fixture(scope="module")
def tokens():
return [
boa.load("contracts/mocks/ERC20Mock.vy", "tkn_a", "tkn_a", 18),
boa.load("contracts/mocks/ERC20Mock.vy", "tkn_b", "tkn_b", 18),
boa.load("tests/mocks/MockERC20.vy", "tkn_a", "tkn_a", 18),
boa.load("tests/mocks/MockERC20.vy", "tkn_b", "tkn_b", 18),
]


Expand Down
3 changes: 2 additions & 1 deletion tests/stateful/stateful_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
from hypothesis.strategies import integers

from contracts.main import TwocryptoFactory as factory
from contracts.mocks import ERC20Mock as ERC20
from tests.utils.constants import UNIX_DAY
from tests.utils.strategies import address, pool_from_preset
from tests.utils.tokens import mint_for_testing

ERC20 = boa.load_partial("tests/mocks/MockERC20.vy")


class StatefulBase(RuleBasedStateMachine):
pool = None
Expand Down
3 changes: 1 addition & 2 deletions tests/utils/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ def fees(draw):
# towards 18 in case of failure (instead of 2)
token = sampled_from([18, 6, 2]).map(
# token = just(18).map(
lambda x: boa.load("contracts/mocks/ERC20Mock.vy", "USD", "USD", x)
lambda x: boa.load("tests/mocks/MockERC20.vy", x)
)
weth = just(boa.load("contracts/mocks/WETH.vy"))


# ---------------- pool ----------------
Expand Down

0 comments on commit be6b966

Please sign in to comment.