Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/prometheus endpoint #369

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
383737f
feat: prometheus endpoint
annasambrook Dec 13, 2024
c97ef40
fix: metric labels
annasambrook Dec 13, 2024
547a4ba
Merge remote-tracking branch 'origin/develop' into feat/prometheus-en…
annasambrook Dec 13, 2024
b30afc8
chore: generators
annasambrook Dec 13, 2024
829bdd4
chore: generators
annasambrook Dec 16, 2024
d1c9603
Merge branch 'refs/heads/develop' into feat/prometheus-endpoint
annasambrook Dec 16, 2024
aa31df2
chore: generators
annasambrook Dec 16, 2024
a4fdacd
refactor: move wallet balance to market manager
annasambrook Dec 17, 2024
47caf37
enhance: add staking contract slots to metrics endpoint
annasambrook Dec 18, 2024
9fdab40
fix: changes after code checks
annasambrook Dec 19, 2024
662e48f
chore: generators
annasambrook Dec 19, 2024
9fec4ef
fix: add missing dependency to the skill
Adamantios Dec 19, 2024
79bb146
chore: run tox -e check-dependencies
Adamantios Dec 19, 2024
20962c8
chore: ignore missing prometheus client imports
Adamantios Dec 19, 2024
48874d5
chore: run generators
Adamantios Dec 19, 2024
0902d35
fix: registry duplicated timeseries error
annasambrook Dec 19, 2024
1565bb4
Merge remote-tracking branch 'origin/feat/prometheus-endpoint' into f…
annasambrook Dec 19, 2024
abba52b
chore: generators
annasambrook Dec 19, 2024
1e9d3a0
Update packages/valory/skills/decision_maker_abci/skill.yaml
annasambrook Dec 19, 2024
4476197
Update packages/valory/skills/market_manager_abci/skill.yaml
annasambrook Dec 19, 2024
cce8e0f
chore: autonomy packages lock
annasambrook Dec 19, 2024
ae56e81
fix: tests
annasambrook Dec 19, 2024
572ce4b
fix: test decision request payload
annasambrook Dec 19, 2024
eddd0fa
chore: generators
annasambrook Dec 19, 2024
7132eb2
fix: check stop trading payload test
annasambrook Dec 19, 2024
c37cdd2
fix: tests
annasambrook Dec 19, 2024
8edd3af
fix: keywords must be strings
annasambrook Dec 20, 2024
b565ad6
fix: yield balance check
annasambrook Dec 23, 2024
d6f1cbc
chore: generators
annasambrook Dec 23, 2024
0c54647
fix: olas balance contract call
annasambrook Dec 23, 2024
061e153
add: service owner address
annasambrook Dec 23, 2024
c979c0d
Merge branch 'refs/heads/develop' into feat/prometheus-endpoint
annasambrook Dec 23, 2024
84dbcf7
fix: servie owner address duplication
annasambrook Dec 23, 2024
518f4ec
refactor: make olas token address param
annasambrook Dec 27, 2024
204764e
fix: gitleaksignore
annasambrook Dec 27, 2024
4c6c7a1
fix: trader skill
annasambrook Dec 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"contract/valory/mech_activity/0.1.0": "bafybeibmqmle5fnal3gxlpdmcos2kogzra4q3pr3o5nh7shplxuilji3t4",
"contract/valory/staking_token/0.1.0": "bafybeiep4r6qyilbfgzdvx6t7zvpgaioxqktmxm7puwtnbpb2ftlib43gy",
"contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4",
"skill/valory/market_manager_abci/0.1.0": "bafybeiaru2d32wpmcgqs64eepxud4idgubc3vmsbdwbia7gygipql2mmqi",
"skill/valory/decision_maker_abci/0.1.0": "bafybeiddnmcquiuznts67ridhpnaqw2y3rrt4nfau5kjm74zhk5lhjxi2q",
"skill/valory/trader_abci/0.1.0": "bafybeiemjz3ca7la7jkeqdr7hxo7fa77xe2fkfadzb53gdkji7abpl2eiu",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeietwknem7iiood6pwkfup322ywwjmdrmdapllrcms6jpeev5w2qfe",
"skill/valory/staking_abci/0.1.0": "bafybeicupccurmrg7qesivonlyt3nryarsmk5qf5yh6auno64wn45bybvq",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeieduekpd4zbvjztyxyooppqnmjvup6jfp74uo6hhupvtvzzscdzkq",
"agent/valory/trader/0.1.0": "bafybeihq257kwjybsvrpzhjx4wbretrsurodpckjqdhv3idlnbu4mqvfnq",
"service/valory/trader/0.1.0": "bafybeihr6m4lec5r6kuf2zikusgyqilqwhwlpyehufyndjuziylr73dlqe",
"service/valory/trader_pearl/0.1.0": "bafybeibfqhsrtekx6nvwpz2nbbjyobljcahe6wz6jikyebt7opzxlal45u"
"skill/valory/market_manager_abci/0.1.0": "bafybeiflv6n2t5ptofgvy4clds5vdrheefvp4uycvwcwznxcbvthjvylxa",
"skill/valory/decision_maker_abci/0.1.0": "bafybeihhpknnnyr5jryegqk5nxmoyt43bjzykabvv7dw22h77zsbe3ebiu",
"skill/valory/trader_abci/0.1.0": "bafybeigicr3xxcjqxvfuhebw5pkxfsf4qqpggdtyfte5pg6kzwwlygop2q",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeib67oxviltdoc3kvbct4e4xtqbiuumszw4kn7v5pzmvf7ihp7dnc4",
"skill/valory/staking_abci/0.1.0": "bafybeif2cwf2bcjczbj4fykzyogtvfbfwo3u3ot2gfmeh4cygdenzvt2d4",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeiggs243oehh736f3j4lwuahgperjfnkv6clxdmqdqjbt62g46q254",
"agent/valory/trader/0.1.0": "bafybeiayrzetoc4ulguyv2kt6pf7fcjnvwk35jnw5le3a5oj7ktyc7xe2a",
"service/valory/trader/0.1.0": "bafybeifa6q4guogtlo2rshptf5xdzyxojhfesvagiucyl2ht4vepwuudku",
"service/valory/trader_pearl/0.1.0": "bafybeid6rze7eua5g2s2e3n2ywhdsvard5lejnvxwkvr3utt3jkgre2zry"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
13 changes: 7 additions & 6 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ contracts:
- valory/service_staking_token:0.1.0:bafybeihhcs3ewwzhy7yto4y36uqmice3pdvyl54fvxxv6jsxonesie4dxu
- valory/transfer_nft_condition:0.1.0:bafybeid6z2tf7nc4rhwggktxk5f62bowxdczykrxc3y76sbt2ttlw5hmtq
- valory/erc20:0.1.0:bafybeid2p2jyvjjlcsqugnawksdzsca6ljghpqbp2kfi3cxuxoy2233dbi
- valory/relayer:0.1.0:bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4
protocols:
- open_aea/signing:1.0.0:bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi
- valory/abci:0.1.0:bafybeiaqmp7kocbfdboksayeqhkbrynvlfzsx4uy4x6nohywnmaig4an7u
Expand All @@ -45,12 +46,12 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba
- valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm
- valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeietwknem7iiood6pwkfup322ywwjmdrmdapllrcms6jpeev5w2qfe
- valory/market_manager_abci:0.1.0:bafybeiaru2d32wpmcgqs64eepxud4idgubc3vmsbdwbia7gygipql2mmqi
- valory/decision_maker_abci:0.1.0:bafybeiddnmcquiuznts67ridhpnaqw2y3rrt4nfau5kjm74zhk5lhjxi2q
- valory/trader_abci:0.1.0:bafybeiemjz3ca7la7jkeqdr7hxo7fa77xe2fkfadzb53gdkji7abpl2eiu
- valory/staking_abci:0.1.0:bafybeicupccurmrg7qesivonlyt3nryarsmk5qf5yh6auno64wn45bybvq
- valory/check_stop_trading_abci:0.1.0:bafybeieduekpd4zbvjztyxyooppqnmjvup6jfp74uo6hhupvtvzzscdzkq
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeib67oxviltdoc3kvbct4e4xtqbiuumszw4kn7v5pzmvf7ihp7dnc4
- valory/market_manager_abci:0.1.0:bafybeiflv6n2t5ptofgvy4clds5vdrheefvp4uycvwcwznxcbvthjvylxa
- valory/decision_maker_abci:0.1.0:bafybeihhpknnnyr5jryegqk5nxmoyt43bjzykabvv7dw22h77zsbe3ebiu
- valory/trader_abci:0.1.0:bafybeigicr3xxcjqxvfuhebw5pkxfsf4qqpggdtyfte5pg6kzwwlygop2q
- valory/staking_abci:0.1.0:bafybeif2cwf2bcjczbj4fykzyogtvfbfwo3u3ot2gfmeh4cygdenzvt2d4
- valory/check_stop_trading_abci:0.1.0:bafybeiggs243oehh736f3j4lwuahgperjfnkv6clxdmqdqjbt62g46q254
- valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm
customs:
- valory/mike_strat:0.1.0:bafybeihjiol7f4ch4piwfikurdtfwzsh6qydkbsztpbwbwb2yrqdqf726m
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeihq257kwjybsvrpzhjx4wbretrsurodpckjqdhv3idlnbu4mqvfnq
agent: valory/trader:0.1.0:bafybeiayrzetoc4ulguyv2kt6pf7fcjnvwk35jnw5le3a5oj7ktyc7xe2a
number_of_agents: 4
deployment:
agent:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader_pearl/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeihq257kwjybsvrpzhjx4wbretrsurodpckjqdhv3idlnbu4mqvfnq
agent: valory/trader:0.1.0:bafybeiayrzetoc4ulguyv2kt6pf7fcjnvwk35jnw5le3a5oj7ktyc7xe2a
number_of_agents: 1
deployment:
agent:
Expand Down
4 changes: 3 additions & 1 deletion packages/valory/skills/check_stop_trading_abci/behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ def async_act(self) -> Generator:
with self.context.benchmark_tool.measure(self.behaviour_id).local():
stop_trading = yield from self._compute_stop_trading()
self.context.logger.info(f"Computed {stop_trading=}")
payload = CheckStopTradingPayload(self.context.agent_address, stop_trading)
payload = CheckStopTradingPayload(
self.context.agent_address, stop_trading, self.mech_request_count
)

