mirror of https://github.com/nucypher/nucypher.git
Improve coverage of StakingEscrowAgent wrt to StakingEscrow contract
parent
99403a3a93
commit
beb0e04d86
|
@ -231,6 +231,9 @@ class StakingEscrowAgent(EthereumContractAgent):
|
|||
at_period = self.contract.functions.getCurrentPeriod().call()
|
||||
return self.contract.functions.lockedPerPeriod(at_period).call()
|
||||
|
||||
def get_staker_info(self, staker_address: str):
|
||||
return self.contract.functions.stakerInfo(staker_address).call()
|
||||
|
||||
def get_locked_tokens(self, staker_address: str, periods: int = 0) -> int:
|
||||
"""
|
||||
Returns the amount of tokens this staker has locked
|
||||
|
@ -241,7 +244,8 @@ class StakingEscrowAgent(EthereumContractAgent):
|
|||
return self.contract.functions.getLockedTokens(staker_address, periods).call()
|
||||
|
||||
def owned_tokens(self, staker_address: str) -> int:
|
||||
return self.contract.functions.getAllTokens(staker_address).call()
|
||||
staker_info = self.get_staker_info(staker_address)
|
||||
return staker_info[0]
|
||||
|
||||
def get_substake_info(self, staker_address: str, stake_index: int) -> Tuple[int, int, int]:
|
||||
first_period, *others, locked_value = self.contract.functions.getSubStakeInfo(staker_address, stake_index).call()
|
||||
|
|
|
@ -512,7 +512,7 @@ def paint_stakers(emitter, stakers: List[str], agent) -> None:
|
|||
nickname, _ = nickname_from_seed(staker)
|
||||
emitter.echo(f"{staker} {'Nickname:':10} {nickname}")
|
||||
tab = " " * len(staker)
|
||||
info = agent.contract.functions.stakerInfo(staker).call()
|
||||
info = agent.get_staker_info(staker)
|
||||
stake, confirmed1, confirmed2, restake, *remaining_info = info
|
||||
locked_restake_until_period, worker, worker_start, last_active = remaining_info
|
||||
last_confirmed_period = max(confirmed1, confirmed2)
|
||||
|
|
Loading…
Reference in New Issue