diff --git a/nucypher/blockchain/eth/deployers.py b/nucypher/blockchain/eth/deployers.py index f22f6c1ad..e85823028 100644 --- a/nucypher/blockchain/eth/deployers.py +++ b/nucypher/blockchain/eth/deployers.py @@ -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 diff --git a/tests/blockchain/eth/entities/agents/test_worklock_agent.py b/tests/blockchain/eth/entities/agents/test_worklock_agent.py index e04764ebe..27dd60cb8 100644 --- a/tests/blockchain/eth/entities/agents/test_worklock_agent.py +++ b/tests/blockchain/eth/entities/agents/test_worklock_agent.py @@ -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)