Skip to content

About

Stellar-native campaign escrow, contributor pools and reputation contracts for TogetherFi. Testnet evidence; current hardening under review.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

TogetherFi × Stellar: Soroban Contracts

Grant preparation status

Current source update: the first-initialization hardening changes the initialization ABI for future deployments. It has not been deployed. The v2 receipts below remain historical evidence for the earlier WASM, not proof of the patched initializer. See hardening and validation boundaries.

Campaign Escrow v2 and both dedicated contributor pools are deployed and initialized on Stellar Testnet for the requested validation. Both role accounts have verified 2-of-3 configurations and disabled setup masters. Quorum-authorized completion is confirmed with two verified member signatures; no production readiness, mainnet deployment or real-funds activity is claimed or authorized. Historical v1 IDs remain separately labeled below.

Signer update confirmed: Zyad replaced Ace on both dedicated testnet role accounts in ledger 5207471, retaining 2-of-3. Zyad and King completed campaign 3; Zyad and Ayoub completed campaign 4. See the confirmed signer rotation. Mohammed is a technical reviewer, not a signer. His PR #1 review was authored from the GitHub account requested for PR #2: @elastikchain-eth. His final PR #2 approval and Zyad's are linked below. See the native-only review handoff for the review boundary and remaining acceptance gates.

Current testnet evidence includes the v2 ID, transactions, deployed WASM verification and pending acceptance gates. See wallet signing instructions for the quorum test.

Confirmed lifecycle proofs: v2 deployment, 2-of-3 handoff, sponsor funding, sponsor activation/approval. Quorum-authorized release is confirmed with exact 82/10/5/2/1 payout deltas and reconciled liability. The original real 30-day timeout/refund is now confirmed: Campaign 2 refund, ledger 5,560,022, 4 November 2026 at 20:22:30 UTC. Eligibility began 3 November at 12:46:17 UTC. The original sponsor received exactly 1 test XLM; escrow balance and liability are zero. See refund reconciliation.

This working tree is pinned to upstream baseline commit 6fd30883bf8c305eb8dd8a8a8fabe7226171332b in UPSTREAM_COMMIT.

Tests

Engineering ownership and AI assistance

Ayoub is the founder and developer of TogetherFi and its Soroban technical lead: personal GitHub and GitHub. Ayoub is TogetherFi's founder, sole developer and technical lead. He writes the application and its Soroban code and is accountable for implementation, testing and delivery. AI tools assist his work; they do not replace human responsibility or the separate scoped human reviews. Ayoub's future Stellar allocation is 498 hours over 26 weeks, averaging approximately 19.15 hours/week. This is one shared allocation across work packages, not a separate allocation per package. Ayoub confirms separate human peer review by Zyad (INKY), an internal peer reviewer and testnet co-signer, not an additional implementation author. Mohammed supplied a scoped review of PR #1 from @elastikchain-eth. Neither review is a formal audit, and the earlier review is not approval of this updated snapshot. PR #2 merged on 30 October 2026 at 16:53:58 UTC. On 31 October, GitHub recorded formal APPROVED reviews from Mohammed and Zyad, both against the exact final head 233a2f5f6c1d15e8d9a0058642ac0fdf60e76d32. These reviews are not a formal security audit and do not prove that the updated source has been deployed. King is one of three testnet validators and a transaction co-signer, not a code reviewer. Any two of the three signers may authorize a release; King cannot act alone. Zyad replaced Ace on both dedicated testnet role accounts in confirmed ledger 5207471. Zyad and King completed campaign 3; Zyad and Ayoub completed campaign 4 with exact payout checks. Production decisions are led by Ayoub; this does not authorize mainnet deployment or real-funds operations. King's community and operations role is described in the contributor allocation.

