Skip to content

Commit 3883f9f

Browse files
authored
Merge branch 'main' into feature/cross-contract-reentrancy-tests
2 parents 79920ea + 7bde77f commit 3883f9f

16,392 files changed

Lines changed: 1926781 additions & 23825 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.

.env.example

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +0,0 @@
1-
# Server Configuration
2-
PORT=3000
3-
4-
# Stellar Configuration (Optional - will run in simulation mode if not provided)
5-
STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org
6-
STELLAR_AUDIT_ACCOUNT_PUBLIC_KEY=your_stellar_public_key_here
7-
STELLAR_AUDIT_ACCOUNT_SECRET_KEY=your_stellar_secret_key_here
8-
9-
# Database Configuration (SQLite - file will be created automatically)
10-
DB_PATH=./data/audit.db

.github/workflows/test.yml

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Vesting API Tests
1+
name: Vesting Vault Tests
22

33
on:
44
push:
@@ -9,82 +9,4 @@ on:
99
jobs:
1010
test:
1111
runs-on: ubuntu-latest
12-
13-
services:
14-
sqlite:
15-
image: keinos/sqlite3:latest
16-
options: >-
17-
--health-cmd "sqlite3 --version"
18-
--health-interval 10s
19-
--health-timeout 5s
20-
--health-retries 5
2112

22-
steps:
23-
- uses: actions/checkout@v4
24-
25-
- name: Setup Node.js
26-
uses: actions/setup-node@v4
27-
with:
28-
node-version: '18'
29-
cache: 'npm'
30-
31-
- name: Install dependencies
32-
run: npm ci
33-
34-
- name: Create environment file
35-
run: cp .env.example .env
36-
37-
- name: Create data directory
38-
run: mkdir -p data
39-
40-
- name: Run tests
41-
run: npm test
42-
43-
- name: Generate coverage report
44-
run: npm run test:coverage
45-
46-
- name: Upload coverage to Codecov
47-
uses: codecov/codecov-action@v3
48-
with:
49-
file: ./coverage/lcov.info
50-
flags: unittests
51-
name: codecov-umbrella
52-
fail_ci_if_error: false
53-
54-
security-audit:
55-
runs-on: ubuntu-latest
56-
steps:
57-
- uses: actions/checkout@v4
58-
59-
- name: Setup Node.js
60-
uses: actions/setup-node@v4
61-
with:
62-
node-version: '18'
63-
cache: 'npm'
64-
65-
- name: Install dependencies
66-
run: npm ci
67-
68-
- name: Run security audit
69-
run: npm audit --audit-level=moderate
70-
continue-on-error: true
71-
72-
lint:
73-
runs-on: ubuntu-latest
74-
steps:
75-
- uses: actions/checkout@v4
76-
77-
- name: Setup Node.js
78-
uses: actions/setup-node@v4
79-
with:
80-
node-version: '18'
81-
cache: 'npm'
82-
83-
- name: Install dependencies
84-
run: npm ci
85-
86-
- name: Run ESLint
87-
run: |
88-
npm install -g eslint
89-
eslint . --ext .js || true
90-
continue-on-error: true

.gitignore

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Dependencies
2+
node_modules/
3+
backend/node_modules/
4+
5+
# Environment variables
6+
.env
7+
.env.local
8+
.env.development.local
9+
.env.test.local
10+
.env.production.local
11+
12+
# Logs
13+
logs
14+
*.log
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
18+
lerna-debug.log*
19+
20+
# Runtime data
21+
pids
22+
*.pid
23+
*.seed
24+
*.pid.lock
25+
26+
#
27+
node_modules
28+
Coverage directory used by tools like istanbul
29+
coverage/
30+
*.lcov
31+
32+
# nyc test coverage
33+
.nyc_output
34+
35+
# Dependency directories
36+
jspm_packages/
37+
38+
# Optional npm cache directory
39+
.npm
40+
41+
# Optional eslint cache
42+
.eslintcache
43+
44+
# Microbundle cache
45+
.rpt2_cache/
46+
.rts2_cache_cjs/
47+
.rts2_cache_es/
48+
.rts2_cache_umd/
49+
50+
# Optional REPL history
51+
.node_repl_history
52+
53+
# Output of 'npm pack'
54+
*.tgz
55+
56+
# Yarn Integrity file
57+
.yarn-integrity
58+
59+
# dotenv environment variables file
60+
.env.test
61+
node_modules

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"kiroAgent.configureMCP": "Disabled"
3+
}

ARCHITECTURE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Backend Architecture
2+
3+
## Data Flow Overview
4+
5+
```mermaid
6+
flowchart TD
7+
A[Stellar Horizon API] --> B[RPC Indexer]
8+
B --> C[PostgreSQL Database]
9+
C --> D[Express API]
10+
D --> E[Dashboard UI]
11+
```
12+
13+
## Explanation
14+
15+
1. The RPC Indexer fetches vesting-related data from the Stellar Horizon API.
16+
2. The RPC Indexer processes and stores the data in the PostgreSQL database.
17+
3. The Express API reads data from the PostgreSQL database.
18+
4. The Dashboard UI consumes data from the Express API.

