Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ISTONEUSDStaking

Git Source

Author: luoyhang003

Interface for the STONEUSD staking contract used in the Genesis Expedition event.

This interface defines:

  • Locking of STONEUSD to earn RawStones and Hammers
  • Eligibility tracking for daily rewarded hammers
  • Unlocking staked STONEUSD after the event ends
  • View helpers for quota, locked amount, and user eligibility

Functions

lock

Locks STONEUSD into the staking contract to participate in the event.

  • Requires the event to be active.
  • Enforces per-user lock quota.
  • May trigger referral binding and bonus hammer distribution.
function lock(uint256 _tokenLocked, address _referrer) external;

Parameters

NameTypeDescription
_tokenLockeduint256The amount of STONEUSD to lock.
_referreraddressThe address of the user who referred the caller (optional).

unlock

Unlocks all previously locked STONEUSD after the event ends.

  • Callable only after the global unlock timestamp.
  • Transfers all unlocked tokens back to the user.
function unlock() external;

getLockedAmount

Returns the total amount of STONEUSD locked by a user.

function getLockedAmount(address _player) external view returns (uint256 locked_);

Parameters

NameTypeDescription
_playeraddressThe user whose locked amount is queried.

Returns

NameTypeDescription
locked_uint256The total locked STONEUSD amount.

getLockQuota

Returns the remaining amount of STONEUSD the user is still allowed to lock.

Quota is based on the MAX_LOCK_COUNT (10 * 1000 STONEUSD).

function getLockQuota(address _player) external view returns (uint256 quota_);

Parameters

NameTypeDescription
_playeraddressThe user whose quota is queried.

Returns

NameTypeDescription
quota_uint256Remaining allowable lock amount.

getEligibility

Returns whether the user has activated daily hammer rewards (eligibility).

Eligibility becomes true once the user locks STONEUSD for the first time.

function getEligibility(address _player) external view returns (bool eligibility_);

Parameters

NameTypeDescription
_playeraddressThe user whose eligibility is queried.

Returns

NameTypeDescription
eligibility_boolTrue if the user receives daily system hammer rewards.

getLockCount

Returns how many times the user has locked 1000 STONEUSD units.

Each 1000 STONEUSD increases lockCount by 1, up to MAX_LOCK_COUNT.

function getLockCount(address _player) external view returns (uint256 lockCount_);

Parameters

NameTypeDescription
_playeraddressThe user whose lockCount is queried.

Returns

NameTypeDescription
lockCount_uint256Number of lock units attributed to the user.

Events

TokenLocked

Emitted when a user locks STONEUSD for event participation.

event TokenLocked(address indexed player, address indexed token, uint256 amount);

Parameters

NameTypeDescription
playeraddressThe user performing the lock.
tokenaddressThe address of the locked token (STONEUSD).
amountuint256The amount of STONEUSD locked.

TokenUnlocked

Emitted when a user unlocks their previously locked STONEUSD.

event TokenUnlocked(address indexed player, address indexed token, uint256 amount);

Parameters

NameTypeDescription
playeraddressThe user unlocking the tokens.
tokenaddressThe address of the unlocked token (STONEUSD).
amountuint256The amount unlocked.