The proposed team allocation totals 768 hours over 26 weeks, approximately 29.5 aggregate hours/week: Ayoub 498, Zyad 52, Mohammed 26, Ace 96 and King 96. Zyad's allocation covers internal review and testing, not development. The grant ask is $62,400: 576 engineering hours at $95/hour ($54,720) and 192 operations/testing hours at $40/hour ($7,680). Ace and King each have a proposed rate of $40/hour ($3,840 each; $7,680 combined). They use scoped GameFi and SocialFi admin panels, support users, manage events/missions and report bugs; neither has source-code access or an engineering role. King is separately one of the three testnet validators and may co-sign a transaction with another signer under the 2-of-3 threshold; that does not grant him code access or code-review authority. Named allocations must reflect each contributor's actual confirmed commitment; none are inferred from a review agreement. Historical TogetherFi platform engineering hours are not Stellar Testnet hours. Reputation Anchor grant eligibility and any additional budget remain unresolved; this allocation does not promise its future work for free.

Testnet acceptance evidence

The fixed policy is 82/10/5/2/1. complete(campaign_id, operation_version) has no split or destination argument, and there is no split setter. Only the stored sponsor can commit creator/referrer at activation; they cannot be replaced afterward. Governance cannot authorize settlement by itself.

Direct tests in campaign escrow tests:

  • admin_alternative_split_calls_fail_without_changing_campaign_or_balances
  • admin_cannot_select_or_replace_sponsor_committed_beneficiaries
  • governance_is_not_the_settlement_authority
  • exact_split_sends_each_leg_to_its_approved_destination

The verification script uses Rust-compatible committed lockfiles (--locked), tests the three retained native packages, and builds their WASM with Rust 1.81.0. The workflow has three independent contract jobs and one offline Node-guard job. It retains verification artifacts. A reference copy is supplied as docs/proposed-ci-workflow.yml. See CI runs for the result of the exact new PR commit. Earlier five-contract/six-job runs belong to the historical broader source tree and do not prove this cleanup passed. A configured workflow is not passing evidence, and passing CI alone does not prove its WASM bytes equal the previously deployed locally built binaries.

The selected settlement-control mechanism is a native Stellar account multisig with a 2-of-3 policy. The current on-chain roster is Ayoub, Zyad, and King on both dedicated role accounts. The replacement was confirmed on 15 October 2026 in ledger 5207471: rotation confirmation. The historical deployment manifest retains the original Ayoub, Ace and King roster. Three independently held Stellar signing keys are required, not EVM addresses or three keys held by the backend. Both account configurations are verified on testnet: signer weights 1/1/1, low/medium/high thresholds 2/2/2, setup master weight 0. Disabled setup-key attempts were rejected by the network. The historical member 1-of-3 rejection and 2-of-3 completion remain valid evidence for that earlier roster, not Zyad's participation. A separate one-test-XLM campaign completed the fresh Zyad and King release test in ledger 5207647. Zyad alone was rejected at RPC ingestion with txBadAuth; Zyad and King together completed campaign 3, with the exact fixed split and pool credits verified. No Ayoub or Ace signature authorized this fresh release. The additional Zyad and Ayoub pair test completed campaign 4 in ledger 5207852 after Ayoub alone was correctly blocked. Both signatures were verified; the exact split and accounting reconciled. Its consumed envelope needs no further signatures or submission. Mainnet needs different wallets supplied by Ayoub. Governance custody must also be independently threshold-controlled so the backend cannot bypass settlement quorum by rotating the settlement role to its own key. See testnet acceptance checklist.

The public review snapshot is Stellar-native: sponsors fund campaigns directly on Stellar. Optional bridge components and their dependency trees are absent. No cross-chain funding, USDC liquidity or replenishment mechanism is claimed.

This repository contains the native Soroban contracts for the TogetherFi Stellar integration.


Existing v1 deployed contracts (Stellar testnet, historical)

The addresses and transactions below are v1 historical evidence only. They are not the v2 implementation and do not describe a new deployment.

Contract Address
Campaign Escrow CDEAOPTIFKCOFOOHNXXFLF3WAUSTXZKMIXN7NM5OM2BO3CLBX2AND34N
Reputation Anchor CBJVDSS6VUWNORYG2W7ZMHPGMCBXQN5A2CKK5OSS7L2WFR6RSFLGQILC

Campaign Escrow v2 (contracts/campaign_escrow): testnet validation

Testnet contract: CC7EVM46T45WMEXMDKGCVTJ6RHVTDG24WZU3WQEPU5IW7EBOJJD3LPOZ. Test fixture asset is free seven-decimal XLM, not production USDC.

