Skip to main content

Getter Functions

Implementation Note

View functions remain fully backward compatible for querying staking state, user history, and contract configuration. They do not use signature verification.

This section details all available getter functions in the contract, providing comprehensive information about the contract's state and configuration.


Contract State Retrieval Functions​

getAddressHistory​

Function Type: view
Function Signature: getAddressHistory(address _account)

Retrieves the complete transaction history for a specified user address.

Input Parameters​

ParameterTypeDescription
_accountaddressAddress of the user to retrieve history for

Return Value​

Returns an array of HistoryMetadata structs containing the user's transaction history:

struct HistoryMetadata {
bytes32 transactionType; // 0x01 for staking, 0x02 for unstaking
uint256 amount; // Amount of staking tokens staked/unstaked
uint256 timestamp; // Transaction timestamp
uint256 totalStaked; // User's total staked tokens after transaction
}

getSizeOfAddressHistory​

Function Type: view
Function Signature: getSizeOfAddressHistory(address _account)

Returns the total number of transactions in a user's history.

Input Parameters​

ParameterTypeDescription
_accountaddressAddress of the user to query

Return Value​

TypeDescription
uint256Number of transactions in user's history

getAddressHistoryByIndex​

Function Type: view
Function Signature: getAddressHistoryByIndex(address _account, uint256 _index)

Retrieves a specific transaction from a user's history based on its index.

Input Parameters​

ParameterTypeDescription
_accountaddressAddress of the user to query
_indexuint256Index of the transaction to retrieve

Return Value​

Returns a single HistoryMetadata struct:

struct HistoryMetadata {
bytes32 transactionType; // 0x01 for staking, 0x02 for unstaking
uint256 amount; // Amount of staking tokens staked/unstaked
uint256 timestamp; // Transaction timestamp
uint256 totalStaked; // User's total staked tokens after transaction
}

Price and Token Functions​

priceOfStaking​

Function Type: view
Function Signature: priceOfStaking()

Calculates the current exchange rate between staking tokens and MATE tokens.

Return Value​

TypeDescription
uint256Current exchange rate (staking tokens to MATE)

User Time Lock Functions​

getTimeToUserUnlockFullUnstakingTime​

Function Type: view
Function Signature: getTimeToUserUnlockFullUnstakingTime(address _account)

Calculates when a user can perform full unstaking (withdraw all tokens) based on their transaction history. Full unstaking requires waiting after the last time their balance reached 0.

Input Parameters​

ParameterTypeDescription
_accountaddressAddress of the user to query

Return Value​

TypeDescription
uint256Timestamp when user can perform full unstaking

Execution Flow​

  1. Backward History Search: Iterates through user's history from most recent to oldest transaction
  2. Zero Balance Detection: Searches for the last transaction where totalStaked == 0
  3. Cooldown Calculation: If found, returns timestamp + secondsToUnllockFullUnstaking.current
  4. Fallback Logic: If no zero balance found in history, uses first transaction timestamp userHistory[_account][0].timestamp + secondsToUnllockFullUnstaking.current

getTimeToUserUnlockStakingTime​

Function Type: view
Function Signature: getTimeToUserUnlockStakingTime(address _account)

Calculates when a user becomes eligible to stake again after their last full unstaking. Users must wait a configurable period after their balance reaches zero.

Input Parameters​

ParameterTypeDescription
_accountaddressAddress of the user to query

Return Value​

TypeDescription
uint256Timestamp when user can stake again (0 if already allowed)

Execution Flow​

  1. History Check: If no history exists (length == 0), returns 0 (user can stake immediately)
  2. Recent Transaction Analysis: Examines the most recent transaction in user's history
  3. Zero Balance Cooldown: If last transaction resulted in totalStaked == 0, returns timestamp + secondsToUnlockStaking.current
  4. No Cooldown: If current balance > 0, returns 0 (user can stake immediately)

System Configuration Functions​

getSecondsToUnlockFullUnstaking​

Function Type: view
Function Signature: getSecondsToUnlockFullUnstaking()

Retrieves the current full unstaking unlock period in seconds.

Return Value​

TypeDescription
uint256Current full unstaking time lock period

getSecondsToUnlockStaking​

Function Type: view
Function Signature: getSecondsToUnlockStaking()

Retrieves the current staking unlock period in seconds.

Return Value​

TypeDescription
uint256Current staking time lock period

User Asset Functions​

getUserAmountStaked​

Function Type: view
Function Signature: getUserAmountStaked(address _account)

Retrieves the total amount of staking tokens currently staked by a user.

Input Parameters​

ParameterTypeDescription
_accountaddressAddress of the user to query

Return Value​

TypeDescription
uint256Total amount of staking tokens staked by the user

Contract Reference Functions​

getGoldenFisher​

Function Type: view
Function Signature: getGoldenFisher()

Retrieves the address of the Golden Fisher contract.

Return Value​

TypeDescription
addressAddress of the Golden Fisher contract

getGoldenFisherProposal​

Function Type: view
Function Signature: getGoldenFisherProposal()

Retrieves the address of the Golden Fisher contract proposal.

Return Value​

TypeDescription
addressAddress of the Golden Fisher contract proposal

getEstimatorAddress​

Function Type: view
Function Signature: getEstimatorAddress()

Retrieves the address of the current Estimator contract.

Return Value​

TypeDescription
addressAddress of the current Estimator contract

getEstimatorProposal​

Function Type: view
Function Signature: getEstimatorProposal()

Retrieves the address of the proposed new Estimator contract.

Return Value​

TypeDescription
addressAddress of the proposed Estimator contract (zero address if none)

getCoreAddress​

Function Type: view
Function Signature: getCoreAddress()

Retrieves the address of the EVVM core contract.

Return Value​

TypeDescription
addressAddress of the EVVM contract

Presale Staker Information​

getPresaleStaker​

Function Type: view
Function Signature: getPresaleStaker(address _account)

Determines if a user is a presale staker and retrieves their staked amount.

Input Parameters​

ParameterTypeDescription
_accountaddressAddress of the user to query

Return Value​

TypeDescription
booltrue if user is a presale staker, false otherwise
uint256Amount of staking tokens staked by the user during presale

getPresaleStakerCount​

Function Type: view
Function Signature: getPresaleStakerCount()

Retrieves the total number of presale stakers in the contract.

Return Value​

TypeDescription
uint256Number of presale stakers in the contract

Contract Status Functions​

getAllowPublicStaking​

Function Type: view
Function Signature: getAllowPublicStaking()

Retrieves the complete public staking configuration and status including the current flag state and any pending changes.

Return Value​

TypeDescription
BoolTypeProposalComplete public staking configuration with flag and pending change timestamp

The struct contains the following fields:

struct BoolTypeProposal {
bool flag; // Current value of the allowPublicStaking variable
uint256 timeToAccept; // Timestamp when the change should be accepted
}

getAllowPresaleStaking​

Function Type: view
Function Signature: getAllowPresaleStaking()

Retrieves the complete presale staking configuration and status including the current flag state and any pending changes.

Return Value​

TypeDescription
BoolTypeProposalComplete presale staking configuration with flag and pending change timestamp

The struct contains the following fields:

struct BoolTypeProposal {
bool flag; // Current value of the allowPresaleStaking variable
uint256 timeToAccept; // Timestamp when the change should be accepted
}

EVVM Integration Functions​

getEvvmID​

Function Type: view
Function Signature: getEvvmID()

Retrieves the unique identifier for the EVVM instance this staking contract is connected to.

Return Value​

TypeDescription
uint256Unique EVVM identifier used in signature verification