Introduction

Protocol reference for the LayerSub stack.

Contracts, solvency model, API and deployed addresses for $SUB and the LayerSub-Staking vault.

2ContractsLayerSubToken · LayerSubStakingVault
19Documented functionsWith reverts and events
7REST endpointsRead-only indexer API
1Live networksof 3 configured

Why solvency is the hard part

Because LayerSub uses one token for both staking and rewards, the vault must never pay staked principal out as yield. Rewards therefore come from an explicit budget the owner funds, and emission stops the moment that budget would run out.

Reward per tokenrewardPerToken() = rewardPerTokenStored + (elapsed × rewardRate × 1e18) / totalStaked

elapsed = lastTimeRewardApplicable() − lastUpdateTime. Returns the stored value unchanged while totalStaked is zero.

Earned by a stakerearned(a) = balanceOf(a) × (rewardPerToken() − userRewardPerTokenPaid[a]) / 1e18 + rewards[a]

Two floor divisions sit between the budget and the payout, which is where the vault's rounding surplus comes from.

Read the solvency model

Live deployment

Ethereum Sepolia (chain 11155111) is the only network with bytecode on chain. The other 2 entries are planned.

$SUB token
0xaa3b5cDF3a315158d8cC6621Eb7d7a3E095fADf9
Staking vault
0x32720d8C06C24751dd1DFF4e3940D58f1f5bd0F6
Initial $SUB supply
1,000,000 $SUBMinted to the deployer at construction.
Reward budget
100,000 $SUBFunded into the vault via fundRewards.
Emission rate
1,000 $SUB / day11574074074074074 wei per second, as set by setRewardRate.
All addresses and parameters

Integrating

The backend exposes 7 read-only endpoints over the indexed chain state. Two conventions catch most integrations out:

  • Amounts are decimal strings

    $SUB is an 18-decimal token, so amounts routinely exceed Number.MAX_SAFE_INTEGER. Every uint256 is serialised as a decimal string and never as a JSON number. Parse with BigInt(value), or viem's formatUnits(value, 18) for display.

  • Unknown query parameters are rejected

    A typo such as ?limitt=10 returns 400 rather than being silently ignored, so a mistake in an integration surfaces immediately instead of looking like a backend bug.