def agent(testerchain, proxy_deployer) -> UserEscrowAgent: deployer_address, beneficiary_address, *everybody_else = testerchain.interface.w3.eth.accounts # Escrow escrow_deployer = UserEscrowDeployer( deployer_address=deployer_address, allocation_registry=TEST_ALLOCATION_REGISTRY) _txhash = escrow_deployer.deploy() escrow_deployer.initial_deposit(value=TEST_ALLOCATION, duration=TEST_DURATION) assert escrow_deployer.contract.functions.getLockedTokens().call( ) == TEST_ALLOCATION escrow_deployer.assign_beneficiary(beneficiary_address=beneficiary_address) escrow_deployer.enroll_principal_contract() assert escrow_deployer.contract.functions.getLockedTokens().call( ) == TEST_ALLOCATION _agent = escrow_deployer.make_agent() _direct_agent = UserEscrowAgent( blockchain=testerchain, allocation_registry=TEST_ALLOCATION_REGISTRY, beneficiary=beneficiary_address) assert _direct_agent == _agent assert _direct_agent.contract.abi == _agent.contract.abi assert _direct_agent.contract.address == _agent.contract.address assert _agent.principal_contract.address == escrow_deployer.contract.address assert _agent.principal_contract.abi == escrow_deployer.contract.abi assert _direct_agent.contract.abi == escrow_deployer.contract.abi assert _direct_agent.contract.address == escrow_deployer.contract.address yield _agent TEST_ALLOCATION_REGISTRY.clear()
def agent(testerchain, proxy_deployer, allocation_value) -> UserEscrowAgent: deployer_address, beneficiary_address, *everybody_else = testerchain.client.accounts # Mock Powerup consumption (Deployer) testerchain.transacting_power = TransactingPower( blockchain=testerchain, password=INSECURE_DEVELOPMENT_PASSWORD, account=deployer_address) testerchain.transacting_power.activate() # Escrow escrow_deployer = UserEscrowDeployer( deployer_address=deployer_address, blockchain=testerchain, allocation_registry=TEST_ALLOCATION_REGISTRY) _txhash = escrow_deployer.deploy() escrow_deployer.initial_deposit(value=allocation_value, duration=TEST_DURATION) assert escrow_deployer.contract.functions.getLockedTokens().call( ) == allocation_value escrow_deployer.assign_beneficiary(beneficiary_address=beneficiary_address) escrow_deployer.enroll_principal_contract() assert escrow_deployer.contract.functions.getLockedTokens().call( ) == allocation_value _agent = escrow_deployer.make_agent() _direct_agent = UserEscrowAgent( blockchain=testerchain, allocation_registry=TEST_ALLOCATION_REGISTRY, beneficiary=beneficiary_address) assert _direct_agent == _agent assert _direct_agent.contract.abi == _agent.contract.abi assert _direct_agent.contract.address == _agent.contract.address assert _agent.principal_contract.address == escrow_deployer.contract.address assert _agent.principal_contract.abi == escrow_deployer.contract.abi assert _direct_agent.contract.abi == escrow_deployer.contract.abi assert _direct_agent.contract.address == escrow_deployer.contract.address yield _agent TEST_ALLOCATION_REGISTRY.clear()