Skip to content

Synapse-bridgez/synapse-contracts

Repository files navigation

synapse-contract

Rust · WASM · Stellar/Soroban · Part of synapse-core


Fiat hits the relayer. The contract takes over. State machine drives it to settlement, on-chain, in public, forever. No middleware eating your margin. No custodian holding your funds. No trust required — the ledger is the guarantee.

register_deposit
      │
   Pending ──► Processing ──► Completed
                    │
                 Failed ──► DLQ ──► retry_dlq ──► Processing

Every hop is an immutable on-chain event. You can't hide it. You can't undo it. That's not a bug.


Roles

Two. Hard-coded. No governance theatre.

Role Who What they can do
admin Deployer Add/remove relayers, allowlist assets, drain DLQ
relayer synapse-core backend Register deposits, advance state, finalise settlements

Call something you're not authorised for and the contract panics. That's the entire access policy.


Code

src/
├── lib.rs          ← entry points
├── types/mod.rs    ← Transaction, Settlement, DlqEntry, TransactionStatus
├── storage/mod.rs  ← all ledger I/O, centralised, no exceptions
├── access/mod.rs   ← require_admin / require_relayer
└── events/mod.rs   ← on-chain audit trail
tests/
└── contract_test.rs

Ship it

rustup target add wasm32-unknown-unknown
cargo install --locked soroban-cli

cargo build --target wasm32-unknown-unknown --release
cargo test

soroban contract deploy \
  --wasm target/wasm32-unknown-unknown/release/synapse_contract.wasm \
  --network testnet \
  --source <YOUR_SECRET_KEY>

Before mainnet — these will hurt you

Where The problem
lib.rs initialize has no re-entrancy guard — anyone can reinitialise the contract
lib.rs retry_dlq is a stub — DLQ entries are stuck forever
types/mod.rs generate_id entropy is weak — collisions under load are real
storage/mod.rs No TTL bumps — persistent entries expire and vanish silently
access/mod.rs No pause / unpause — zero kill switch if something goes sideways
tests/ Most tests are stubs — the coverage number is a lie

Open an issue before you start. Don't step on each other.

About

On-chain backbone for the Synapse Bridge fiat gateway written in Rust on Soroban, deployed on Stellar. Handles deposit registration, transaction lifecycle, settlement batching, and a dead-letter queue with full on-chain audit trails. No middlemen. No trust assumptions. Just cryptographic guarantees that your fiat-to-Stellar flow is working

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages