Documentation

    Documentation

    Documentation

    Ring Platform Logo

    Завантаження документації...

    Підготовка контенту платформи Ring

    Ring Platform Logo

    Завантаження документації...

    Підготовка контенту платформи Ring

    Ring Platform Logo

    Завантаження документації...

    Підготовка контенту платформи Ring

    1. /
    2. /Token Economics Setup

    Updated Jun 15, 20268 min listen

    1. /
    2. /Token Economics Setup

    Updated Jun 15, 20268 min listen

    1. /
    2. /Token Economics Setup

    Updated Jun 15, 20268 min listen

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    Database migrations
    First Success Validation
    Troubleshooting
    Next Steps
    Architecture
    Backend modes and databases
    Data Model
    Authentication Architecture
    Email AI-CRM architecture
    PaymentConductor architecture
    Refcodes architecture
    News Kingdom architecture
    Proxy and internationalization
    Real Time
    Discovery Mutation Sync
    Security
    Features
    Doc System
    Authentication
    Email AI-CRM
    Entities
    Opportunities
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Tunnel Protocol
    Web3 Wallet
    Multi-Vendor Store
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    Referral Codes (Refcodes)
    Affiliate & Referral Enablement
    Payment Integration
    PaymentConductor
    VideoConductor
    WayForPay Payment Integration
    News Module - Digital Newspaper Experience
    Member Blogs
    Scientific Editor
    Locale System
    Security & Compliance
    NFT Marketplace
    Token Staking System
    Performance Optimization Patterns
    Mobile Experience
    Wallet
    Wallet Security Tips
    API
    Authentication
    Email AI-CRM API
    Entities
    Opportunities
    Messaging API
    Notifications API
    Wallet API
    Store API
    Admin API
    CLI
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Database Backend Selection
    Token Economics Setup
    Payment Gateway Integration
    AI Agent Customization
    Reference Ring deployments
    Branding
    Features
    Localization
    Themes
    Components
    Web3
    Token launch jurisdictions
    Deployment
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Development
    Local Setup
    Code Structure
    Documentation components
    Community tooling
    Ring MCP Server
    Generative Images (ImageConductor)
    Autonomous Newsroom (Grok)
    OSS vs enterprise
    Whitelabel Navigation
    Best Practices
    Workflow
    Code Style
    Performance
    Testing
    Deployment
    Debugging
    Contributing
    MCP
    ring-image-create
    ring-video-create
    Roadmap
    Examples
    Quick Start
    Authentication
    Email AI-CRM developer guide
    API Integration Examples
    Web3 Integration
    White Label
    Real World
    API Examples (cURL)
    Integrations
    Ethereum wallets (Wagmi v3)

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    Database migrations
    First Success Validation
    Troubleshooting
    Next Steps
    Architecture
    Backend modes and databases
    Data Model
    Authentication Architecture
    Email AI-CRM architecture
    PaymentConductor architecture
    Refcodes architecture
    News Kingdom architecture
    Proxy and internationalization
    Real Time
    Discovery Mutation Sync
    Security
    Features
    Doc System
    Authentication
    Email AI-CRM
    Entities
    Opportunities
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Tunnel Protocol
    Web3 Wallet
    Multi-Vendor Store
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    Referral Codes (Refcodes)
    Affiliate & Referral Enablement
    Payment Integration
    PaymentConductor
    VideoConductor
    WayForPay Payment Integration
    News Module - Digital Newspaper Experience
    Member Blogs
    Scientific Editor
    Locale System
    Security & Compliance
    NFT Marketplace
    Token Staking System
    Performance Optimization Patterns
    Mobile Experience
    Wallet
    Wallet Security Tips
    API
    Authentication
    Email AI-CRM API
    Entities
    Opportunities
    Messaging API
    Notifications API
    Wallet API
    Store API
    Admin API
    CLI
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Database Backend Selection
    Token Economics Setup
    Payment Gateway Integration
    AI Agent Customization
    Reference Ring deployments
    Branding
    Features
    Localization
    Themes
    Components
    Web3
    Token launch jurisdictions
    Deployment
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Development
    Local Setup
    Code Structure
    Documentation components
    Community tooling
    Ring MCP Server
    Generative Images (ImageConductor)
    Autonomous Newsroom (Grok)
    OSS vs enterprise
    Whitelabel Navigation
    Best Practices
    Workflow
    Code Style
    Performance
    Testing
    Deployment
    Debugging
    Contributing
    MCP
    ring-image-create
    ring-video-create
    Roadmap
    Examples
    Quick Start
    Authentication
    Email AI-CRM developer guide
    API Integration Examples
    Web3 Integration
    White Label
    Real World
    API Examples (cURL)
    Integrations
    Ethereum wallets (Wagmi v3)

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    Database migrations
    First Success Validation
    Troubleshooting
    Next Steps
    Architecture
    Backend modes and databases
    Data Model
    Authentication Architecture
    Email AI-CRM architecture
    PaymentConductor architecture
    Refcodes architecture
    News Kingdom architecture
    Proxy and internationalization
    Real Time
    Discovery Mutation Sync
    Security
    Features
    Doc System
    Authentication
    Email AI-CRM
    Entities
    Opportunities
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Tunnel Protocol
    Web3 Wallet
    Multi-Vendor Store
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    Referral Codes (Refcodes)
    Affiliate & Referral Enablement
    Payment Integration
    PaymentConductor
    VideoConductor
    WayForPay Payment Integration
    News Module - Digital Newspaper Experience
    Member Blogs
    Scientific Editor
    Locale System
    Security & Compliance
    NFT Marketplace
    Token Staking System
    Performance Optimization Patterns
    Mobile Experience
    Wallet
    Wallet Security Tips
    API
    Authentication
    Email AI-CRM API
    Entities
    Opportunities
    Messaging API
    Notifications API
    Wallet API
    Store API
    Admin API
    CLI
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Database Backend Selection
    Token Economics Setup
    Payment Gateway Integration
    AI Agent Customization
    Reference Ring deployments
    Branding
    Features
    Localization
    Themes
    Components
    Web3
    Token launch jurisdictions
    Deployment
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Development
    Local Setup
    Code Structure
    Documentation components
    Community tooling
    Ring MCP Server
    Generative Images (ImageConductor)
    Autonomous Newsroom (Grok)
    OSS vs enterprise
    Whitelabel Navigation
    Best Practices
    Workflow
    Code Style
    Performance
    Testing
    Deployment
    Debugging
    Contributing
    MCP
    ring-image-create
    ring-video-create
    Roadmap
    Examples
    Quick Start
    Authentication
    Email AI-CRM developer guide
    API Integration Examples
    Web3 Integration
    White Label
    Real World
    API Examples (cURL)
    Integrations
    Ethereum wallets (Wagmi v3)

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)
    Docs
    Customization
    Docs
    Customization
    Docs
    Customization

    Token Economics Setup

    Executive summary

    Ring clones ship a three-layer economy: (1) an off-chain credit ledger in PostgreSQL for membership and store checkout, (2) optional on-chain RING reference contracts for treasury-grade utility tokenomics, and (3) a referral token rail (ReferralRewards + refcodes) for platform-funded growth payouts. ring-platform.org brands the utility token as RING; agricultural clones (e.g. GreenFood) may fork symbols to DAAR / DAARION via ring-config.json.

    Payment integration

    PaymentConductor — WayForPay, Stripe, internal credit

    Web3 wallet feature

    Custodial wallets, balances, top-up UX

    Referral codes (refcodes)

    Attribution, ledger, on-chain mint

    Affiliate enablement

    Dual-rail ERP commission + token rewards

    Refcodes architecture

    viem minter, env contract, cron

    Customization guide

    ring-config.json, locales, feature flags

    Philosophy

    Traditional platforms capture value in opaque ledgers. Ring-powered clones expose fee flows you control: membership utility, marketplace settlement, referral growth, and optional on-chain treasury — all configurable per white-label instance.

    PrincipleRing implementation
    Utility-firstTokens gate features and settle platform fees — not investment promises
    Postgres-primaryCredit balances and subscriptions live in users.data + ring_subscriptions when DB_BACKEND_MODE=k8s-postgres-fcm
    Fiat + credit coexistWayForPay/Stripe for card rails; internal_credit spends the same ledger
    Per-clone brandingring-config.json → tokens.ring.symbol drives UI copy via getRingTokenSymbol()
    Three economic layers

    Layer 1 — Off-chain credit ledger (production path today)

    Most membership and store flows debit an application credit balance — denominated in your clone token symbol (default RING) — without requiring a wallet signature on every renewal.

    Data model

    StoreLocationContents
    Balanceusers.data.credit_balanceamount, usd_equivalent, subscription_active, subscription_next_payment
    Historyusers.data.credit_transactionsTyped ledger entries with optional tx_hash, order_id
    Subscriptionsring_subscriptions collectionStatus, next_payment_due, failed_attempts, auto_renew

    Schema comment: users.data JSONB in data/schema.sql v4+.

    Core services

    ServicePathRole
    UserCreditServicefeatures/wallet/services/user-credit-service.tsBalance read/write, spend, top-up, membership fee debit, tunnel publish on change
    SubscriptionServiceservices/membership/subscription-service.tsCreate/cancel/renew; 1 RING/month; upgrades membership.tier → member
    PriceOracleServiceservices/blockchain/price-oracle-service.tsRING/USD via viem + Chainlink/CoinGecko/CMC/Binance fallbacks
    Internal credit checkoutlib/payments/processors/internal-credit.processor.tsPaymentConductor rail for store + membership spend

    Membership economics (reference)

    ParameterValueWhere enforced
    Monthly fee1 utility tokensubscription-service.ts (membershipFee = '1.0')
    Billing period30 daysnext_payment_due timestamp math
    Recommended buffer12 tokens (1 year)RingToken.MIN_SUBSCRIPTION_BALANCE on-chain; UI warnings via credit limits
    Role gateSUBSCRIBER+ to subscribePOST /api/membership/subscription/create
    1. 1

      User tops up or receives airdrop

      POST /api/wallet/credit/topup (admin/ops) or fulfillment after wallet_topup PaymentConductor purpose adds credits via userCreditService.addCredits().

    2. 2

      User creates subscription

      POST /api/membership/subscription/create debits 1 RING credit, writes ring_subscriptions, sets credit_balance.subscription_active.

      Contract env gate

      This route returns 503 until RING_TOKEN_CONTRACT_ADDRESS and RING_MEMBERSHIP_CONTRACT_ADDRESS are set — even though the debit is ledger-based. Set deployed addresses (or placeholder addresses in dev) to unlock the API.

    3. 3

      Store checkout with credit

      When PAYMENT_STORE_ALLOW_CREDIT=true, PaymentConductor internal_credit rail spends credits for orders in currencies allowed by PAYMENT_CREDIT_ACCEPT_ORDER_CURRENCY (defaults to PAYMENT_FIAT_CURRENCY).

    Credit API surface

    EndpointMethodPurpose
    /api/wallet/credit/balanceGETBalance + subscription snapshot
    /api/wallet/credit/historyGETPaginated transaction history
    /api/wallet/credit/topupPOSTAdd credits
    /api/wallet/credit/spendPOSTSpend credits
    /api/prices/ring-usdGETOracle price for UI and receipts
    /api/membership/subscription/createPOSTStart membership
    /api/membership/subscription/statusGETSubscription state
    /api/membership/subscription/cancelPOSTCancel

    Client hook: hooks/use-credit-balance.ts — initial REST fetch + tunnel push updates (no polling).

    Layer 2 — On-chain RING reference contracts

    Ring ships UUPS upgradeable reference contracts for clones that want treasury-controlled ERC-20 utility on Polygon (chainId 137).

    RingToken (contracts/RingToken.sol)

    ConstantValue
    INITIAL_SUPPLY1,000,000,000 RING → minted to treasury at initialize
    MEMBERSHIP_FEE1 RING / month
    MIN_SUBSCRIPTION_BALANCE12 RING
    Decimals18

    Owner functions: setMembershipContract, setTreasury, creditTokens (treasury airdrops), pause / unpause.

    Membership-only: deductMembershipFee(member) — callable only by linked RingMembership.

    RingMembership (contracts/RingMembership.sol)

    ConstantValue
    SUBSCRIPTION_PERIOD30 days
    GRACE_PERIOD7 days
    MAX_FAILED_ATTEMPTS3 → EXPIRED

    Statuses: INACTIVE, ACTIVE, EXPIRED, CANCELLED, SUSPENDED.

    On-chain lifecycle: createSubscription() → processBatchPayments(batchSize) (operator/cron) → cancelSubscription() / admin suspend.

    Utility token — not a security pitch

    RING reference tokenomics gate platform access. Consult counsel before marketing yield, profit expectations, or exchange listings.

    On-chain ↔ ledger sync

    App subscriptions today run on the credit ledger. On-chain RingMembership is the reference for treasury policy and future sync; wire batch renewal cron to subscriptionService.processBatchPayments() when you bridge both layers.

    Deploy reference contracts

    Hardhat project: contracts/. ReferralRewards compiles from contracts/contracts-src/; RingToken / RingMembership live at contracts/*.sol — align hardhat.config.js paths.sources or copy sources before compile if factories fail.

    1. 1

      Install and compile

    2. 2

      Testnet deploy (script references Polygon Mumbai — migrate to Amoy or fork script for current testnets)

      Deploy order: RingToken → RingMembership → ringToken.setMembershipContract(...). Output: contracts/deployments/mumbai-deployment.json.

    3. 3

      Mainnet — scripts/deploy-mainnet.js after audit + multisig treasury. Fund deployer with POL; use Alchemy/Infura RPC (not anonymous polygon-rpc.com).

    4. 4

      Wire env and redeploy app

      Client metadata: constants/web3.ts — TOKEN_CONFIGS, staking scaffold (RING_STAKING_ADDRESS, 20% APR placeholder).

    Layer 3 — Referral token rewards (refcodes)

    Growth economics are separate from membership fees. When a referred user completes a qualifying purchase, the platform mints or transfers reward tokens via ReferralRewards (UUPS).

    PiecePath / contract
    Contractcontracts/contracts-src/ReferralRewards.sol
    Deploynpx hardhat run scripts/deploy-referral-rewards.js --network polygon
    Minterfeatures/refcodes/services/reward-minter.ts (viem)
    Ops runbookREFERRAL-ONCHAIN-OPS.md (repo root)

    Clone install helper: scripts/install-refcodes-module.sh.

    Payment rails — fiat, credit, native token

    Token economics intersect PaymentConductor — one ledger (payment_transactions), multiple rails.

    RailEnvUse
    merchant_redirectWayForPay / StripeCard checkout, membership upgrade fiat
    internal_creditPAYMENT_STORE_ALLOW_CREDIT=trueSpend credit_balance at store
    native_tokenPAYMENT_STORE_ALLOW_TOKEN=trueOn-chain token checkout (advanced)

    Apply data/migrations/004_payment_transactions.sql before production payments. Full operator guide: Payment integration.

    White-label token branding

    ring-config.json

    getRingTokenSymbol() and getNativeTokenConfig() read this for checkout labels, wallet UI, and payment copy. Fork the symbol/name for vertical clones (e.g. GFT, DAAR) without renaming Solidity unless you deploy a new ERC-20.

    Sidebar and public pages

    ring-config.json → sidebar.quickLinks includes about.sidebar.tokenEconomy → /token-economy on your clone's marketing site.

    Staking and vendor gates

    constants/web3.ts defines a RING staking pool scaffold (20% APR, 100 RING minimum) — configure addresses per clone or disable in UI.

    components/vendor/staking-card.tsx supports per-product vendor stake requirements (tokenSymbol, requiredStake) — use for agent/vendor activation flows, not global protocol rules.

    Design your clone economy

    1. 1

      Classify the token

      Recommended

      Utility token — listings, membership, marketplace fees. No profit promises.

      Security tokens and multi-token splits need legal review before launch.

    2. 2

      Set parameters

      Map fees in constants/store.ts / ERP commission helpers for marketplace cuts.

    3. 3

      Integrate with Ring services

      1. Deploy or fork RingToken.sol / RingMembership.sol (optional)
      2. Update ring-config.json + constants/web3.ts addresses
      3. Set RING_TOKEN_CONTRACT_ADDRESS + membership env vars
      4. Enable PAYMENT_STORE_ALLOW_CREDIT if store should spend credits
      5. Deploy ReferralRewards when refcodes on-chain rewards are live
      6. Smoke: npm run smoke:pipelines (see scripts/PIPELINES.md)

    Health metrics

    MetricSignal
    Active subscriptions / failed payment ratering_subscriptions + credit history
    Credit ledger vs treasuryReconcile users.data.credit_balance with on-chain treasury movements
    Referral mint queuereferral_rewards status + /admin/refcodes
    Oracle freshnessPriceOracleService cache TTL and fallback usage
    Payment ledgerpayment_transactions by rail and processor

    Legal and launch checklist

    Jurisdiction

    Token launches have jurisdiction-specific consequences. Engage counsel before public sale, exchange listing, or yield marketing. See the dedicated guide: Token launch jurisdictions (EU MiCA, US SEC/CFTC, UK FCA, Ukraine, FATF, official sources).

    Immediate

    • Choose: RING reference vs branded ERC-20 fork
    • Set ring-config.json token symbol + public token economy page
    • Multisig treasury and contract owner keys
    • Tokenomics paper (utility, fees, treasury — no investment claims)

    Development

    • Postgres migrations through 004_payment_transactions + 005_refcodes_schema
    • Wire credit + PaymentConductor env vars
    • Deploy testnet contracts; run contracts/test
    • Smoke membership create + store credit checkout

    Launch

    • Mainnet deploy after audit
    • Verify contracts on Polygonscan
    • Enable refcodes minter (REFERRAL-ONCHAIN-OPS.md)
    • Monitor subscription metrics and treasury alerts

    Payment integration

    Webhooks, WayForPay, Stripe setup

    Database migrations

    refcodes, payment_transactions, schema order

    Ring customization opportunities

    Web3 specialists on the platform

    Token Economics Setup

    Executive summary

    Ring clones ship a three-layer economy: (1) an off-chain credit ledger in PostgreSQL for membership and store checkout, (2) optional on-chain RING reference contracts for treasury-grade utility tokenomics, and (3) a referral token rail (ReferralRewards + refcodes) for platform-funded growth payouts. ring-platform.org brands the utility token as RING; agricultural clones (e.g. GreenFood) may fork symbols to DAAR / DAARION via ring-config.json.

    Payment integration

    PaymentConductor — WayForPay, Stripe, internal credit

    Web3 wallet feature

    Custodial wallets, balances, top-up UX

    Referral codes (refcodes)

    Attribution, ledger, on-chain mint

    Affiliate enablement

    Dual-rail ERP commission + token rewards

    Refcodes architecture

    viem minter, env contract, cron

    Customization guide

    ring-config.json, locales, feature flags

    Philosophy

    Traditional platforms capture value in opaque ledgers. Ring-powered clones expose fee flows you control: membership utility, marketplace settlement, referral growth, and optional on-chain treasury — all configurable per white-label instance.

    PrincipleRing implementation
    Utility-firstTokens gate features and settle platform fees — not investment promises
    Postgres-primaryCredit balances and subscriptions live in users.data + ring_subscriptions when DB_BACKEND_MODE=k8s-postgres-fcm
    Fiat + credit coexistWayForPay/Stripe for card rails; internal_credit spends the same ledger
    Per-clone brandingring-config.json → tokens.ring.symbol drives UI copy via getRingTokenSymbol()
    Three economic layers

    Layer 1 — Off-chain credit ledger (production path today)

    Most membership and store flows debit an application credit balance — denominated in your clone token symbol (default RING) — without requiring a wallet signature on every renewal.

    Data model

    StoreLocationContents
    Balanceusers.data.credit_balanceamount, usd_equivalent, subscription_active, subscription_next_payment
    Historyusers.data.credit_transactionsTyped ledger entries with optional tx_hash, order_id
    Subscriptionsring_subscriptions collectionStatus, next_payment_due, failed_attempts, auto_renew

    Schema comment: users.data JSONB in data/schema.sql v4+.

    Core services

    ServicePathRole
    UserCreditServicefeatures/wallet/services/user-credit-service.tsBalance read/write, spend, top-up, membership fee debit, tunnel publish on change
    SubscriptionServiceservices/membership/subscription-service.tsCreate/cancel/renew; 1 RING/month; upgrades membership.tier → member
    PriceOracleServiceservices/blockchain/price-oracle-service.tsRING/USD via viem + Chainlink/CoinGecko/CMC/Binance fallbacks
    Internal credit checkoutlib/payments/processors/internal-credit.processor.tsPaymentConductor rail for store + membership spend

    Membership economics (reference)

    ParameterValueWhere enforced
    Monthly fee1 utility tokensubscription-service.ts (membershipFee = '1.0')
    Billing period30 daysnext_payment_due timestamp math
    Recommended buffer12 tokens (1 year)RingToken.MIN_SUBSCRIPTION_BALANCE on-chain; UI warnings via credit limits
    Role gateSUBSCRIBER+ to subscribePOST /api/membership/subscription/create
    1. 1

      User tops up or receives airdrop

      POST /api/wallet/credit/topup (admin/ops) or fulfillment after wallet_topup PaymentConductor purpose adds credits via userCreditService.addCredits().

    2. 2

      User creates subscription

      POST /api/membership/subscription/create debits 1 RING credit, writes ring_subscriptions, sets credit_balance.subscription_active.

      Contract env gate

      This route returns 503 until RING_TOKEN_CONTRACT_ADDRESS and RING_MEMBERSHIP_CONTRACT_ADDRESS are set — even though the debit is ledger-based. Set deployed addresses (or placeholder addresses in dev) to unlock the API.

    3. 3

      Store checkout with credit

      When PAYMENT_STORE_ALLOW_CREDIT=true, PaymentConductor internal_credit rail spends credits for orders in currencies allowed by PAYMENT_CREDIT_ACCEPT_ORDER_CURRENCY (defaults to PAYMENT_FIAT_CURRENCY).

    Credit API surface

    EndpointMethodPurpose
    /api/wallet/credit/balanceGETBalance + subscription snapshot
    /api/wallet/credit/historyGETPaginated transaction history
    /api/wallet/credit/topupPOSTAdd credits
    /api/wallet/credit/spendPOSTSpend credits
    /api/prices/ring-usdGETOracle price for UI and receipts
    /api/membership/subscription/createPOSTStart membership
    /api/membership/subscription/statusGETSubscription state
    /api/membership/subscription/cancelPOSTCancel

    Client hook: hooks/use-credit-balance.ts — initial REST fetch + tunnel push updates (no polling).

    Layer 2 — On-chain RING reference contracts

    Ring ships UUPS upgradeable reference contracts for clones that want treasury-controlled ERC-20 utility on Polygon (chainId 137).

    RingToken (contracts/RingToken.sol)

    ConstantValue
    INITIAL_SUPPLY1,000,000,000 RING → minted to treasury at initialize
    MEMBERSHIP_FEE1 RING / month
    MIN_SUBSCRIPTION_BALANCE12 RING
    Decimals18

    Owner functions: setMembershipContract, setTreasury, creditTokens (treasury airdrops), pause / unpause.

    Membership-only: deductMembershipFee(member) — callable only by linked RingMembership.

    RingMembership (contracts/RingMembership.sol)

    ConstantValue
    SUBSCRIPTION_PERIOD30 days
    GRACE_PERIOD7 days
    MAX_FAILED_ATTEMPTS3 → EXPIRED

    Statuses: INACTIVE, ACTIVE, EXPIRED, CANCELLED, SUSPENDED.

    On-chain lifecycle: createSubscription() → processBatchPayments(batchSize) (operator/cron) → cancelSubscription() / admin suspend.

    Utility token — not a security pitch

    RING reference tokenomics gate platform access. Consult counsel before marketing yield, profit expectations, or exchange listings.

    On-chain ↔ ledger sync

    App subscriptions today run on the credit ledger. On-chain RingMembership is the reference for treasury policy and future sync; wire batch renewal cron to subscriptionService.processBatchPayments() when you bridge both layers.

    Deploy reference contracts

    Hardhat project: contracts/. ReferralRewards compiles from contracts/contracts-src/; RingToken / RingMembership live at contracts/*.sol — align hardhat.config.js paths.sources or copy sources before compile if factories fail.

    1. 1

      Install and compile

    2. 2

      Testnet deploy (script references Polygon Mumbai — migrate to Amoy or fork script for current testnets)

      Deploy order: RingToken → RingMembership → ringToken.setMembershipContract(...). Output: contracts/deployments/mumbai-deployment.json.

    3. 3

      Mainnet — scripts/deploy-mainnet.js after audit + multisig treasury. Fund deployer with POL; use Alchemy/Infura RPC (not anonymous polygon-rpc.com).

    4. 4

      Wire env and redeploy app

      Client metadata: constants/web3.ts — TOKEN_CONFIGS, staking scaffold (RING_STAKING_ADDRESS, 20% APR placeholder).

    Layer 3 — Referral token rewards (refcodes)

    Growth economics are separate from membership fees. When a referred user completes a qualifying purchase, the platform mints or transfers reward tokens via ReferralRewards (UUPS).

    PiecePath / contract
    Contractcontracts/contracts-src/ReferralRewards.sol
    Deploynpx hardhat run scripts/deploy-referral-rewards.js --network polygon
    Minterfeatures/refcodes/services/reward-minter.ts (viem)
    Ops runbookREFERRAL-ONCHAIN-OPS.md (repo root)

    Clone install helper: scripts/install-refcodes-module.sh.

    Payment rails — fiat, credit, native token

    Token economics intersect PaymentConductor — one ledger (payment_transactions), multiple rails.

    RailEnvUse
    merchant_redirectWayForPay / StripeCard checkout, membership upgrade fiat
    internal_creditPAYMENT_STORE_ALLOW_CREDIT=trueSpend credit_balance at store
    native_tokenPAYMENT_STORE_ALLOW_TOKEN=trueOn-chain token checkout (advanced)

    Apply data/migrations/004_payment_transactions.sql before production payments. Full operator guide: Payment integration.

    White-label token branding

    ring-config.json

    getRingTokenSymbol() and getNativeTokenConfig() read this for checkout labels, wallet UI, and payment copy. Fork the symbol/name for vertical clones (e.g. GFT, DAAR) without renaming Solidity unless you deploy a new ERC-20.

    Sidebar and public pages

    ring-config.json → sidebar.quickLinks includes about.sidebar.tokenEconomy → /token-economy on your clone's marketing site.

    Staking and vendor gates

    constants/web3.ts defines a RING staking pool scaffold (20% APR, 100 RING minimum) — configure addresses per clone or disable in UI.

    components/vendor/staking-card.tsx supports per-product vendor stake requirements (tokenSymbol, requiredStake) — use for agent/vendor activation flows, not global protocol rules.

    Design your clone economy

    1. 1

      Classify the token

      Recommended

      Utility token — listings, membership, marketplace fees. No profit promises.

      Security tokens and multi-token splits need legal review before launch.

    2. 2

      Set parameters

      Map fees in constants/store.ts / ERP commission helpers for marketplace cuts.

    3. 3

      Integrate with Ring services

      1. Deploy or fork RingToken.sol / RingMembership.sol (optional)
      2. Update ring-config.json + constants/web3.ts addresses
      3. Set RING_TOKEN_CONTRACT_ADDRESS + membership env vars
      4. Enable PAYMENT_STORE_ALLOW_CREDIT if store should spend credits
      5. Deploy ReferralRewards when refcodes on-chain rewards are live
      6. Smoke: npm run smoke:pipelines (see scripts/PIPELINES.md)

    Health metrics

    MetricSignal
    Active subscriptions / failed payment ratering_subscriptions + credit history
    Credit ledger vs treasuryReconcile users.data.credit_balance with on-chain treasury movements
    Referral mint queuereferral_rewards status + /admin/refcodes
    Oracle freshnessPriceOracleService cache TTL and fallback usage
    Payment ledgerpayment_transactions by rail and processor

    Legal and launch checklist

    Jurisdiction

    Token launches have jurisdiction-specific consequences. Engage counsel before public sale, exchange listing, or yield marketing. See the dedicated guide: Token launch jurisdictions (EU MiCA, US SEC/CFTC, UK FCA, Ukraine, FATF, official sources).

    Immediate

    • Choose: RING reference vs branded ERC-20 fork
    • Set ring-config.json token symbol + public token economy page
    • Multisig treasury and contract owner keys
    • Tokenomics paper (utility, fees, treasury — no investment claims)

    Development

    • Postgres migrations through 004_payment_transactions + 005_refcodes_schema
    • Wire credit + PaymentConductor env vars
    • Deploy testnet contracts; run contracts/test
    • Smoke membership create + store credit checkout

    Launch

    • Mainnet deploy after audit
    • Verify contracts on Polygonscan
    • Enable refcodes minter (REFERRAL-ONCHAIN-OPS.md)
    • Monitor subscription metrics and treasury alerts

    Payment integration

    Webhooks, WayForPay, Stripe setup

    Database migrations

    refcodes, payment_transactions, schema order

    Ring customization opportunities

    Web3 specialists on the platform

    Token Economics Setup

    Executive summary

    Ring clones ship a three-layer economy: (1) an off-chain credit ledger in PostgreSQL for membership and store checkout, (2) optional on-chain RING reference contracts for treasury-grade utility tokenomics, and (3) a referral token rail (ReferralRewards + refcodes) for platform-funded growth payouts. ring-platform.org brands the utility token as RING; agricultural clones (e.g. GreenFood) may fork symbols to DAAR / DAARION via ring-config.json.

    Payment integration

    PaymentConductor — WayForPay, Stripe, internal credit

    Web3 wallet feature

    Custodial wallets, balances, top-up UX

    Referral codes (refcodes)

    Attribution, ledger, on-chain mint

    Affiliate enablement

    Dual-rail ERP commission + token rewards

    Refcodes architecture

    viem minter, env contract, cron

    Customization guide

    ring-config.json, locales, feature flags

    Philosophy

    Traditional platforms capture value in opaque ledgers. Ring-powered clones expose fee flows you control: membership utility, marketplace settlement, referral growth, and optional on-chain treasury — all configurable per white-label instance.

    PrincipleRing implementation
    Utility-firstTokens gate features and settle platform fees — not investment promises
    Postgres-primaryCredit balances and subscriptions live in users.data + ring_subscriptions when DB_BACKEND_MODE=k8s-postgres-fcm
    Fiat + credit coexistWayForPay/Stripe for card rails; internal_credit spends the same ledger
    Per-clone brandingring-config.json → tokens.ring.symbol drives UI copy via getRingTokenSymbol()
    Three economic layers

    Layer 1 — Off-chain credit ledger (production path today)

    Most membership and store flows debit an application credit balance — denominated in your clone token symbol (default RING) — without requiring a wallet signature on every renewal.

    Data model

    StoreLocationContents
    Balanceusers.data.credit_balanceamount, usd_equivalent, subscription_active, subscription_next_payment
    Historyusers.data.credit_transactionsTyped ledger entries with optional tx_hash, order_id
    Subscriptionsring_subscriptions collectionStatus, next_payment_due, failed_attempts, auto_renew

    Schema comment: users.data JSONB in data/schema.sql v4+.

    Core services

    ServicePathRole
    UserCreditServicefeatures/wallet/services/user-credit-service.tsBalance read/write, spend, top-up, membership fee debit, tunnel publish on change
    SubscriptionServiceservices/membership/subscription-service.tsCreate/cancel/renew; 1 RING/month; upgrades membership.tier → member
    PriceOracleServiceservices/blockchain/price-oracle-service.tsRING/USD via viem + Chainlink/CoinGecko/CMC/Binance fallbacks
    Internal credit checkoutlib/payments/processors/internal-credit.processor.tsPaymentConductor rail for store + membership spend

    Membership economics (reference)

    ParameterValueWhere enforced
    Monthly fee1 utility tokensubscription-service.ts (membershipFee = '1.0')
    Billing period30 daysnext_payment_due timestamp math
    Recommended buffer12 tokens (1 year)RingToken.MIN_SUBSCRIPTION_BALANCE on-chain; UI warnings via credit limits
    Role gateSUBSCRIBER+ to subscribePOST /api/membership/subscription/create
    1. 1

      User tops up or receives airdrop

      POST /api/wallet/credit/topup (admin/ops) or fulfillment after wallet_topup PaymentConductor purpose adds credits via userCreditService.addCredits().

    2. 2

      User creates subscription

      POST /api/membership/subscription/create debits 1 RING credit, writes ring_subscriptions, sets credit_balance.subscription_active.

      Contract env gate

      This route returns 503 until RING_TOKEN_CONTRACT_ADDRESS and RING_MEMBERSHIP_CONTRACT_ADDRESS are set — even though the debit is ledger-based. Set deployed addresses (or placeholder addresses in dev) to unlock the API.

    3. 3

      Store checkout with credit

      When PAYMENT_STORE_ALLOW_CREDIT=true, PaymentConductor internal_credit rail spends credits for orders in currencies allowed by PAYMENT_CREDIT_ACCEPT_ORDER_CURRENCY (defaults to PAYMENT_FIAT_CURRENCY).

    Credit API surface

    EndpointMethodPurpose
    /api/wallet/credit/balanceGETBalance + subscription snapshot
    /api/wallet/credit/historyGETPaginated transaction history
    /api/wallet/credit/topupPOSTAdd credits
    /api/wallet/credit/spendPOSTSpend credits
    /api/prices/ring-usdGETOracle price for UI and receipts
    /api/membership/subscription/createPOSTStart membership
    /api/membership/subscription/statusGETSubscription state
    /api/membership/subscription/cancelPOSTCancel

    Client hook: hooks/use-credit-balance.ts — initial REST fetch + tunnel push updates (no polling).

    Layer 2 — On-chain RING reference contracts

    Ring ships UUPS upgradeable reference contracts for clones that want treasury-controlled ERC-20 utility on Polygon (chainId 137).

    RingToken (contracts/RingToken.sol)

    ConstantValue
    INITIAL_SUPPLY1,000,000,000 RING → minted to treasury at initialize
    MEMBERSHIP_FEE1 RING / month
    MIN_SUBSCRIPTION_BALANCE12 RING
    Decimals18

    Owner functions: setMembershipContract, setTreasury, creditTokens (treasury airdrops), pause / unpause.

    Membership-only: deductMembershipFee(member) — callable only by linked RingMembership.

    RingMembership (contracts/RingMembership.sol)

    ConstantValue
    SUBSCRIPTION_PERIOD30 days
    GRACE_PERIOD7 days
    MAX_FAILED_ATTEMPTS3 → EXPIRED

    Statuses: INACTIVE, ACTIVE, EXPIRED, CANCELLED, SUSPENDED.

    On-chain lifecycle: createSubscription() → processBatchPayments(batchSize) (operator/cron) → cancelSubscription() / admin suspend.

    Utility token — not a security pitch

    RING reference tokenomics gate platform access. Consult counsel before marketing yield, profit expectations, or exchange listings.

    On-chain ↔ ledger sync

    App subscriptions today run on the credit ledger. On-chain RingMembership is the reference for treasury policy and future sync; wire batch renewal cron to subscriptionService.processBatchPayments() when you bridge both layers.

    Deploy reference contracts

    Hardhat project: contracts/. ReferralRewards compiles from contracts/contracts-src/; RingToken / RingMembership live at contracts/*.sol — align hardhat.config.js paths.sources or copy sources before compile if factories fail.

    1. 1

      Install and compile

    2. 2

      Testnet deploy (script references Polygon Mumbai — migrate to Amoy or fork script for current testnets)

      Deploy order: RingToken → RingMembership → ringToken.setMembershipContract(...). Output: contracts/deployments/mumbai-deployment.json.

    3. 3

      Mainnet — scripts/deploy-mainnet.js after audit + multisig treasury. Fund deployer with POL; use Alchemy/Infura RPC (not anonymous polygon-rpc.com).

    4. 4

      Wire env and redeploy app

      Client metadata: constants/web3.ts — TOKEN_CONFIGS, staking scaffold (RING_STAKING_ADDRESS, 20% APR placeholder).

    Layer 3 — Referral token rewards (refcodes)

    Growth economics are separate from membership fees. When a referred user completes a qualifying purchase, the platform mints or transfers reward tokens via ReferralRewards (UUPS).

    PiecePath / contract
    Contractcontracts/contracts-src/ReferralRewards.sol
    Deploynpx hardhat run scripts/deploy-referral-rewards.js --network polygon
    Minterfeatures/refcodes/services/reward-minter.ts (viem)
    Ops runbookREFERRAL-ONCHAIN-OPS.md (repo root)

    Clone install helper: scripts/install-refcodes-module.sh.

    Payment rails — fiat, credit, native token

    Token economics intersect PaymentConductor — one ledger (payment_transactions), multiple rails.

    RailEnvUse
    merchant_redirectWayForPay / StripeCard checkout, membership upgrade fiat
    internal_creditPAYMENT_STORE_ALLOW_CREDIT=trueSpend credit_balance at store
    native_tokenPAYMENT_STORE_ALLOW_TOKEN=trueOn-chain token checkout (advanced)

    Apply data/migrations/004_payment_transactions.sql before production payments. Full operator guide: Payment integration.

    White-label token branding

    ring-config.json

    getRingTokenSymbol() and getNativeTokenConfig() read this for checkout labels, wallet UI, and payment copy. Fork the symbol/name for vertical clones (e.g. GFT, DAAR) without renaming Solidity unless you deploy a new ERC-20.

    Sidebar and public pages

    ring-config.json → sidebar.quickLinks includes about.sidebar.tokenEconomy → /token-economy on your clone's marketing site.

    Staking and vendor gates

    constants/web3.ts defines a RING staking pool scaffold (20% APR, 100 RING minimum) — configure addresses per clone or disable in UI.

    components/vendor/staking-card.tsx supports per-product vendor stake requirements (tokenSymbol, requiredStake) — use for agent/vendor activation flows, not global protocol rules.

    Design your clone economy

    1. 1

      Classify the token

      Recommended

      Utility token — listings, membership, marketplace fees. No profit promises.

      Security tokens and multi-token splits need legal review before launch.

    2. 2

      Set parameters

      Map fees in constants/store.ts / ERP commission helpers for marketplace cuts.

    3. 3

      Integrate with Ring services

      1. Deploy or fork RingToken.sol / RingMembership.sol (optional)
      2. Update ring-config.json + constants/web3.ts addresses
      3. Set RING_TOKEN_CONTRACT_ADDRESS + membership env vars
      4. Enable PAYMENT_STORE_ALLOW_CREDIT if store should spend credits
      5. Deploy ReferralRewards when refcodes on-chain rewards are live
      6. Smoke: npm run smoke:pipelines (see scripts/PIPELINES.md)

    Health metrics

    MetricSignal
    Active subscriptions / failed payment ratering_subscriptions + credit history
    Credit ledger vs treasuryReconcile users.data.credit_balance with on-chain treasury movements
    Referral mint queuereferral_rewards status + /admin/refcodes
    Oracle freshnessPriceOracleService cache TTL and fallback usage
    Payment ledgerpayment_transactions by rail and processor

    Legal and launch checklist

    Jurisdiction

    Token launches have jurisdiction-specific consequences. Engage counsel before public sale, exchange listing, or yield marketing. See the dedicated guide: Token launch jurisdictions (EU MiCA, US SEC/CFTC, UK FCA, Ukraine, FATF, official sources).

    Immediate

    • Choose: RING reference vs branded ERC-20 fork
    • Set ring-config.json token symbol + public token economy page
    • Multisig treasury and contract owner keys
    • Tokenomics paper (utility, fees, treasury — no investment claims)

    Development

    • Postgres migrations through 004_payment_transactions + 005_refcodes_schema
    • Wire credit + PaymentConductor env vars
    • Deploy testnet contracts; run contracts/test
    • Smoke membership create + store credit checkout

    Launch

    • Mainnet deploy after audit
    • Verify contracts on Polygonscan
    • Enable refcodes minter (REFERRAL-ONCHAIN-OPS.md)
    • Monitor subscription metrics and treasury alerts

    Payment integration

    Webhooks, WayForPay, Stripe setup

    Database migrations

    refcodes, payment_transactions, schema order

    Ring customization opportunities

    Web3 specialists on the platform

    /api/membership/payment/ringPOSTMembership payment variants
    /api/membership/payment/ringPOSTMembership payment variants
    /api/membership/payment/ringPOSTMembership payment variants