@cancore/contracts 0.1.0 → 0.2.0-rc.6

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.
Files changed (50) hide show
  1. package/README.md +266 -10
  2. package/dist/abi.d.ts +6086 -1675
  3. package/dist/abi.js +1 -1
  4. package/dist/{chunk-CIBYXHSX.js → chunk-IAPV7XWJ.js} +2 -2
  5. package/dist/chunk-IAPV7XWJ.js.map +1 -0
  6. package/dist/chunk-NV5IUURP.js +9252 -0
  7. package/dist/chunk-NV5IUURP.js.map +1 -0
  8. package/dist/index.d.ts +1180 -29
  9. package/dist/index.js +2600 -17
  10. package/dist/index.js.map +1 -1
  11. package/dist/networks.d.ts +2 -2
  12. package/dist/networks.js +1 -1
  13. package/package.json +10 -8
  14. package/spec/abi/AttestorSet.json +476 -0
  15. package/spec/abi/CNRX.json +1294 -0
  16. package/spec/abi/CNRXStaking.json +510 -0
  17. package/spec/abi/CancoreRouter.json +2564 -0
  18. package/spec/abi/FeeVault.json +604 -0
  19. package/spec/abi/HTLC.json +717 -0
  20. package/spec/abi/IBurnMintERC20.json +252 -0
  21. package/spec/abi/ICancoreRouter.json +1226 -0
  22. package/spec/abi/IHTLC.json +382 -0
  23. package/spec/abi/IPermit2.json +150 -0
  24. package/spec/abi/MultiBalanceChecker.json +34 -0
  25. package/spec/abi/PointsClaim.json +791 -0
  26. package/spec/protocol/asyncapi.json +1288 -0
  27. package/spec/protocol/messages.schema.json +525 -0
  28. package/spec/protocol/records.schema.json +94 -0
  29. package/spec/protocol/rest.schema.json +118 -0
  30. package/spec/protocol/typed-data/FillerAuth.json +58 -0
  31. package/spec/protocol/typed-data/FillerKeyRegistration.json +69 -0
  32. package/spec/protocol/typed-data/FillerMessage.json +115 -0
  33. package/spec/protocol/typed-data/FillerQuote.json +75 -0
  34. package/spec/protocol/typed-data/GatewayMessage.json +93 -0
  35. package/spec/protocol/typed-data/StakeBinding.json +75 -0
  36. package/spec/protocol/typed-data/TicketIntent.json +113 -0
  37. package/spec/protocol/typed-data/TicketReceipt.json +51 -0
  38. package/spec/protocol/vectors/draw.json +61 -0
  39. package/spec/protocol/vectors/jcs.json +59 -0
  40. package/spec/protocol/vectors/messages.json +523 -0
  41. package/spec/protocol/vectors/records.json +81 -0
  42. package/spec/protocol/vectors/settle-attestations.json +542 -0
  43. package/spec/typed-data/FillProof.json +227 -0
  44. package/spec/typed-data/FillTicket.json +115 -0
  45. package/spec/typed-data/Order.json +141 -0
  46. package/spec/typed-data/Quote.json +69 -0
  47. package/spec/vectors/canton-order.json +67 -0
  48. package/dist/chunk-CIBYXHSX.js.map +0 -1
  49. package/dist/chunk-ZSX67S72.js +0 -3423
  50. package/dist/chunk-ZSX67S72.js.map +0 -1
