-
Notifications
You must be signed in to change notification settings - Fork 0
feat: PoC redeem frontrun protection #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
921cacc
5f09feb
6b8e5f0
df3f649
c4342da
f51f916
49e51be
0346320
37f05e4
4f509fa
4a99f0e
89f34ac
ff1950d
2b96738
0e46285
3e798f7
369517d
76d4d2b
cfaf3dc
b34b8c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| It uses [Bun](https://bun.com/) for JavaScript and Typescript runtime and package management (instead of Nodejs + npm). | ||
|
|
||
| The content is organized into a Bun workspace. See @README.md for: | ||
|
|
||
| - High-level architecture and component interactions | ||
| - Detailed setup instructions | ||
| - Functional flow documentation | ||
|
|
@@ -15,13 +16,13 @@ | |
|
|
||
| All packages are in the `./packages` directory: | ||
|
|
||
| | Package | Type | Purpose | | ||
| |---------|------|---------| | ||
| | `btcindexer` | Service (Worker) | Bitcoin-to-Sui bridging and minting | | ||
| | `sui-indexer` | Service (Worker) | Sui blockchain monitoring and redemption | | ||
| | `block-ingestor` | Service (Worker) | Receives Bitcoin blocks via REST API | | ||
| | `compliance` | Service (Worker) | Sanctions and geo-blocking data | | ||
| | `lib` | Shared Library | Common utilities and types | | ||
| | Package | Type | Purpose | | ||
| | ---------------- | ---------------- | ---------------------------------------- | | ||
| | `btcindexer` | Service (Worker) | Bitcoin-to-Sui bridging and minting | | ||
| | `sui-indexer` | Service (Worker) | Sui blockchain monitoring and redemption | | ||
| | `block-ingestor` | Service (Worker) | Receives Bitcoin blocks via REST API | | ||
| | `compliance` | Service (Worker) | Sanctions and geo-blocking data | | ||
| | `lib` | Shared Library | Common utilities and types | | ||
|
|
||
| ### Core Technologies | ||
|
|
||
|
|
@@ -138,7 +139,7 @@ | |
|
|
||
| **Location**: `./packages/sui-indexer` | ||
|
|
||
| ### Architecture | ||
|
Check failure on line 142 in AGENTS.md
|
||
|
|
||
| - `src/index.ts` - Entry point with scheduled task | ||
| - `src/processor.ts` - Sui event indexing | ||
|
|
@@ -156,13 +157,13 @@ | |
| - Manages presign objects for Bitcoin transaction signing | ||
| - Implements coin selection logic for redemption transactions | ||
|
|
||
| ### Key Features | ||
|
Check failure on line 160 in AGENTS.md
|
||
|
|
||
| 1. **Event Monitoring**: Indexes Sui events for nBTC redemption requests | ||
| 2. **Redemption Processing**: Handles burn-and-redeem flow with IKA MPC | ||
| 3. **UTXO Management**: Manages UTXO lifecycle (available → locked → spent) | ||
|
|
||
| ### Configuration | ||
|
Check failure on line 166 in AGENTS.md
|
||
|
|
||
| - **Cron**: Every minute (`* * * * *`) | ||
| - **D1 Database**: Shared `btcindexer-dev` | ||
|
|
@@ -176,18 +177,18 @@ | |
|
|
||
| See @packages/block-ingestor/README.md for detailed architecture. | ||
|
|
||
| ### Architecture | ||
|
Check failure on line 180 in AGENTS.md
|
||
|
|
||
| - `src/index.ts` - HTTP router and handlers | ||
| - `src/ingest.ts` - Block ingestion logic | ||
| - `src/api/put-blocks.ts` - msgpack encoding/decoding | ||
| - `src/api/client.ts` - Client for sending blocks | ||
|
|
||
| ### Key Features | ||
|
Check failure on line 187 in AGENTS.md
|
||
|
|
||
| Receives Bitcoin blocks via REST API, validates them, and enqueues to `block-queue` for processing by BTCIndexer. | ||
|
|
||
| ### Configuration | ||
|
Check failure on line 191 in AGENTS.md
|
||
|
|
||
| - **KV Namespace**: `BtcBlocks` (shared with btcindexer) | ||
| - **Queue Producer**: `block-queue` | ||
|
|
@@ -197,25 +198,25 @@ | |
|
|
||
| **Location**: `./packages/compliance` | ||
|
|
||
| ### Architecture | ||
|
Check failure on line 201 in AGENTS.md
|
||
|
|
||
| - `src/index.ts` - Scheduled worker entry point | ||
| - `src/sanction.ts` - Sanctions list updating logic | ||
| - `src/storage.ts` - D1 storage for sanctions | ||
| - `src/rpc.ts` - RPC interface for other services to query compliance data | ||
|
|
||
| ### Key Features | ||
|
Check failure on line 208 in AGENTS.md
|
||
|
|
||
| 1. **Sanctions List Updates**: Daily cron job fetches and updates sanctions data | ||
| 2. **Compliance API**: Exposes RPC methods for other services to check addresses | ||
| 3. **Geo-blocking**: Supports geo-blocking rules | ||
|
|
||
| ### Configuration | ||
|
Check failure on line 214 in AGENTS.md
|
||
|
|
||
| - **Cron**: Daily at 1am (`0 1 * * *`) | ||
| - **D1 Database**: `compliance` | ||
|
|
||
| ### Database Schema | ||
|
Check failure on line 219 in AGENTS.md
|
||
|
|
||
| See migration files in `packages/compliance/db/migrations/`. | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.