CONTRIBUTING.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# Contributing to Vesting Vault
2+
3+
Thank you for your interest in contributing to Vesting Vault! This guide will help you get the development environment set up and running quickly.
4+
5+
## Prerequisites
6+
7+
Before you begin, ensure you have the following installed:
8+
9+
- [Docker](https://docs.docker.com/get-docker/) (v20.10 or later)
10+
- [Docker Compose](https://docs.docker.com/compose/install/) (v2.0 or later)
11+
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
12+
13+
## Quick Start (Recommended)
14+
15+
The fastest way to get started is using Docker Compose:
16+
17+
1. **Clone the repository**
18+
```bash
19+
git clone <repository-url>
20+
cd Vesting-Vault
21+
```
22+
23+
2. **Start all services**
24+
```bash
25+
docker-compose up -d
26+
```
27+
28+
3. **Verify services are running**
29+
```bash
30+
# Check backend health
31+
curl http://localhost:3000/health
32+
33+
# Check all services status
34+
docker-compose ps
35+
```
36+
37+
That's it! Your development environment is now running with:
38+
- Backend API: http://localhost:3000
39+
- PostgreSQL Database: localhost:5432
40+
- Redis Cache: localhost:6379
41+
42+
## Development Workflow
43+
44+
### Running Services
45+
46+
```bash
47+
# Start all services in detached mode
48+
docker-compose up -d
49+
50+
# Start services with logs
51+
docker-compose up
52+
53+
# Stop all services
54+
docker-compose down
55+
56+
# Stop services and remove volumes (clean slate)
57+
docker-compose down -v
58+
```
59+
60+
### Viewing Logs
61+
62+
```bash
63+
# View all logs
64+
docker-compose logs
65+
66+
# View specific service logs
67+
docker-compose logs backend
68+
docker-compose logs db
69+
docker-compose logs redis
70+
71+
# Follow logs in real-time
72+
docker-compose logs -f backend
73+
```
74+
75+
### Backend Development
76+
77+
The backend service is configured for development with hot-reloading:
78+
79+
```bash
80+
# Access the backend container
81+
docker-compose exec backend sh
82+
83+
# Install new dependencies
84+
docker-compose exec backend npm install <package-name>
85+
86+
# Run tests
87+
docker-compose exec backend npm test
88+
89+
# Access database directly
90+
docker-compose exec db psql -U postgres -d vesting_vault
91+
```
92+
93+
### Database Management
94+
95+
```bash
96+
# Connect to PostgreSQL
97+
docker-compose exec db psql -U postgres -d vesting_vault
98+
99+
# Create database migrations (if using Sequelize)
100+
docker-compose exec backend npx sequelize-cli migration:create --name migration_name
101+
102+
# Run migrations
103+
docker-compose exec backend npx sequelize-cli db:migrate
104+
```
105+
106+
## Environment Configuration
107+
108+
### Backend Environment Variables
109+
110+
Copy the example environment file and customize as needed:
111+
112+
```bash
113+
cp backend/.env.example backend/.env
114+
```
115+
116+
Key environment variables:
117+
- `PORT`: Backend server port (default: 3000)
118+
- `NODE_ENV`: Environment (development/production)
119+
- `DB_HOST`: Database host (default: db for Docker)
120+
- `DB_PORT`: Database port (default: 5432)
121+
- `DB_NAME`: Database name (default: vesting_vault)
122+
- `DB_USER`: Database user (default: postgres)
123+
- `DB_PASSWORD`: Database password (default: password)
124+
- `STELLAR_RPC_URL`: Stellar RPC endpoint (e.g., https://soroban-testnet.stellar.org)
125+
- `STELLAR_NETWORK_PASSPHRASE`: Passphrase for the configured network
126+
127+
## Project Structure
128+
129+
```
130+
Vesting-Vault/
131+
├── backend/ # Node.js backend application
132+
│ ├── src/
133+
│ │ ├── index.js # Application entry point
134+
│ │ └── database/ # Database configuration
135+
│ ├── Dockerfile # Backend Docker configuration
136+
│ ├── package.json # Node.js dependencies
137+
│ └── .env.example # Environment variables template
138+
├── docker-compose.yml # Docker services configuration
139+
└── CONTRIBUTING.md # This file
140+
```
141+
142+
## Common Issues & Solutions
143+
144+
### Port Conflicts
145+
146+
If you encounter port conflicts, modify the port mappings in `docker-compose.yml`:
147+
148+
```yaml
149+
ports:
150+
- "3001:3000" # Change host port from 3000 to 3001
151+
```
152+
153+
### Database Connection Issues
154+
155+
1. Ensure the database service is healthy:
156+
```bash
157+
docker-compose ps
158+
```
159+
160+
2. Check database logs:
161+
```bash
162+
docker-compose logs db
163+
```
164+
165+
3. Verify environment variables in your `.env` file match the database configuration.
166+
167+
### Permission Issues (Linux/Mac)
168+
169+
If you encounter permission errors, run:
170+
171+
```bash
172+
sudo chown -R $USER:$USER .
173+
```
174+
175+
## Development Tips
176+
177+
1. **Use meaningful commit messages** following conventional commit format
178+
2. **Run tests before committing** changes
179+
3. **Check logs** when services don't start properly
180+
4. **Use `docker-compose down -v`** for a completely fresh start
181+
5. **Monitor resource usage** with `docker stats`
182+
183+
## API Endpoints
184+
185+
Once the backend is running, you can access:
186+
187+
- `GET /` - Welcome message
188+
- `GET /health` - Health check endpoint
189+
190+
## Getting Help
191+
192+
If you encounter issues:
193+
194+
1. Check the troubleshooting section above
195+
2. Review service logs: `docker-compose logs`
196+
3. Ensure Docker and Docker Compose are up to date
197+
4. Check that ports 3000, 5432, and 6379 are available
198+
199+
## Code Style Guidelines
200+
201+
- Use ESLint for JavaScript code formatting
202+
- Follow conventional commit message format
203+
- Write meaningful variable and function names
204+
- Add comments for complex logic
205+
206+
Thank you for contributing to Vesting Vault! 🚀

0 commit comments

Comments
 (0)