everyblock-mcp 0.4.0 → 0.5.0
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/README.md +3 -0
- package/dist/abi.js +444 -0
- package/dist/chain.js +1 -1
- package/dist/server.js +84 -0
- package/package.json +1 -1
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
|
|
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
|
@@ -14,7 +14,7 @@ export const MONAD_MAINNET = 143;
|
|
|
14
14
|
export const MONAD_TESTNET = 10143;
|
|
15
15
|
/** The live Monad testnet deployment (docs/SUBMISSION.md, "Deployed contracts"). */
|
|
16
16
|
export const TESTNET_RPC = "https://testnet-rpc.monad.xyz";
|
|
17
|
-
export const TESTNET_EVERYBLOCK = "
|
|
17
|
+
export const TESTNET_EVERYBLOCK = "0x885F6CD4E75F432E8DE60A0fbA97fC0D24c415ad";
|
|
18
18
|
/** The hosted web app's proof endpoint for the testnet deployment. */
|
|
19
19
|
export const TESTNET_PROOF_URL = "https://everyblock-gray.vercel.app/api/proof";
|
|
20
20
|
export const ANVIL = 31337;
|
package/dist/server.js
CHANGED
|
@@ -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.",
|