Skip to content

feat(registry): add name pricing with length-based registration feesΒ #1

Open

Description

@Meet-hybrid

πŸ’  Sidera β€” Stellar Name Service. Contribute via Drips Wave / GrantFox. Comment with your approach and wait for assignment before starting.

Description

Registration is currently free (register charges nothing), which invites name-squatting: one account can register thousands of short valuable names (bob, xlm, usdc) at zero cost. A paid registry needs a length-based fee β€” shorter names cost more β€” so scarcity is priced instead of grabbed.

Desired outcome: register requires an XLM payment attached to the invocation, priced by a public length-tier function, with the fee held by the contract (treasury distribution is a separate tranche).

Scope

  • Crate/module: crates/registry, src/lib.rs
  • API: new fn price_for(env, name) -> i128 read-only view; register gains a fee check on the attached payment
  • Storage: new DataKey::FeeConfig (instance) for tier boundaries; contract XLM balance implicitly holds fees
  • Tests: pricing tiers (3–4 / 5–7 / 8–31 / 32 chars), insufficient-payment rejection, exact-payment acceptance, config update gated by admin auth
  • Docs: docs/ pricing section + README note

Non-goals

  • Fee distribution/treasury (separate issue)
  • USDC or other token pricing
  • Renewal fees (separate issue)
  • Auctions or premium-name lists

What "done" looks like

  • price_for returns deterministic tiers, e.g. len 3–4: 100 XLM-stroops scale, documented constants
  • register rejects underpayment with a new RegistryError::InsufficientFee (code 6)
  • Overpayment is accepted and NOT refunded (documented) or rejected β€” pick one, document it, test it
  • Fee config update requires admin authorization
  • Unit tests cover every tier boundary and both payment paths
  • cargo fmt --all -- --check, clippy -D warnings, full tests pass
  • WASM builds for wasm32v1-none and stays under 150 KB

Implementation guidelines

  • Follow the existing pattern: validate β†’ require_auth β†’ mutate β†’ write (see register in src/lib.rs)
  • Reuse the workspace error style in RegistryError; add the variant at the next free code
  • Use env.storage().instance() for FeeConfig (small hot config), consistent with DataKey::Count
  • Attached-payment checks: use the native XLM contract address via token::StellarAssetClient/Client patterns already present in the SDK; do not introduce new dependencies
  • Keep all fallible validation before any storage mutation

Verification

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test -p sidera-registry --all-targets --locked
cargo build --locked --release --target wasm32v1-none -p sidera-registry

PR guidelines

  • Get assigned before starting; do not start work on a reserved issue.
  • Work in a fork; branch off upstream/main; open the PR against Sidera-Protocol/sidera-contracts:main.
  • PR description must include Closes #1.
  • All CI checks must pass; a human maintainer review is required (see CONTRIBUTING.md).

Metadata

  • Affected crates/files: contracts/registry/src/lib.rs, docs/
  • Complexity label: complexity: medium (150 base points)
  • Type labels: enhancement

Activity

  1. Rodrigoue9 commented on Oct 7, 2026

    @Rodrigoue9

    Hi @maintainer! I would like to implement length-based pricing tiers for domain registration.

    Technical Outline:

    1. Pricing Schedule:
      • Implement length-based fee calculation helper (calculate_fee(name: &String) -> i128):
        • 3 characters: Premium tier
        • 4 characters: Standard plus tier
        • 5+ characters: Base tier
    2. Token Transfer Integration:
      • Accept payment token contract address and execute token::Client::new(&env, &token_address).transfer(&owner, &treasury, &fee) during register.
      • Store treasury address in contract instance storage with admin setter.
    3. Atomicity & Invariants:
      • If payment token transfer fails (e.g. insufficient balance/allowance), registration atomically aborts.
    4. Verification:
      • Mock token contract tests verifying exact fee deductions for various name lengths.
      • Zero clippy warnings and clean formatting.

    Track Record

    Looking forward to your assignment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: mediumStandard features or involved bug fixes (150 pts)enhancementNew feature or requestexternal-contributorsSuitable for contributors outside the maintainer team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions