everyblock-mcp 0.4.0 → 0.5.2
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.
- package/LICENSE +21 -0
- package/README.md +4 -1
- package/dist/abi.js +444 -0
- package/dist/chain.js +37 -7
- package/dist/server.js +85 -1
- package/package.json +3 -8
- package/LICENSE.md +0 -75
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Samuel Aleonomoh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -26,6 +26,9 @@ With neither `RPC_URL` nor `EVERYBLOCK` set it talks to the live Monad testnet d
|
|
|
26
26
|
| `split` / `merge` | yes | Mints complete sets (1 UP + 1 DOWN for $1.00), or burns them back into collateral. |
|
|
27
27
|
| `faucet` | yes | Mints TestUSD collateral (testnet and local only). |
|
|
28
28
|
| `open_market` | yes | Opens the current (or next) market for a feed when no keeper has; returns the existing id if it is open. |
|
|
29
|
+
| `post_quote` | yes | Posts a resting maker quote that joins every batch until filled, cancelled or expired (`ttlSeconds`, default 60). |
|
|
30
|
+
| `cancel_quote` | yes | Takes a quote off (not during the window it sits in) and credits what it holds. |
|
|
31
|
+
| `withdraw_quote_cash` | yes | Collects the cash a market's quotes earned. |
|
|
29
32
|
| `register_agent` | signs | Signs "I am an agent called X" with the wallet and registers it with the app, so the leaderboard shows the name with an Agent badge. No transaction. |
|
|
30
33
|
| `settle` | yes | Proves a market's price to beat and/or its result with signed Pyth prices from the app's `/api/proof` (no Pyth key needed), paying Pyth's update fee. |
|
|
31
34
|
|
|
@@ -90,4 +93,4 @@ tests). `npm run abi` regenerates `src/abi.ts` from the Foundry build (run `forg
|
|
|
90
93
|
|
|
91
94
|
## License
|
|
92
95
|
|
|
93
|
-
[
|
|
96
|
+
[MIT](LICENSE). Copyright (c) 2026 Samuel Aleonomoh.
|
package/dist/abi.js
CHANGED
|
@@ -83,6 +83,32 @@ export const everyblockAbi = [
|
|
|
83
83
|
],
|
|
84
84
|
"stateMutability": "view"
|
|
85
85
|
},
|
|
86
|
+
{
|
|
87
|
+
"type": "function",
|
|
88
|
+
"name": "MAX_QUOTES",
|
|
89
|
+
"inputs": [],
|
|
90
|
+
"outputs": [
|
|
91
|
+
{
|
|
92
|
+
"name": "",
|
|
93
|
+
"type": "uint256",
|
|
94
|
+
"internalType": "uint256"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"stateMutability": "view"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"type": "function",
|
|
101
|
+
"name": "MAX_QUOTES_PER_MAKER",
|
|
102
|
+
"inputs": [],
|
|
103
|
+
"outputs": [
|
|
104
|
+
{
|
|
105
|
+
"name": "",
|
|
106
|
+
"type": "uint256",
|
|
107
|
+
"internalType": "uint256"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"stateMutability": "view"
|
|
111
|
+
},
|
|
86
112
|
{
|
|
87
113
|
"type": "function",
|
|
88
114
|
"name": "MAX_SAMPLE_DELAY",
|
|
@@ -96,6 +122,19 @@ export const everyblockAbi = [
|
|
|
96
122
|
],
|
|
97
123
|
"stateMutability": "view"
|
|
98
124
|
},
|
|
125
|
+
{
|
|
126
|
+
"type": "function",
|
|
127
|
+
"name": "MIN_QUOTE_SIZE",
|
|
128
|
+
"inputs": [],
|
|
129
|
+
"outputs": [
|
|
130
|
+
{
|
|
131
|
+
"name": "",
|
|
132
|
+
"type": "uint64",
|
|
133
|
+
"internalType": "uint64"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"stateMutability": "view"
|
|
137
|
+
},
|
|
99
138
|
{
|
|
100
139
|
"type": "function",
|
|
101
140
|
"name": "SAMPLES",
|
|
@@ -172,6 +211,24 @@ export const everyblockAbi = [
|
|
|
172
211
|
],
|
|
173
212
|
"stateMutability": "view"
|
|
174
213
|
},
|
|
214
|
+
{
|
|
215
|
+
"type": "function",
|
|
216
|
+
"name": "cancelQuote",
|
|
217
|
+
"inputs": [
|
|
218
|
+
{
|
|
219
|
+
"name": "marketId",
|
|
220
|
+
"type": "uint256",
|
|
221
|
+
"internalType": "uint256"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"name": "slot",
|
|
225
|
+
"type": "uint8",
|
|
226
|
+
"internalType": "uint8"
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
"outputs": [],
|
|
230
|
+
"stateMutability": "nonpayable"
|
|
231
|
+
},
|
|
175
232
|
{
|
|
176
233
|
"type": "function",
|
|
177
234
|
"name": "claim",
|
|
@@ -567,6 +624,72 @@ export const everyblockAbi = [
|
|
|
567
624
|
],
|
|
568
625
|
"stateMutability": "view"
|
|
569
626
|
},
|
|
627
|
+
{
|
|
628
|
+
"type": "function",
|
|
629
|
+
"name": "getQuotes",
|
|
630
|
+
"inputs": [
|
|
631
|
+
{
|
|
632
|
+
"name": "marketId",
|
|
633
|
+
"type": "uint256",
|
|
634
|
+
"internalType": "uint256"
|
|
635
|
+
}
|
|
636
|
+
],
|
|
637
|
+
"outputs": [
|
|
638
|
+
{
|
|
639
|
+
"name": "",
|
|
640
|
+
"type": "tuple[4]",
|
|
641
|
+
"internalType": "struct Everyblock.Quote[4]",
|
|
642
|
+
"components": [
|
|
643
|
+
{
|
|
644
|
+
"name": "maker",
|
|
645
|
+
"type": "address",
|
|
646
|
+
"internalType": "address"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"name": "kind",
|
|
650
|
+
"type": "uint8",
|
|
651
|
+
"internalType": "enum Everyblock.Kind"
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"name": "tick",
|
|
655
|
+
"type": "uint8",
|
|
656
|
+
"internalType": "uint8"
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"name": "price",
|
|
660
|
+
"type": "uint8",
|
|
661
|
+
"internalType": "uint8"
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"name": "expiresAt",
|
|
665
|
+
"type": "uint40",
|
|
666
|
+
"internalType": "uint40"
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"name": "batchId",
|
|
670
|
+
"type": "uint40",
|
|
671
|
+
"internalType": "uint40"
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
"name": "size",
|
|
675
|
+
"type": "uint64",
|
|
676
|
+
"internalType": "uint64"
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"name": "offset",
|
|
680
|
+
"type": "uint96",
|
|
681
|
+
"internalType": "uint96"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"name": "escrow",
|
|
685
|
+
"type": "uint128",
|
|
686
|
+
"internalType": "uint128"
|
|
687
|
+
}
|
|
688
|
+
]
|
|
689
|
+
}
|
|
690
|
+
],
|
|
691
|
+
"stateMutability": "view"
|
|
692
|
+
},
|
|
570
693
|
{
|
|
571
694
|
"type": "function",
|
|
572
695
|
"name": "isCleared",
|
|
@@ -826,6 +949,45 @@ export const everyblockAbi = [
|
|
|
826
949
|
],
|
|
827
950
|
"stateMutability": "nonpayable"
|
|
828
951
|
},
|
|
952
|
+
{
|
|
953
|
+
"type": "function",
|
|
954
|
+
"name": "postQuote",
|
|
955
|
+
"inputs": [
|
|
956
|
+
{
|
|
957
|
+
"name": "marketId",
|
|
958
|
+
"type": "uint256",
|
|
959
|
+
"internalType": "uint256"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
"name": "kind",
|
|
963
|
+
"type": "uint8",
|
|
964
|
+
"internalType": "enum Everyblock.Kind"
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
"name": "price",
|
|
968
|
+
"type": "uint8",
|
|
969
|
+
"internalType": "uint8"
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
"name": "size",
|
|
973
|
+
"type": "uint64",
|
|
974
|
+
"internalType": "uint64"
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
"name": "expiresAt",
|
|
978
|
+
"type": "uint40",
|
|
979
|
+
"internalType": "uint40"
|
|
980
|
+
}
|
|
981
|
+
],
|
|
982
|
+
"outputs": [
|
|
983
|
+
{
|
|
984
|
+
"name": "slot",
|
|
985
|
+
"type": "uint8",
|
|
986
|
+
"internalType": "uint8"
|
|
987
|
+
}
|
|
988
|
+
],
|
|
989
|
+
"stateMutability": "nonpayable"
|
|
990
|
+
},
|
|
829
991
|
{
|
|
830
992
|
"type": "function",
|
|
831
993
|
"name": "previewClaim",
|
|
@@ -878,6 +1040,30 @@ export const everyblockAbi = [
|
|
|
878
1040
|
],
|
|
879
1041
|
"stateMutability": "view"
|
|
880
1042
|
},
|
|
1043
|
+
{
|
|
1044
|
+
"type": "function",
|
|
1045
|
+
"name": "quoteCash",
|
|
1046
|
+
"inputs": [
|
|
1047
|
+
{
|
|
1048
|
+
"name": "",
|
|
1049
|
+
"type": "uint256",
|
|
1050
|
+
"internalType": "uint256"
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
"name": "",
|
|
1054
|
+
"type": "address",
|
|
1055
|
+
"internalType": "address"
|
|
1056
|
+
}
|
|
1057
|
+
],
|
|
1058
|
+
"outputs": [
|
|
1059
|
+
{
|
|
1060
|
+
"name": "",
|
|
1061
|
+
"type": "uint256",
|
|
1062
|
+
"internalType": "uint256"
|
|
1063
|
+
}
|
|
1064
|
+
],
|
|
1065
|
+
"stateMutability": "view"
|
|
1066
|
+
},
|
|
881
1067
|
{
|
|
882
1068
|
"type": "function",
|
|
883
1069
|
"name": "redeem",
|
|
@@ -993,6 +1179,25 @@ export const everyblockAbi = [
|
|
|
993
1179
|
],
|
|
994
1180
|
"stateMutability": "view"
|
|
995
1181
|
},
|
|
1182
|
+
{
|
|
1183
|
+
"type": "function",
|
|
1184
|
+
"name": "withdrawQuoteCash",
|
|
1185
|
+
"inputs": [
|
|
1186
|
+
{
|
|
1187
|
+
"name": "marketId",
|
|
1188
|
+
"type": "uint256",
|
|
1189
|
+
"internalType": "uint256"
|
|
1190
|
+
}
|
|
1191
|
+
],
|
|
1192
|
+
"outputs": [
|
|
1193
|
+
{
|
|
1194
|
+
"name": "amount",
|
|
1195
|
+
"type": "uint256",
|
|
1196
|
+
"internalType": "uint256"
|
|
1197
|
+
}
|
|
1198
|
+
],
|
|
1199
|
+
"stateMutability": "nonpayable"
|
|
1200
|
+
},
|
|
996
1201
|
{
|
|
997
1202
|
"type": "event",
|
|
998
1203
|
"name": "BatchCleared",
|
|
@@ -1290,6 +1495,215 @@ export const everyblockAbi = [
|
|
|
1290
1495
|
],
|
|
1291
1496
|
"anonymous": false
|
|
1292
1497
|
},
|
|
1498
|
+
{
|
|
1499
|
+
"type": "event",
|
|
1500
|
+
"name": "QuoteCancelled",
|
|
1501
|
+
"inputs": [
|
|
1502
|
+
{
|
|
1503
|
+
"name": "marketId",
|
|
1504
|
+
"type": "uint256",
|
|
1505
|
+
"indexed": true,
|
|
1506
|
+
"internalType": "uint256"
|
|
1507
|
+
},
|
|
1508
|
+
{
|
|
1509
|
+
"name": "slot",
|
|
1510
|
+
"type": "uint8",
|
|
1511
|
+
"indexed": false,
|
|
1512
|
+
"internalType": "uint8"
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
"name": "maker",
|
|
1516
|
+
"type": "address",
|
|
1517
|
+
"indexed": true,
|
|
1518
|
+
"internalType": "address"
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
"name": "cash",
|
|
1522
|
+
"type": "uint256",
|
|
1523
|
+
"indexed": false,
|
|
1524
|
+
"internalType": "uint256"
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
"name": "tokens",
|
|
1528
|
+
"type": "uint256",
|
|
1529
|
+
"indexed": false,
|
|
1530
|
+
"internalType": "uint256"
|
|
1531
|
+
}
|
|
1532
|
+
],
|
|
1533
|
+
"anonymous": false
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
"type": "event",
|
|
1537
|
+
"name": "QuoteCashWithdrawn",
|
|
1538
|
+
"inputs": [
|
|
1539
|
+
{
|
|
1540
|
+
"name": "marketId",
|
|
1541
|
+
"type": "uint256",
|
|
1542
|
+
"indexed": true,
|
|
1543
|
+
"internalType": "uint256"
|
|
1544
|
+
},
|
|
1545
|
+
{
|
|
1546
|
+
"name": "maker",
|
|
1547
|
+
"type": "address",
|
|
1548
|
+
"indexed": true,
|
|
1549
|
+
"internalType": "address"
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
"name": "amount",
|
|
1553
|
+
"type": "uint256",
|
|
1554
|
+
"indexed": false,
|
|
1555
|
+
"internalType": "uint256"
|
|
1556
|
+
}
|
|
1557
|
+
],
|
|
1558
|
+
"anonymous": false
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
"type": "event",
|
|
1562
|
+
"name": "QuoteFilled",
|
|
1563
|
+
"inputs": [
|
|
1564
|
+
{
|
|
1565
|
+
"name": "marketId",
|
|
1566
|
+
"type": "uint256",
|
|
1567
|
+
"indexed": true,
|
|
1568
|
+
"internalType": "uint256"
|
|
1569
|
+
},
|
|
1570
|
+
{
|
|
1571
|
+
"name": "batchId",
|
|
1572
|
+
"type": "uint256",
|
|
1573
|
+
"indexed": true,
|
|
1574
|
+
"internalType": "uint256"
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
"name": "slot",
|
|
1578
|
+
"type": "uint8",
|
|
1579
|
+
"indexed": false,
|
|
1580
|
+
"internalType": "uint8"
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
"name": "maker",
|
|
1584
|
+
"type": "address",
|
|
1585
|
+
"indexed": true,
|
|
1586
|
+
"internalType": "address"
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
"name": "filled",
|
|
1590
|
+
"type": "uint256",
|
|
1591
|
+
"indexed": false,
|
|
1592
|
+
"internalType": "uint256"
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
"name": "cash",
|
|
1596
|
+
"type": "uint256",
|
|
1597
|
+
"indexed": false,
|
|
1598
|
+
"internalType": "uint256"
|
|
1599
|
+
}
|
|
1600
|
+
],
|
|
1601
|
+
"anonymous": false
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
"type": "event",
|
|
1605
|
+
"name": "QuoteJoined",
|
|
1606
|
+
"inputs": [
|
|
1607
|
+
{
|
|
1608
|
+
"name": "marketId",
|
|
1609
|
+
"type": "uint256",
|
|
1610
|
+
"indexed": true,
|
|
1611
|
+
"internalType": "uint256"
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
"name": "batchId",
|
|
1615
|
+
"type": "uint256",
|
|
1616
|
+
"indexed": true,
|
|
1617
|
+
"internalType": "uint256"
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
"name": "slot",
|
|
1621
|
+
"type": "uint8",
|
|
1622
|
+
"indexed": false,
|
|
1623
|
+
"internalType": "uint8"
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
"name": "maker",
|
|
1627
|
+
"type": "address",
|
|
1628
|
+
"indexed": true,
|
|
1629
|
+
"internalType": "address"
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
"name": "kind",
|
|
1633
|
+
"type": "uint8",
|
|
1634
|
+
"indexed": false,
|
|
1635
|
+
"internalType": "enum Everyblock.Kind"
|
|
1636
|
+
},
|
|
1637
|
+
{
|
|
1638
|
+
"name": "tick",
|
|
1639
|
+
"type": "uint8",
|
|
1640
|
+
"indexed": false,
|
|
1641
|
+
"internalType": "uint8"
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
"name": "size",
|
|
1645
|
+
"type": "uint64",
|
|
1646
|
+
"indexed": false,
|
|
1647
|
+
"internalType": "uint64"
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
"name": "offset",
|
|
1651
|
+
"type": "uint96",
|
|
1652
|
+
"indexed": false,
|
|
1653
|
+
"internalType": "uint96"
|
|
1654
|
+
}
|
|
1655
|
+
],
|
|
1656
|
+
"anonymous": false
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
"type": "event",
|
|
1660
|
+
"name": "QuotePosted",
|
|
1661
|
+
"inputs": [
|
|
1662
|
+
{
|
|
1663
|
+
"name": "marketId",
|
|
1664
|
+
"type": "uint256",
|
|
1665
|
+
"indexed": true,
|
|
1666
|
+
"internalType": "uint256"
|
|
1667
|
+
},
|
|
1668
|
+
{
|
|
1669
|
+
"name": "slot",
|
|
1670
|
+
"type": "uint8",
|
|
1671
|
+
"indexed": false,
|
|
1672
|
+
"internalType": "uint8"
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
"name": "maker",
|
|
1676
|
+
"type": "address",
|
|
1677
|
+
"indexed": true,
|
|
1678
|
+
"internalType": "address"
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
"name": "kind",
|
|
1682
|
+
"type": "uint8",
|
|
1683
|
+
"indexed": false,
|
|
1684
|
+
"internalType": "enum Everyblock.Kind"
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
"name": "price",
|
|
1688
|
+
"type": "uint8",
|
|
1689
|
+
"indexed": false,
|
|
1690
|
+
"internalType": "uint8"
|
|
1691
|
+
},
|
|
1692
|
+
{
|
|
1693
|
+
"name": "size",
|
|
1694
|
+
"type": "uint64",
|
|
1695
|
+
"indexed": false,
|
|
1696
|
+
"internalType": "uint64"
|
|
1697
|
+
},
|
|
1698
|
+
{
|
|
1699
|
+
"name": "expiresAt",
|
|
1700
|
+
"type": "uint40",
|
|
1701
|
+
"indexed": false,
|
|
1702
|
+
"internalType": "uint40"
|
|
1703
|
+
}
|
|
1704
|
+
],
|
|
1705
|
+
"anonymous": false
|
|
1706
|
+
},
|
|
1293
1707
|
{
|
|
1294
1708
|
"type": "event",
|
|
1295
1709
|
"name": "Redeemed",
|
|
@@ -1478,11 +1892,21 @@ export const everyblockAbi = [
|
|
|
1478
1892
|
"name": "NoFeeRecipient",
|
|
1479
1893
|
"inputs": []
|
|
1480
1894
|
},
|
|
1895
|
+
{
|
|
1896
|
+
"type": "error",
|
|
1897
|
+
"name": "NoQuoteSlot",
|
|
1898
|
+
"inputs": []
|
|
1899
|
+
},
|
|
1481
1900
|
{
|
|
1482
1901
|
"type": "error",
|
|
1483
1902
|
"name": "NotOwner",
|
|
1484
1903
|
"inputs": []
|
|
1485
1904
|
},
|
|
1905
|
+
{
|
|
1906
|
+
"type": "error",
|
|
1907
|
+
"name": "NotQuoteMaker",
|
|
1908
|
+
"inputs": []
|
|
1909
|
+
},
|
|
1486
1910
|
{
|
|
1487
1911
|
"type": "error",
|
|
1488
1912
|
"name": "NotSettled",
|
|
@@ -1493,6 +1917,21 @@ export const everyblockAbi = [
|
|
|
1493
1917
|
"name": "NothingToRedeem",
|
|
1494
1918
|
"inputs": []
|
|
1495
1919
|
},
|
|
1920
|
+
{
|
|
1921
|
+
"type": "error",
|
|
1922
|
+
"name": "QuoteBusy",
|
|
1923
|
+
"inputs": []
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
"type": "error",
|
|
1927
|
+
"name": "QuoteExpired",
|
|
1928
|
+
"inputs": []
|
|
1929
|
+
},
|
|
1930
|
+
{
|
|
1931
|
+
"type": "error",
|
|
1932
|
+
"name": "QuoteTooSmall",
|
|
1933
|
+
"inputs": []
|
|
1934
|
+
},
|
|
1496
1935
|
{
|
|
1497
1936
|
"type": "error",
|
|
1498
1937
|
"name": "Reentrancy",
|
|
@@ -1513,6 +1952,11 @@ export const everyblockAbi = [
|
|
|
1513
1952
|
"name": "StrikeNotSet",
|
|
1514
1953
|
"inputs": []
|
|
1515
1954
|
},
|
|
1955
|
+
{
|
|
1956
|
+
"type": "error",
|
|
1957
|
+
"name": "TooManyQuotes",
|
|
1958
|
+
"inputs": []
|
|
1959
|
+
},
|
|
1516
1960
|
{
|
|
1517
1961
|
"type": "error",
|
|
1518
1962
|
"name": "TransferFailed",
|
package/dist/chain.js
CHANGED
|
@@ -9,20 +9,20 @@ export const FEED_NAMES = {
|
|
|
9
9
|
"0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d": "SOL/USD",
|
|
10
10
|
"0x31491744e2dbf6df7fcf4ac0820d18a609b49076d45066d3568424e62f686cd1": "MON/USD",
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
const DEFAULT_FEEDS = Object.keys(FEED_NAMES);
|
|
13
13
|
export const MONAD_MAINNET = 143;
|
|
14
|
-
|
|
14
|
+
const MONAD_TESTNET = 10143;
|
|
15
15
|
/** The live Monad testnet deployment (docs/SUBMISSION.md, "Deployed contracts"). */
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const TESTNET_RPC = "https://testnet-rpc.monad.xyz";
|
|
17
|
+
const TESTNET_EVERYBLOCK = "0x885F6CD4E75F432E8DE60A0fbA97fC0D24c415ad";
|
|
18
18
|
/** The hosted web app's proof endpoint for the testnet deployment. */
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const TESTNET_PROOF_URL = "https://everyblock-gray.vercel.app/api/proof";
|
|
20
|
+
const ANVIL = 31337;
|
|
21
21
|
/** Monad charges the gas limit, not gas used: estimate, then add 15% (as the keeper does). */
|
|
22
22
|
const GAS_MARGIN_PCT = 115n;
|
|
23
23
|
/** The fee function another stream adds; absent on older deployments, which then charge no fee. */
|
|
24
24
|
const feeAbi = parseAbi(["function marketFeeBps(uint256 marketId) view returns (uint256)"]);
|
|
25
|
-
|
|
25
|
+
const isLocalRpc = (url) => /^https?:\/\/(127\.0\.0\.1|localhost)(:|\/|$)/.test(url);
|
|
26
26
|
/**
|
|
27
27
|
* Environment:
|
|
28
28
|
* RPC_URL, EVERYBLOCK the chain and contract (default: both unset = the Monad testnet deployment)
|
|
@@ -175,6 +175,10 @@ export async function send(ctx, target, functionName, args, value) {
|
|
|
175
175
|
let gas;
|
|
176
176
|
try {
|
|
177
177
|
gas = ((await ctx.pub.estimateContractGas(call)) * GAS_MARGIN_PCT) / 100n;
|
|
178
|
+
// An order or quote sent in a window's last seconds may land in the next window and clear this batch first.
|
|
179
|
+
if (target === "everyblock" && (functionName === "placeOrder" || functionName === "postQuote")) {
|
|
180
|
+
gas += await lazyClearGas(ctx, args[0]);
|
|
181
|
+
}
|
|
178
182
|
}
|
|
179
183
|
catch (e) {
|
|
180
184
|
throw new Error(`${functionName} would revert: ${reason(e)}`);
|
|
@@ -205,3 +209,29 @@ export function reason(e) {
|
|
|
205
209
|
}
|
|
206
210
|
/** The batch an order sent now joins: the time window, or the block on per-block deployments. */
|
|
207
211
|
export const batchAt = (ctx, t) => ctx.batchSeconds ? t.timestamp / BigInt(ctx.batchSeconds) : t.number;
|
|
212
|
+
/** Seconds before a window ends in which a transaction may land in the next window (and so clear this batch). */
|
|
213
|
+
const CLEAR_MARGIN_S = 2n;
|
|
214
|
+
/**
|
|
215
|
+
* Extra gas for a write that may have to clear the market's pending batch first: only when that batch's window
|
|
216
|
+
* ends within CLEAR_MARGIN_S (the estimate, taken inside the window, can't include the clearing), sized from its
|
|
217
|
+
* occupied ticks and resting quotes (a full 99x2 book clears for ~400k; each quote adds up to ~60k). Mirrors
|
|
218
|
+
* web/lib/batch.ts. Monad charges the limit, so it is 0 whenever no clearing can fall on this transaction.
|
|
219
|
+
*/
|
|
220
|
+
async function lazyClearGas(ctx, marketId) {
|
|
221
|
+
if (!ctx.batchSeconds)
|
|
222
|
+
return 0n;
|
|
223
|
+
const [m, block] = await Promise.all([read(ctx, "getMarket", [marketId]), ctx.pub.getBlock({ blockTag: "latest" })]);
|
|
224
|
+
const pending = BigInt(m.pendingBatch);
|
|
225
|
+
const end = (pending + 1n) * BigInt(ctx.batchSeconds);
|
|
226
|
+
if (pending === 0n || block.timestamp >= end || end - block.timestamp > CLEAR_MARGIN_S)
|
|
227
|
+
return 0n;
|
|
228
|
+
const [b, quotes] = await Promise.all([read(ctx, "getBatch", [marketId, pending]), read(ctx, "getQuotes", [marketId]).catch(() => [])]);
|
|
229
|
+
const bits = (x) => {
|
|
230
|
+
let n = 0n;
|
|
231
|
+
for (let v = x; v > 0n; v &= v - 1n)
|
|
232
|
+
n++;
|
|
233
|
+
return n;
|
|
234
|
+
};
|
|
235
|
+
const live = BigInt(quotes.filter((q) => /[1-9a-f]/i.test(q.maker.slice(2)) && q.size > 0n).length);
|
|
236
|
+
return 60000n + 2200n * (bits(b[0]) + bits(b[1])) + 60000n * live;
|
|
237
|
+
}
|
package/dist/server.js
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { everyblockAbi } from "./abi.js";
|
|
6
6
|
import { FEED_NAMES, feeBps, MONAD_MAINNET, now, read, readToken, reason, send, serialize, writeBlocker, batchAt, } from "./chain.js";
|
|
7
7
|
import { centsToUsd, clearBatch, describeKind, escrowOf, feeOn, GRACE, isBid, kindOf, KINDS, marketStatus, meanPrice, OUTCOMES, ownPriceAt, priceOf, scenarios, tickOf, usd, WINDOW, } from "./orders.js";
|
|
8
|
-
|
|
8
|
+
const INSTRUCTIONS = `Everyblock runs short crypto UP/DOWN markets (e.g. "is BTC/USD higher at the close than at the open?") on Monad.
|
|
9
9
|
|
|
10
10
|
How it works:
|
|
11
11
|
- Each market has an open and a close time (5 minutes on the live schedule). The strike is the mean of 12 Pyth prices over the 60 s before the open; the closing price is the mean of 12 Pyth prices over the 60 s from the close. UP wins if the closing mean is above the strike, DOWN if below; a tie, or no proof within an hour, voids the market and every share redeems for $0.50.
|
|
@@ -87,8 +87,25 @@ async function marketView(ctx, marketId, t, latestBlock) {
|
|
|
87
87
|
pendingBatch: m.pendingBatch === 0n ? null : m.pendingBatch,
|
|
88
88
|
fee: { bps: fee.bps, source: fee.source },
|
|
89
89
|
lastClearing: latestBlock === null ? undefined : await lastClearing(ctx, marketId, latestBlock),
|
|
90
|
+
restingQuotes: await restingQuotes(ctx, marketId, t),
|
|
90
91
|
};
|
|
91
92
|
}
|
|
93
|
+
/** A market's resting quotes: makers' orders that join every batch until filled, cancelled or expired. */
|
|
94
|
+
async function restingQuotes(ctx, marketId, t) {
|
|
95
|
+
const qs = (await read(ctx, "getQuotes", [marketId]).catch(() => []));
|
|
96
|
+
return qs
|
|
97
|
+
.map((q, slot) => ({ q, slot }))
|
|
98
|
+
.filter(({ q }) => q.maker !== "0x0000000000000000000000000000000000000000")
|
|
99
|
+
.map(({ q, slot }) => ({
|
|
100
|
+
slot,
|
|
101
|
+
maker: q.maker,
|
|
102
|
+
...describeKind(q.kind),
|
|
103
|
+
limitCents: q.price,
|
|
104
|
+
sharesLeft: q.size,
|
|
105
|
+
expires: iso(BigInt(q.expiresAt)),
|
|
106
|
+
live: BigInt(q.expiresAt) > t,
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
92
109
|
async function batchView(ctx, marketId, batchId) {
|
|
93
110
|
const [b, cleared] = await Promise.all([
|
|
94
111
|
read(ctx, "getBatch", [marketId, batchId]),
|
|
@@ -613,6 +630,73 @@ export function createServer(ctx) {
|
|
|
613
630
|
});
|
|
614
631
|
});
|
|
615
632
|
}));
|
|
633
|
+
server.registerTool("post_quote", {
|
|
634
|
+
title: "Post a resting quote",
|
|
635
|
+
description: "Posts a maker quote that rests on the market and joins EVERY batch until it is filled, cancelled, expires or the market closes, so takers arriving at any time can trade against it (an ordinary order lives one batch only). Escrowed once like an order (collateral plus fee for buys, shares for sells). At least 10 shares; at most 4 quotes per market and 2 per maker. Fills go straight to your UP/DOWN balance; cash (sale proceeds, price improvement) accrues until withdraw_quote_cash. Every fill is at the batch's single clearing price, never worse than your limit. Keep quotes short-lived (ttlSeconds) and re-post when the price moves: a resting quote can be hit after the market moves.",
|
|
636
|
+
inputSchema: {
|
|
637
|
+
...orderShape,
|
|
638
|
+
ttlSeconds: z.number().int().min(5).max(3600).optional().describe("How long it rests, in seconds (default 60)."),
|
|
639
|
+
},
|
|
640
|
+
annotations: writes,
|
|
641
|
+
}, guarded(async (a) => {
|
|
642
|
+
const blocked = writeBlocker(ctx);
|
|
643
|
+
if (blocked)
|
|
644
|
+
return fail(blocked);
|
|
645
|
+
if (a.size < 10)
|
|
646
|
+
return fail("a quote needs at least 10 shares");
|
|
647
|
+
return serialize(ctx, async () => {
|
|
648
|
+
const q = await quote(ctx, a);
|
|
649
|
+
if (q.problems.length)
|
|
650
|
+
return fail(`quote refused: ${q.problems.join("; ")}`);
|
|
651
|
+
let approval;
|
|
652
|
+
if (q.escrowCollateral > 0n)
|
|
653
|
+
approval = await ensureAllowance(ctx, q.escrowCollateral);
|
|
654
|
+
const { timestamp } = await now(ctx);
|
|
655
|
+
const expiresAt = timestamp + BigInt(a.ttlSeconds ?? 60);
|
|
656
|
+
const sent = await send(ctx, "everyblock", "postQuote", [q.marketId, q.kind, a.price, q.size, expiresAt]);
|
|
657
|
+
const ev = eventArgs(sent, "QuotePosted");
|
|
658
|
+
return ok({
|
|
659
|
+
posted: true,
|
|
660
|
+
...tx(sent),
|
|
661
|
+
approval,
|
|
662
|
+
quote: { ...q.view.order, slot: ev?.slot, expires: iso(expiresAt) },
|
|
663
|
+
escrow: q.view.escrow,
|
|
664
|
+
next: `It joins every batch until ${iso(expiresAt)}. cancel_quote with slot ${ev?.slot} takes it off (not during the window it is sitting in); withdraw_quote_cash collects what it earned.`,
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
}));
|
|
668
|
+
server.registerTool("cancel_quote", {
|
|
669
|
+
title: "Cancel a resting quote",
|
|
670
|
+
description: "Takes your quote off the market: settles the last batch it joined, then credits what it still holds (collateral to your quote cash, shares back to your balance). Refused while the quote sits in the batch window that is still open; try again a few seconds later.",
|
|
671
|
+
inputSchema: { marketId: id.describe("Market id."), slot: z.number().int().min(0).max(3).describe("The quote's slot (from post_quote or get_market).") },
|
|
672
|
+
annotations: writes,
|
|
673
|
+
}, guarded(async ({ marketId, slot }) => {
|
|
674
|
+
const blocked = writeBlocker(ctx);
|
|
675
|
+
if (blocked)
|
|
676
|
+
return fail(blocked);
|
|
677
|
+
return serialize(ctx, async () => {
|
|
678
|
+
const sent = await send(ctx, "everyblock", "cancelQuote", [BigInt(marketId), slot]);
|
|
679
|
+
const ev = eventArgs(sent, "QuoteCancelled");
|
|
680
|
+
return ok({ cancelled: true, ...tx(sent), marketId, slot, cashCreditedUsd: ev ? usd(ev.cash, ctx.cent) : undefined, sharesReturned: ev?.tokens });
|
|
681
|
+
});
|
|
682
|
+
}));
|
|
683
|
+
server.registerTool("withdraw_quote_cash", {
|
|
684
|
+
title: "Withdraw quote cash",
|
|
685
|
+
description: "Sends you the cash your resting quotes earned in a market (sale proceeds, price improvement, refunds of cancelled quotes).",
|
|
686
|
+
inputSchema: { marketId: id.describe("Market id.") },
|
|
687
|
+
annotations: writes,
|
|
688
|
+
}, guarded(async ({ marketId }) => {
|
|
689
|
+
const blocked = writeBlocker(ctx);
|
|
690
|
+
if (blocked)
|
|
691
|
+
return fail(blocked);
|
|
692
|
+
return serialize(ctx, async () => {
|
|
693
|
+
const owed = (await read(ctx, "quoteCash", [BigInt(marketId), ctx.address]));
|
|
694
|
+
if (owed === 0n)
|
|
695
|
+
return ok({ withdrawn: false, reason: "nothing to withdraw", marketId });
|
|
696
|
+
const sent = await send(ctx, "everyblock", "withdrawQuoteCash", [BigInt(marketId)]);
|
|
697
|
+
return ok({ withdrawn: true, ...tx(sent), marketId, amountUsd: usd(owed, ctx.cent) });
|
|
698
|
+
});
|
|
699
|
+
}));
|
|
616
700
|
server.registerTool("register_agent", {
|
|
617
701
|
title: "Register as an agent",
|
|
618
702
|
description: "Signs a message with this server's wallet saying it is an AI agent with the given name, and registers it with the Everyblock app, so the leaderboard shows the name with an Agent badge and in the Agents tab. Costs nothing (a signature, not a transaction). Run it again to change the name.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "everyblock-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server that lets any AI agent read, quote and trade Everyblock's per-block UP/DOWN markets.",
|
|
6
6
|
"engines": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"files": [
|
|
31
31
|
"dist",
|
|
32
32
|
"README.md",
|
|
33
|
-
"LICENSE
|
|
33
|
+
"LICENSE"
|
|
34
34
|
],
|
|
35
35
|
"keywords": [
|
|
36
36
|
"mcp",
|
|
@@ -40,10 +40,5 @@
|
|
|
40
40
|
"agent",
|
|
41
41
|
"trading"
|
|
42
42
|
],
|
|
43
|
-
"
|
|
44
|
-
"type": "git",
|
|
45
|
-
"url": "git+https://github.com/Osiyomeoh/everyblock.git",
|
|
46
|
-
"directory": "mcp"
|
|
47
|
-
},
|
|
48
|
-
"license": "PolyForm-Noncommercial-1.0.0"
|
|
43
|
+
"license": "MIT"
|
|
49
44
|
}
|
package/LICENSE.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
Required Notice: Copyright (c) 2026 Samuel Aleonomoh (https://github.com/Osiyomeoh)
|
|
2
|
-
|
|
3
|
-
# PolyForm Noncommercial License 1.0.0
|
|
4
|
-
|
|
5
|
-
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
6
|
-
|
|
7
|
-
## Acceptance
|
|
8
|
-
|
|
9
|
-
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
10
|
-
|
|
11
|
-
## Copyright License
|
|
12
|
-
|
|
13
|
-
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
|
|
14
|
-
|
|
15
|
-
## Distribution License
|
|
16
|
-
|
|
17
|
-
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
|
|
18
|
-
|
|
19
|
-
## Notices
|
|
20
|
-
|
|
21
|
-
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
22
|
-
|
|
23
|
-
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
24
|
-
|
|
25
|
-
## Changes and New Works License
|
|
26
|
-
|
|
27
|
-
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
28
|
-
|
|
29
|
-
## Patent License
|
|
30
|
-
|
|
31
|
-
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
32
|
-
|
|
33
|
-
## Noncommercial Purposes
|
|
34
|
-
|
|
35
|
-
Any noncommercial purpose is a permitted purpose.
|
|
36
|
-
|
|
37
|
-
## Personal Uses
|
|
38
|
-
|
|
39
|
-
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
40
|
-
|
|
41
|
-
## Noncommercial Organizations
|
|
42
|
-
|
|
43
|
-
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
44
|
-
|
|
45
|
-
## Fair Use
|
|
46
|
-
|
|
47
|
-
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
48
|
-
|
|
49
|
-
## No Other Rights
|
|
50
|
-
|
|
51
|
-
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
52
|
-
|
|
53
|
-
## Patent Defense
|
|
54
|
-
|
|
55
|
-
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
56
|
-
|
|
57
|
-
## Violations
|
|
58
|
-
|
|
59
|
-
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
60
|
-
|
|
61
|
-
## No Liability
|
|
62
|
-
|
|
63
|
-
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
64
|
-
|
|
65
|
-
## Definitions
|
|
66
|
-
|
|
67
|
-
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
68
|
-
|
|
69
|
-
**You** refers to the individual or entity agreeing to these terms.
|
|
70
|
-
|
|
71
|
-
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
72
|
-
|
|
73
|
-
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
74
|
-
|
|
75
|
-
**Use** means anything you do with the software requiring one of your licenses.
|