Holds the configured settlement asset for a TogetherFi creator campaign and releases it atomically on completion with the platform's fixed payout split:

Recipient Share
Creator wallet 82%
Platform treasury 10%
NFT contributor pool 5%
Community contributor pool 2%
Verified referrer wallet 1% (mandatory; activation fails without one)

Functions

Function Caller Action
initialize(governance, settlement, token, service_treasury, nft_pool, revenue_pool, deployer, deployment_salt) verified deployer + governance One-time setup bound to the creation preimage
fund(campaign_id, sponsor, amount) sponsor signs Transfer configured asset sponsor → contract
activate(campaign_id, creator, referrer, terms_hash) stored sponsor Commit payout destinations and terms
complete(campaign_id, operation_version) settlement authority Release with split atomically
refund_expired(campaign_id) anyone after expiry Return full balance to stored sponsor
get_campaign(id) anyone Read campaign state

The two pool addresses are fixed at escrow initialization. They must be dedicated Contributor Pool deployments for the same token. Only the fixed 5% and 2% campaign allocations may enter those pools through authenticated, one-time campaign credits. Every campaign requires a verified referrer; there is no fallback recipient for the 1% referrer leg.

Campaign funding is at least 100 base units (0.0000100 for a 7-decimal asset), which ensures every fixed 5% / 2% / 1% payout leg is nonzero.

Contributor Pool (contracts/contributor_pool): testnet validation

Both separate instances are deployed and initialized:

  • 5% NFT contributor pool: CAUPWNNQLQLURIJJTFW7LURJRD2OLGV4R5E6LNSUJXKSESRVGO54YP76.
  • 2% community: CD6TNSBSLAPXE4JXDBNTNEMMXH7DAWGUA3TR5HMP4QQIHCYM7544ED25. Their first authenticated campaign credits are confirmed: 0.05 and 0.02 test XLM.

Deploy two separately initialized instances: one for the 5% NFT contributor allocation and one for the 2% community contributor allocation. An escrow completion transfers its respective pool allocation to that instance. The pool contract cannot choose a recipient or sweep money to an operator:

  • publish_manifest(...) requires both governance and an independent eligibility authority to authorize the same transaction.
  • The manifest stores an immutable policy hash, manifest hash, exact recipients, exact base-unit amounts, and claim expiry. One manifest is capped at 64 recipients; publish separate cycles rather than truncating a candidate set.
  • Each recipient must authorize their own claim(manifest_id,index).
  • An allocation cannot be claimed twice. Claims are bounded by the actual token balance and all outstanding manifest liabilities.
  • A direct token transfer is never allocatable reward funding. The configured Campaign Escrow must authenticate each campaign's one-time credit after its matching 5% or 2% transfer, and the escrow refuses pool addresses whose configured escrow or token do not match.
  • After expiry, expire_manifest releases only the unclaimed reservation to the pool's carry-forward balance; it makes no transfer to governance.
  • Governance and eligibility authority must always be distinct addresses; neither can publish a recipient manifest alone.
  • Claim expiry is limited to 30 days. Refreshing a manifest's TTL refreshes every allocation as well, and a scheduled TTL touch is required while a claim window remains active.

Off-chain eligibility must be revalidated from auditable evidence before the two authorities publish: NFT contributors need verified ownership and campaign-promotion evidence; community recipients need verified qualifying content and all required UTC check-ins. Missing or ambiguous evidence fails closed. The canonical manifest serialization and SHA-256 policy/manifest hashes are documented by the application and must be independently reviewed before any deployment.

Existing v1 testnet transactions

Step Transaction hash
Deploy 54b6a37c3b95c86135aa8ae369f761f99a4204125bc025363bf2d3171101f553
Initialize ff9e9c6347fd4acb86986dfd52e87a649b87b350338a096bcbb6e30c5b05b1bd
Fund (end-to-end test) ebced8761f76e5e1bbdb5d0fe0859f095ce999e2fb5487358474399484d25c89
Complete (end-to-end test) 268ad813ee9192a9a6838b03173e3403d83df7bf1ab3cf17ae2c8790f574496b

Split verified on-chain: 82.5% creator / 10% platform treasury / 5% revenue pool / 2.5% referrer. Escrow drained to zero.

