| name | ton-staking |
| description | Activate when the user works with TON staking, WTON, seigniorage, SeigManager, DepositManager, staking balance queries, layer2 operators, or TON/WTON decimal conversion. Covers the ton-staking-v2 system.
|
| license | MIT |
| metadata | {"author":"tokamak-network","version":"1.0.0"} |
TON Staking V2
TON Staking V2 distributes seigniorage (newly minted TON) to L2 sequencers proportional to each L2's TVL. Stakers deposit TON → convert to WTON → stake on a layer2 operator.
Critical: Decimal Precision
This is the most common source of bugs in Tokamak development.
| Token | Decimals | Unit Name | Example: "100 tokens" |
|---|
| TON | 18 | WAD | 100 * 1e18 |
| WTON | 27 | RAY | 100 * 1e27 |
All staking functions return values in WTON (27 decimals).
// WRONG: dividing by 1e18 to get human-readable
uint256 staked = seigManager.stakeOf(layer2, account);
uint256 humanReadable = staked / 1e18; // WRONG! Off by 1e9
// CORRECT: divide by 1e27 for WTON values
uint256 staked = seigManager.stakeOf(layer2, account);
uint256 humanReadable = staked / 1e27; // Correct
const staked = await seigManager.stakeOf(layer2, account);
const display = ethers.formatEther(staked);
const staked = await seigManager.stakeOf(layer2, account);
const display = ethers.formatUnits(staked, 27);
Core Contracts
| Contract | Mainnet | Sepolia |
|---|
| TON | 0x2be5e8c109e2197D077D13A82dAead6a9b3433C5 | 0xa30fe40285b8f5c0457dbc3b7c8a280373c40044 |
| WTON | 0xc4A11aaf6ea915Ed7Ac194161d2fC9384F15bff2 | 0x79e0d92670106c85e9067b56b8f674340dca0bbd |
| SeigManagerProxy | 0x0b55a0f463b6defb81c6063973763951712d0e5f | 0x2320542ae933FbAdf8f5B97cA348c7CeDA90fAd7 |
| DepositManagerProxy | 0x0b58ca72b12f01fc05f8f252e226f3e2089bd00e | 0x90ffcc7F168DceDBEF1Cb6c6eB00cA73F922956F |
Full address list with ABIs: See references/contract-addresses.md
Key Functions
SeigManager (read staking state)
// Get staked amount for account on a specific layer2 (returns WTON, 27 decimals)
function stakeOf(address layer2, address account) external view returns (uint256)
// Get uncommitted seigniorage
function uncommittedStakeOf(address layer2, address account) external view returns (uint256)
// Seigniorage rate
function seigPerBlock() external view returns (uint256)
// Commission rate for a layer2 operator
function commissionRates(address layer2) external view returns (uint256)
// Get the coinage token address for a layer2
function coinages(address layer2) external view returns (address)
DepositManager (deposit/withdraw)
// Deposit WTON to a layer2 (must approve WTON first)
function deposit(address layer2, uint256 amount) external
// Request withdrawal (starts 13-day lockup on L1)
function requestWithdrawal(address layer2, uint256 amount) external
// Process pending withdrawal after lockup
function processRequest(address layer2, bool receiveTON) external
Staking Flow
1. Acquire TON
2. Swap TON → WTON (WTON contract: swapFromTON)
3. Approve WTON spending to DepositManager
4. Call DepositManager.deposit(layer2, amount)
5. Seigniorage accrues per block automatically
6. To withdraw: requestWithdrawal → wait 13 days → processRequest
Seigniorage Distribution
- 3.92 TON per block minted as seigniorage
- Split into: staker seigniorage + PowerTON + DAO
- Distributed proportionally by each L2's TVL
- DAO can pause/resume seigniorage for specific L2s
Detailed seigniorage math (RAY arithmetic): See references/seigniorage-math.md
On-Chain Query Script
Query staking data directly:
bash /mnt/skills/user/ton-staking/scripts/query-stake.sh <address>
Common Mistakes
| Mistake | Fix |
|---|
Using formatEther for WTON | Use formatUnits(value, 27) |
| Calling Logic contract directly | Always call the Proxy address |
| Forgetting WTON approval before deposit | wton.approve(depositManager, amount) first |
| Not waiting 13 days for L1 withdrawal | Use CrossTrade for instant withdrawals |
| Assuming TON and WTON are interchangeable | They have different decimals (18 vs 27) |
Related
- tokamak-contracts skill: full address lists, proxy pattern details
- cross-trade skill: bypass the 13-day withdrawal delay
- npm:
@tokamak-network/tokamak-staking-lib (seigniorage calculator)
- Source: https://github.com/tokamak-network/ton-staking-v2