File size: 3,191 Bytes
a134d9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7968201
 
 
 
a134d9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#   -*- coding: utf-8 -*-
#   ------------------------------------------------------------------------------
#
#     Copyright 2024 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.
#
#   ------------------------------------------------------------------------------

from string import Template

FPMMS_FIELD = "fixedProductMarketMakers"
QUERY_FIELD = "query"
ERROR_FIELD = "errors"
DATA_FIELD = "data"
ID_FIELD = "id"
ANSWER_FIELD = "currentAnswer"
QUESTION_FIELD = "question"
OUTCOMES_FIELD = "outcomes"
TITLE_FIELD = "title"
ANSWER_TIMESTAMP_FIELD = "currentAnswerTimestamp"
OPENING_TIMESTAMP_FIELD = "openingTimestamp"
RESOLUTION_TIMESTAMP_FIELD = "resolutionTimestamp"
CREATION_TIMESTAMP_FIELD = "creationTimestamp"
LIQUIDITY_FIELD = "liquidityParameter"
LIQUIDIY_MEASURE_FIELD = "liquidityMeasure"
TOKEN_AMOUNTS_FIELD = "outcomeTokenAmounts"

FPMMS_WITH_TOKENS_QUERY = Template(
    """
    {
      ${fpmms_field}(
        where: {
          creator: "${creator}",
          id_gt: "${fpmm_id}",
          isPendingArbitration: false,
          currentAnswer: null,
          openingTimestamp_gt:${current_timestamp},
          outcomeTokenAmounts_not: ["0","0"]
        },
        orderBy: ${id_field}
        orderDirection: asc
        first: ${first}
      ){
        ${id_field}
        ${question_field} {
          ${outcomes_field}
          ${answer_timestamp_field}
          answers{
          answer
          }
        }
        ${title_field}
        ${opening_timestamp_field}
        ${creation_timestamp_field}
        ${liquidity_field}
        ${liquidity_measure_field}
        ${token_amounts_field}
      }
    }
    """
)


omen_trader_votes_query = Template(
    """
    {
        fpmmTrades(
            where: {
                type: Buy,
                fpmm_: {
                    creator: "${fpmm_creator}",
                    id: "${fpmm_id}",
                },
                id_gt: "${id_gt}"
            }
            first: ${first}
            orderBy: id
            orderDirection: asc
        ) {
            id
            title
            collateralToken
            outcomeTokenMarginalPrice
            oldOutcomeTokenMarginalPrice
            type
            creator {
                id
            }
            creationTimestamp
            collateralAmount
            collateralAmountUSD
            feeAmount
            outcomeIndex
            outcomeTokensTraded
            transactionHash
            fpmm {
                id
                outcomes
                title
                condition {
                    id
                }
            }
        }
    }
    """
)