From 5c56d4311ee5158407053cceda9663e4a4fe4884 Mon Sep 17 00:00:00 2001 From: szotov Date: Sat, 21 Apr 2018 16:59:58 +0300 Subject: [PATCH] Fixed escrow and integration tests --- .../eth/contracts/test_integration.py | 42 +++---- .../eth/contracts/test_miners_escrow.py | 104 +++++++++--------- 2 files changed, 75 insertions(+), 71 deletions(-) diff --git a/tests/blockchain/eth/contracts/test_integration.py b/tests/blockchain/eth/contracts/test_integration.py index 2734293df..c0ab8d236 100644 --- a/tests/blockchain/eth/contracts/test_integration.py +++ b/tests/blockchain/eth/contracts/test_integration.py @@ -193,9 +193,9 @@ def test_all(web3, chain, token, escrow, policy_manager): tx = escrow.transact({'from': creator}).preDeposit([ursula2], [1000], [10]) chain.wait_for_receipt(tx) assert reward + 1000 == token.call().balanceOf(escrow.address) - assert 1000 == web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, ursula2, 0).encode('latin-1')) + assert 1000 == web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, ursula2, 0)) assert 1000 == escrow.call().getLockedTokens(ursula2) - assert 10 == web3.toInt(escrow.call().getMinerInfo(MAX_RELEASE_PERIODS_FIELD, ursula2, 0).encode('latin-1')) + assert 10 == web3.toInt(escrow.call().getMinerInfo(MAX_RELEASE_PERIODS_FIELD, ursula2, 0)) # Can't pre-deposit tokens again for same owner with pytest.raises(TransactionFailed): @@ -223,14 +223,14 @@ def test_all(web3, chain, token, escrow, policy_manager): assert 1000 == escrow.call().calculateLockedTokens(ursula1, 2) # Wait 1 period and deposit from one more Ursula - wait_time(chain, 1) + chain.wait_time(hours=1) tx = user_escrow_1.transact({'from': ursula3}).minerDeposit(1000, 10) chain.wait_for_receipt(tx) - assert 1000 == web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, user_escrow_1.address, 0).encode('latin-1')) + assert 1000 == web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, user_escrow_1.address, 0)) assert 1000 == escrow.call().getLockedTokens(user_escrow_1.address) assert 10 == web3.toInt( - escrow.call().getMinerInfo(MAX_RELEASE_PERIODS_FIELD, user_escrow_1.address, 0).encode('latin-1')) - assert 0 == web3.toInt(escrow.call().getMinerInfo(RELEASE_FIELD, user_escrow_1.address, 0).encode('latin-1')) + escrow.call().getMinerInfo(MAX_RELEASE_PERIODS_FIELD, user_escrow_1.address, 0)) + assert 0 == web3.toInt(escrow.call().getMinerInfo(RELEASE_FIELD, user_escrow_1.address, 0)) assert reward + 3000 == token.call().balanceOf(escrow.address) assert 9000 == token.call().balanceOf(user_escrow_1.address) @@ -247,7 +247,7 @@ def test_all(web3, chain, token, escrow, policy_manager): tx = escrow.transact({'from': ursula1}).confirmActivity() chain.wait_for_receipt(tx) - wait_time(chain, 1) + chain.wait_time(hours=1) tx = escrow.transact({'from': ursula1}).confirmActivity() chain.wait_for_receipt(tx) tx = escrow.transact({'from': ursula2}).confirmActivity() @@ -255,7 +255,7 @@ def test_all(web3, chain, token, escrow, policy_manager): tx = user_escrow_1.transact({'from': ursula3}).confirmActivity() chain.wait_for_receipt(tx) - wait_time(chain, 1) + chain.wait_time(hours=1) tx = escrow.transact({'from': ursula1}).confirmActivity() chain.wait_for_receipt(tx) tx = escrow.transact({'from': ursula2}).confirmActivity() @@ -295,7 +295,7 @@ def test_all(web3, chain, token, escrow, policy_manager): assert 8000 == web3.eth.getBalance(policy_manager.address) assert alice2_balance + 2000 == web3.eth.getBalance(alice2) assert 1 == web3.toInt( - policy_manager.call().getPolicyInfo(DISABLED_FIELD, policy_id_5, NULL_ADDR).encode('latin-1')) + policy_manager.call().getPolicyInfo(DISABLED_FIELD, policy_id_5, NULL_ADDR)) # Can't revoke again with pytest.raises(TransactionFailed): @@ -312,7 +312,7 @@ def test_all(web3, chain, token, escrow, policy_manager): assert 7000 == web3.eth.getBalance(policy_manager.address) assert alice1_balance + 1000 == web3.eth.getBalance(alice1) assert 0 == web3.toInt( - policy_manager.call().getPolicyInfo(DISABLED_FIELD, policy_id_2, NULL_ADDR).encode('latin-1')) + policy_manager.call().getPolicyInfo(DISABLED_FIELD, policy_id_2, NULL_ADDR)) # Can't revoke again with pytest.raises(TransactionFailed): @@ -320,7 +320,7 @@ def test_all(web3, chain, token, escrow, policy_manager): chain.wait_for_receipt(tx) # Wait, confirm activity, mint - wait_time(chain, 1) + chain.wait_time(hours=1) tx = escrow.transact({'from': ursula1}).confirmActivity() chain.wait_for_receipt(tx) tx = escrow.transact({'from': ursula2}).confirmActivity() @@ -328,7 +328,7 @@ def test_all(web3, chain, token, escrow, policy_manager): tx = user_escrow_1.transact({'from': ursula3}).confirmActivity() chain.wait_for_receipt(tx) - wait_time(chain, 1) + chain.wait_time(hours=1) tx = policy_manager.transact({'from': alice2, 'gas_price': 0})\ .revokeArrangement(policy_id_3, user_escrow_1.address) chain.wait_for_receipt(tx) @@ -340,16 +340,16 @@ def test_all(web3, chain, token, escrow, policy_manager): tx = user_escrow_1.transact({'from': ursula3}).confirmActivity() chain.wait_for_receipt(tx) - wait_time(chain, 1) + chain.wait_time(hours=1) tx = escrow.transact({'from': ursula1}).confirmActivity() chain.wait_for_receipt(tx) - wait_time(chain, 1) + chain.wait_time(hours=1) tx = escrow.transact({'from': ursula1}).confirmActivity() chain.wait_for_receipt(tx) # Withdraw reward and refund - wait_time(chain, 3) + chain.wait_time(hours=3) ursula1_balance = web3.eth.getBalance(ursula1) tx = policy_manager.transact({'from': ursula1, 'gas_price': 0}).withdraw() chain.wait_for_receipt(tx) @@ -394,9 +394,9 @@ def test_all(web3, chain, token, escrow, policy_manager): chain.wait_for_receipt(tx) tx = user_escrow_1.transact({'from': ursula3}).confirmActivity() chain.wait_for_receipt(tx) - wait_time(chain, 1) + chain.wait_time(hours=1) - wait_time(chain, 1) + chain.wait_time(hours=1) tx = escrow.transact({'from': ursula1}).mint() chain.wait_for_receipt(tx) tx = escrow.transact({'from': ursula2}).mint() @@ -411,13 +411,13 @@ def test_all(web3, chain, token, escrow, policy_manager): assert 0 == escrow.call().getLockedTokens(user_escrow_1.address) assert 0 == escrow.call().getLockedTokens(user_escrow_2.address) - tokens_amount = web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, ursula1, 0).encode('latin-1')) + tokens_amount = web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, ursula1, 0)) tx = escrow.transact({'from': ursula1}).withdraw(tokens_amount) chain.wait_for_receipt(tx) - tokens_amount = web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, ursula2, 0).encode('latin-1')) + tokens_amount = web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, ursula2, 0)) tx = escrow.transact({'from': ursula2}).withdraw(tokens_amount) chain.wait_for_receipt(tx) - tokens_amount = web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, user_escrow_1.address, 0).encode('latin-1')) + tokens_amount = web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, user_escrow_1.address, 0)) tx = user_escrow_1.transact({'from': ursula3}).minerWithdraw(tokens_amount) chain.wait_for_receipt(tx) assert 10000 < token.call().balanceOf(ursula1) @@ -425,7 +425,7 @@ def test_all(web3, chain, token, escrow, policy_manager): assert 10000 < token.call().balanceOf(user_escrow_1.address) # Unlock and withdraw all tokens in UserEscrow - wait_time(chain, 1) + chain.wait_time(hours=1) assert 0 == user_escrow_1.call().getLockedTokens() assert 0 == user_escrow_2.call().getLockedTokens() tokens_amount = token.call().balanceOf(user_escrow_1.address) diff --git a/tests/blockchain/eth/contracts/test_miners_escrow.py b/tests/blockchain/eth/contracts/test_miners_escrow.py index ef6c4488c..9efee2795 100644 --- a/tests/blockchain/eth/contracts/test_miners_escrow.py +++ b/tests/blockchain/eth/contracts/test_miners_escrow.py @@ -52,20 +52,16 @@ def escrow_contract(web3, chain, token, request): return make_escrow -# TODO extract method -def wait_time(chain, wait_hours): - web3 = chain.w3 - step = 50 - end_timestamp = web3.eth.getBlock(web3.eth.blockNumber).timestamp + wait_hours * 60 * 60 - while web3.eth.getBlock(web3.eth.blockNumber).timestamp < end_timestamp: - chain.wait.for_block(web3.eth.blockNumber + step) - - def test_escrow(web3, chain, token, escrow_contract): escrow = escrow_contract(1500) creator = web3.eth.accounts[0] ursula1 = web3.eth.accounts[1] ursula2 = web3.eth.accounts[2] + deposit_log = escrow.eventFilter('Deposited') + lock_log = escrow.eventFilter('Locked') + activity_log = escrow.eventFilter('ActivityConfirmed') + switching_lock_log = escrow.eventFilter('LockSwitched') + withdraw_log = escrow.eventFilter('Withdrawn') # Give Ursula and Ursula(2) some coins tx = token.transact({'from': creator}).transfer(ursula1, 10000) @@ -126,19 +122,19 @@ def test_escrow(web3, chain, token, escrow_contract): assert 1000 == escrow.call().calculateLockedTokens(ursula1, 1) assert 1000 == escrow.call().calculateLockedTokens(ursula1, 2) - events = escrow.pastEvents('Deposited').get() + events = deposit_log.get_all_entries() assert 1 == len(events) event_args = events[0]['args'] assert ursula1 == event_args['owner'] assert 1000 == event_args['value'] assert 1 == event_args['periods'] - events = escrow.pastEvents('Locked').get() + events = lock_log.get_all_entries() assert 1 == len(events) event_args = events[0]['args'] assert ursula1 == event_args['owner'] assert 1000 == event_args['value'] assert 500 == event_args['releaseRate'] - events = escrow.pastEvents('ActivityConfirmed').get() + events = activity_log.get_all_entries() assert 1 == len(events) event_args = events[0]['args'] assert ursula1 == event_args['owner'] @@ -148,7 +144,7 @@ def test_escrow(web3, chain, token, escrow_contract): tx = escrow.transact({'from': ursula1}).switchLock() chain.wait_for_receipt(tx) assert 500 == escrow.call().calculateLockedTokens(ursula1, 2) - events = escrow.pastEvents('LockSwitched').get() + events = switching_lock_log.get_all_entries() assert 1 == len(events) event_args = events[0]['args'] assert ursula1 == event_args['owner'] @@ -157,7 +153,7 @@ def test_escrow(web3, chain, token, escrow_contract): tx = escrow.transact({'from': ursula1}).switchLock() chain.wait_for_receipt(tx) assert 1000 == escrow.call().calculateLockedTokens(ursula1, 2) - events = escrow.pastEvents('LockSwitched').get() + events = switching_lock_log.get_all_entries() assert 2 == len(events) event_args = events[1]['args'] assert ursula1 == event_args['owner'] @@ -170,19 +166,19 @@ def test_escrow(web3, chain, token, escrow_contract): assert 500 == escrow.call().getLockedTokens(ursula2) assert 500 == escrow.call().calculateLockedTokens(ursula2, 1) - events = escrow.pastEvents('Deposited').get() + events = deposit_log.get_all_entries() assert 2 == len(events) event_args = events[1]['args'] assert ursula2 == event_args['owner'] assert 500 == event_args['value'] assert 2 == event_args['periods'] - events = escrow.pastEvents('Locked').get() + events = lock_log.get_all_entries() assert 2 == len(events) event_args = events[1]['args'] assert ursula2 == event_args['owner'] assert 500 == event_args['value'] assert 250 == event_args['releaseRate'] - events = escrow.pastEvents('ActivityConfirmed').get() + events = activity_log.get_all_entries() assert 2 == len(events) event_args = events[1]['args'] assert ursula2 == event_args['owner'] @@ -190,7 +186,7 @@ def test_escrow(web3, chain, token, escrow_contract): assert 500 == event_args['value'] # Checks locked tokens in next period - wait_time(chain, 1) + chain.wait_time(hours=1) assert 1000 == escrow.call().getLockedTokens(ursula1) assert 500 == escrow.call().getLockedTokens(ursula2) assert 1500 == escrow.call().getAllLockedTokens() @@ -205,7 +201,7 @@ def test_escrow(web3, chain, token, escrow_contract): # Ursula can deposit more tokens tx = escrow.transact({'from': ursula1}).confirmActivity() chain.wait_for_receipt(tx) - events = escrow.pastEvents('ActivityConfirmed').get() + events = activity_log.get_all_entries() assert 3 == len(events) event_args = events[2]['args'] assert ursula1 == event_args['owner'] @@ -216,7 +212,7 @@ def test_escrow(web3, chain, token, escrow_contract): chain.wait_for_receipt(tx) assert 2000 == token.call().balanceOf(escrow.address) assert 8500 == token.call().balanceOf(ursula1) - events = escrow.pastEvents('ActivityConfirmed').get() + events = activity_log.get_all_entries() assert 4 == len(events) event_args = events[3]['args'] assert ursula1 == event_args['owner'] @@ -234,13 +230,13 @@ def test_escrow(web3, chain, token, escrow_contract): assert 750 == escrow.call().calculateLockedTokens(ursula1, 2) # Wait 1 period and checks locking - wait_time(chain, 1) + chain.wait_time(hours=1) assert 1500 == escrow.call().getLockedTokens(ursula1) # Confirm activity and wait 1 period tx = escrow.transact({'from': ursula1}).confirmActivity() chain.wait_for_receipt(tx) - wait_time(chain, 1) + chain.wait_time(hours=1) assert 750 == escrow.call().getLockedTokens(ursula1) assert 0 == escrow.call().calculateLockedTokens(ursula1, 1) @@ -249,7 +245,7 @@ def test_escrow(web3, chain, token, escrow_contract): chain.wait_for_receipt(tx) assert 1900 == token.call().balanceOf(escrow.address) assert 8600 == token.call().balanceOf(ursula1) - events = escrow.pastEvents('Withdrawn').get() + events = withdraw_log.get_all_entries() assert 1 == len(events) event_args = events[0]['args'] assert ursula1 == event_args['owner'] @@ -280,7 +276,7 @@ def test_escrow(web3, chain, token, escrow_contract): chain.wait_for_receipt(tx) assert 300 == escrow.call().calculateLockedTokens(ursula1, 2) assert 0 == escrow.call().calculateLockedTokens(ursula1, 3) - wait_time(chain, 1) + chain.wait_time(hours=1) assert 600 == escrow.call().getLockedTokens(ursula1) assert 300 == escrow.call().calculateLockedTokens(ursula1, 1) assert 0 == escrow.call().calculateLockedTokens(ursula1, 2) @@ -293,7 +289,7 @@ def test_escrow(web3, chain, token, escrow_contract): assert 500 == escrow.call().calculateLockedTokens(ursula1, 2) assert 200 == escrow.call().calculateLockedTokens(ursula1, 3) assert 0 == escrow.call().calculateLockedTokens(ursula1, 4) - wait_time(chain, 1) + chain.wait_time(hours=1) assert 800 == escrow.call().getLockedTokens(ursula1) # Ursula(2) starts unlocking and increases lock by deposit more tokens @@ -305,7 +301,7 @@ def test_escrow(web3, chain, token, escrow_contract): assert 1000 == escrow.call().calculateLockedTokens(ursula2, 1) assert 500 == escrow.call().calculateLockedTokens(ursula2, 2) assert 0 == escrow.call().calculateLockedTokens(ursula2, 3) - wait_time(chain, 1) + chain.wait_time(hours=1) assert 1000 == escrow.call().getLockedTokens(ursula2) # And increases locked time @@ -322,11 +318,11 @@ def test_escrow(web3, chain, token, escrow_contract): assert 100 == escrow.call().calculateLockedTokens(ursula2, 2) assert 0 == escrow.call().calculateLockedTokens(ursula2, 3) - assert 6 == len(escrow.pastEvents('Deposited').get()) - assert 9 == len(escrow.pastEvents('Locked').get()) - assert 5 == len(escrow.pastEvents('LockSwitched').get()) - assert 1 == len(escrow.pastEvents('Withdrawn').get()) - assert 11 == len(escrow.pastEvents('ActivityConfirmed').get()) + assert 6 == len(deposit_log.get_all_entries()) + assert 9 == len(lock_log.get_all_entries()) + assert 5 == len(switching_lock_log.get_all_entries()) + assert 1 == len(withdraw_log.get_all_entries()) + assert 11 == len(activity_log.get_all_entries()) def test_locked_distribution(web3, chain, token, escrow_contract): @@ -365,7 +361,7 @@ def test_locked_distribution(web3, chain, token, escrow_contract): assert 0 == shift # Wait next period - wait_time(chain, 1) + chain.wait_time(hours=1) n_locked = escrow.call().getAllLockedTokens() assert n_locked > 0 @@ -408,7 +404,7 @@ def test_locked_distribution(web3, chain, token, escrow_contract): assert len(miners) == web3.toInt(escrow.call().getMinerInfo(MINERS_LENGTH, NULL_ADDR, 0)) for index, miner in enumerate(miners): assert miners[index] == \ - web3.toChecksumAddress(escrow.call().getMinerInfo(MINER, NULL_ADDR, index)) + web3.toChecksumAddress(escrow.call().getMinerInfo(MINER, NULL_ADDR, index)[12:]) def test_mining(web3, chain, token, escrow_contract): @@ -416,6 +412,12 @@ def test_mining(web3, chain, token, escrow_contract): creator = web3.eth.accounts[0] ursula1 = web3.eth.accounts[1] ursula2 = web3.eth.accounts[2] + mining_log = escrow.eventFilter('Mined') + deposit_log = escrow.eventFilter('Deposited') + lock_log = escrow.eventFilter('Locked') + activity_log = escrow.eventFilter('ActivityConfirmed') + switching_lock_log = escrow.eventFilter('LockSwitched') + withdraw_log = escrow.eventFilter('Withdrawn') # Give Escrow tokens for reward and initialize contract tx = token.transact({'from': creator}).transfer(escrow.address, 10 ** 9) @@ -428,6 +430,7 @@ def test_mining(web3, chain, token, escrow_contract): ) tx = escrow.transact({'from': creator}).setPolicyManager(policy_manager.address) chain.wait_for_receipt(tx) + assert policy_manager.address == escrow.call().policyManager() # Give Ursula and Ursula(2) some coins tx = token.transact({'from': creator}).transfer(ursula1, 10000) @@ -458,13 +461,13 @@ def test_mining(web3, chain, token, escrow_contract): # Using locked tokens starts from next period assert 0 == escrow.call().getAllLockedTokens() - # Ursula can't use method from Miner contract - with pytest.raises(TypeError): - tx = escrow.transact({'from': ursula1}).mint(ursula1, 1, 1, 1, 1, 1) + # Ursula can't use method from Issuer contract + with pytest.raises(Exception): + tx = escrow.transact({'from': ursula1}).mint(1, 1, 1, 1, 1) chain.wait_for_receipt(tx) # Only Ursula confirm next period - wait_time(chain, 1) + chain.wait_time(hours=1) assert 1500 == escrow.call().getAllLockedTokens() tx = escrow.transact({'from': ursula1}).confirmActivity() chain.wait_for_receipt(tx) @@ -474,7 +477,7 @@ def test_mining(web3, chain, token, escrow_contract): chain.wait_for_receipt(tx) # Ursula and Ursula(2) mint tokens for last periods - wait_time(chain, 1) + chain.wait_time(hours=1) assert 1000 == escrow.call().getAllLockedTokens() tx = escrow.transact({'from': ursula1}).mint() chain.wait_for_receipt(tx) @@ -484,7 +487,7 @@ def test_mining(web3, chain, token, escrow_contract): assert 1050 == web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, ursula1, 0)) assert 521 == web3.toInt(escrow.call().getMinerInfo(VALUE_FIELD, ursula2, 0)) - events = escrow.pastEvents('Mined').get() + events = mining_log.get_all_entries() assert 2 == len(events) event_args = events[0]['args'] assert ursula1 == event_args['owner'] @@ -508,7 +511,7 @@ def test_mining(web3, chain, token, escrow_contract): chain.wait_for_receipt(tx) # Ursula can't confirm next period because end of locking - wait_time(chain, 1) + chain.wait_time(hours=1) assert 500 == escrow.call().getAllLockedTokens() with pytest.raises(TransactionFailed): tx = escrow.transact({'from': ursula1}).confirmActivity() @@ -519,7 +522,7 @@ def test_mining(web3, chain, token, escrow_contract): chain.wait_for_receipt(tx) # Ursula mint tokens for next period - wait_time(chain, 1) + chain.wait_time(hours=1) assert 500 == escrow.call().getAllLockedTokens() tx = escrow.transact({'from': ursula1}).mint() chain.wait_for_receipt(tx) @@ -535,7 +538,7 @@ def test_mining(web3, chain, token, escrow_contract): assert period + 1 == policy_manager.call().getPeriod(ursula1, 1) assert period + 2 == policy_manager.call().getPeriod(ursula1, 2) - events = escrow.pastEvents('Mined').get() + events = mining_log.get_all_entries() assert 3 == len(events) event_args = events[2]['args'] assert ursula1 == event_args['owner'] @@ -547,7 +550,7 @@ def test_mining(web3, chain, token, escrow_contract): chain.wait_for_receipt(tx) tx = escrow.transact({'from': ursula2}).confirmActivity() chain.wait_for_receipt(tx) - wait_time(chain, 2) + chain.wait_time(hours=2) assert 0 == escrow.call().getAllLockedTokens() tx = escrow.transact({'from': ursula2}).mint() @@ -560,7 +563,7 @@ def test_mining(web3, chain, token, escrow_contract): assert period + 3 == policy_manager.call().getPeriod(ursula2, 1) assert period + 4 == policy_manager.call().getPeriod(ursula2, 2) - events = escrow.pastEvents('Mined').get() + events = mining_log.get_all_entries() assert 4 == len(events) event_args = events[3]['args'] assert ursula2 == event_args['owner'] @@ -613,16 +616,16 @@ def test_mining(web3, chain, token, escrow_contract): chain.wait_for_receipt(tx) assert 10134 == token.call().balanceOf(ursula2) - events = escrow.pastEvents('Withdrawn').get() + events = withdraw_log.get_all_entries() assert 1 == len(events) event_args = events[0]['args'] assert ursula2 == event_args['owner'] assert 634 == event_args['value'] - assert 3 == len(escrow.pastEvents('Deposited').get()) - assert 6 == len(escrow.pastEvents('Locked').get()) - assert 3 == len(escrow.pastEvents('LockSwitched').get()) - assert 10 == len(escrow.pastEvents('ActivityConfirmed').get()) + assert 3 == len(deposit_log.get_all_entries()) + assert 6 == len(lock_log.get_all_entries()) + assert 3 == len(switching_lock_log.get_all_entries()) + assert 10 == len(activity_log.get_all_entries()) # TODO test max miners @@ -630,6 +633,7 @@ def test_mining(web3, chain, token, escrow_contract): def test_pre_deposit(web3, chain, token, escrow_contract): escrow = escrow_contract(1500) creator = web3.eth.accounts[0] + deposit_log = escrow.eventFilter('Deposited') # Initialize Escrow contract tx = escrow.transact().initialize() @@ -680,7 +684,7 @@ def test_pre_deposit(web3, chain, token, escrow_contract): assert 50 * (index + 1) == \ web3.toInt(escrow.call().getMinerInfo(MAX_RELEASE_PERIODS_FIELD, owner, 0)) - events = escrow.pastEvents('Deposited').get() + events = deposit_log.get_all_entries() assert 6 == len(events) event_args = events[0]['args'] assert web3.eth.accounts[1] == event_args['owner']