This repository was archived by the owner on Apr 22, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmodels.py
More file actions
154 lines (140 loc) · 6.02 KB
/
models.py
File metadata and controls
154 lines (140 loc) · 6.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023-2026 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------
"""This module contains the shared state for the abci skill of ImpactEvaluatorSkillAbciApp."""
from packages.valory.skills.abstract_round_abci.models import ApiSpecs
from packages.valory.skills.abstract_round_abci.models import (
BenchmarkTool as BaseBenchmarkTool,
)
from packages.valory.skills.abstract_round_abci.models import Requests as BaseRequests
from packages.valory.skills.abstract_round_abci.models import (
SharedState as BaseSharedState,
)
from packages.valory.skills.agent_db_abci.agent_db_client import (
AgentDBClient as BaseAgentDBClient,
)
from packages.valory.skills.contribute_db_abci.models import (
ContributeDatabase as BaseContributeDatabase,
)
from packages.valory.skills.contribute_db_abci.models import (
Params as ContributeDBAbciParams,
)
from packages.valory.skills.contribute_db_abci.rounds import Event as ContributeDBEvent
from packages.valory.skills.decision_making_abci.models import (
Params as DecisionMakingAbciParams,
)
from packages.valory.skills.decision_making_abci.rounds import (
Event as DecisionMakingEvent,
)
from packages.valory.skills.dynamic_nft_abci.models import (
Params as DynamicNFTAbciParams,
)
from packages.valory.skills.dynamic_nft_abci.rounds import Event as DynamicNFTEvent
from packages.valory.skills.impact_evaluator_abci.composition import (
ImpactEvaluatorSkillAbciApp,
)
from packages.valory.skills.mech_interact_abci.models import (
MechResponseSpecs as BaseMechResponseSpecs,
)
from packages.valory.skills.mech_interact_abci.models import (
MechToolsSpecs as InteractMechToolsSpecs,
)
from packages.valory.skills.mech_interact_abci.models import (
MechsSubgraph as InteractMechsSubgraph,
)
from packages.valory.skills.mech_interact_abci.models import (
Params as MechInteractAbciParams,
)
from packages.valory.skills.mech_interact_abci.rounds import Event as MechInteractEvent
from packages.valory.skills.olas_week_abci.models import Params as OlasWeekAbciParams
from packages.valory.skills.olas_week_abci.rounds import Event as OlasWeekEvent
from packages.valory.skills.reset_pause_abci.rounds import Event as ResetPauseEvent
from packages.valory.skills.staking_abci.models import Params as StakingAbciParams
from packages.valory.skills.staking_abci.rounds import Event as StakingEvent
from packages.valory.skills.termination_abci.models import TerminationParams
from packages.valory.skills.twitter_scoring_abci.models import (
Params as TwitterScoringAbciParams,
)
from packages.valory.skills.twitter_scoring_abci.rounds import (
Event as TwitterScoringEvent,
)
ContributeDBParams = ContributeDBAbciParams
DynamicNFTParams = DynamicNFTAbciParams
TwitterScoringParams = TwitterScoringAbciParams
DecisionMakingParams = DecisionMakingAbciParams
OlasWeekParams = OlasWeekAbciParams
MechInteractParams = MechInteractAbciParams
Requests = BaseRequests
BenchmarkTool = BaseBenchmarkTool
MechResponseSpecs = BaseMechResponseSpecs
AgentDBClient = BaseAgentDBClient
ContributeDatabase = BaseContributeDatabase
MechToolsSpecs = InteractMechToolsSpecs
MechsSubgraph = InteractMechsSubgraph
class RandomnessApi(ApiSpecs):
"""A model that wraps ApiSpecs for randomness api specifications."""
MARGIN = 5
MULTIPLIER = 5
MULTIPLIER_DB = 10
class SharedState(BaseSharedState):
"""Keep the current shared state of the skill."""
abci_app_cls = ImpactEvaluatorSkillAbciApp
def setup(self) -> None:
"""Set up."""
super().setup()
ImpactEvaluatorSkillAbciApp.event_to_timeout[
ContributeDBEvent.ROUND_TIMEOUT
] = (self.context.params.round_timeout_seconds * MULTIPLIER_DB)
ImpactEvaluatorSkillAbciApp.event_to_timeout[
TwitterScoringEvent.ROUND_TIMEOUT
] = (self.context.params.round_timeout_seconds * MULTIPLIER)
ImpactEvaluatorSkillAbciApp.event_to_timeout[
TwitterScoringEvent.TWEET_EVALUATION_ROUND_TIMEOUT
] = self.context.params.tweet_evaluation_round_timeout
ImpactEvaluatorSkillAbciApp.event_to_timeout[DynamicNFTEvent.ROUND_TIMEOUT] = (
self.context.params.round_timeout_seconds * MULTIPLIER
)
ImpactEvaluatorSkillAbciApp.event_to_timeout[ResetPauseEvent.ROUND_TIMEOUT] = (
self.context.params.round_timeout_seconds
)
ImpactEvaluatorSkillAbciApp.event_to_timeout[
ResetPauseEvent.RESET_AND_PAUSE_TIMEOUT
] = (self.context.params.reset_pause_duration + MARGIN)
ImpactEvaluatorSkillAbciApp.event_to_timeout[
DecisionMakingEvent.ROUND_TIMEOUT
] = self.context.params.round_timeout_seconds
ImpactEvaluatorSkillAbciApp.event_to_timeout[OlasWeekEvent.ROUND_TIMEOUT] = (
self.context.params.round_timeout_seconds * MULTIPLIER
)
ImpactEvaluatorSkillAbciApp.event_to_timeout[
MechInteractEvent.ROUND_TIMEOUT
] = self.context.params.round_timeout_seconds
ImpactEvaluatorSkillAbciApp.event_to_timeout[StakingEvent.ROUND_TIMEOUT] = (
self.context.params.round_timeout_seconds
)
class Params(
ContributeDBParams,
TwitterScoringParams,
DynamicNFTParams,
DecisionMakingParams,
OlasWeekParams,
MechInteractParams,
StakingAbciParams,
TerminationParams,
):
"""A model to represent params for multiple abci apps."""