Note: XLM native asset used as USDC stand-in for the testnet test. This historical stand-in does not select the v2 asset/issuer. The final asset requires separate confirmation; no mainnet deployment is authorized here.


Reputation Anchor (contracts/reputation_anchor)

Stores creator TogetherScores permanently on Stellar as the authoritative on-chain identity record. The historical contract schema names one optional external reference field arbitrum_tx_hash. Its name is retained only for compatibility with the deployed historical interface. It is optional application metadata, not a funding requirement, bridge component or authenticated proof.

Functions

Function Caller Action
initialize(admin, deployer, deployment_salt) verified deployer + admin One-time setup bound to the creation preimage
anchor_score(profile_id, creator, score, tier, arbitrum_tx_hash) admin only Write/update score
get_score(profile_id) anyone Read one score record
get_scores_batch(profile_ids) anyone Batch read (missing entries skipped)

ScoreRecord fields

pub struct ScoreRecord {
    pub profile_id:       u64,    // TogetherFi DB profile ID
    pub creator:          Address, // Stellar G-key
    pub score:            u32,    // 0-1000 (TogetherScore v2)
    pub tier:             Symbol, // "bronze" | "silver" | "gold"
    pub arbitrum_tx_hash: String, // historical optional external reference
    pub anchored_at:      u64,   // unix timestamp (ledger time)
}

ScoreAnchored event

Emitted by anchor_score on every call. Indexed by (profile_id, score, tier, anchored_at, arbitrum_tx_hash). Any Stellar explorer can verify the anchor on-chain.


Building

Toolchain requirement: CRITICAL

Campaign Escrow, Contributor Pool, and Reputation Anchor must compile with Rust 1.81. Rust 1.82+ produces WASM that soroban-sdk 21.x / stellar-cli 27 rejects at deploy-time:

HostError: Error(WasmVm, InvalidAction)
Translation error: "reference-types not enabled: zero byte expected"

This is a rustc/LLVM codegen issue with wasm32-unknown-unknown targets in newer compilers. -C target-feature=... flags do not help; the fix is an older compiler.

Build commands

# Campaign Escrow
cd contracts/campaign_escrow
cargo +1.81 build --target wasm32-unknown-unknown --release

# Reputation Anchor
cd contracts/reputation_anchor
cargo +1.81 build --target wasm32-unknown-unknown --release

# Contributor Pool
cd contracts/contributor_pool
cargo +1.81 build --target wasm32-unknown-unknown --release

Running tests

# Campaign Escrow
cd contracts/campaign_escrow
cargo +1.81.0 test --locked

# Reputation Anchor
cd contracts/reputation_anchor
cargo +1.81.0 test --locked

# Contributor Pool
cd contracts/contributor_pool
cargo +1.81.0 test --locked

Reproducible evidence bundle

Install the exact Rust 1.81.0 toolchain and the wasm32-unknown-unknown target, then run:

From the Soroban repository root (or the application subtree), run:

for package in campaign_escrow contributor_pool reputation_anchor; do
  bash scripts/verify-contract.sh "$package" 1.81.0 wasm32-unknown-unknown
done

The script uses committed lockfiles with --locked, tests each package, builds its WASM with the required target, and writes transcripts and hashes to evidence/current/<package>/. These are local reproducibility artifacts only; they are not deployment, testnet, or live-route proof.

Deploying (stellar-cli 27)

# Upload and deploy
stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/<name>.wasm \
  --source <your-keypair-alias> \
  --network testnet

Repository structure

contracts/
  campaign_escrow/
    Cargo.toml
    src/
      lib.rs    : contract implementation
      test.rs   : escrow lifecycle, authorization, and immutable-policy tests
  reputation_anchor/
    Cargo.toml
    src/
      lib.rs    : contract implementation
      test.rs   : integration tests
  contributor_pool/
    Cargo.toml
    src/
      lib.rs     : immutable contributor manifest and self-claim implementation
      test.rs    : pool lifecycle and replay-protection tests
LICENSE
README.md

License

MIT © 2024-2026 TogetherFi

About

Stellar-native campaign escrow, contributor pools and reputation contracts for TogetherFi. Testnet evidence; current hardening under review.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages