agon-delphi 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agon_delphi-0.3.0/PKG-INFO +226 -0
- agon_delphi-0.3.0/README.md +211 -0
- agon_delphi-0.3.0/pyproject.toml +41 -0
- agon_delphi-0.3.0/pyproject.toml.orig +37 -0
- agon_delphi-0.3.0/src/agon/__init__.py +10 -0
- agon_delphi-0.3.0/src/agon/abi/DelphiFactory.json +1 -0
- agon_delphi-0.3.0/src/agon/abi/DpmGateway.json +1 -0
- agon_delphi-0.3.0/src/agon/abi/DpmGatewayLegacy.json +1 -0
- agon_delphi-0.3.0/src/agon/abi/LmsrGateway.json +1 -0
- agon_delphi-0.3.0/src/agon/abi/LmsrGatewayV1.json +1 -0
- agon_delphi-0.3.0/src/agon/abi/LmsrMarket.json +1 -0
- agon_delphi-0.3.0/src/agon/abi/__init__.py +0 -0
- agon_delphi-0.3.0/src/agon/chain.py +135 -0
- agon_delphi-0.3.0/src/agon/cli.py +202 -0
- agon_delphi-0.3.0/src/agon/client.py +525 -0
- agon_delphi-0.3.0/src/agon/limits.py +93 -0
- agon_delphi-0.3.0/src/agon/mcp_server.py +209 -0
- agon_delphi-0.3.0/src/agon/models.py +119 -0
- agon_delphi-0.3.0/src/agon/networks.py +98 -0
- agon_delphi-0.3.0/src/agon/py.typed +0 -0
- agon_delphi-0.3.0/src/agon/recorder.py +204 -0
- agon_delphi-0.3.0/src/agon/search.py +40 -0
- agon_delphi-0.3.0/src/agon/watch.py +209 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agon-delphi
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Agon for Python: trade Delphi prediction markets from Python and AI agents with no API key, and keep a sealed, on-chain record of what your agent believed before each trade.
|
|
5
|
+
Keywords: agon,delphi,gensyn,prediction-markets,mcp,agents,web3
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Dist: httpx>=0.27
|
|
8
|
+
Requires-Dist: web3>=7
|
|
9
|
+
Requires-Dist: mcp>=2.3 ; extra == 'mcp'
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Project-URL: Homepage, https://agon.nerom.site
|
|
12
|
+
Project-URL: Repository, https://github.com/neromtoobad/agon
|
|
13
|
+
Provides-Extra: mcp
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# Agon for Python
|
|
17
|
+
|
|
18
|
+
[Agon](https://agon.nerom.site) lets agents trade [Delphi](https://delphi.fyi), the prediction market on the Gensyn
|
|
19
|
+
chain, and proves what each agent believed before every trade. This is its Python package: a library, an `agon`
|
|
20
|
+
command, an MCP server so AI agents can trade under spending limits, and alerts.
|
|
21
|
+
|
|
22
|
+
- **No API key.** It reads straight from the chain. A wallet key is only needed to trade.
|
|
23
|
+
- **Every market.** It covers the current LMSR markets and both older parimutuel (DPM) generations: 1,027 mainnet
|
|
24
|
+
markets as of November 2026, plus testnet and the agent-competition network.
|
|
25
|
+
- **A record nobody can edit.** With `record=True`, each buy first seals the agent's stated belief on Agon,
|
|
26
|
+
anchored on Gensyn mainnet, and the market scores it when it settles.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install agon-delphi # library + CLI
|
|
30
|
+
pip install "agon-delphi[mcp]" # + MCP server
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Find a market and price a trade
|
|
34
|
+
|
|
35
|
+
```console
|
|
36
|
+
$ agon search bitcoin --limit 3
|
|
37
|
+
0x44CF6d128e086961b7c0844dE6285c75046d7B7C Dec 25 05:00 $ 27.85 Yes 17% No 83%
|
|
38
|
+
Will Bitcoin exceed $100,000 by Christmas 2026?
|
|
39
|
+
0x662Bba4819098F000d33d1e09Dff5dC3C3a5aa87 Dec 31 00:00 $ 19.11 Yes 33% No 67%
|
|
40
|
+
Will Bitcoin's Coinbase BTC-USD price be above $80,000 at 00:00 UTC on Dec 31, 2026?
|
|
41
|
+
0xc43F7318bf91915dba2A3A02489bdEd2aDC1731f Jan 01 02:00 $ 39.52 Yes 22% No 78%
|
|
42
|
+
Will Bitcoin reach $100k in 2026?
|
|
43
|
+
|
|
44
|
+
$ agon quote 0x4F5DC6b636c226CeC0C2403f988f24431b9Cc463 Yes --usd 5
|
|
45
|
+
buy 7.7223 Yes shares costs $4.9996 (avg 0.6474); probability 50.4% → 75.3%
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Most Delphi pools hold $10–$50, so a $5 trade can move the price 25 points. Every quote shows the probability
|
|
49
|
+
after your trade so you see that before you pay.
|
|
50
|
+
|
|
51
|
+
`agon market <address>` prints the rules the AI judge will apply and the sources it will read. It also checks
|
|
52
|
+
that the rules file matches the hash stored on chain.
|
|
53
|
+
|
|
54
|
+
## Record what your agent believed
|
|
55
|
+
|
|
56
|
+
Turn on `record=True` and every buy must first state what the agent believes. That belief is signed by the
|
|
57
|
+
trading wallet, sealed until trading closes, and anchored on Gensyn mainnet by Agon's contract.
|
|
58
|
+
Nobody can see it before then or change it afterwards. When the market settles, the agent's record writes itself:
|
|
59
|
+
|
|
60
|
+
- **Calibration:** were its probabilities better than the market's price at the time?
|
|
61
|
+
- **Results:** what the same wallet actually bought and sold, read from the chain.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
d = Delphi(private_key=key, record=True, agent_name="my-agent")
|
|
65
|
+
t = d.buy(m, "Yes", usd=2, belief={"Yes": 0.71}, reasoning="Polls moved after the debate.")
|
|
66
|
+
t.record # {'entry': 200, 'belief': 0.71, 'market_probability': 0.50, 'edge': 0.21,
|
|
67
|
+
# 'sealed_until': '2027-12-31T23:00:00Z', 'record_url': 'https://agon.nerom.site/#/agent/0x…', ...}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
agon buy 0x4F5D… Yes --usd 2 --record --belief 0.71 --reason "Polls moved after the debate."
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- **No entry, no trade.** A buy without a belief is refused, and so is one whose entry can't be logged.
|
|
75
|
+
`record="try"` trades anyway and says why the entry is missing.
|
|
76
|
+
- **When it's logged.** The entry is sent after the trade has been simulated, so failed buys never leave entries.
|
|
77
|
+
- **What it covers.** Mainnet markets whose trading window was at least 12 hours long; shorter ones are refused.
|
|
78
|
+
- **Which server.** Entries go to https://agon.nerom.site. The server is in this repo; point `recorder_url`
|
|
79
|
+
or `AGON_URL` at your own instance if you run one.
|
|
80
|
+
- **In the MCP server.** Set `AGON_RECORD=true` (plus `AGON_AGENT_NAME`) and the `buy` tool requires the
|
|
81
|
+
agent's `probability` and `reasoning`. `my_record` shows what it has logged and, after settlement, how it scored.
|
|
82
|
+
- **Proof for the model, too.** An entry can carry a receipt from Gensyn's REE (`receipt=`)
|
|
83
|
+
proving which open model produced the forecast. Agon re-runs receipts on a second machine.
|
|
84
|
+
|
|
85
|
+
## Library
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from agon import Delphi
|
|
89
|
+
|
|
90
|
+
d = Delphi() # mainnet, read-only
|
|
91
|
+
for m in d.search("election", limit=5):
|
|
92
|
+
print(m.summary())
|
|
93
|
+
|
|
94
|
+
m = d.market("0x4F5DC6b636c226CeC0C2403f988f24431b9Cc463")
|
|
95
|
+
print(m.rules, m.sources, m.metadata_verified)
|
|
96
|
+
|
|
97
|
+
q = d.quote_buy(m, "Yes", usd=2) # shares, average price, probability before/after
|
|
98
|
+
print(q.shares, q.average_price, q.probability_after)
|
|
99
|
+
|
|
100
|
+
d = Delphi(private_key="0x...") # or set AGON_PRIVATE_KEY
|
|
101
|
+
t = d.buy(m, "Yes", usd=2, max_slippage=0.02) # approves only what this trade needs
|
|
102
|
+
d.sell(m, "Yes") # everything you hold in that outcome
|
|
103
|
+
|
|
104
|
+
for p in d.positions(): # every market, with what to do next
|
|
105
|
+
print(p.question, p.outcome_label, p.shares, p.value_usd, p.action) # action: redeem | liquidate | None
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
You can pass an address or a `Market` anywhere one is expected, and outcomes take a label (`"Yes"`) or an index.
|
|
109
|
+
Money comes back as USD floats and shares as decimal numbers; every object has `.to_dict()`.
|
|
110
|
+
|
|
111
|
+
## Command line
|
|
112
|
+
|
|
113
|
+
| command | does |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `agon markets [--status open\|settled\|…\|all]` | list markets with live odds, soonest to close first |
|
|
116
|
+
| `agon search <words>` | keyword search over questions, outcomes and rules |
|
|
117
|
+
| `agon market <address>` | one market in full: rules, sources, deadlines, fee, hash check |
|
|
118
|
+
| `agon quote <address> <outcome> --usd N \| --shares N \| --sell N` | price a trade, send nothing |
|
|
119
|
+
| `agon buy <address> <outcome> --usd N` | buy (asks you to type `yes` first unless `--yes`) |
|
|
120
|
+
| `agon sell <address> <outcome> [--shares N]` | sell, default everything |
|
|
121
|
+
| `agon positions [wallet]` | what a wallet holds and can collect |
|
|
122
|
+
| `agon collect <address>` | redeem a settled market, or liquidate an expired or failed one |
|
|
123
|
+
| `agon balance` | your USDC and gas |
|
|
124
|
+
| `agon watch …` | alerts, see below |
|
|
125
|
+
|
|
126
|
+
Add `--json` to any command for machine output, and `--network testnet` or `--network competition-testnet` to
|
|
127
|
+
leave mainnet.
|
|
128
|
+
|
|
129
|
+
## MCP server: let an agent trade, with limits
|
|
130
|
+
|
|
131
|
+
Claude Code:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
claude mcp add agon -- uvx --from "agon-delphi[mcp]" agon-mcp
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Claude Desktop, Cursor, or anything else that speaks MCP over stdio:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"mcpServers": {
|
|
142
|
+
"agon": {
|
|
143
|
+
"command": "uvx",
|
|
144
|
+
"args": ["--from", "agon-delphi[mcp]", "agon-mcp"],
|
|
145
|
+
"env": {
|
|
146
|
+
"AGON_PRIVATE_KEY": "0x...",
|
|
147
|
+
"AGON_ALLOW_TRADING": "true",
|
|
148
|
+
"AGON_MAX_TRADE_USD": "2",
|
|
149
|
+
"AGON_MAX_DAILY_USD": "10"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The read tools are `list_markets`, `get_market`, `quote_buy`, `quote_sell`, `get_positions`, `wallet_status` and `my_record`.
|
|
157
|
+
The write tools are `buy`, `sell` and `collect`.
|
|
158
|
+
|
|
159
|
+
Without a key or `AGON_ALLOW_TRADING=true` the server is read-only, and the write tools say so instead of
|
|
160
|
+
sending anything. With trading on, every buy is checked first:
|
|
161
|
+
|
|
162
|
+
| setting | default |
|
|
163
|
+
|---|---|
|
|
164
|
+
| `AGON_MAX_TRADE_USD` | 5 per trade |
|
|
165
|
+
| `AGON_MAX_DAILY_USD` | 20 per UTC day, kept in a ledger file so a restart doesn't reset it |
|
|
166
|
+
| `AGON_MAX_SLIPPAGE` | 0.03 |
|
|
167
|
+
| `AGON_ALLOWED_MARKETS` | all (comma list of addresses to restrict) |
|
|
168
|
+
|
|
169
|
+
Use a separate wallet for the agent and only put in what you're willing to lose.
|
|
170
|
+
|
|
171
|
+
## Alerts
|
|
172
|
+
|
|
173
|
+
Delphi has no notifications or webhooks, so `agon watch` polls the chain and tells you about:
|
|
174
|
+
|
|
175
|
+
- new markets
|
|
176
|
+
- moves of 10 points or more (`--move`)
|
|
177
|
+
- markets about to close (`--closing-hours`)
|
|
178
|
+
- markets that close, settle (with the winner), fail or expire
|
|
179
|
+
- money your wallet can now collect (`--wallet`)
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
agon watch --query "bitcoin" --telegram # TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID
|
|
183
|
+
agon watch --wallet 0xYou --webhook https://… # each alert POSTed as JSON
|
|
184
|
+
agon watch --json --once # one pass, JSON lines (for cron)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The first run records a baseline, and alerts start from the second check.
|
|
188
|
+
|
|
189
|
+
## What this does that the official SDK doesn't
|
|
190
|
+
|
|
191
|
+
[`@gensyn-ai/gensyn-delphi-sdk`](https://www.npmjs.com/package/@gensyn-ai/gensyn-delphi-sdk) 2.1.0 is TypeScript
|
|
192
|
+
only. Its mainnet config has the two DPM deployments but **not the LMSR one**, and LMSR is where most open markets
|
|
193
|
+
are (56 of 82 when this was written). LMSR quote functions also return three values where DPM returns one. Full
|
|
194
|
+
notes are in [docs/contracts.md](docs/contracts.md).
|
|
195
|
+
|
|
196
|
+
| | SDK 2.1.0 | Agon for Python |
|
|
197
|
+
|---|---|---|
|
|
198
|
+
| Language | TypeScript | Python |
|
|
199
|
+
| Mainnet LMSR markets | no | yes |
|
|
200
|
+
| List markets and positions without an API key | no (REST API needs a key) | yes, from chain |
|
|
201
|
+
| Keyword search | no (category filter only) | yes |
|
|
202
|
+
| Rules-file hash check | no | yes |
|
|
203
|
+
| Buy with a dollar budget | no (exact shares) | yes, never over budget |
|
|
204
|
+
| Default approval | unlimited | exact amount |
|
|
205
|
+
| Agent spending limits | no | yes |
|
|
206
|
+
| Alerts | no | yes |
|
|
207
|
+
| Sealed, scored record of what an agent believed | no | yes (`record=True`) |
|
|
208
|
+
|
|
209
|
+
## Tests
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
uv run pytest tests/test_unit.py # offline, about a second
|
|
213
|
+
uv run pytest tests/test_fork.py -s # needs Foundry's anvil, about a minute, no real money
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The fork tests run a private copy of Gensyn mainnet and put a throwaway wallet through two full lifecycles:
|
|
217
|
+
|
|
218
|
+
- **LMSR:** buy with a $3 budget, sell half, jump the clock past the deadline, settle as Delphi's oracle relayer,
|
|
219
|
+
redeem the winnings.
|
|
220
|
+
- **DPM:** buy, let the market expire unsettled, liquidate.
|
|
221
|
+
- **Record** (with `AGON_TEST_URL` pointing at a local Agon server): a buy without a belief is
|
|
222
|
+
refused, then a belief is signed, accepted by Agon and sealed before the buy is sent.
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
MIT
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Agon for Python
|
|
2
|
+
|
|
3
|
+
[Agon](https://agon.nerom.site) lets agents trade [Delphi](https://delphi.fyi), the prediction market on the Gensyn
|
|
4
|
+
chain, and proves what each agent believed before every trade. This is its Python package: a library, an `agon`
|
|
5
|
+
command, an MCP server so AI agents can trade under spending limits, and alerts.
|
|
6
|
+
|
|
7
|
+
- **No API key.** It reads straight from the chain. A wallet key is only needed to trade.
|
|
8
|
+
- **Every market.** It covers the current LMSR markets and both older parimutuel (DPM) generations: 1,027 mainnet
|
|
9
|
+
markets as of November 2026, plus testnet and the agent-competition network.
|
|
10
|
+
- **A record nobody can edit.** With `record=True`, each buy first seals the agent's stated belief on Agon,
|
|
11
|
+
anchored on Gensyn mainnet, and the market scores it when it settles.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install agon-delphi # library + CLI
|
|
15
|
+
pip install "agon-delphi[mcp]" # + MCP server
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Find a market and price a trade
|
|
19
|
+
|
|
20
|
+
```console
|
|
21
|
+
$ agon search bitcoin --limit 3
|
|
22
|
+
0x44CF6d128e086961b7c0844dE6285c75046d7B7C Dec 25 05:00 $ 27.85 Yes 17% No 83%
|
|
23
|
+
Will Bitcoin exceed $100,000 by Christmas 2026?
|
|
24
|
+
0x662Bba4819098F000d33d1e09Dff5dC3C3a5aa87 Dec 31 00:00 $ 19.11 Yes 33% No 67%
|
|
25
|
+
Will Bitcoin's Coinbase BTC-USD price be above $80,000 at 00:00 UTC on Dec 31, 2026?
|
|
26
|
+
0xc43F7318bf91915dba2A3A02489bdEd2aDC1731f Jan 01 02:00 $ 39.52 Yes 22% No 78%
|
|
27
|
+
Will Bitcoin reach $100k in 2026?
|
|
28
|
+
|
|
29
|
+
$ agon quote 0x4F5DC6b636c226CeC0C2403f988f24431b9Cc463 Yes --usd 5
|
|
30
|
+
buy 7.7223 Yes shares costs $4.9996 (avg 0.6474); probability 50.4% → 75.3%
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Most Delphi pools hold $10–$50, so a $5 trade can move the price 25 points. Every quote shows the probability
|
|
34
|
+
after your trade so you see that before you pay.
|
|
35
|
+
|
|
36
|
+
`agon market <address>` prints the rules the AI judge will apply and the sources it will read. It also checks
|
|
37
|
+
that the rules file matches the hash stored on chain.
|
|
38
|
+
|
|
39
|
+
## Record what your agent believed
|
|
40
|
+
|
|
41
|
+
Turn on `record=True` and every buy must first state what the agent believes. That belief is signed by the
|
|
42
|
+
trading wallet, sealed until trading closes, and anchored on Gensyn mainnet by Agon's contract.
|
|
43
|
+
Nobody can see it before then or change it afterwards. When the market settles, the agent's record writes itself:
|
|
44
|
+
|
|
45
|
+
- **Calibration:** were its probabilities better than the market's price at the time?
|
|
46
|
+
- **Results:** what the same wallet actually bought and sold, read from the chain.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
d = Delphi(private_key=key, record=True, agent_name="my-agent")
|
|
50
|
+
t = d.buy(m, "Yes", usd=2, belief={"Yes": 0.71}, reasoning="Polls moved after the debate.")
|
|
51
|
+
t.record # {'entry': 200, 'belief': 0.71, 'market_probability': 0.50, 'edge': 0.21,
|
|
52
|
+
# 'sealed_until': '2027-12-31T23:00:00Z', 'record_url': 'https://agon.nerom.site/#/agent/0x…', ...}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
agon buy 0x4F5D… Yes --usd 2 --record --belief 0.71 --reason "Polls moved after the debate."
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- **No entry, no trade.** A buy without a belief is refused, and so is one whose entry can't be logged.
|
|
60
|
+
`record="try"` trades anyway and says why the entry is missing.
|
|
61
|
+
- **When it's logged.** The entry is sent after the trade has been simulated, so failed buys never leave entries.
|
|
62
|
+
- **What it covers.** Mainnet markets whose trading window was at least 12 hours long; shorter ones are refused.
|
|
63
|
+
- **Which server.** Entries go to https://agon.nerom.site. The server is in this repo; point `recorder_url`
|
|
64
|
+
or `AGON_URL` at your own instance if you run one.
|
|
65
|
+
- **In the MCP server.** Set `AGON_RECORD=true` (plus `AGON_AGENT_NAME`) and the `buy` tool requires the
|
|
66
|
+
agent's `probability` and `reasoning`. `my_record` shows what it has logged and, after settlement, how it scored.
|
|
67
|
+
- **Proof for the model, too.** An entry can carry a receipt from Gensyn's REE (`receipt=`)
|
|
68
|
+
proving which open model produced the forecast. Agon re-runs receipts on a second machine.
|
|
69
|
+
|
|
70
|
+
## Library
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from agon import Delphi
|
|
74
|
+
|
|
75
|
+
d = Delphi() # mainnet, read-only
|
|
76
|
+
for m in d.search("election", limit=5):
|
|
77
|
+
print(m.summary())
|
|
78
|
+
|
|
79
|
+
m = d.market("0x4F5DC6b636c226CeC0C2403f988f24431b9Cc463")
|
|
80
|
+
print(m.rules, m.sources, m.metadata_verified)
|
|
81
|
+
|
|
82
|
+
q = d.quote_buy(m, "Yes", usd=2) # shares, average price, probability before/after
|
|
83
|
+
print(q.shares, q.average_price, q.probability_after)
|
|
84
|
+
|
|
85
|
+
d = Delphi(private_key="0x...") # or set AGON_PRIVATE_KEY
|
|
86
|
+
t = d.buy(m, "Yes", usd=2, max_slippage=0.02) # approves only what this trade needs
|
|
87
|
+
d.sell(m, "Yes") # everything you hold in that outcome
|
|
88
|
+
|
|
89
|
+
for p in d.positions(): # every market, with what to do next
|
|
90
|
+
print(p.question, p.outcome_label, p.shares, p.value_usd, p.action) # action: redeem | liquidate | None
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
You can pass an address or a `Market` anywhere one is expected, and outcomes take a label (`"Yes"`) or an index.
|
|
94
|
+
Money comes back as USD floats and shares as decimal numbers; every object has `.to_dict()`.
|
|
95
|
+
|
|
96
|
+
## Command line
|
|
97
|
+
|
|
98
|
+
| command | does |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `agon markets [--status open\|settled\|…\|all]` | list markets with live odds, soonest to close first |
|
|
101
|
+
| `agon search <words>` | keyword search over questions, outcomes and rules |
|
|
102
|
+
| `agon market <address>` | one market in full: rules, sources, deadlines, fee, hash check |
|
|
103
|
+
| `agon quote <address> <outcome> --usd N \| --shares N \| --sell N` | price a trade, send nothing |
|
|
104
|
+
| `agon buy <address> <outcome> --usd N` | buy (asks you to type `yes` first unless `--yes`) |
|
|
105
|
+
| `agon sell <address> <outcome> [--shares N]` | sell, default everything |
|
|
106
|
+
| `agon positions [wallet]` | what a wallet holds and can collect |
|
|
107
|
+
| `agon collect <address>` | redeem a settled market, or liquidate an expired or failed one |
|
|
108
|
+
| `agon balance` | your USDC and gas |
|
|
109
|
+
| `agon watch …` | alerts, see below |
|
|
110
|
+
|
|
111
|
+
Add `--json` to any command for machine output, and `--network testnet` or `--network competition-testnet` to
|
|
112
|
+
leave mainnet.
|
|
113
|
+
|
|
114
|
+
## MCP server: let an agent trade, with limits
|
|
115
|
+
|
|
116
|
+
Claude Code:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
claude mcp add agon -- uvx --from "agon-delphi[mcp]" agon-mcp
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Claude Desktop, Cursor, or anything else that speaks MCP over stdio:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"mcpServers": {
|
|
127
|
+
"agon": {
|
|
128
|
+
"command": "uvx",
|
|
129
|
+
"args": ["--from", "agon-delphi[mcp]", "agon-mcp"],
|
|
130
|
+
"env": {
|
|
131
|
+
"AGON_PRIVATE_KEY": "0x...",
|
|
132
|
+
"AGON_ALLOW_TRADING": "true",
|
|
133
|
+
"AGON_MAX_TRADE_USD": "2",
|
|
134
|
+
"AGON_MAX_DAILY_USD": "10"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The read tools are `list_markets`, `get_market`, `quote_buy`, `quote_sell`, `get_positions`, `wallet_status` and `my_record`.
|
|
142
|
+
The write tools are `buy`, `sell` and `collect`.
|
|
143
|
+
|
|
144
|
+
Without a key or `AGON_ALLOW_TRADING=true` the server is read-only, and the write tools say so instead of
|
|
145
|
+
sending anything. With trading on, every buy is checked first:
|
|
146
|
+
|
|
147
|
+
| setting | default |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `AGON_MAX_TRADE_USD` | 5 per trade |
|
|
150
|
+
| `AGON_MAX_DAILY_USD` | 20 per UTC day, kept in a ledger file so a restart doesn't reset it |
|
|
151
|
+
| `AGON_MAX_SLIPPAGE` | 0.03 |
|
|
152
|
+
| `AGON_ALLOWED_MARKETS` | all (comma list of addresses to restrict) |
|
|
153
|
+
|
|
154
|
+
Use a separate wallet for the agent and only put in what you're willing to lose.
|
|
155
|
+
|
|
156
|
+
## Alerts
|
|
157
|
+
|
|
158
|
+
Delphi has no notifications or webhooks, so `agon watch` polls the chain and tells you about:
|
|
159
|
+
|
|
160
|
+
- new markets
|
|
161
|
+
- moves of 10 points or more (`--move`)
|
|
162
|
+
- markets about to close (`--closing-hours`)
|
|
163
|
+
- markets that close, settle (with the winner), fail or expire
|
|
164
|
+
- money your wallet can now collect (`--wallet`)
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
agon watch --query "bitcoin" --telegram # TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID
|
|
168
|
+
agon watch --wallet 0xYou --webhook https://… # each alert POSTed as JSON
|
|
169
|
+
agon watch --json --once # one pass, JSON lines (for cron)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The first run records a baseline, and alerts start from the second check.
|
|
173
|
+
|
|
174
|
+
## What this does that the official SDK doesn't
|
|
175
|
+
|
|
176
|
+
[`@gensyn-ai/gensyn-delphi-sdk`](https://www.npmjs.com/package/@gensyn-ai/gensyn-delphi-sdk) 2.1.0 is TypeScript
|
|
177
|
+
only. Its mainnet config has the two DPM deployments but **not the LMSR one**, and LMSR is where most open markets
|
|
178
|
+
are (56 of 82 when this was written). LMSR quote functions also return three values where DPM returns one. Full
|
|
179
|
+
notes are in [docs/contracts.md](docs/contracts.md).
|
|
180
|
+
|
|
181
|
+
| | SDK 2.1.0 | Agon for Python |
|
|
182
|
+
|---|---|---|
|
|
183
|
+
| Language | TypeScript | Python |
|
|
184
|
+
| Mainnet LMSR markets | no | yes |
|
|
185
|
+
| List markets and positions without an API key | no (REST API needs a key) | yes, from chain |
|
|
186
|
+
| Keyword search | no (category filter only) | yes |
|
|
187
|
+
| Rules-file hash check | no | yes |
|
|
188
|
+
| Buy with a dollar budget | no (exact shares) | yes, never over budget |
|
|
189
|
+
| Default approval | unlimited | exact amount |
|
|
190
|
+
| Agent spending limits | no | yes |
|
|
191
|
+
| Alerts | no | yes |
|
|
192
|
+
| Sealed, scored record of what an agent believed | no | yes (`record=True`) |
|
|
193
|
+
|
|
194
|
+
## Tests
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
uv run pytest tests/test_unit.py # offline, about a second
|
|
198
|
+
uv run pytest tests/test_fork.py -s # needs Foundry's anvil, about a minute, no real money
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The fork tests run a private copy of Gensyn mainnet and put a throwaway wallet through two full lifecycles:
|
|
202
|
+
|
|
203
|
+
- **LMSR:** buy with a $3 budget, sell half, jump the clock past the deadline, settle as Delphi's oracle relayer,
|
|
204
|
+
redeem the winnings.
|
|
205
|
+
- **DPM:** buy, let the market expire unsettled, liquidate.
|
|
206
|
+
- **Record** (with `AGON_TEST_URL` pointing at a local Agon server): a buy without a belief is
|
|
207
|
+
refused, then a belief is signed, accepted by Agon and sealed before the buy is sent.
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
MIT
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "agon-delphi"
|
|
3
|
+
version = "0.3.0"
|
|
4
|
+
description = "Agon for Python: trade Delphi prediction markets from Python and AI agents with no API key, and keep a sealed, on-chain record of what your agent believed before each trade."
|
|
5
|
+
requires-python = ">=3.10"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
keywords = [
|
|
9
|
+
"agon",
|
|
10
|
+
"delphi",
|
|
11
|
+
"gensyn",
|
|
12
|
+
"prediction-markets",
|
|
13
|
+
"mcp",
|
|
14
|
+
"agents",
|
|
15
|
+
"web3",
|
|
16
|
+
]
|
|
17
|
+
dependencies = [
|
|
18
|
+
"httpx>=0.27",
|
|
19
|
+
"web3>=7",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.optional-dependencies]
|
|
23
|
+
mcp = ["mcp>=2.3"]
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
agon = "agon.cli:main"
|
|
27
|
+
agon-mcp = "agon.mcp_server:main"
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://agon.nerom.site"
|
|
31
|
+
Repository = "https://github.com/neromtoobad/agon"
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["uv_build>=0.12.20,<0.13.0"]
|
|
35
|
+
build-backend = "uv_build"
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = ["pytest>=9.2.0"]
|
|
39
|
+
|
|
40
|
+
[tool.uv.build-backend]
|
|
41
|
+
module-name = "agon"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "agon-delphi"
|
|
3
|
+
version = "0.3.0"
|
|
4
|
+
description = "Agon for Python: trade Delphi prediction markets from Python and AI agents with no API key, and keep a sealed, on-chain record of what your agent believed before each trade."
|
|
5
|
+
requires-python = ">=3.10"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
keywords = ["agon", "delphi", "gensyn", "prediction-markets", "mcp", "agents", "web3"]
|
|
9
|
+
dependencies = [
|
|
10
|
+
"httpx>=0.27",
|
|
11
|
+
"web3>=7",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[project.optional-dependencies]
|
|
15
|
+
mcp = [
|
|
16
|
+
"mcp>=2.3",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["uv_build>=0.12.20,<0.13.0"]
|
|
21
|
+
build-backend = "uv_build"
|
|
22
|
+
|
|
23
|
+
[dependency-groups]
|
|
24
|
+
dev = [
|
|
25
|
+
"pytest>=9.2.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
agon = "agon.cli:main"
|
|
30
|
+
agon-mcp = "agon.mcp_server:main"
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://agon.nerom.site"
|
|
34
|
+
Repository = "https://github.com/neromtoobad/agon"
|
|
35
|
+
|
|
36
|
+
[tool.uv.build-backend]
|
|
37
|
+
module-name = "agon"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Agon for Python: read and trade Delphi prediction markets with no API key, and record what your agent
|
|
2
|
+
believed before each trade, sealed and anchored on the Gensyn chain."""
|
|
3
|
+
|
|
4
|
+
from .client import Delphi, DelphiError, InsufficientFunds
|
|
5
|
+
from .models import Market, Position, Quote, Trade
|
|
6
|
+
from .networks import NETWORKS, Deployment, Network
|
|
7
|
+
|
|
8
|
+
__all__ = ["Delphi", "DelphiError", "InsufficientFunds", "Market", "Position", "Quote", "Trade",
|
|
9
|
+
"NETWORKS", "Network", "Deployment"]
|
|
10
|
+
__version__ = "0.3.0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"inputs":[{"internalType":"address","name":"implementation","type":"address"},{"internalType":"uint256","name":"marketCreationFee","type":"uint256"},{"internalType":"address","name":"marketCreationFeeRecipient","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"FailedDeployment","type":"error"},{"inputs":[{"internalType":"uint256","name":"firstIdx","type":"uint256"},{"internalType":"uint256","name":"lastIdx","type":"uint256"}],"name":"FirstIdxExceedsLastIdx","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ImplementationIsNotAContract","type":"error"},{"inputs":[],"name":"ImplementationIsZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint256","name":"lastIdx","type":"uint256"},{"internalType":"uint256","name":"marketCount","type":"uint256"}],"name":"LastIdxOutOfBounds","type":"error"},{"inputs":[{"internalType":"uint256","name":"provided","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"MarketCreationFeeIsTooHigh","type":"error"},{"inputs":[{"internalType":"uint256","name":"provided","type":"uint256"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"MarketCreationFeeIsTooLow","type":"error"},{"inputs":[],"name":"MarketCreationFeeRecipientIsZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"uint256","name":"settlementFees","type":"uint256"},{"internalType":"uint256","name":"marketCreationFee","type":"uint256"}],"name":"SettlementFeesExceedMarketCreationFee","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"deployer","type":"address"},{"indexed":true,"internalType":"address","name":"implementation","type":"address"},{"indexed":false,"internalType":"address","name":"newMarketProxy","type":"address"},{"components":[{"internalType":"uint256","name":"outcomeCount","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"},{"internalType":"uint256","name":"tradingFee","type":"uint256"},{"internalType":"uint256","name":"tradingDeadline","type":"uint256"},{"internalType":"uint256","name":"earliestResolveTime","type":"uint256"},{"internalType":"uint256","name":"settlementDeadline","type":"uint256"}],"indexed":false,"internalType":"struct ILmsrMarketTypes.MarketConfig","name":"newMarketConfig","type":"tuple"},{"components":[{"internalType":"string","name":"uri","type":"string"},{"internalType":"bytes32","name":"uriContentHash","type":"bytes32"}],"indexed":false,"internalType":"struct IDelphiMarket.VerifiableUri","name":"newMarketMetadata","type":"tuple"}],"name":"NewMarketProxy","type":"event"},{"inputs":[],"name":"IMPLEMENTATION","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MARKET_CREATION_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MARKET_CREATION_FEE_RECIPIENT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SETTLEMENT_FEES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"initialDeposit_","type":"uint256"},{"components":[{"internalType":"uint256","name":"outcomeCount","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"},{"internalType":"uint256","name":"tradingFee","type":"uint256"},{"internalType":"uint256","name":"tradingDeadline","type":"uint256"},{"internalType":"uint256","name":"earliestResolveTime","type":"uint256"},{"internalType":"uint256","name":"settlementDeadline","type":"uint256"}],"internalType":"struct ILmsrMarketTypes.MarketConfig","name":"newMarketConfig_","type":"tuple"},{"components":[{"internalType":"string","name":"uri","type":"string"},{"internalType":"bytes32","name":"uriContentHash","type":"bytes32"}],"internalType":"struct IDelphiMarket.VerifiableUri","name":"newMarketMetadata_","type":"tuple"}],"name":"deployNewMarketProxy","outputs":[{"internalType":"address","name":"newMarketProxy","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"firstIdx","type":"uint256"},{"internalType":"uint256","name":"lastIdx","type":"uint256"}],"name":"getMarketProxies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalMarketProxiesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"marketProxies","type":"address[]"}],"name":"marketProxiesExist","outputs":[{"internalType":"bool[]","name":"res","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"marketProxy","type":"address"}],"name":"marketProxyExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"inputs":[{"internalType":"contract IERC20Metadata","name":"token_","type":"address"},{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"required","type":"uint256"}],"name":"AllowanceTooLow","type":"error"},{"inputs":[],"name":"BuyTooSmall","type":"error"},{"inputs":[{"internalType":"address","name":"delphiFactory","type":"address"}],"name":"DelphiFactoryIsNotContract","type":"error"},{"inputs":[],"name":"DelphiFactoryIsZeroAddress","type":"error"},{"inputs":[],"name":"GatewayNotInitialized","type":"error"},{"inputs":[],"name":"GrossTokensOutNotPositive","type":"error"},{"inputs":[{"internalType":"address","name":"initializer","type":"address"},{"internalType":"address","name":"deployer","type":"address"}],"name":"InitializerNotDeployer","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"MarketNotOpen","type":"error"},{"inputs":[{"internalType":"address","name":"marketProxy","type":"address"}],"name":"MarketProxyNotDeployedByFactory","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"NotOracleRelayer","type":"error"},{"inputs":[],"name":"OracleRelayerNotSet","type":"error"},{"inputs":[{"internalType":"uint256","name":"newSupply","type":"uint256"},{"internalType":"uint256","name":"minDelta","type":"uint256"}],"name":"OutcomeSupplyBelowMinDelta","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"SellOverlap","type":"error"},{"inputs":[],"name":"SellTooSmall","type":"error"},{"inputs":[{"internalType":"address","name":"marketProxy","type":"address"}],"name":"SettlementAlreadyLocked","type":"error"},{"inputs":[{"internalType":"address","name":"marketProxy","type":"address"}],"name":"SettlementNotLocked","type":"error"},{"inputs":[{"internalType":"uint256","name":"sharesIn","type":"uint256"},{"internalType":"uint256","name":"minDelta","type":"uint256"}],"name":"SharesInBelowMinDelta","type":"error"},{"inputs":[{"internalType":"uint256","name":"sharesIn","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"}],"name":"SharesInExceedSupply","type":"error"},{"inputs":[{"internalType":"uint256","name":"sharesOut","type":"uint256"},{"internalType":"uint256","name":"minDelta","type":"uint256"}],"name":"SharesOutBelowMinDelta","type":"error"},{"inputs":[],"name":"SqrtOverlap","type":"error"},{"inputs":[{"internalType":"uint8","name":"decimals","type":"uint8"}],"name":"TokenDecimalsTooHigh","type":"error"},{"inputs":[{"internalType":"uint8","name":"decimals","type":"uint8"}],"name":"TokenDecimalsTooLow","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokensIn","type":"uint256"},{"internalType":"uint256","name":"minTokensIn","type":"uint256"}],"name":"TokensInBelowMin","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokensIn","type":"uint256"},{"internalType":"uint256","name":"maxTokensIn","type":"uint256"}],"name":"TokensInExceedsMax","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokensOut","type":"uint256"},{"internalType":"uint256","name":"minTokensOut","type":"uint256"}],"name":"TokensOutBelowMin","type":"error"},{"inputs":[],"name":"ZeroNetTokensIn","type":"error"},{"inputs":[],"name":"ZeroOracleRelayerAddress","type":"error"},{"inputs":[],"name":"ZeroSharesIn","type":"error"},{"inputs":[],"name":"ZeroSharesOut","type":"error"},{"inputs":[],"name":"ZeroTokensIn","type":"error"},{"inputs":[],"name":"ZeroTokensOut","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"uint256","name":"outcomeIdx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokensIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sharesOut","type":"uint256"}],"name":"GatewayBuy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"indexed":true,"internalType":"address","name":"liquidator","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"outcomeIndices","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"sharesIn","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"totalTokensOut","type":"uint256"}],"name":"GatewayLiquidation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"marketProxy","type":"address"}],"name":"GatewayMarketFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"marketProxy","type":"address"},{"indexed":false,"internalType":"uint256","name":"winningOutcomeIdx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"marketCreatorReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refund","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"marketCreatorTradingFeesCut","type":"uint256"}],"name":"GatewayMarketSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"indexed":true,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"sharesIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokensOut","type":"uint256"}],"name":"GatewayRedemption","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"uint256","name":"outcomeIdx","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sharesIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokensOut","type":"uint256"}],"name":"GatewaySell","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"marketProxy","type":"address"},{"indexed":true,"internalType":"address","name":"keeper","type":"address"}],"name":"MarketResolutionRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousRelayer","type":"address"},{"indexed":true,"internalType":"address","name":"newRelayer","type":"address"}],"name":"OracleRelayerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"MIN_SHARES_DELTA","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_TOKENS_DELTA","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_DECIMAL_SCALER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"address[]","name":"owners","type":"address[]"},{"internalType":"uint256[]","name":"outcomeIndices","type":"uint256[]"}],"name":"batchBalanceOf","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"},{"internalType":"uint256","name":"sharesOut","type":"uint256"},{"internalType":"uint256","name":"maxTokensIn","type":"uint256"}],"name":"buyExactOut","outputs":[{"internalType":"uint256","name":"tokensIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"},{"internalType":"uint256","name":"sharesOut","type":"uint256"},{"internalType":"uint256","name":"maxTokensIn","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"buyExactOutWithPermit","outputs":[{"internalType":"uint256","name":"tokensIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"initialPool","type":"uint256"},{"internalType":"uint256","name":"outcomeCount","type":"uint256"}],"name":"calculateInitialDepositAndRefund","outputs":[{"internalType":"uint256","name":"initialDeposit","type":"uint256"},{"internalType":"uint256","name":"refund","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"initialDeposit","type":"uint256"},{"internalType":"uint256","name":"outcomeCount","type":"uint256"}],"name":"calculateInitialPoolAndRefund","outputs":[{"internalType":"uint256","name":"initialPool","type":"uint256"},{"internalType":"uint256","name":"refund","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"delphiFactory","outputs":[{"internalType":"contract IDelphiFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"marketProxy","type":"address"}],"name":"failMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"getMarket","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"outcomeCount","type":"uint256"},{"internalType":"uint256","name":"k","type":"uint256"},{"internalType":"uint256","name":"tradingFee","type":"uint256"},{"internalType":"uint256","name":"tradingDeadline","type":"uint256"},{"internalType":"uint256","name":"settlementDeadline","type":"uint256"}],"internalType":"struct IDynamicParimutuelMarketTypes.MarketConfig","name":"config","type":"tuple"},{"internalType":"uint256","name":"initialPool","type":"uint256"},{"internalType":"uint256","name":"pool","type":"uint256"},{"internalType":"uint256","name":"tradingFees","type":"uint256"},{"internalType":"uint256","name":"refund","type":"uint256"},{"internalType":"uint256","name":"sumTerm36","type":"uint256"},{"internalType":"uint256","name":"winningOutcomeIdx","type":"uint256"}],"internalType":"struct IDynamicParimutuelMarketTypes.Market","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDelphiFactory","name":"delphiFactory_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256[]","name":"outcomeIndices","type":"uint256[]"}],"name":"liquidate","outputs":[{"internalType":"uint256[]","name":"sharesIn","type":"uint256[]"},{"internalType":"uint256","name":"totalTokensOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"liquidateMarketCreationShares","outputs":[{"internalType":"uint256","name":"_totalTokensOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"marketCreationSharesLiquidated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"marketCreator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"marketCreatorSharesPerOutcome","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"marketCreatorTotalSharesLiquidationValue","outputs":[{"internalType":"uint256","name":"tokensOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"}],"name":"marketCreatorWinningSharesSettlementValue","outputs":[{"internalType":"uint256","name":"tokensOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"marketMetadata","outputs":[{"components":[{"internalType":"string","name":"uri","type":"string"},{"internalType":"bytes32","name":"uriContentHash","type":"bytes32"}],"internalType":"struct IDelphiMarket.VerifiableUri","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"marketStatus","outputs":[{"internalType":"enum IDynamicParimutuelMarketTypes.MarketStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"maxInitialDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"maxK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"maxOutcomeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"maxSettlementWindow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"maxTradingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"maxTradingWindow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"minInitialDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"minK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"minOutcomeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"minSettlementWindow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"minTradingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"minTradingWindow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleRelayer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"outcomeSuppliesSum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"},{"internalType":"uint256","name":"sharesOut","type":"uint256"}],"name":"quoteBuyExactOut","outputs":[{"internalType":"uint256","name":"tokensIn","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"},{"internalType":"uint256","name":"sharesIn","type":"uint256"}],"name":"quoteSellExactIn","outputs":[{"internalType":"uint256","name":"tokensOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"sharesIn","type":"uint256"},{"internalType":"uint256","name":"tokensOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"marketProxy","type":"address"}],"name":"resolveMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"},{"internalType":"uint256","name":"sharesIn","type":"uint256"},{"internalType":"uint256","name":"minTokensOut","type":"uint256"}],"name":"sellExactIn","outputs":[{"internalType":"uint256","name":"tokensOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oracleRelayer_","type":"address"}],"name":"setOracleRelayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"winningOutcomeIdx","type":"uint256"},{"internalType":"address","name":"oracleFeeRecipient","type":"address"}],"name":"settleMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"marketProxy","type":"address"}],"name":"settlementLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256[]","name":"outcomeIndices","type":"uint256[]"}],"name":"spotImpliedProbabilities","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"}],"name":"spotImpliedProbability","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"}],"name":"spotPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256[]","name":"outcomeIndices","type":"uint256[]"}],"name":"spotPrices","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256[]","name":"outcomeIndices","type":"uint256[]"}],"name":"totalSupplies","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDynamicParimutuelMarket","name":"marketProxy","type":"address"},{"internalType":"uint256","name":"outcomeIdx","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|