everyblock-mcp 0.5.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 +1 -1
- package/dist/chain.js +37 -7
- package/dist/server.js +1 -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
|
@@ -93,4 +93,4 @@ tests). `npm run abi` regenerates `src/abi.ts` from the Foundry build (run `forg
|
|
|
93
93
|
|
|
94
94
|
## License
|
|
95
95
|
|
|
96
|
-
[
|
|
96
|
+
[MIT](LICENSE). Copyright (c) 2026 Samuel Aleonomoh.
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "everyblock-mcp",
|
|
3
|
-
"version": "0.5.
|
|
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.
|