Skip to main content

Earn Overview

Sparky Earn offers fixed-term USDT products backed by an on-chain ERC-1155 contract. Users subscribe during a subscription window, principal is locked until settlement, then principal + interest are claimed on-chain.

All paths below are relative to https://api-avax.<sparky-domain>/api/v1 (one deployment per chain — see Base URLs).

  • Token: USDT (6 decimals)
  • Receipt: soulbound ERC-1155 NFT (non-transferable), burned on claim
  • Interest: principal × (annual_rate / 365) × lock_days

Product lifecycle

created ──▶ subscribing ──▶ active ──▶ settled ──▶ ended
│ │
└──▶ cancelled ◀───────────┘
StatusMeaning
createdNot yet open
subscribingSubscription window open
activeWindow closed, principal locked
settledMatured — claim available
endedEveryone has claimed
cancelledEmergency cancel — emergencyClaim returns principal

Transitions are driven by a scheduler that runs every 60 s, so expect up to a minute of lag around each boundary.

NFT status

StatusMeaning
createdRecord created, awaiting chain confirmation
activeMinted, product running
maturedSettled, claimable
redeemedClaimed, NFT burned

Units

Field familyUnitExample
Product quotas / limits (total_quota, min_amount, …)on-chain units (USDT × 10^6)"100000000" = 100 USDT
Subscription records (amount, expected_return, …)on-chain units
annual_rate, period_ratepercent string"50.00%"
*_bpsbasis points5000 = 50 %
POST /earn/subscribe/prepareamount in requesthuman-readable USDT"100"

Subscription flow

① GET /earn/products → pick a product in `subscribing`
② POST /earn/subscribe/prepare → backend EIP-712 signature (30 min)
③ USDT.approve(contract, amount) (on-chain)
④ Earn.subscribe(productId, amount, deadline, signature) (on-chain)
⑤ backend indexes `Subscribed` → record + NFT + points

Claiming after settlement is a direct contract call (claim(productId)); no backend endpoint is involved.

Endpoints

MethodEndpointAuthDescription
GET/earn/domainEIP-712 domain + Subscribe type
GET/earn/productsProduct list
GET/earn/products/:idProduct detail
GET/earn/performanceHistorical performance
GET/earn/subscriptionsJWTMy subscriptions
POST/earn/subscribe/prepareJWTSubscription signature

Contract interface: Earn contract. Daily subscription quotas per user derive from the Earn Level — see Points › Earn Quota.

Errors

{ "error": "Product is not open for subscription", "code": "SUBSCRIPTION_CLOSED" }
codeHTTPMeaning
SUBSCRIPTION_CLOSED400Product not subscribing or outside the window
AMOUNT_TOO_LOW400Below min_amount
AMOUNT_TOO_HIGH400Above max_amount_per_user
QUOTA_EXCEEDED400Product quota exhausted
INVALID_AMOUNT400Malformed / ≤ 0
PRODUCT_NOT_FOUND404
UNAUTHORIZED401