Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lack of fund errors #35

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from hexbytes import HexBytes

import vyper.evm.opcodes as evm_opcodes
from tests.evm_backends.base_env import BaseEnv, EvmError
from tests.evm_backends.base_env import BaseEnv, ExecutionReverted
from tests.evm_backends.pyevm_env import PyEvmEnv
from tests.evm_backends.revm_env import RevmEnv
from tests.utils import working_directory
Expand Down Expand Up @@ -314,7 +314,7 @@ def assert_side_effects_invoked(side_effects_contract, side_effects_trigger, n=1
@pytest.fixture(scope="module")
def tx_failed(env):
@contextmanager
def fn(exception=EvmError, exc_text=None):
def fn(exception=ExecutionReverted, exc_text=None):
with pytest.raises(exception) as excinfo:
yield

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_initial_state(market_maker):
def test_initiate(env, market_maker, erc20, tx_failed):
a0 = env.accounts[0]
ether, ethers = to_wei(1, "ether"), to_wei(2, "ether")
env.set_balance(a0, ethers)
env.set_balance(a0, ethers * 2)
erc20.approve(market_maker.address, ethers)
market_maker.initiate(erc20.address, ether, value=ethers)
assert market_maker.totalEthQty() == ethers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def get_balance():


def test_initial_state(env, tx_failed, get_contract, get_balance, contract_code):
env.set_balance(env.deployer, to_wei(2, "ether"))
# Initial deposit has to be divisible by two
with tx_failed():
get_contract(contract_code, value=13)
env.set_balance(env.deployer, to_wei(2, "ether"))
# Seller puts item up for sale
a0_pre_bal, a1_pre_bal = get_balance()
c = get_contract(contract_code, value=to_wei(2, "ether"))
Expand Down Expand Up @@ -73,8 +73,8 @@ def test_abort(env, tx_failed, get_balance, get_contract, contract_code):

def test_purchase(env, get_contract, tx_failed, get_balance, contract_code):
a0, a1, a2, a3 = env.accounts[:4]
env.set_balance(a0, 10**18)
env.set_balance(a1, 10**18)
for a in env.accounts[:4]:
env.set_balance(a, 10**18)

init_bal_a0, init_bal_a1 = get_balance()
c = get_contract(contract_code, value=2)
Expand Down