Contracts

StZETA

StZETA serves as the fundamental contract, functioning as a liquid staking pool. This contract handles deposits and withdrawals, mints and burns liquid tokens, delegates funds to node operators, applies fees, and distributes rewards.The StZETA contract introduces stZETA, an ERC20 token, which indicates an account's proportion of the total ZETA tokens within the Zearn system. Being a non-rebasable token, the quantity of tokens in the user's wallet remains unchanged. However, its value may fluctuate over time as the volume of ZETA tokens within the protocol isn't static. It's worth noting that stZETA will be incorporated into a range of DeFi applications across ZetaChain.

View Methods

symbol()

Provides the token's symbol, typically a condensed form of its name.

function symbol() returns (string)

decimals()

Provides the number of decimals required to represent a token amount accurately.

function decimals() returns (uint8)

totalSupply()

Provides the total number of tokens currently in circulation.

function totalSupply() returns (uint256)

balanceOf()

Indicates the quantity of tokens held by the account

function balanceOf(address _account) returns (uint256)

getTotalStakeAcrossAllValidators()

Provides the aggregate of delegated ZETA across all validators.

function getTotalStakeAcrossAllValidators() public view override returns (uint256)

Returns:

Name
Type
Description

total

uint256

The total delegated ZETA across all validators

getTotalPooledZETA()

Provides the summed total of pooled ZETA

function getTotalPooledMatic() public view override returns (uint256)

Returns:

Name
Type
Description

total

uint2560

The total pooled ZETA inside the protocol

convertZETATostZETA()

Provides the ZETA value for any given stZETA amount input into the function.

function convertStMaticToMatic(uint256 _amountInZETA) public view
        override
        returns (
            uint256 amountInstZETA,
            uint256 totalstZETASupply,
            uint256 totalPooledZETA
        )

Parameters:

Name
Type
Description

_amountInZETA

uint256

Amount of ZETA to be converted to stZETA

Returns

Name
Type
Description

amountInstZETA

uint256

Amount of stZETA after conversion

totalstZETASupply

uint256

Total stZETA in the contract

totalPooledZETA

uint256

Total ZETA in the staking pool

Methods

transfer()

Transfers amount tokens from the account of the initiator to the to account.

function transfer(address to, uint256 amount) returns (bool)

NOTE

Requirements:

  • to should not be assigned the zero address.

  • the caller should maintain a minimum balance of amount.

  • the contract ought to be active, not paused.

Parameters

Name
Type
Description

to

address

Address of tokens recipient

amount

uint256

Amount of tokens to transfer

Returns:

A boolean value that shows if the operation was successful.

allowance()

This is the number of tokens that the spender is permitted to spend on behalf of owner using transferFrom. It's initially set to zero.

function allowance(address owner, address spender) returns (uint256)

NOTE

This value changes when approve or transferFrom is called.

Parameters

Name
Type
Description

owner

address

Address of owner

spender

address

Address of spender

approve()

Establishes amount as the allocation for spender in relation to the caller's tokens.

function approve(address spender, uint256 amount) returns (bool)

NOTE

Requirements:

  • spender cannot be the zero address.

  • the contract must not be paused.

Parameters:

Name
Type
Description

spender

address

Address of spender

amount

uint256

Amount of tokens

Returns:

A boolean value that shows if the operation was successful.

transferFrom()

Transfers amount tokens from the from to the to via the allowance process. This amount is subsequently reduced from the caller's allowance.

function transferFrom(address from, address to, uint256 amount) returns (bool)

NOTE

Requirements:

  • from and to cannot be the zero addresses.

  • from must have a balance of at least amount.

  • the caller must have allowance for from(sender)'s tokens of at least amount.

  • the contract must not be paused.

Parameters:

Name
Type
Description

from

address

Address of spender

to

address

Address of recipient

amount

uint256

Amount of tokens

Returns:

A boolean value that shows if the operation was successful.

increaseAllowance()

Increments the allowance provided to the spender by the caller by an addedValue, in a precise and atomic manner.

function increaseAllowance(address spender, uint256 addedValue) returns (bool)

NOTE

Requirements:

  • spender cannot be the the zero address.

  • the contract must not be paused.

Parameters:

Name
Type
Description

spender

address

Address of spender

addedValue

uint256

Amount of tokens to increase allowance

Returns:

A boolean value that shows if the operation was successful.

decreaseAllowance()

Reduces the allowance given to spender by the caller by subtractedValue in a single operation.

function decreaseAllowance(address spender, uint256 subtractedValue) returns (bool)

NOTE

Requirements:

  • spender cannot be the the zero address.

  • spender must have allowance for the caller of at least subtractedValue.

  • the contract must not be paused.

Parameters:

Name
Type
Description

spender

address

Address of spender

subtractedValue

uint256

Amount of tokens to decrease allowance

Returns:

A boolean value that shows if the operation was successful.

submit()

Transfer ZETA to the stZETA contract, which then generates stZETA for the sender.

 function submit() external payable returns (uint256)

Parameters:

{ value: unit256 }

Amount to submit in ZETA

calculatePendingBufferedTokens()

Calculate the total amount stored in all the NFTs owned by stZETA contract

function calculatePendingBufferedTokens() 
        public
        view
        returns (uint256 pendingBufferedTokens)

Returns:

Name
Type
Description

pendingBufferedTokens

uint256

The total pending buffered tokens

NodeOperatorsRegistry

Coming soon

Last updated