Belong.net Logo
Contract guides

Staking Guide

End-to-end staking operations on EVM chains for LONG tokens, executed directly from the user's wallet.
Purple tokens and gift boxes beside Unlock Bigger Rewards with LONG.
LONG staking tiers determine the fee and reward benefits listed in this guide.Original post

Overview

This guide provides frontend examples for performing staking operations with LONG tokens on EVM-compatible chains directly from the user's wallet. It covers minting, depositing, withdrawing, redeeming, and emergency operations.

Staking places LONG into a staking contract; withdrawing or redeeming follows the contract functions below. Start by matching the wallet network and token amount to the operation you intend to sign. For the customer-facing effect of staking on venue fees, see Fees & Staking.


Important Note

Throughout the examples below, parseEther("<amount>") is used to convert token amounts into their on-chain uint256 representation. Although the function name refers to “Ether”, it represents LONG tokens, not ETH. For example, parseEther("0.5") corresponds to 0.5 LONG tokens.


Process Flow

flowchart TD;

    A[Start: User Connect] --> B[Staking Mint]
    B --> C[Staking Deposit]
    C --> D{Withdraw or Redeem?}
    D --> E[Staking Withdraw]
    D --> F[Staking Redeem]
    E --> G[Emergency Functions]
    F --> G
    G --> H[End: Tokens Managed]


Usage Examples

Staking Mint

/*
 * mint(uint256 shares, address user)
 * The user mints sLONG shares by depositing LONG.
 * Note: parseEther("0.5") means 0.5 LONG tokens (not ETH).
 */
async function stakingMint() {
  // Approve LONG token before mint
  const transaction = prepareContractCall({
    contract,
    method: "mint",
    params: [parseEther("0.5"), "0xUserAddress"],
  });
}

Staking Deposit

/*
 * deposit(uint256 assets, address user)
 * The user deposits LONG tokens and receives sLONG.
 * Note: parseEther("0.5") means 0.5 LONG tokens (not ETH).
 */
async function stakingDeposit() {
  // Approve LONG token before deposit
  const transaction = prepareContractCall({
    contract,
    method: "deposit",
    params: [parseEther("0.5"), "0xUserAddress"],
  });
}

Staking Withdraw

/*
 * withdraw(uint256 assets, address receiver, address owner)
 * The user withdraws LONG by burning sLONG.
 * Note: parseEther("0.1") means 0.1 LONG tokens (not ETH).
 */
async function stakingWithdraw() {
  const transaction = prepareContractCall({
    contract,
    method: "withdraw",
    params: [parseEther("0.1"), "0xUserAddress", "0xUserAddress"],
  });
}

Staking Redeem

/*
 * redeem(uint256 shares, address receiver, address owner)
 * The user redeems sLONG and receives LONG.
 * Note: parseEther("0.1") means 0.1 LONG tokens (not ETH).
 */
async function stakingRedeem() {
  const transaction = prepareContractCall({
    contract,
    method: "redeem",
    params: [parseEther("0.1"), "0xUserAddress", "0xUserAddress"],
  });
}

Emergency Withdraw

/*
 * emergencyWithdraw(uint256 assets, address receiver, address owner)
 * Emergency withdrawal in case of issues.
 * Note: parseEther("0.1") means 0.1 LONG tokens (not ETH).
 */
async function emergencyWithdraw() {
  const transaction = prepareContractCall({
    contract,
    method: "emergencyWithdraw",
    params: [parseEther("0.1"), "0xUserAddress", "0xUserAddress"],
  });
}

Emergency Redeem

/*
 * emergencyRedeem(uint256 shares, address receiver, address owner)
 * Emergency redemption for stuck positions.
 * Note: parseEther("0.1") means 0.1 LONG tokens (not ETH).
 */
async function emergencyRedeem() {
  const transaction = prepareContractCall({
    contract,
    method: "emergencyRedeem",
    params: [parseEther("0.1"), "0xUserAddress", "0xUserAddress"],
  });
}

Errors

MCP tools return errors in the standard JSON format:

{
  "error": "STAKING_INSUFFICIENT_BALANCE"
}

Common error codes

CodeDescription
STAKING_INSUFFICIENT_BALANCENot enough LONG tokens to complete the transaction.
APPROVE_REQUIREDToken approval is missing or insufficient.
EMERGENCY_ONLYOperation allowed only in emergency mode.
INVALID_AMOUNTProvided amount is invalid (zero or exceeds limits).

Copyright © 2026