Skip to content

packages.valory.skills.abstract_round_abci.common

This module contains the behaviours, round and payloads for the 'abstract_round_abci' skill.

random_selection

def random_selection(elements: List[Any], randomness: float) -> str

Select a random element from a list.

:param: elements: a list of elements to choose among :param: randomness: a random number in the [0,1) interval

Returns:

a randomly chosen element

RandomnessBehaviour Objects

class RandomnessBehaviour(BaseBehaviour)

Check whether Tendermint nodes are running.

failsafe_randomness

def failsafe_randomness() -> Generator[None, None, RandomnessObservation]

This methods provides a failsafe for randomeness retrival.

Returns:

derived randomness

get_randomness_from_api

def get_randomness_from_api() -> Generator[None, None, RandomnessObservation]

Retrieve randomness from given api specs.

async_act

def async_act() -> Generator

Retrieve randomness from API.

Steps: - Do a http request to the API. - Retry until reciving valid values for randomness or retries exceed. - If retrieved values are valid continue else generate randomness from chain.

clean_up

def clean_up() -> None

Clean up the resources due to a 'stop' event.

It can be optionally implemented by the concrete classes.

SelectKeeperBehaviour Objects

class SelectKeeperBehaviour(BaseBehaviour)

Select the keeper agent.

async_act

def async_act() -> Generator

Do the action.

Steps: - Select a keeper randomly. - Send the transaction with the keeper and wait for it to be mined. - Wait until ABCI application transitions to the next round. - Go to the next behaviour state (set done event).

Back to top