Skip to content

Commit c844169

Browse files
authored
Merge branch 'main' into docs/invariant-test-docs-609
2 parents 24ce4ee + 7439b9e commit c844169

113 files changed

Lines changed: 19328 additions & 7208 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codex

Whitespace-only changes.

.kiro/steering/css-tokens.md

Lines changed: 0 additions & 113 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

NONCE_REPLAY_PROTECTION.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44

55
This implementation adds nonce-based replay protection to operator-authorized actions in the Stellar smart contract, preventing replay attacks and ensuring that operator actions can only be executed once.
66

7+
## Developer Quick Reference
8+
9+
### Nonce lifecycle
10+
11+
1. Read the next expected nonce with `get_operator_nonce(operator)`
12+
2. Submit the signed operator action with that exact nonce
13+
3. Contract accepts once, increments stored nonce, and emits `NonceIncrementedEvent`
14+
4. Reusing old nonce returns `StaleNonce`; skipping ahead returns `InvalidNonce`
15+
16+
### Recommended client flow
17+
18+
- Treat nonce as on-chain state (not local-only state)
19+
- Re-fetch nonce right before signing every operator action
20+
- After a nonce error, re-read nonce before retrying
21+
722
## Changes Made
823

924
### 1. Storage Key Addition (`stellar-contracts/src/lib.rs`)

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ The `FiatBridge` contract exposes read-only views intended for operational dashb
7777
- **AI Integration**: Google Generative AI assistant
7878
- **Fiat Payout**: Paystack API (Nigerian bank transfers)
7979

80+
### 4. Admin Authentication Architecture
81+
The admin dashboard and administrative actions rely on an on-chain root of trust. The `AdminGuard` component in the Next.js app fetches the configured admin address directly from the smart contract using `getAdmin()`. All administrative write operations require cryptographic signatures matching this address, ensuring front-end role spoofing is impossible. For a detailed architectural breakdown, see the [FiatBridge Contract README](stellar-contracts/FIAT_BRIDGE_README.md#admin-authentication-architecture).
82+
8083
## Tech Stack
8184

8285
| Layer | Technology | Purpose |
@@ -100,6 +103,8 @@ DEX-CHAT converts crypto to fiat through an AI-guided conversation flow. The end
100103

101104
The user connects their Freighter wallet and tells the AI assistant they want to offramp a token amount. The frontend builds a Soroban `deposit` transaction that transfers the specified token from the user's Stellar account into the `FiatBridge` contract. The contract validates the deposit against oracle-sourced prices, enforces slippage limits, checks per-token and daily deposit caps, and records a `Receipt` with a unique memo hash.
102105

106+
For maintainers: how slippage BPS and the on-chain threshold interact is documented in [docs/slippage-threshold.md](docs/slippage-threshold.md).
107+
103108
### 2. Escrow (on-chain hold)
104109

105110
Deposited funds are held in the smart contract's escrow. A withdrawal request is queued with a risk tier that determines the timelock duration — higher-value or higher-risk withdrawals wait longer before they can be executed. During this period the admin dashboard provides real-time metrics (queue depth, oldest request age, accrued fees) so operators can monitor the pipeline.

dex_with_fiat_frontend/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ GEMINI_API_KEY=your_gemini_api_key_here
2828

2929
# Admin secret for accessing reconciliation and audit log endpoints.
3030
ADMIN_SECRET=your_admin_secret_here
31+
32+
# Sentry DSN for error tracking and monitoring
33+
NEXT_PUBLIC_SENTRY_DSN=
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
import type { NextConfig } from "next";
1+
import type { NextConfig } from 'next';
2+
import { withSentryConfig } from '@sentry/nextjs';
23

34
const nextConfig: NextConfig = {
45
/* config options here */
56
};
67

7-
export default nextConfig;
8+
export default withSentryConfig(nextConfig, {
9+
org: process.env.SENTRY_ORG,
10+
project: process.env.SENTRY_PROJECT,
11+
silent: !process.env.CI,
12+
widenClientFileUpload: true,
13+
tunnelRoute: '/monitoring',
14+
disableLogger: true,
15+
});

0 commit comments

Comments
 (0)