with self.context.benchmark_tool.measure(self.behaviour_id).consensus():
yield from self.send_a2a_transaction(payload)
Expand Down
2 changes: 2 additions & 0 deletions packages/valory/skills/check_stop_trading_abci/payloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""This module contains the transaction payloads for the check stop trading abci."""

from dataclasses import dataclass
from typing import Optional

from packages.valory.skills.abstract_round_abci.base import BaseTxPayload

Expand All @@ -29,3 +30,4 @@ class CheckStopTradingPayload(BaseTxPayload):
"""A transaction payload for the check stop trading abci."""

vote: bool
mech_request_count: Optional[int]
24 changes: 23 additions & 1 deletion packages/valory/skills/check_stop_trading_abci/rounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,19 @@ def _get_deserialized(self, key: str) -> DeserializedCollection:
serialized = self.db.get_strict(key)
return CollectionRound.deserialize_collection(serialized)

@property
def is_staking_kpi_met(self) -> bool:
"""Get the status of the staking kpi."""
return bool(self.db.get("is_staking_kpi_met", False))

@property
def n_mech_requests(self) -> int:
"""Get the number of mech requests."""
n_mech_requests = self.db.get("n_mech_requests", 0)
if n_mech_requests is None:
return 0
return n_mech_requests


class CheckStopTradingRound(VotingRound):
"""A round for checking stop trading conditions."""
Expand All @@ -77,6 +86,15 @@ class CheckStopTradingRound(VotingRound):
no_majority_event = Event.NO_MAJORITY
collection_key = get_name(SynchronizedData.participant_to_votes)

@property
def mech_request_count(self) -> int:
"""Get the mech request count from the payload."""
payload = self.payloads[0]

if not hasattr(payload, "mech_request_count"):
return 0
return payload.mech_request_count

def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]:
"""Process the end of the block."""
res = super().end_block()
Expand All @@ -85,7 +103,11 @@ def end_block(self) -> Optional[Tuple[BaseSynchronizedData, Enum]]:
return None

is_staking_kpi_met = self.positive_vote_threshold_reached
self.synchronized_data.update(is_staking_kpi_met=is_staking_kpi_met)
n_mech_requests = self.mech_request_count

self.synchronized_data.update(
is_staking_kpi_met=is_staking_kpi_met, n_mech_requests=n_mech_requests
)

return res

Expand Down
12 changes: 6 additions & 6 deletions packages/valory/skills/check_stop_trading_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ aea_version: '>=1.0.0, <2.0.0'
fingerprint:
README.md: bafybeif2pq7fg5upl6vmfgfzpiwsh4nbk4zaeyz6upyucqi5tasrxgq4ee
__init__.py: bafybeifc23rlw2hzhplp3wfceixnmwq5ztnixhh7jp4dd5av3crwp3x22a
behaviours.py: bafybeie5mkpxsd6z3vjsoacvswin6zz4q4um5gqp6jhwtn65fepx2kma3m
behaviours.py: bafybeibbjo73ntwkwnc2ozbx27b2min6hgwrayrql5ozn6ttjb4z6jxp3m
dialogues.py: bafybeictrrnwcijiejczy23dfvbx5kujgef3dulzqhs3etl2juvz5spm2e
fsm_specification.yaml: bafybeihhau35a5xclncjpxh5lg7qiw34xs4d5qlez7dnjpkf45d3gc57ai
handlers.py: bafybeiard64fwxib3rtyp67ymhf222uongcyqhfhdyttpsyqkmyh5ajipu
models.py: bafybeigwdhgianx5rizlb7ebmm6pdtkixh4uehbvu5c24ysvyvojs74dfq
payloads.py: bafybeidh5bqywun4chrbsci2xbcrnnzuys5sswxwbxq3yl2ksawi3xsi5q
rounds.py: bafybeift7b2afck4e5so2cpgyoywa76t6el6d4qwfoitvfdjw6kgf4fwie
payloads.py: bafybeigyuhfflh45oovhlwij3zgay4xjrrj2mt2pbhtxtughlimzn2jvgq
rounds.py: bafybeigjx533enl364yfbylno5psehrlj6l74v2sukg2pioawbcz7ermzm
tests/__init__.py: bafybeihv2cjk4va5bc5ncqtppqg2xmmxcro34bma36trtvk32gtmhdycxu
tests/test_dialogues.py: bafybeia5ac27w7ijx2nyx5dqyrnv4troo4572gjq7nrcxdncexoxucnqti
tests/test_handlers.py: bafybeigpmtx2hyunzn6nxk2x4bvvybek7jvuhbk34fqlj7fgfsszcoqhxy
tests/test_payloads.py: bafybeih7q7kdfxsf4ejxxqwjumwglfwwcrbqcjnuy42mkhnfwccxuhiviy
tests/test_rounds.py: bafybeidgbc7mi7r2fpk7ak6xceohuoq2zkpkberkokcb3sb2uzwkxoluae
tests/test_payloads.py: bafybeibygk4xox7itkxwypolxp6yak2hpbtvhtpdaqey2zj6qxqnzo4uqm
tests/test_rounds.py: bafybeigxv27wqlpf4si2xcpe7bgn6k6ubr5nt37w7sskiapbuht5miz3wq
fingerprint_ignore_patterns: []
connections: []
contracts:
- valory/mech:0.1.0:bafybeiejfjfoxqggghcme43sx53q5gruefrws3k2jam2opkxl5uzffoarm
protocols: []
skills:
- valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u
- valory/staking_abci:0.1.0:bafybeicupccurmrg7qesivonlyt3nryarsmk5qf5yh6auno64wn45bybvq
- valory/staking_abci:0.1.0:bafybeif2cwf2bcjczbj4fykzyogtvfbfwo3u3ot2gfmeh4cygdenzvt2d4
behaviours:
main:
args: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
def test_check_stop_trading_payload() -> None:
"""Test `CheckStopTradingPayload`."""

payload = CheckStopTradingPayload(sender="sender", vote=True)
payload = CheckStopTradingPayload(sender="sender", vote=True, mech_request_count=1)

assert payload.vote
assert payload.data == {"vote": True}
assert payload.mech_request_count == 1
assert CheckStopTradingPayload.from_json(payload.json) == payload
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def get_participant_to_votes(
"""participant_to_votes"""

return {
participant: CheckStopTradingPayload(sender=participant, vote=vote)
participant: CheckStopTradingPayload(
sender=participant, vote=vote, mech_request_count=1
)
for participant in participants
}

Expand All @@ -102,10 +104,11 @@ def get_participant_to_votes_serialized(
def get_payloads(
payload_cls: Type[CheckStopTradingPayload],
data: Optional[str],
mech_request_count: int,
) -> Mapping[str, CheckStopTradingPayload]:
"""Get payloads."""
return {
participant: payload_cls(participant, data is not None)
participant: payload_cls(participant, data is not None, mech_request_count)
for participant in get_participants()
}

Expand Down Expand Up @@ -198,6 +201,7 @@ class TestCheckStopTradingRound(BaseCheckStopTradingRoundTest):
payloads=get_payloads(
payload_cls=CheckStopTradingPayload,
data=get_dummy_check_stop_trading_payload_serialized(),
mech_request_count=1,
),
final_data={},
event=Event.SKIP_TRADING,
Expand All @@ -217,6 +221,7 @@ class TestCheckStopTradingRound(BaseCheckStopTradingRoundTest):
payloads=get_payloads(
payload_cls=CheckStopTradingPayload,
data=get_dummy_check_stop_trading_payload_serialized(),
mech_request_count=1,
),
final_data={},
event=Event.NO_MAJORITY,
Expand Down
43 changes: 1 addition & 42 deletions packages/valory/skills/decision_maker_abci/behaviours/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from aea.protocols.base import Message
from aea.protocols.dialogue.base import Dialogue

from packages.valory.contracts.erc20.contract import ERC20
from packages.valory.contracts.gnosis_safe.contract import (
GnosisSafeContract,
SafeOperation,
Expand Down Expand Up @@ -109,8 +108,6 @@ class DecisionMakerBaseBehaviour(BetsManagerBehaviour, ABC):
def __init__(self, **kwargs: Any) -> None:
"""Initialize the bet placement behaviour."""
super().__init__(**kwargs)
self.token_balance = 0
self.wallet_balance = 0
self.multisend_batches: List[MultisendBatch] = []
self.multisend_data = b""
self._safe_tx_hash = ""
Expand Down Expand Up @@ -265,23 +262,6 @@ def is_first_period(self) -> bool:
or self.shared_state.mock_data is None
)

@property
def sampled_bet(self) -> Bet:
"""Get the sampled bet and reset the bets list."""
self.read_bets()
bet_index = self.synchronized_data.sampled_bet_index
return self.bets[bet_index]

@property
def collateral_token(self) -> str:
"""Get the contract address of the token that the market maker supports."""
return self.sampled_bet.collateralToken

@property
def is_wxdai(self) -> bool:
"""Get whether the collateral address is wxDAI."""
return self.collateral_token.lower() == WXDAI.lower()

@staticmethod
def wei_to_native(wei: int) -> float:
"""Convert WEI to native token."""
Expand Down Expand Up @@ -325,29 +305,8 @@ def check_balance(self) -> WaitableConditionType:
self._mock_balance_check()
return True

response_msg = yield from self.get_contract_api_response(
performative=ContractApiMessage.Performative.GET_RAW_TRANSACTION, # type: ignore
contract_address=self.collateral_token,
contract_id=str(ERC20.contract_id),
contract_callable="check_balance",
account=self.synchronized_data.safe_contract_address,
)
if response_msg.performative != ContractApiMessage.Performative.RAW_TRANSACTION:
self.context.logger.error(
f"Could not calculate the balance of the safe: {response_msg}"
)
return False

token = response_msg.raw_transaction.body.get("token", None)
wallet = response_msg.raw_transaction.body.get("wallet", None)
if token is None or wallet is None:
self.context.logger.error(
f"Something went wrong while trying to get the balance of the safe: {response_msg}"
)
return False
yield from self.wait_for_condition_with_sleep(self.get_balance)

self.token_balance = int(token)
self.wallet_balance = int(wallet)
self._report_balance()
return True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,15 @@ def async_act(self) -> Generator:
tx_submitter = self.matching_round.auto_round_id()
betting_tx_hex = yield from self._prepare_safe_tx()
wallet_balance = self.wallet_balance
token_balance = self.token_balance

payload = BetPlacementPayload(
agent,
tx_submitter,
betting_tx_hex,
mocking_mode,
wallet_balance,
token_balance,
)

yield from self.finish_behaviour(payload)
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ def async_act(self) -> Generator:
with self.context.benchmark_tool.measure(self.behaviour_id).local():
payload_content = None
mocking_mode: Optional[bool] = self.benchmarking_mode.enabled
decision_request_timestamp = None
if self._metadata and self.n_slots_supported:
mech_requests = [self.metadata]
payload_content = json.dumps(mech_requests, sort_keys=True)
decision_request_timestamp = self.synced_timestamp
if not self.n_slots_supported:
mocking_mode = None

Expand All @@ -106,5 +108,7 @@ def async_act(self) -> Generator:
self.shared_state.bet_id_row_manager = bets_mapping

agent = self.context.agent_address
payload = DecisionRequestPayload(agent, payload_content, mocking_mode)
payload = DecisionRequestPayload(
agent, payload_content, mocking_mode, decision_request_timestamp
)
yield from self.finish_behaviour(payload)
Loading
Loading