@@ -0,0 +1,94 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cancore.io/schemas/filler-protocol/v1/records.schema.json",
4
+ "title": "Cancore filler protocol v1 — public records",
5
+ "$comment": "The draw record (GET /v1/draws/{orderHash}), the epoch record (GET /v1/draws/epochs/{id}) — auction-and-draw §3.3–3.4 — and the gateway identity (GET /v1/gateway). Records are signed by the gateway like an S→F frame (sig over GatewayMessage{keccak256(JCS(record without sig))}) but are public: no fillerId, no sentAt.",
6
+ "$defs": {
7
+ "drawCandidate": {
8
+ "type": "object",
9
+ "required": ["fillerId", "weight"],
10
+ "properties": { "fillerId": { "$ref": "messages.schema.json#/$defs/fillerId" }, "weight": { "$ref": "messages.schema.json#/$defs/uintDec256" } }
11
+ },
12
+ "drawAttempt": {
13
+ "type": "object",
14
+ "required": ["attempt", "tBase", "closedBy", "drandRound", "drandRandomness", "drandSignature", "candidates", "r", "winnerFillerId", "fallbackReason"],
15
+ "properties": {
16
+ "attempt": { "$ref": "messages.schema.json#/$defs/uint32" },
17
+ "tBase": { "$ref": "messages.schema.json#/$defs/timeS" },
18
+ "closedBy": { "anyOf": [{ "enum": ["OFFER_TIMEOUT", "OFFER_DECLINE", "TICKET_DECLINE", "TICKET_EXPIRED", "FILLED", null] }, { "$ref": "messages.schema.json#/$defs/futureEnumValue" }] },
19
+ "drandRound": { "$ref": "messages.schema.json#/$defs/uintDec64" },
20
+ "drandRandomness": { "$ref": "messages.schema.json#/$defs/bytes32" },
21
+ "drandSignature": { "type": "string", "pattern": "^0x[0-9a-f]{96}$", "description": "BLS signature of the round, 48 bytes (G1)" },
22
+ "candidates": { "type": "array", "items": { "$ref": "#/$defs/drawCandidate" }, "description": "ascending by the UTF-8 bytes of fillerId (A-22)" },
23
+ "r": { "$ref": "messages.schema.json#/$defs/uintDec256" },
24
+ "winnerFillerId": { "$ref": "messages.schema.json#/$defs/fillerId" },
25
+ "fallbackReason": { "anyOf": [{ "enum": ["DRAW_FALLBACK", null] }, { "$ref": "messages.schema.json#/$defs/futureEnumValue" }] }
26
+ }
27
+ },
28
+ "drawRecord": {
29
+ "type": "object",
30
+ "required": ["orderHash", "source", "openRef", "t0", "epochId", "deltaDrand", "attempts", "sig"],
31
+ "properties": {
32
+ "orderHash": { "$ref": "messages.schema.json#/$defs/bytes32" },
33
+ "source": { "$ref": "messages.schema.json#/$defs/caip2" },
34
+ "openRef": { "type": "string", "minLength": 1, "description": "EVM: open tx hash; Canton: Execute update id" },
35
+ "t0": { "$ref": "messages.schema.json#/$defs/timeS" },
36
+ "epochId": { "$ref": "messages.schema.json#/$defs/uintDec64" },
37
+ "deltaDrand": { "$ref": "messages.schema.json#/$defs/uint32", "description": "seconds" },
38
+ "attempts": { "type": "array", "items": { "$ref": "#/$defs/drawAttempt" } },
39
+ "sig": { "$ref": "messages.schema.json#/$defs/sig65" }
40
+ }
41
+ },
42
+ "epochLeaf": {
43
+ "type": "object",
44
+ "description": "StandardMerkleTree leaf [\"string\", \"uint256\", \"uint8\", \"uint16\"] = (fillerId, base, tier, reliabilityBps)",
45
+ "required": ["fillerId", "base", "tier", "reliabilityBps"],
46
+ "properties": {
47
+ "fillerId": { "$ref": "messages.schema.json#/$defs/fillerId" },
48
+ "base": { "$ref": "messages.schema.json#/$defs/uintDec256" },
49
+ "tier": { "$ref": "messages.schema.json#/$defs/uint8" },
50
+ "reliabilityBps": { "type": "integer", "minimum": 0, "maximum": 10000 }
51
+ }
52
+ },
53
+ "stakeStep": {
54
+ "type": "object",
55
+ "required": ["tier", "minStake", "step"],
56
+ "properties": {
57
+ "tier": { "$ref": "messages.schema.json#/$defs/uint8" },
58
+ "minStake": { "$ref": "messages.schema.json#/$defs/uintDec256" },
59
+ "step": { "$ref": "messages.schema.json#/$defs/uintDec256" }
60
+ }
61
+ },
62
+ "epochRecord": {
63
+ "type": "object",
64
+ "required": ["epochId", "startsAt", "endsAt", "weightsRoot", "leaves", "stakeSteps", "rMinBps", "snapshotBlocks", "sig"],
65
+ "properties": {
66
+ "epochId": { "$ref": "messages.schema.json#/$defs/uintDec64" },
67
+ "startsAt": { "$ref": "messages.schema.json#/$defs/timeS" },
68
+ "endsAt": { "$ref": "messages.schema.json#/$defs/timeS" },
69
+ "weightsRoot": { "$ref": "messages.schema.json#/$defs/bytes32" },
70
+ "leaves": { "type": "array", "items": { "$ref": "#/$defs/epochLeaf" } },
71
+ "stakeSteps": { "type": "array", "items": { "$ref": "#/$defs/stakeStep" } },
72
+ "rMinBps": { "type": "integer", "minimum": 0, "maximum": 10000 },
73
+ "snapshotBlocks": {
74
+ "type": "object",
75
+ "propertyNames": { "$ref": "messages.schema.json#/$defs/caip2" },
76
+ "additionalProperties": { "$ref": "messages.schema.json#/$defs/uintDec64" }
77
+ },
78
+ "sig": { "$ref": "messages.schema.json#/$defs/sig65" }
79
+ }
80
+ },
81
+ "gatewayInfo": {
82
+ "type": "object",
83
+ "description": "GET /v1/gateway: the mirror of @cancore/contracts FILLER_GATEWAYS for this environment. A taker trusts the package, and uses this to notice a rotation",
84
+ "required": ["env", "gateway", "ticketSigners", "protocolVersion", "maxMessageAgeMs"],
85
+ "properties": {
86
+ "env": { "type": "string", "minLength": 1 },
87
+ "gateway": { "$ref": "messages.schema.json#/$defs/address" },
88
+ "ticketSigners": { "type": "array", "items": { "$ref": "messages.schema.json#/$defs/address" } },
89
+ "protocolVersion": { "$ref": "messages.schema.json#/$defs/protocolVersion" },
90
+ "maxMessageAgeMs": { "$ref": "messages.schema.json#/$defs/durationMs", "description": "freshness bound of §3.4 in both directions: |receivedAt − sentAt| ≤ maxMessageAgeMs, and a message id is not reused within it" }
91
+ }
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,118 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cancore.io/schemas/filler-protocol/v1/rest.schema.json",
4
+ "title": "Cancore filler protocol v1 — REST fallback",
5
+ "$comment": "protocol §3.6. Bodies are the WebSocket frames: every request body is a filler message with its envelope (id, fillerId, sentAt) and msgSig, verified before processing as on the WebSocket (S-19); every response is a freshly signed S→F message. /v1/filler/* needs `Authorization: Bearer <token>` from POST /v1/filler/auth; the token is bound to the fillerId it was issued for, and a ticket of another filler is 404 UNKNOWN_TICKET. GET /v1/filler/attestations/{orderHash} answers 404 ATTESTATIONS_NOT_READY until the gateway holds ≥ threshold verified signatures for this filler's fill, and 404 UNKNOWN_TICKET when this filler holds no ticket on the order. /v1/draws/* and /v1/gateway are public. Every non-2xx body is the `error` frame, with the HTTP status of x-error-status. x-endpoints: request/response name a $def here or in messages.schema.json.",
6
+ "x-endpoints": [
7
+ { "method": "GET", "path": "/v1/filler/auth/challenge", "auth": "none", "response": "messages.schema.json#/$defs/auth.challenge" },
8
+ { "method": "POST", "path": "/v1/filler/auth", "auth": "none", "request": "messages.schema.json#/$defs/auth.response", "response": "#/$defs/authToken" },
9
+ { "method": "GET", "path": "/v1/filler/tickets", "auth": "bearer", "query": "#/$defs/ticketListQuery", "response": "#/$defs/ticketList" },
10
+ { "method": "POST", "path": "/v1/filler/tickets/{orderHash}/{attempt}/intent", "auth": "bearer", "request": "messages.schema.json#/$defs/ticket.intent", "response": "messages.schema.json#/$defs/ticket.intent.ack" },
11
+ { "method": "POST", "path": "/v1/filler/tickets/{orderHash}/{attempt}/receipt", "auth": "bearer", "request": "messages.schema.json#/$defs/ticket.receipt", "response": "#/$defs/empty" },
12
+ { "method": "POST", "path": "/v1/filler/tickets/{orderHash}/{attempt}/decline", "auth": "bearer", "request": "messages.schema.json#/$defs/ticket.decline", "response": "#/$defs/empty" },
13
+ { "method": "POST", "path": "/v1/filler/stake-bindings", "auth": "bearer", "request": "#/$defs/stakeBindingRequest", "response": "#/$defs/empty" },
14
+ { "method": "GET", "path": "/v1/filler/quotes", "auth": "bearer", "query": "#/$defs/quoteListQuery", "response": "#/$defs/quoteList" },
15
+ { "method": "GET", "path": "/v1/filler/stats", "auth": "bearer", "response": "#/$defs/fillerStats" },
16
+ { "method": "GET", "path": "/v1/filler/penalties", "auth": "bearer", "query": "#/$defs/pageQuery", "response": "#/$defs/penaltyList" },
17
+ { "method": "GET", "path": "/v1/filler/attestations/{orderHash}", "auth": "bearer", "response": "messages.schema.json#/$defs/settle.attestations" },
18
+ { "method": "GET", "path": "/v1/draws/{orderHash}", "auth": "none", "response": "records.schema.json#/$defs/drawRecord" },
19
+ { "method": "GET", "path": "/v1/draws/epochs/{id}", "auth": "none", "response": "records.schema.json#/$defs/epochRecord" },
20
+ { "method": "GET", "path": "/v1/gateway", "auth": "none", "response": "records.schema.json#/$defs/gatewayInfo" }
21
+ ],
22
+ "x-error-status": {
23
+ "BAD_REQUEST": 400, "UNAUTHENTICATED": 401, "UNSUPPORTED_VERSION": 400, "UNSUPPORTED_TYPE": 400, "BAD_SIGNATURE": 422,
24
+ "STALE_MESSAGE": 400, "REPLAYED_MESSAGE": 409, "TICKET_REFUSED": 409, "UNKNOWN_REQUEST": 404, "UNKNOWN_TICKET": 404, "TICKET_CLOSED": 409, "NOT_ELIGIBLE": 403, "RATE_LIMITED": 429, "INTERNAL": 500,
25
+ "ATTESTATIONS_NOT_READY": 404
26
+ },
27
+ "$defs": {
28
+ "errorBody": { "$ref": "messages.schema.json#/$defs/errorS2F" },
29
+ "empty": { "type": "object", "description": "no fields in v1; receivers ignore unknown ones (V-2)" },
30
+ "authToken": {
31
+ "type": "object",
32
+ "required": ["token", "expiresAt"],
33
+ "properties": { "token": { "type": "string", "minLength": 1 }, "expiresAt": { "$ref": "messages.schema.json#/$defs/timeMs" } }
34
+ },
35
+ "pageQuery": {
36
+ "type": "object",
37
+ "properties": { "cursor": { "type": "string", "minLength": 1 }, "limit": { "type": "string", "pattern": "^([1-9][0-9]?|100)$", "description": "1..100, default 50" } }
38
+ },
39
+ "ticketListQuery": {
40
+ "allOf": [{ "$ref": "#/$defs/pageQuery" }],
41
+ "type": "object",
42
+ "properties": { "status": { "enum": ["OFFERED", "ISSUED"], "description": "a request filter: the gateway owns the list, so it is closed" } }
43
+ },
44
+ "quoteListQuery": {
45
+ "allOf": [{ "$ref": "#/$defs/pageQuery" }],
46
+ "type": "object",
47
+ "properties": { "since": { "type": "string", "pattern": "^(0|[1-9][0-9]*)$", "description": "unix ms" } }
48
+ },
49
+ "ticketList": {
50
+ "type": "object",
51
+ "required": ["items", "nextCursor"],
52
+ "properties": {
53
+ "items": {
54
+ "type": "array",
55
+ "items": { "oneOf": [{ "$ref": "messages.schema.json#/$defs/ticket.offer" }, { "$ref": "messages.schema.json#/$defs/ticket.issued" }] }
56
+ },
57
+ "nextCursor": { "type": ["string", "null"] }
58
+ }
59
+ },
60
+ "stakeBindingRequest": {
61
+ "type": "object",
62
+ "description": "sig = StakeBinding{partnerId, stakingAddress, chainId, nonce} by the staking address; the body carries the filler envelope and msgSig like every request body",
63
+ "allOf": [{ "$ref": "messages.schema.json#/$defs/f2sEnvelope" }],
64
+ "required": ["partnerId", "stakingAddress", "chainId", "nonce", "sig"],
65
+ "properties": {
66
+ "partnerId": { "$ref": "messages.schema.json#/$defs/fillerId" },
67
+ "stakingAddress": { "$ref": "messages.schema.json#/$defs/address" },
68
+ "chainId": { "$ref": "messages.schema.json#/$defs/uintDec256" },
69
+ "nonce": { "$ref": "messages.schema.json#/$defs/uintDec64" },
70
+ "sig": { "$ref": "messages.schema.json#/$defs/sig65" }
71
+ }
72
+ },
73
+ "quoteRecord": {
74
+ "type": "object",
75
+ "required": ["quote", "ack", "status"],
76
+ "properties": {
77
+ "quote": { "$ref": "messages.schema.json#/$defs/quote" },
78
+ "ack": { "$ref": "messages.schema.json#/$defs/quote.ack" },
79
+ "status": { "anyOf": [{ "enum": ["COUNTED", "LATE", "SHORT_TTL", "REPLACED", "BAD_SIG", "OUTLIER", "IN_BAND", "OUT_OF_BAND", "WON", "LOST"] }, { "$ref": "messages.schema.json#/$defs/futureEnumValue" }] }
80
+ }
81
+ },
82
+ "quoteList": {
83
+ "type": "object",
84
+ "required": ["items", "nextCursor"],
85
+ "properties": { "items": { "type": "array", "items": { "$ref": "#/$defs/quoteRecord" } }, "nextCursor": { "type": ["string", "null"] } }
86
+ },
87
+ "fillerStats": {
88
+ "type": "object",
89
+ "required": ["won", "delivered", "noShow", "reliability", "capacityUsd", "inFlightUsd"],
90
+ "properties": {
91
+ "won": { "type": "integer", "minimum": 0 },
92
+ "delivered": { "type": "integer", "minimum": 0 },
93
+ "noShow": { "type": "integer", "minimum": 0 },
94
+ "reliability": { "type": "integer", "minimum": 0, "maximum": 10000, "description": "basis points" },
95
+ "capacityUsd": { "$ref": "messages.schema.json#/$defs/intDecUsd" },
96
+ "inFlightUsd": { "$ref": "messages.schema.json#/$defs/intDecUsd" }
97
+ }
98
+ },
99
+ "penaltyRecord": {
100
+ "type": "object",
101
+ "required": ["violationId", "code", "step", "at", "details"],
102
+ "properties": {
103
+ "violationId": { "type": "string", "minLength": 1 },
104
+ "code": { "type": "string", "minLength": 1 },
105
+ "step": { "$ref": "messages.schema.json#/$defs/penaltyStep" },
106
+ "orderHash": { "$ref": "messages.schema.json#/$defs/bytes32" },
107
+ "attempt": { "$ref": "messages.schema.json#/$defs/uint32" },
108
+ "at": { "$ref": "messages.schema.json#/$defs/timeMs" },
109
+ "details": { "type": "object" }
110
+ }
111
+ },
112
+ "penaltyList": {
113
+ "type": "object",
114
+ "required": ["items", "nextCursor"],
115
+ "properties": { "items": { "type": "array", "items": { "$ref": "#/$defs/penaltyRecord" } }, "nextCursor": { "type": ["string", "null"] } }
116
+ }
117
+ }
118
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "$comment": "Filler protocol v1 (frozen, RC): Signed by the quote key in answer to auth.challenge. Domain CancoreFillerProtocol v1, no chainId, no verifyingContract. Digests by ethers TypedDataEncoder.",
3
+ "primaryType": "FillerAuth",
4
+ "domain": {
5
+ "name": "CancoreFillerProtocol",
6
+ "version": "1",
7
+ "fields": [
8
+ "name",
9
+ "version"
10
+ ]
11
+ },
12
+ "typeString": "FillerAuth(string fillerId,bytes32 nonce,uint64 expiresAt)",
13
+ "types": {
14
+ "FillerAuth": [
15
+ {
16
+ "name": "fillerId",
17
+ "type": "string"
18
+ },
19
+ {
20
+ "name": "nonce",
21
+ "type": "bytes32"
22
+ },
23
+ {
24
+ "name": "expiresAt",
25
+ "type": "uint64"
26
+ }
27
+ ]
28
+ },
29
+ "vectors": [
30
+ {
31
+ "note": "answer to a challenge",
32
+ "message": {
33
+ "fillerId": "acme-markets",
34
+ "nonce": "0x63ed6389bd2a1d23bb678583c227172bda874e82b97b1c170bfeeb4373b4b0d5",
35
+ "expiresAt": "1790000030"
36
+ },
37
+ "digest": "0x08b9926005ad8e873686fbbb4bd260081b5648e62ccb6ba0e2e8d64c0b69233d"
38
+ },
39
+ {
40
+ "note": "every integer at its maximum",
41
+ "message": {
42
+ "fillerId": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
43
+ "nonce": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
44
+ "expiresAt": "18446744073709551615"
45
+ },
46
+ "digest": "0x0355d6c6535d23cb365f8f94fc078f562f7fca4376c6102df44e18e045f4cb1a"
47
+ },
48
+ {
49
+ "note": "zero values, empty string",
50
+ "message": {
51
+ "fillerId": "",
52
+ "nonce": "0x0000000000000000000000000000000000000000000000000000000000000000",
53
+ "expiresAt": "0"
54
+ },
55
+ "digest": "0x9cd41646d5050057d09cc545be00a740a41784e02bfc90d161bf326c667f2df3"
56
+ }
57
+ ]
58
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$comment": "Filler protocol v1, settlement design (variant A, CAN-2139; protocol.md §3.3): Signed by the key being registered (an EOA: 65 bytes, low-s, v ∈ {27, 28}; no EIP-1271) — at onboarding, and with the NEW key at a manual key change by Cancore staff; there is no rotation type. issuedAt in unix seconds. Signed vectors carry `signature` by a test key derived from a public label: it recovers to messageKey. Domain CancoreFillerProtocol v1, no chainId, no verifyingContract. Digests by ethers TypedDataEncoder.",
3
+ "primaryType": "FillerKeyRegistration",
4
+ "domain": {
5
+ "name": "CancoreFillerProtocol",
6
+ "version": "1",
7
+ "fields": [
8
+ "name",
9
+ "version"
10
+ ]
11
+ },
12
+ "typeString": "FillerKeyRegistration(string fillerId,address messageKey,uint64 issuedAt)",
13
+ "types": {
14
+ "FillerKeyRegistration": [
15
+ {
16
+ "name": "fillerId",
17
+ "type": "string"
18
+ },
19
+ {
20
+ "name": "messageKey",
21
+ "type": "address"
22
+ },
23
+ {
24
+ "name": "issuedAt",
25
+ "type": "uint64"
26
+ }
27
+ ]
28
+ },
29
+ "vectors": [
30
+ {
31
+ "note": "onboarding: acme-markets registers its message key",
32
+ "message": {
33
+ "fillerId": "acme-markets",
34
+ "messageKey": "0x4fee983989d3a8046f29d376080ef9c334323105",
35
+ "issuedAt": "1789900000"
36
+ },
37
+ "digest": "0xe73be03b7204b06997bb67d4aefe464f0edbc784e46727a375397cc0c1a508aa",
38
+ "signature": "0x6e2e04d4bd17c204745afb4208c718a77268f6ec07ee39221f12031ccf63fe457bb6fae86dc7fbcbbd6b0818e394d17f1f8812d30fb56ec58b161184af6e5f7d1c"
39
+ },
40
+ {
41
+ "note": "manual key change by Cancore staff: the same registration, signed by the NEW key",
42
+ "message": {
43
+ "fillerId": "acme-markets",
44
+ "messageKey": "0x9ee9e7c9421a25e3f77088f23b16022ecce80ec2",
45
+ "issuedAt": "1790100000"
46
+ },
47
+ "digest": "0xbbadffdde7a3aadf87d8c37d4419936581c647e0f92deccaf393456165f50bd3",
48
+ "signature": "0xddd5690d91e92ab1180b40bcac2e34a815121afe76c8ce949c747392e1ff06af206edd720a4bed70948df02e7483d327db0cc68c5e4f097f63fac04f0c5ccc571c"
49
+ },
50
+ {
51
+ "note": "every integer at its maximum (unsigned)",
52
+ "message": {
53
+ "fillerId": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
54
+ "messageKey": "0xffffffffffffffffffffffffffffffffffffffff",
55
+ "issuedAt": "18446744073709551615"
56
+ },
57
+ "digest": "0xc1ffbf3b5782193f003dd8701be0dc59a94fbcee164641fe7aec31ee391e50b9"
58
+ },
59
+ {
60
+ "note": "zero values (unsigned)",
61
+ "message": {
62
+ "fillerId": "",
63
+ "messageKey": "0x0000000000000000000000000000000000000000",
64
+ "issuedAt": "0"
65
+ },
66
+ "digest": "0xf0170117e8dfc4f1e76def69dffe11d7bf46d2f3f0b849851650bd374b552549"
67
+ }
68
+ ]
69
+ }
@@ -0,0 +1,115 @@
1
+ {
2
+ "$comment": "Filler protocol v1, settlement design (variant A, CAN-2139; protocol.md §3.3): `bodyHash` = keccak256(utf8(JCS(message without \"msgSig\"))), JCS = RFC 8785; the body keeps id, fillerId, sentAt and any inner typed sig. Each vector carries the F→S body, its canonical text and the hash. msgSig in a body is a placeholder: the excluded field. Domain CancoreFillerProtocol v1, no chainId, no verifyingContract. Digests by ethers TypedDataEncoder.",
3
+ "primaryType": "FillerMessage",
4
+ "domain": {
5
+ "name": "CancoreFillerProtocol",
6
+ "version": "1",
7
+ "fields": [
8
+ "name",
9
+ "version"
10
+ ]
11
+ },
12
+ "typeString": "FillerMessage(bytes32 bodyHash)",
13
+ "types": {
14
+ "FillerMessage": [
15
+ {
16
+ "name": "bodyHash",
17
+ "type": "bytes32"
18
+ }
19
+ ]
20
+ },
21
+ "vectors": [
22
+ {
23
+ "note": "ticket.intent: the inner TicketIntent sig is in the body, msgSig is not",
24
+ "body": {
25
+ "type": "ticket.intent",
26
+ "id": "i-1",
27
+ "fillerId": "acme-markets",
28
+ "sentAt": 1790000021000,
29
+ "orderHash": "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
30
+ "attempt": 0,
31
+ "validFrom": "1790000040",
32
+ "validUntil": "1790000400",
33
+ "deliveryKey": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
34
+ "repayTo": "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc",
35
+ "sig": "0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221c",
36
+ "msgSig": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
37
+ },
38
+ "jcs": "{\"attempt\":0,\"deliveryKey\":\"0x742d35cc6634c0532925a3b844bc454e4438f44e\",\"fillerId\":\"acme-markets\",\"id\":\"i-1\",\"orderHash\":\"0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6\",\"repayTo\":\"0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc\",\"sentAt\":1790000021000,\"sig\":\"0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221c\",\"type\":\"ticket.intent\",\"validFrom\":\"1790000040\",\"validUntil\":\"1790000400\"}",
39
+ "message": {
40
+ "bodyHash": "0xfb7c6cbfc7c9db05936598d58d8691affe325f5aa23dc750228b9c55299fbf5a"
41
+ },
42
+ "digest": "0x6d290885737e5c0045c9374bea1a1d55ac27c8b638cdad4fbdb15d25378ba586"
43
+ },
44
+ {
45
+ "note": "ticket.decline: no inner signature, the envelope is the only one",
46
+ "body": {
47
+ "type": "ticket.decline",
48
+ "id": "d-1",
49
+ "fillerId": "acme-markets",
50
+ "sentAt": 1790000027001,
51
+ "orderHash": "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
52
+ "attempt": 0,
53
+ "reason": "TICKET_ISSUED_LATE",
54
+ "detail": "ticket.issued 3001 ms after acceptBy",
55
+ "msgSig": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
56
+ },
57
+ "jcs": "{\"attempt\":0,\"detail\":\"ticket.issued 3001 ms after acceptBy\",\"fillerId\":\"acme-markets\",\"id\":\"d-1\",\"orderHash\":\"0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6\",\"reason\":\"TICKET_ISSUED_LATE\",\"sentAt\":1790000027001,\"type\":\"ticket.decline\"}",
58
+ "message": {
59
+ "bodyHash": "0xbce98e0bf252ac12261023c2182f57109ae8464e9e5732a90b2b456a8b8c7b41"
60
+ },
61
+ "digest": "0xf3902941f23658e47a4085e26270b084619a2fce12a7ca7356120890feaea1be"
62
+ },
63
+ {
64
+ "note": "quote.reconfirm.reply declining: signed by the envelope only",
65
+ "body": {
66
+ "type": "quote.reconfirm.reply",
67
+ "id": "r-2",
68
+ "fillerId": "acme-markets",
69
+ "sentAt": 1790000014000,
70
+ "orderHash": "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
71
+ "accept": false,
72
+ "msgSig": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
73
+ },
74
+ "jcs": "{\"accept\":false,\"fillerId\":\"acme-markets\",\"id\":\"r-2\",\"orderHash\":\"0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6\",\"sentAt\":1790000014000,\"type\":\"quote.reconfirm.reply\"}",
75
+ "message": {
76
+ "bodyHash": "0x3408b67652613536d8c2b1cf1be3acf7e7fa2ec5dd9515a9729e19108b4aa67e"
77
+ },
78
+ "digest": "0x1aa4c883ead3820c13bb033585574a5b1b9a318333f896a5e55222c31073abfb"
79
+ },
80
+ {
81
+ "note": "pong to a gateway ping",
82
+ "body": {
83
+ "type": "pong",
84
+ "id": "po-1",
85
+ "fillerId": "acme-markets",
86
+ "sentAt": 1789999995100,
87
+ "re": "gp-1",
88
+ "msgSig": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
89
+ },
90
+ "jcs": "{\"fillerId\":\"acme-markets\",\"id\":\"po-1\",\"re\":\"gp-1\",\"sentAt\":1789999995100,\"type\":\"pong\"}",
91
+ "message": {
92
+ "bodyHash": "0x59ce596a6f75b446a92f1a8e26a3e299a1c963e06ad2fce66f17671e9b0d3eba"
93
+ },
94
+ "digest": "0xd2cf52769b873de0eec06857660e595e6b25ddad5f1ff782ebc74d7ec4cf9ab7"
95
+ },
96
+ {
97
+ "note": "error from the filler: a frame it cannot handle",
98
+ "body": {
99
+ "type": "error",
100
+ "id": "e-1",
101
+ "fillerId": "acme-markets",
102
+ "sentAt": 1790000030000,
103
+ "re": "g-77",
104
+ "code": "UNKNOWN_TICKET",
105
+ "message": "no ticket for this orderHash",
106
+ "msgSig": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
107
+ },
108
+ "jcs": "{\"code\":\"UNKNOWN_TICKET\",\"fillerId\":\"acme-markets\",\"id\":\"e-1\",\"message\":\"no ticket for this orderHash\",\"re\":\"g-77\",\"sentAt\":1790000030000,\"type\":\"error\"}",
109
+ "message": {
110
+ "bodyHash": "0xc9cd1026df66737e04da90ecd692f7c2d13b1dc328d3aca964baebfe78be96b6"
111
+ },
112
+ "digest": "0x3fba365492f3b5498fa1861648f4625d94d15278fd07e92fb95e5733c2434b2f"
113
+ }
114
+ ]
115
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "$comment": "Filler protocol v1, settlement design (variant A, CAN-2139; protocol.md §3.3): `requestId` = keccak256(utf8(requestId)), each vector names the string it hashes; `fillerId` is the quoting filler's id as a string. Signed by the message key. Domain CancoreFillerProtocol v1, no chainId, no verifyingContract. Digests by ethers TypedDataEncoder.",
3
+ "primaryType": "FillerQuote",
4
+ "domain": {
5
+ "name": "CancoreFillerProtocol",
6
+ "version": "1",
7
+ "fields": [
8
+ "name",
9
+ "version"
10
+ ]
11
+ },
12
+ "typeString": "FillerQuote(bytes32 requestId,string fillerId,uint256 amountOut,uint64 validUntil,uint64 nonce)",
13
+ "types": {
14
+ "FillerQuote": [
15
+ {
16
+ "name": "requestId",
17
+ "type": "bytes32"
18
+ },
19
+ {
20
+ "name": "fillerId",
21
+ "type": "string"
22
+ },
23
+ {
24
+ "name": "amountOut",
25
+ "type": "uint256"
26
+ },
27
+ {
28
+ "name": "validUntil",
29
+ "type": "uint64"
30
+ },
31
+ {
32
+ "name": "nonce",
33
+ "type": "uint64"
34
+ }
35
+ ]
36
+ },
37
+ "vectors": [
38
+ {
39
+ "note": "typical quote",
40
+ "requestIdString": "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
41
+ "message": {
42
+ "requestId": "0x4b719538a6492794ff50c3ddbfde37e42bc802b9063ff4356c0945b5e9639f24",
43
+ "fillerId": "acme-markets",
44
+ "amountOut": "999000000",
45
+ "validUntil": "1790000060",
46
+ "nonce": "1"
47
+ },
48
+ "digest": "0xe3b63a6ae2730532fb841002059d6e8c92124d95e98c09857d7e0f5ba3512e3b"
49
+ },
50
+ {
51
+ "note": "every integer at its maximum, 64-character request id, 63-character fillerId",
52
+ "requestIdString": "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
53
+ "message": {
54
+ "requestId": "0xed68c8357dc6066eb99776f6a12613ca306bb78066e20c62fe30eafcc78ace8b",
55
+ "fillerId": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",
56
+ "amountOut": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
57
+ "validUntil": "18446744073709551615",
58
+ "nonce": "18446744073709551615"
59
+ },
60
+ "digest": "0x44f94a3bd804f9a24e94d2b731e75f8cb48c31257726185e7f1330d628032364"
61
+ },
62
+ {
63
+ "note": "zero values, one-character request id, one-character fillerId",
64
+ "requestIdString": "!",
65
+ "message": {
66
+ "requestId": "0x3275a893b2c93461554cf2a4dd7f413d56decdd6f3fdf0589dbb8bc4fd742386",
67
+ "fillerId": "0",
68
+ "amountOut": "0",
69
+ "validUntil": "0",
70
+ "nonce": "0"
71
+ },
72
+ "digest": "0xfd2112078aeedf176c9d476e5afd3a6da22c69abaaed33904b2a042754d9925f"
73
+ }
74
+ ]
75
+ }
@@ -0,0 +1,93 @@
1
+ {
2
+ "$comment": "Filler protocol v1 (frozen, RC): `bodyHash` = keccak256(utf8(JCS(message without \"sig\"))), JCS = RFC 8785. Each vector carries the S→F body, its canonical text and the hash. Domain CancoreFillerProtocol v1, no chainId, no verifyingContract. Digests by ethers TypedDataEncoder.",
3
+ "primaryType": "GatewayMessage",
4
+ "domain": {
5
+ "name": "CancoreFillerProtocol",
6
+ "version": "1",
7
+ "fields": [
8
+ "name",
9
+ "version"
10
+ ]
11
+ },
12
+ "typeString": "GatewayMessage(bytes32 bodyHash)",
13
+ "types": {
14
+ "GatewayMessage": [
15
+ {
16
+ "name": "bodyHash",
17
+ "type": "bytes32"
18
+ }
19
+ ]
20
+ },
21
+ "vectors": [
22
+ {
23
+ "note": "ticket.offer of the fixture order; `sig` is excluded from the body",
24
+ "body": {
25
+ "type": "ticket.offer",
26
+ "id": "g-20",
27
+ "fillerId": "acme-markets",
28
+ "sentAt": 1790000020000,
29
+ "orderHash": "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
30
+ "attempt": 0,
31
+ "order": {
32
+ "user": "0xa11ce00000000000000000000000000000000001",
33
+ "originChainId": "11155111",
34
+ "inputToken": "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
35
+ "inputAmount": "1003000000",
36
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000066eee",
37
+ "outputAsset": "0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d",
38
+ "minReceived": "999000000",
39
+ "recipient": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
40
+ "createdAt": "1790000000",
41
+ "fillDeadline": "1790000600",
42
+ "feeBps": "30"
43
+ },
44
+ "amountOut": "999000000",
45
+ "validFrom": "1790000040",
46
+ "validUntil": "1790000400",
47
+ "acceptBy": 1790000023000,
48
+ "sig": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
49
+ },
50
+ "jcs": "{\"acceptBy\":1790000023000,\"amountOut\":\"999000000\",\"attempt\":0,\"fillerId\":\"acme-markets\",\"id\":\"g-20\",\"order\":{\"createdAt\":\"1790000000\",\"destination\":\"0x0000000000000000000000000000000000000000000000000000000000066eee\",\"feeBps\":\"30\",\"fillDeadline\":\"1790000600\",\"inputAmount\":\"1003000000\",\"inputToken\":\"0x1c7d4b196cb0c7b01d743fbc6116a902379c7238\",\"minReceived\":\"999000000\",\"originChainId\":\"11155111\",\"outputAsset\":\"0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d\",\"recipient\":\"0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e\",\"user\":\"0xa11ce00000000000000000000000000000000001\"},\"orderHash\":\"0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6\",\"sentAt\":1790000020000,\"type\":\"ticket.offer\",\"validFrom\":\"1790000040\",\"validUntil\":\"1790000400\"}",
51
+ "message": {
52
+ "bodyHash": "0x9761fd334e3181da88a7535ed44b41ad489861149416d59559afeff730e6aca7"
53
+ },
54
+ "digest": "0xe9fe85265890cbe31ec53a5edd4fcd2309fcad75f82de04e9772cd480adfc242"
55
+ },
56
+ {
57
+ "note": "quote.ack",
58
+ "body": {
59
+ "type": "quote.ack",
60
+ "id": "g-9",
61
+ "fillerId": "acme-markets",
62
+ "sentAt": 1789999991001,
63
+ "re": "q-1",
64
+ "requestId": "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
65
+ "quoteHash": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
66
+ "receivedAt": 1789999991000,
67
+ "status": "COUNTED",
68
+ "sig": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
69
+ },
70
+ "jcs": "{\"fillerId\":\"acme-markets\",\"id\":\"g-9\",\"quoteHash\":\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\",\"re\":\"q-1\",\"receivedAt\":1789999991000,\"requestId\":\"req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31\",\"sentAt\":1789999991001,\"status\":\"COUNTED\",\"type\":\"quote.ack\"}",
71
+ "message": {
72
+ "bodyHash": "0x3ac71a88363d0cfbf721dc01913a0701358a201fc5ffa1241265c507d9ef49ce"
73
+ },
74
+ "digest": "0xc9912d2414f6eb8c78a4b9327bddf42de058b9b7f41f64ee938b347cb8d9427b"
75
+ },
76
+ {
77
+ "note": "auth.challenge: the one frame without fillerId",
78
+ "body": {
79
+ "type": "auth.challenge",
80
+ "id": "g-1",
81
+ "sentAt": 1789999980000,
82
+ "nonce": "0x63ed6389bd2a1d23bb678583c227172bda874e82b97b1c170bfeeb4373b4b0d5",
83
+ "expiresAt": "1790000030",
84
+ "sig": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
85
+ },
86
+ "jcs": "{\"expiresAt\":\"1790000030\",\"id\":\"g-1\",\"nonce\":\"0x63ed6389bd2a1d23bb678583c227172bda874e82b97b1c170bfeeb4373b4b0d5\",\"sentAt\":1789999980000,\"type\":\"auth.challenge\"}",
87
+ "message": {
88
+ "bodyHash": "0x3b18b7f3fb449214fba90add5344539a1a1053a7f851f6b147b50af4e7ac33c6"
89
+ },
90
+ "digest": "0x4d8c912572367e3bdda6bceb31820513a3b45775c88f14132199a0e86e39df2e"
91
+ }
92
+ ]
93
+ }