Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion sdk/packages/simplex/scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM node:22

# Install dependencies required for builds
RUN apt-get update && apt-get install -y python3 make g++ git curl protobuf-compiler --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y python3 make g++ git curl protobuf-compiler libprotobuf-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN groupadd -g 1001 simplex && \
Expand Down
1 change: 1 addition & 0 deletions sdk/packages/simplex/scripts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ services:
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.retention.time=30d"
- "--web.enable-admin-api"
networks:
- simplex-network
ports:
Expand Down
14 changes: 14 additions & 0 deletions sdk/packages/simplex/scripts/generate-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ rm -rf "$OUT_DIR"
mkdir -p "$OUT_DIR"

echo "Generating TypeScript from proto files..."
# Locate well-known proto includes (wrappers.proto, descriptor.proto, etc.)
WELL_KNOWN_PROTOS=""
for candidate in "$(dirname "$(command -v protoc)" 2>/dev/null)/../include" /usr/include /usr/local/include; do
if [ -f "$candidate/google/protobuf/wrappers.proto" ]; then
WELL_KNOWN_PROTOS="$candidate"
break
fi
done
if [ -z "$WELL_KNOWN_PROTOS" ]; then
echo "Error: Could not find Google well-known proto includes (google/protobuf/wrappers.proto)"
exit 1
fi

protoc \
--plugin="protoc-gen-ts_proto=$PLUGIN" \
--ts_proto_out="$OUT_DIR" \
Expand All @@ -78,6 +91,7 @@ protoc \
--ts_proto_opt=useExactTypes=false \
--ts_proto_opt=forceLong=string \
-I="$PROTO_DIR" \
-I="$WELL_KNOWN_PROTOS" \
"$PROTO_DIR"/mpcvault/platform/v1/api.proto \
"$PROTO_DIR"/mpcvault/platform/v1/error.proto

Expand Down
2 changes: 1 addition & 1 deletion sdk/packages/simplex/scripts/monitoring/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ global:
scrape_configs:
- job_name: "simplex"
static_configs:
- targets: ["simplex:9090"]
- targets: ["hyperbridge-simplex:9090"]
12 changes: 10 additions & 2 deletions sdk/packages/simplex/src/bin/simplex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ interface FillerTomlConfig {
pendingQueue: PendingQueueConfig
logging?: LoggingConfig
watchOnly?: boolean | Record<string, boolean>
substratePrivateKey?: string
hyperbridgeWsUrl?: string
substratePrivateKey: string
hyperbridgeWsUrl: string
entryPointAddress?: string
solverAccountContractAddress?: string
}
Expand Down Expand Up @@ -557,6 +557,14 @@ function validateConfig(config: FillerTomlConfig): void {
throw new Error("Signer configuration is required via [simplex.signer]")
}

if (!config.simplex?.substratePrivateKey) {
throw new Error("simplex.substratePrivateKey is required")
}

if (!config.simplex?.hyperbridgeWsUrl) {
throw new Error("simplex.hyperbridgeWsUrl is required")
}

if ((!config.strategies || config.strategies.length === 0) && !allChainsWatchOnly) {
throw new Error("At least one strategy must be configured (unless all chains are in watchOnly mode)")
}
Expand Down
17 changes: 15 additions & 2 deletions sdk/packages/simplex/src/strategies/fx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,28 @@ export class FXFiller implements FillerStrategy {
continue
}

if (policyMaxOutput < output.amount) {
this.logger.info(
{
orderId: order.id,
token: output.token,
policyOutput: policyMaxOutput.toString(),
userRequested: output.amount.toString(),
},
"Skipping order: filler price yields less than user's requested amount",
)
return 0
}

if (sourceChain !== destChain && finalOutputAmount < output.amount) {
this.logger.info(
{
orderId: order.id,
token: output.token,
fillerOutput: finalOutputAmount.toString(),
fillerBalance: balance.toString(),
userRequested: output.amount.toString(),
},
"Skipping order: filler output below user's requested minimum",
"Skipping cross-chain order: insufficient balance for full fill",
)
return 0
}
Expand Down
Loading