Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 47 additions & 43 deletions docs/sandbox-deployment.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,70 @@
# Sandbox Deployment Recipes
# Soroban Sandbox Local Deployment Quickstart

Quick developer setup for FluxaPay using Docker Compose templates (Issue #231).
This guide walks through deploying and testing the full FluxaPay contract stack locally using the Stellar Soroban Sandbox network.

## Prerequisites
## 📋 Prerequisites

- Docker Desktop or Docker Engine + Compose v2
- Stellar CLI (`stellar`) on the host for `scripts/sandbox-init.sh`
- Copy environment template: `cp .env.docker.example .env.docker`
- Docker Desktop / Docker Engine
- `stellar-cli` (v21.0.0+ installed via Cargo: `cargo install --locked stellar-cli`)
- Node.js 18+

## Local Standalone Sandbox
## 🚀 Step-by-Step Walkthrough

Runs a local Stellar/Soroban node via `stellar/quickstart`.
### 1. Launch Local Soroban Sandbox

Start local Stellar standalone network via Docker:
```bash
docker compose up -d
./scripts/sandbox-init.sh
docker run --rm -it \
-p 8000:8000 \
--name soroban-preview \
stellar/quickstart:testing \
--standalone \
--enable-soroban-rpc
```

Default endpoints:

| Service | URL |
|---------|-----|
| Soroban RPC | `http://localhost:8000/soroban/rpc` |
| Horizon | `http://localhost:8000` |
| Friendbot | `http://localhost:8000/friendbot?addr=<G-address>` |

Build WASM inside Docker (optional profile):
### 2. Initialize Network & Secret Keys

Run sandbox initialization script:
```bash
docker compose --profile build up contract-builder
bash scripts/sandbox-init.sh
```

## Testnet Devbox

Containerized Node.js workspace prewired for testnet RPC/HORIZON URLs.
### 3. Deploy Contract Stack

Deploy all 5 core Soroban smart contracts:
```bash
docker compose -f docker-compose.testnet.yml up -d
docker compose -f docker-compose.testnet.yml exec devbox bash
cd sdk && npm install && npm run build
```
# 1. PaymentProcessor
stellar contract deploy --wasm target/wasm32-unknown-unknown/release/payment_processor.wasm --source alice --network standalone

Run SDK build check profile:
# 2. RefundManager
stellar contract deploy --wasm target/wasm32-unknown-unknown/release/refund_manager.wasm --source alice --network standalone

```bash
docker compose -f docker-compose.testnet.yml --profile ci up sdk-check
```
# 3. FXOracle
stellar contract deploy --wasm target/wasm32-unknown-unknown/release/fx_oracle.wasm --source alice --network standalone

## Environment Variables
# 4. MerchantRegistry
stellar contract deploy --wasm target/wasm32-unknown-unknown/release/merchant_registry.wasm --source alice --network standalone

See `.env.docker.example` for all supported variables. After deploying contracts, populate:

- `PAYMENT_PROCESSOR_ID`
- `MERCHANT_REGISTRY_ID`
- `FX_ORACLE_ID`
- `REFUND_MANAGER_ID`

Then follow invoke recipes in [`local-invoke.md`](./local-invoke.md).
# 5. PaymentLinkManager
stellar contract deploy --wasm target/wasm32-unknown-unknown/release/payment_link_manager.wasm --source alice --network standalone
```

## Tear Down
### 4. Account Funding & Initializing Entrypoints

```bash
docker compose down -v
docker compose -f docker-compose.testnet.yml down -v
# Fund test accounts
node scripts/fund-accounts.js

# Invoke initialize on PaymentProcessor
stellar contract invoke \
--id <PAYMENT_PROCESSOR_ID> \
--source alice \
--network standalone \
-- \
initialize --admin alice --fee_bps 100
```

## 🛠️ Troubleshooting

- **`InsufficientFunds`**: Fund the invoking account using Friendbot: `curl "http://localhost:8000/friendbot?addr=<ACCOUNT_ADDRESS>"`.
- **`ContractNotFound`**: Ensure the contract ID matches the deployment output saved in `.env`.