Properly bond worklock to staking escrow at deploy-time.

pull/1550/head
Kieran Prasch 2019-09-11 10:29:53 -07:00 committed by Kieran R. Prasch
parent 1fe806bc57
commit 5c3c6a00e8
2 changed files with 11 additions and 8 deletions

View File

@ -1104,8 +1104,12 @@ class WorklockDeployer(BaseContractDeployer):
*constructor_args,
gas_limit=gas_limit)
bonding_function = self.staking_agent.contract.functions.setWorkLock(worklock_contract.address)
bonding_receipt = self.blockchain.send_transaction(sender_address=self.deployer_address,
contract_function=bonding_function)
# Gather the transaction hashes
self.deployment_transactions = {'deployment': deploy_txhash}
self.deployment_transactions = {'deployment': deploy_txhash, 'bond_escrow': bonding_receipt}
self._contract = worklock_contract
return self.deployment_transactions

View File

@ -100,7 +100,7 @@ def test_bidding(testerchain, agency, token_economics, test_registry):
def test_get_remaining_work(testerchain, agency, token_economics, test_registry):
agent = ContractAgency.get_agent(WorkLockAgent, registry=test_registry)
bidder = testerchain.unassigned_accounts[2]
bidder = testerchain.unassigned_accounts[-1]
remaining = agent.get_remaining_work(target_address=bidder)
assert remaining
@ -108,14 +108,13 @@ def test_get_remaining_work(testerchain, agency, token_economics, test_registry)
def test_claim(testerchain, agency, token_economics, test_registry):
testerchain.time_travel(seconds=(60*60)+1) # Wait exactly 1 hour + 1 second
agent = ContractAgency.get_agent(WorkLockAgent, registry=test_registry)
bidder = testerchain.unassigned_accounts[2]
bidder = testerchain.unassigned_accounts[-1]
receipt = agent.claim(sender_address=bidder)
assert receipt
def test_refund(testerchain, agency, token_economics, test_registry):
def test_refund_rejection_without_work(testerchain, agency, token_economics, test_registry):
agent = ContractAgency.get_agent(WorkLockAgent, registry=test_registry)
bidder = testerchain.unassigned_accounts[2]
receipt = agent.refund(sender_address=bidder)
assert receipt
bidder = testerchain.unassigned_accounts[-1]
with pytest.raises(TransactionFailed):
_receipt = agent.refund(sender_address=bidder)