Expand description
§Onboarding Bridge Contract
A Soroban smart contract that bridges tokens to C-addresses on the Stellar network. It supports single and batch funding, cross-chain onboarding via a multi-sig relayer network, timelocked vesting schedules, a referral fee-split system, and a governance-grade timelocked upgrade path.
§Architecture
All state lives in one of two Soroban storage tiers:
- Instance storage — contract-wide singletons (admin, fee config, asset whitelist, relayer threshold, pending upgrade). Extends its TTL on every mutating call.
- Persistent storage — per-address or per-asset data (balances, nonces, daily
usage, timelock entries). Extended explicitly via
extend_persistent_ttl.
§Fee Model
fee = floor(amount × fee_bps / 10_000)
net = amount − fee
effective = min(global_fee_bps, asset_fee_cap)
tiered = looked up by source's cumulative bridged volume§Access Control
Three roles exist:
| Role | Stored as | Capabilities |
|---|---|---|
admin | DataKey::Admin | All privileged mutations |
fee_collector | DataKey::FeeCollector | withdraw_fees only |
| relayer set | DataKey::Relayer(pubkey) | Cross-chain attestation |
§Replay Protection
Two independent mechanisms exist:
- Sequential nonce (
DataKey::Nonce) — optionalnonce: Option<u64>parameter on every mutating function. PassNoneto skip (standard Stellar transaction replay protection applies). PassSome(n)to enforce strict ordering. - Auth-entry nonce (
DataKey::UsedAuthNonce) — used byverify_auth_entryto permanently burn a(source, nonce)pair within a ledger-sequence window, preventing Soroban authorization-entry reuse.
Structs§
- Asset
Counters - Packed per-asset counters stored in a single persistent-storage entry.
- Bridge
Config - Packed contract-wide configuration stored in a single instance-storage entry.
- Bridge
Config Data - Snapshot of admin + fee_collector + fee_bps used during initialization and cached for efficient admin-auth checks in mutating functions.
- Commitment
Entry - A pending commit-reveal entry created by
commit_fund. - FeeTier
- A volume-based fee tier.
- Meta
Fund Params - Parameters for an EIP-712-style meta-transaction fund request.
- Onboarding
Bridge - Onboarding
Bridge Args - OnboardingBridgeArgs is a type for building arg lists for functions defined in “OnboardingBridge”.
- Onboarding
Bridge Client - OnboardingBridgeClient is a client for calling the contract defined in “OnboardingBridge”.
- Pending
Upgrade - A scheduled WASM upgrade waiting for its timelock to elapse.
- Relayer
Sig - An Ed25519 signature from a registered relayer.
- Timelock
Entry - A time-gated funding record created by
fund_c_address_timelocked.
Enums§
- Bridge
Error - All error codes that the contract may return.
- DataKey
- Keys used to address every piece of contract state in Soroban storage.
Statics§
- __
SPEC_ XDR_ TYPE_ ASSETCOUNTERS - __
SPEC_ XDR_ TYPE_ BRIDGECONFIG - __
SPEC_ XDR_ TYPE_ BRIDGECONFIGDATA - __
SPEC_ XDR_ TYPE_ BRIDGEERROR - __
SPEC_ XDR_ TYPE_ COMMITMENTENTRY - __
SPEC_ XDR_ TYPE_ DATAKEY - __
SPEC_ XDR_ TYPE_ FEETIER - __
SPEC_ XDR_ TYPE_ METAFUNDPARAMS - __
SPEC_ XDR_ TYPE_ PENDINGUPGRADE - __
SPEC_ XDR_ TYPE_ RELAYERSIG - __
SPEC_ XDR_ TYPE_ TIMELOCKENTRY