- Contract integration – you deploy your own smart contract and that contract deposits into SuperEarn.
- Frontend‑only integration – your UI calls SuperEarn directly from the user’s wallet.
accountAddress.
Common building blocks
You will need three addresses (See smart contracts page):SUPEREARN_ROUTER– SuperEarn router (ISuperEarnRouter).SUPER_VAULT– the EarnUSDT Super Vault (the EarnUSDT ERC‑20 share token).USDT– Kaia USDT token.
deposit(address superVault, uint256 amount, uint256 minSharesOut) returns (uint256 shares)deposit(address superVault, uint256 amount, address receiver, uint256 minSharesOut) returns (uint256 shares)depositWithPermit(...) returns (uint256 shares)previewDeposit(address superVault, uint256 amount) view returns (uint256 expectedShares)previewRedeem(address superVault, uint256 shares) view returns (uint256 expectedAssets)redeem(address superVault, uint256 shares, uint256 minAssetsOut) returns (uint256 requestId)redeem(address superVault, uint256 shares, address receiver, uint256 minAssetsOut) returns (uint256 requestId)
CooldownVault). All user / integrator deposits and withdrawals must go through SuperEarnRouter; CooldownVault deposits/redeems are restricted to protocol contracts. Claims are permissionless but normally handled by protocol keepers to batch requests.You can get the CooldownVault address from the Super Vault:
1. Contract integration (your own wrapper contract)
When to use-
Centralized service, CEX, wallet, or protocol that:
- Holds users’ funds in its own contract, and
- Wants to manage EarnUSDT on behalf of users.
SuperEarnRouter.
Assume:
1-1. Deposit (USDT → EarnUSDT) via your contract
High‑level flow- User sends USDT into your contract (e.g. via
transferFrom). - Your contract approves
SuperEarnRouterto spend USDT. - Your contract calls
ROUTER.deposit(SUPER_VAULT, amount, receiver, minSharesOut). - EarnUSDT shares are minted to
receiver(usually your contract). - You update your internal accounting.
1-2. Withdraw / redeem (EarnUSDT → USDT) via your contract
Redemption is a 2‑step process under the hood (redeem request → claim after cooldown), but your contract usually only needs to start the request. A keeper / bot normally handles claim. High‑level flow- You reduce the user’s internal share balance.
- Your contract approves
SuperEarnRouterto spend its EarnUSDT shares. - Call
ROUTER.previewRedeemfor an estimate (optional). - Call
ROUTER.redeem(SUPER_VAULT, shares, receiver, minAssetsOut). - You get a
requestIdfor the pending withdrawal. - After cooldown, USDT is delivered to
receiverwhen the request is claimed.
deposit, redeem, or claim on CooldownVault directly. Read access (e.g. redeemRequests) is fine for monitoring.
1-3. Read data via GraphQL (for contract integration)
For more detailed information about Subgraphs, please refer to the Subgraphs page.For reads, you don’t talk to the contract directly. Instead, use the GraphQL read API (built on top of the subgraph / processed data layer). For contract integration:
accountAddress= your wrapper contract address- You filter positions by the EarnUSDT Super Vault.
1-3-1. Get vault list (to find EarnUSDT Super Vault)
- Look for the vault where
vaultNameorcontractAddressmatches your EarnUSDT Super Vault.
1-3-2. Get your contract’s EarnUSDT position
- Use your wrapper contract address as
$wrapper. - Filter
positionsclient‑side wherevault.contractAddress == SUPER_VAULT.
1-3-3. Optional: account charts
2. Frontend‑only integration (direct from user wallet)
When to use- Non‑custodial dApps / wallets.
- You want the user’s wallet to hold EarnUSDT shares directly.
- No custom wrapper contract – just frontend and SuperEarn.
SuperEarnRouter from the user’s wallet using ethers, viem, wagmi, etc.
Assume you have:
routerAddress = SUPEREARN_ROUTERsuperVaultAddress = SUPER_VAULTusdtAddress = USDT
2-1. Deposit (USDT → EarnUSDT) directly from frontend
High‑level UX- User connects wallet.
- Frontend asks user to approve USDT for
SuperEarnRouter. - Frontend calls
deposit(superVault, amount, minSharesOut)from the wallet. - User receives EarnUSDT shares (Super Vault shares) in their wallet.
permit, use depositWithPermit to skip the explicit ERC‑20 approval.
2-2. Withdraw / redeem (EarnUSDT → USDT) from frontend
From the user’s point of view:- They pick how much EarnUSDT to redeem.
- Your UI shows an estimate using
previewRedeem. - You call
redeem(superVault, shares, minAssetsOut)from their wallet. - A redemption request is created; after the cooldown, USDT is claimable / delivered.
redeemRequests and final balances rather than calling claim itself; end users should not call CooldownVault directly.
2-3. Read user data via GraphQL
For more detailed information about Subgraphs, please refer to the Subgraphs page.For frontend‑only integration, the account is the user’s wallet address.
2-3-1. Get EarnUSDT vault info
Samepdm_vaults query as before:
contractAddress / vaultName).
2-3-2. Get a user’s EarnUSDT position
$user. Filter positions by the EarnUSDT vault.
2-3-3. Get user balance / earnings chart
3. Direct contract queries
Most integrations can rely entirely on the subgraph / GraphQL layer. If you need real‑time, raw on‑chain data (e.g. your own indexer, custom monitoring), you can use the view functions onSUPER_VAULT (EarnUSDT yVault) and CooldownVault.
3-1. Get EarnUSDT balances and underlying value
EarnUSDT (the Super Vault) is an ERC‑20 token:
In UI terms:
display balance in USDT = convertToAssets(balanceOf(user)).
3-2. Check cooldown redemption details
When you callROUTER.redeem(...), the router internally creates a CooldownVault RedeemRequest.
You can read its state directly from CooldownVault using the requestId returned by the router.
- Resolve the CooldownVault address
- Query a specific redemption request
- Compute claimable time:
- Show “pending / claimable / claimed” states per
requestId.
3-3. Check global cooldown configuration
You can read the global cooldown period applied to new redemption requests:- Show “estimated withdrawal time” in UI.
- Enforce minimum UX expectations (e.g. “cooldown ≈ 7 days”).
3-4. System status: emergency & pause
For safety‑aware integrations you may want to halt actions if the system is paused or in emergency mode.- Block new deposits / redeems in your app when
isEmergency || isPausedis true. - Keep reads enabled for transparency.
4. Events to watch (monitoring & indexing)
If you run your own indexer or monitoring system, you will mainly care about events from ISuperEarnRouter and CooldownVault.4-1. Router events (user‑facing actions)
Defined inISuperEarnRouter:
-
Deposited
- Trigger on successful USDT → EarnUSDT deposits.
- Index
(sender, receiver, yVault, underlyingAmount, yShares)to reconstruct deposit history.
-
Redeemed
- Trigger when a redeem request is created (EarnUSDT → USDT with cooldown).
- Use
requestIdto join withCooldownVault.redeemRequests(requestId)for full status. ySharesFilledlets you detect partial fills in advanced scenarios.
4-2. CooldownVault events (cooldown lifecycle)
Core events fromICooldownVault:
PredepositRequested, DebtRetrieved, etc.,
but most EarnUSDT integrators can ignore those.)
Usage:
-
RedeemRequested
- Mirrors router
Redeemed, but emitted at the CooldownVault level. - Good for verifying that a given
requestIdexists and carries(assets, shares, requestedTime).
- Mirrors router
-
Claimed
- Emitted when a cooldown redemption is actually claimed and USDT is transferred.
- Use it to mark a pending withdrawal as completed in your own indexer or notifications.
In practice:
- Track user intent via
Deposited/Redeemedon the router.- Track cooldown state + completion via
RedeemRequested/Claimedon CooldownVault.
5. Interface reference (abridged)
This section summarizes only the pieces of the on‑chain interfaces that most integrators actually need. Strategy‑level interfaces such asIStrategyCooldownAware
are intentionally omitted.
5-1. ISuperEarnRouter
Full interface (simplified to the relevant parts):
Rule of thumb:
- For writes, you only need
deposit,depositWithPermit,redeem.- For reads / UX, you mainly need
previewRedeem.
5-2. ICooldownVault (high‑level subset)
CooldownVault is a vault with built‑in cooldown and loss‑limit logic.
Below are the main functions relevant to EarnUSDT integrators.
-
Do not call
depositorredeemon CooldownVault — these are restricted to protocol contracts and go throughSuperEarnRouter. - Claims are permissionless but typically executed by protocol keepers to batch/optimise redemptions.
-
Helpful reads:
cooldownPeriod()– to show global cooldown.redeemRequests(requestId)– to inspect a specific withdrawal.
5-3. IVault (yVault / Super Vault)
The Super Vault wraps CooldownVault shares. For EarnUSDT integration you typically only need:
IVault(SUPER_VAULT).token() just to resolve the CooldownVault address.
Summary
For both integration styles:-
Writes (deposit / redeem) → call
SuperEarnRouter:deposit/depositWithPermitfor USDT → EarnUSDTpreviewRedeem+redeemfor EarnUSDT → USDT (cooldown‑based)
-
Reads (positions / status):
- Use the subgraph / GraphQL layer for portfolio, PnL, and charts.
- Optionally use direct contract reads for real‑time balances or custom monitoring.
-
Monitoring:
- Subscribe to
Deposited/Redeemedon the router andRedeemRequested/Claimedon CooldownVault.
- Subscribe to
accountAddress you query:
- Contract integration → your wrapper contract address.
- Frontend‑only → the user’s wallet address.