Initial project setup: Add contracts, API definitions, tests, and documentation
- Add Foundry project configuration (foundry.toml, foundry.lock) - Add Solidity contracts (TokenFactory138, BridgeVault138, ComplianceRegistry, etc.) - Add API definitions (OpenAPI, GraphQL, gRPC, AsyncAPI) - Add comprehensive test suite (unit, integration, fuzz, invariants) - Add API services (REST, GraphQL, orchestrator, packet service) - Add documentation (ISO20022 mapping, runbooks, adapter guides) - Add development tools (RBC tool, Swagger UI, mock server) - Update OpenZeppelin submodules to v5.0.0
This commit is contained in:
67
api/packages/openapi/v1/components/parameters.yaml
Normal file
67
api/packages/openapi/v1/components/parameters.yaml
Normal file
@@ -0,0 +1,67 @@
|
||||
components:
|
||||
parameters:
|
||||
IdempotencyKey:
|
||||
name: Idempotency-Key
|
||||
in: header
|
||||
required: false
|
||||
description: Idempotency key for ensuring request is only processed once
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
TokenCode:
|
||||
name: code
|
||||
in: path
|
||||
required: true
|
||||
description: Token code (e.g., USDW)
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[A-Z0-9]{1,10}$'
|
||||
LienId:
|
||||
name: lienId
|
||||
in: path
|
||||
required: true
|
||||
description: Lien identifier
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[0-9]+$'
|
||||
AccountRefId:
|
||||
name: accountRefId
|
||||
in: path
|
||||
required: true
|
||||
description: Hashed account reference identifier
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{64}$'
|
||||
WalletRefId:
|
||||
name: walletRefId
|
||||
in: path
|
||||
required: true
|
||||
description: Hashed wallet reference identifier
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{64}$'
|
||||
TriggerId:
|
||||
name: triggerId
|
||||
in: path
|
||||
required: true
|
||||
description: Trigger identifier
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[a-fA-F0-9]{64}$'
|
||||
PacketId:
|
||||
name: packetId
|
||||
in: path
|
||||
required: true
|
||||
description: Packet identifier
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[a-fA-F0-9]{64}$'
|
||||
LockId:
|
||||
name: lockId
|
||||
in: path
|
||||
required: true
|
||||
description: Bridge lock identifier
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[a-fA-F0-9]{64}$'
|
||||
|
||||
635
api/packages/openapi/v1/components/schemas.yaml
Normal file
635
api/packages/openapi/v1/components/schemas.yaml
Normal file
@@ -0,0 +1,635 @@
|
||||
components:
|
||||
schemas:
|
||||
# Core domain models (reference JSON Schema registry)
|
||||
Token:
|
||||
type: object
|
||||
required:
|
||||
- code
|
||||
- address
|
||||
- name
|
||||
- symbol
|
||||
- decimals
|
||||
- issuer
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
pattern: '^[A-Z0-9]{1,10}$'
|
||||
address:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
name:
|
||||
type: string
|
||||
symbol:
|
||||
type: string
|
||||
decimals:
|
||||
type: integer
|
||||
minimum: 0
|
||||
maximum: 255
|
||||
issuer:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
policy:
|
||||
$ref: '#/components/schemas/TokenPolicy'
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
TokenPolicy:
|
||||
type: object
|
||||
properties:
|
||||
paused:
|
||||
type: boolean
|
||||
bridgeOnly:
|
||||
type: boolean
|
||||
bridge:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
lienMode:
|
||||
type: string
|
||||
enum: ["OFF", "HARD_FREEZE", "ENCUMBERED"]
|
||||
forceTransferMode:
|
||||
type: boolean
|
||||
routes:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Rail'
|
||||
|
||||
Lien:
|
||||
type: object
|
||||
required:
|
||||
- lienId
|
||||
- debtor
|
||||
- amount
|
||||
- active
|
||||
properties:
|
||||
lienId:
|
||||
type: string
|
||||
debtor:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
expiry:
|
||||
type: integer
|
||||
priority:
|
||||
type: integer
|
||||
authority:
|
||||
type: string
|
||||
reasonCode:
|
||||
$ref: '#/components/schemas/ReasonCode'
|
||||
active:
|
||||
type: boolean
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
updatedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
ComplianceProfile:
|
||||
type: object
|
||||
required:
|
||||
- refId
|
||||
- allowed
|
||||
- frozen
|
||||
properties:
|
||||
refId:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{64}$'
|
||||
allowed:
|
||||
type: boolean
|
||||
frozen:
|
||||
type: boolean
|
||||
riskTier:
|
||||
type: integer
|
||||
minimum: 0
|
||||
maximum: 255
|
||||
jurisdictionHash:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{64}$'
|
||||
updatedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
Trigger:
|
||||
type: object
|
||||
required:
|
||||
- triggerId
|
||||
- rail
|
||||
- msgType
|
||||
- state
|
||||
- instructionId
|
||||
properties:
|
||||
triggerId:
|
||||
type: string
|
||||
rail:
|
||||
$ref: '#/components/schemas/Rail'
|
||||
msgType:
|
||||
type: string
|
||||
state:
|
||||
$ref: '#/components/schemas/TriggerState'
|
||||
instructionId:
|
||||
type: string
|
||||
endToEndId:
|
||||
type: string
|
||||
payloadHash:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
token:
|
||||
type: string
|
||||
accountRefId:
|
||||
type: string
|
||||
counterpartyRefId:
|
||||
type: string
|
||||
railTxRef:
|
||||
type: string
|
||||
nullable: true
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
updatedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
Packet:
|
||||
type: object
|
||||
required:
|
||||
- packetId
|
||||
- payloadHash
|
||||
- channel
|
||||
- status
|
||||
properties:
|
||||
packetId:
|
||||
type: string
|
||||
triggerId:
|
||||
type: string
|
||||
instructionId:
|
||||
type: string
|
||||
payloadHash:
|
||||
type: string
|
||||
channel:
|
||||
type: string
|
||||
enum: ["PDF", "AS4", "EMAIL", "PORTAL"]
|
||||
messageRef:
|
||||
type: string
|
||||
nullable: true
|
||||
status:
|
||||
type: string
|
||||
enum: ["GENERATED", "DISPATCHED", "DELIVERED", "ACKNOWLEDGED", "FAILED"]
|
||||
acknowledgements:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
ackId:
|
||||
type: string
|
||||
receivedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
status:
|
||||
type: string
|
||||
enum: ["RECEIVED", "ACCEPTED", "REJECTED"]
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
dispatchedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
|
||||
BridgeLock:
|
||||
type: object
|
||||
required:
|
||||
- lockId
|
||||
- token
|
||||
- amount
|
||||
- status
|
||||
properties:
|
||||
lockId:
|
||||
type: string
|
||||
token:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
from:
|
||||
type: string
|
||||
targetChain:
|
||||
type: string
|
||||
targetRecipient:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
enum: ["LOCKED", "UNLOCKED", "PENDING"]
|
||||
sourceChain:
|
||||
type: string
|
||||
nullable: true
|
||||
sourceTx:
|
||||
type: string
|
||||
nullable: true
|
||||
proof:
|
||||
type: string
|
||||
nullable: true
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
unlockedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
|
||||
AccountRef:
|
||||
type: object
|
||||
required:
|
||||
- refId
|
||||
properties:
|
||||
refId:
|
||||
type: string
|
||||
provider:
|
||||
type: string
|
||||
enum: ["BANK", "FINTECH", "CUSTODIAN", "OTHER"]
|
||||
metadata:
|
||||
type: object
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
WalletRef:
|
||||
type: object
|
||||
required:
|
||||
- refId
|
||||
properties:
|
||||
refId:
|
||||
type: string
|
||||
provider:
|
||||
type: string
|
||||
enum: ["WALLETCONNECT", "FIREBLOCKS", "METAMASK", "OTHER"]
|
||||
address:
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
# Enums
|
||||
ReasonCode:
|
||||
type: string
|
||||
enum:
|
||||
- OK
|
||||
- PAUSED
|
||||
- FROM_FROZEN
|
||||
- TO_FROZEN
|
||||
- FROM_NOT_COMPLIANT
|
||||
- TO_NOT_COMPLIANT
|
||||
- LIEN_BLOCK
|
||||
- INSUFF_FREE_BAL
|
||||
- BRIDGE_ONLY
|
||||
- NOT_ALLOWED_ROUTE
|
||||
- UNAUTHORIZED
|
||||
- CONFIG_ERROR
|
||||
|
||||
TriggerState:
|
||||
type: string
|
||||
enum:
|
||||
- CREATED
|
||||
- VALIDATED
|
||||
- SUBMITTED_TO_RAIL
|
||||
- PENDING
|
||||
- SETTLED
|
||||
- REJECTED
|
||||
- CANCELLED
|
||||
- RECALLED
|
||||
|
||||
Rail:
|
||||
type: string
|
||||
enum:
|
||||
- FEDWIRE
|
||||
- SWIFT
|
||||
- SEPA
|
||||
- RTGS
|
||||
|
||||
# Request/Response models
|
||||
DeployTokenRequest:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- symbol
|
||||
- decimals
|
||||
- issuer
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
symbol:
|
||||
type: string
|
||||
pattern: '^[A-Z0-9]{1,10}$'
|
||||
decimals:
|
||||
type: integer
|
||||
minimum: 0
|
||||
maximum: 255
|
||||
issuer:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
defaultLienMode:
|
||||
type: string
|
||||
enum: ["OFF", "HARD_FREEZE", "ENCUMBERED"]
|
||||
default: "ENCUMBERED"
|
||||
bridgeOnly:
|
||||
type: boolean
|
||||
default: false
|
||||
bridge:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
|
||||
UpdatePolicyRequest:
|
||||
type: object
|
||||
properties:
|
||||
paused:
|
||||
type: boolean
|
||||
bridgeOnly:
|
||||
type: boolean
|
||||
bridge:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
lienMode:
|
||||
type: string
|
||||
enum: ["OFF", "HARD_FREEZE", "ENCUMBERED"]
|
||||
forceTransferMode:
|
||||
type: boolean
|
||||
routes:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Rail'
|
||||
|
||||
MintRequest:
|
||||
type: object
|
||||
required:
|
||||
- to
|
||||
- amount
|
||||
properties:
|
||||
to:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
amount:
|
||||
type: string
|
||||
reasonCode:
|
||||
$ref: '#/components/schemas/ReasonCode'
|
||||
|
||||
BurnRequest:
|
||||
type: object
|
||||
required:
|
||||
- from
|
||||
- amount
|
||||
properties:
|
||||
from:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
amount:
|
||||
type: string
|
||||
reasonCode:
|
||||
$ref: '#/components/schemas/ReasonCode'
|
||||
|
||||
ClawbackRequest:
|
||||
type: object
|
||||
required:
|
||||
- from
|
||||
- to
|
||||
- amount
|
||||
properties:
|
||||
from:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
to:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
amount:
|
||||
type: string
|
||||
reasonCode:
|
||||
$ref: '#/components/schemas/ReasonCode'
|
||||
|
||||
ForceTransferRequest:
|
||||
type: object
|
||||
required:
|
||||
- from
|
||||
- to
|
||||
- amount
|
||||
properties:
|
||||
from:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
to:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
amount:
|
||||
type: string
|
||||
reasonCode:
|
||||
$ref: '#/components/schemas/ReasonCode'
|
||||
|
||||
PlaceLienRequest:
|
||||
type: object
|
||||
required:
|
||||
- debtor
|
||||
- amount
|
||||
properties:
|
||||
debtor:
|
||||
type: string
|
||||
amount:
|
||||
type: string
|
||||
expiry:
|
||||
type: integer
|
||||
minimum: 0
|
||||
priority:
|
||||
type: integer
|
||||
minimum: 0
|
||||
maximum: 255
|
||||
reasonCode:
|
||||
$ref: '#/components/schemas/ReasonCode'
|
||||
|
||||
ReduceLienRequest:
|
||||
type: object
|
||||
required:
|
||||
- reduceBy
|
||||
properties:
|
||||
reduceBy:
|
||||
type: string
|
||||
description: Amount to reduce by
|
||||
|
||||
SetComplianceRequest:
|
||||
type: object
|
||||
required:
|
||||
- allowed
|
||||
properties:
|
||||
allowed:
|
||||
type: boolean
|
||||
riskTier:
|
||||
type: integer
|
||||
minimum: 0
|
||||
maximum: 255
|
||||
jurisdictionHash:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{64}$'
|
||||
|
||||
LinkAccountWalletRequest:
|
||||
type: object
|
||||
required:
|
||||
- accountRefId
|
||||
- walletRefId
|
||||
properties:
|
||||
accountRefId:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{64}$'
|
||||
walletRefId:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{64}$'
|
||||
|
||||
SubmitInboundMessageRequest:
|
||||
type: object
|
||||
required:
|
||||
- msgType
|
||||
- instructionId
|
||||
- payloadHash
|
||||
- payload
|
||||
properties:
|
||||
msgType:
|
||||
type: string
|
||||
pattern: '^[a-z]+\\.[0-9]{3}$'
|
||||
instructionId:
|
||||
type: string
|
||||
endToEndId:
|
||||
type: string
|
||||
payloadHash:
|
||||
type: string
|
||||
payload:
|
||||
type: string
|
||||
description: ISO-20022 XML payload
|
||||
rail:
|
||||
$ref: '#/components/schemas/Rail'
|
||||
|
||||
SubmitOutboundMessageRequest:
|
||||
type: object
|
||||
required:
|
||||
- msgType
|
||||
- instructionId
|
||||
- payloadHash
|
||||
- payload
|
||||
- token
|
||||
- amount
|
||||
- accountRefId
|
||||
- counterpartyRefId
|
||||
properties:
|
||||
msgType:
|
||||
type: string
|
||||
pattern: '^[a-z]+\\.[0-9]{3}$'
|
||||
instructionId:
|
||||
type: string
|
||||
endToEndId:
|
||||
type: string
|
||||
payloadHash:
|
||||
type: string
|
||||
payload:
|
||||
type: string
|
||||
description: ISO-20022 XML payload
|
||||
rail:
|
||||
$ref: '#/components/schemas/Rail'
|
||||
token:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
amount:
|
||||
type: string
|
||||
accountRefId:
|
||||
type: string
|
||||
counterpartyRefId:
|
||||
type: string
|
||||
|
||||
GeneratePacketRequest:
|
||||
type: object
|
||||
required:
|
||||
- triggerId
|
||||
- channel
|
||||
properties:
|
||||
triggerId:
|
||||
type: string
|
||||
channel:
|
||||
type: string
|
||||
enum: ["PDF", "AS4", "EMAIL", "PORTAL"]
|
||||
options:
|
||||
type: object
|
||||
description: Channel-specific options
|
||||
|
||||
BridgeLockRequest:
|
||||
type: object
|
||||
required:
|
||||
- token
|
||||
- amount
|
||||
- targetChain
|
||||
- targetRecipient
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
amount:
|
||||
type: string
|
||||
targetChain:
|
||||
type: string
|
||||
targetRecipient:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
|
||||
BridgeUnlockRequest:
|
||||
type: object
|
||||
required:
|
||||
- lockId
|
||||
- token
|
||||
- to
|
||||
- amount
|
||||
- sourceChain
|
||||
- sourceTx
|
||||
- proof
|
||||
properties:
|
||||
lockId:
|
||||
type: string
|
||||
token:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
to:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{40}$'
|
||||
amount:
|
||||
type: string
|
||||
sourceChain:
|
||||
type: string
|
||||
sourceTx:
|
||||
type: string
|
||||
proof:
|
||||
type: string
|
||||
description: Light client proof
|
||||
|
||||
TransactionResponse:
|
||||
type: object
|
||||
properties:
|
||||
txHash:
|
||||
type: string
|
||||
pattern: '^0x[a-fA-F0-9]{64}$'
|
||||
status:
|
||||
type: string
|
||||
enum: ["PENDING", "SUCCESS", "FAILED"]
|
||||
blockNumber:
|
||||
type: integer
|
||||
nullable: true
|
||||
|
||||
Error:
|
||||
type: object
|
||||
required:
|
||||
- code
|
||||
- message
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
reasonCode:
|
||||
$ref: '#/components/schemas/ReasonCode'
|
||||
details:
|
||||
type: object
|
||||
requestId:
|
||||
type: string
|
||||
|
||||
Reference in New Issue
Block a user