SLYXToken

Contract address: 0x...

The SLYXToken contract is an LSP7 token. See the LSP7 interface docs on docs.lukso.tech for a technical documentation of all the inherited functions.

Stakingverse Staked LYX (sLYX) Token contract.

sLYX tokens represent liquid stake in the Stakingverse vault linked to this contract.

  • New sLYX tokens are minted by transferring LYX staked in the linked vault to this contract.
  • sLYX tokens can be burnt to convert them back to staked LYX.

This contract includes also admin functionalities, implemented using OpenZeppelin's upgradeable libraries:

  • pausing minting and burning (as emergency response while a remediation is pending).
  • upgrading the contract (for security patches or future enhancements).

SLYX Read Functions

getExchangeRate

Get the current LYX / sLYX exchange rate to calculate how many sLYX are backing a certain amount of LYX.

function getExchangeRate() external view returns (uint256);

Returns

NameTypeDescription
uint256The amount of LYX backing 1 sLYX (in wei).

getNativeTokenValue

Calculate how many staked LYX (including accumulated rewards) in the vault can be obtained in exchange for sLYXAmount.

Determine the value of sLYX in terms of the native token balance (LYX) staked in the vault. This function calculates the amount of LYX backing an amount of sLYX.

Formula: (sLYX amount * total stake held by sLYX contract in Vault) / total sLYX minted.

function getNativeTokenValue(uint256 sLyxAmount) public view returns (uint256);

Parameters

NameTypeDescription
sLyxAmountuint256The amount of sLYX to convert to staked LYX.

Returns

NameTypeDescription
uint256The amount of staked LYX backing a specific sLYX amount (in wei).

getSLYXTokenValue

Calculate how many sLYX tokens can be obtained when converting stakedLyxAmount.

Calculate the amount of sLYX backing an amount of LYX.

Formula: (LYX amount * total sLYX minted) / total stake held by sLYX contract in Vault.

function getSLYXTokenValue(uint256 stakedLyxAmount) public view returns (uint256);

Parameters

NameTypeDescription
stakedLyxAmountuint256The amount of staked LYX to calculate if exchanging to mint sLYX tokens.

Returns

NameTypeDescription
uint256The amount of sLYX backing a specific amount of staked LYX (in wei).

stakingVault

Address of the Vault contract linked to this SLYX Token contract. sLYX tokens represent liquid stake in this linked vault.

IVault public stakingVault;

SLYX Write Functions

burn

Note: minting sLYX tokens via this function is disabled when the contract is paused by the admin.

Convert amount of sLYX tokens back to staked LYX (including any accumulated rewards).

Burning function to convert sLYX back to LYX at the sLYX / LYX conversion rate.

function burn(
    address from,
    uint256 amount,
    bytes memory data
) public virtual override whenNotPaused;

Parameters

NameTypeDescription
fromaddressThe address to burn sLYX from its balance.
amountuint256The amount of sLYX to convert to staked LYX.
databytesAny optional data to send when notifying the from address via its universalReceiver(...) function that some sLYX tokens were burnt from its balance and converted back to staked LYX.

onVaultStakeReceived

Note: minting sLYX tokens via this function is disabled when the contract is paused by the admin.

Mint new sLYX tokens by transferring LYX staked in the Vault to this SLYXToken contract.

This hook is called when:

  • calling the transferStake(address,uint256,bytes) function,
  • or calling the deposit(address) function, on the linked staking vault, passing the SLYXToken contract address as parameter for address. Only the linked vault can call this function. New sLYX minted can be monitored by listening for the Transfer event on the SLYXToken contract and filtering with address(0) as from.
function onVaultStakeReceived(
    address from,
    uint256 amount,
    bytes calldata data
) external whenNotPaused;

Parameters

NameTypeDescription
fromaddressThe address to mint sLYX for.
amountuint256The amoount of staked LYX to be converted into sLYX (at the LYX / sLYX exchange rate).
databytesAny optional data to send when notifying the from address via its universalReceiver(...) function that some sLYX tokens were minted for its address.

SLYX Errors

InvalidRecipientForSLYXTokensTransfer

Reverts when trying to transfer sLYX to one of these invalid recipient address:

  • the sLYX token contract
  • the vault proxy contract
  • the vault logic implementation contract
error InvalidRecipientForSLYXTokensTransfer(address recipient);

Parameters

NameTypeDescription
recipientaddressOne the three recipient address mentioned above.

OnlyVaultAllowedToMintSLYX

Reverts when an address other than the vault is trying to mint sLYX

error OnlyVaultAllowedToMintSLYX(address caller);

Parameters

NameTypeDescription
calleraddressThe address trying to mint sLYX tokens.

StakingverseVault

Contract address: 0x9F49a95b0c3c9e2A6c77a16C177928294c0F6F04

Designed to manage staking operations, including depositing, withdrawing, and claiming rewards for stakers. Stakers can also query their staked balance, shares, claimable balance (including rewards) and pending withdrawals.

This contract includes admin functionalities (vault owner and operator) for fee management, adding new operators and registering validators in the deposit contract. It also includes a rebalancing mechanism done periodically by an oracle.

The contract implements reentrancy protection, pausable functionality and an upgradeable pattern using OpenZeppelin's upgradeable libraries, ensuring safety and flexibility for future enhancements.

Vault Read Functions

balanceOf

Get the total amount of staked LYX that was deposited by or for associated with account.

function balanceOf(address account) public view override returns (uint256);

Parameters

NameTypeDescription
accountaddressThe address to query the staked balance for.

Returns

NameTypeDescription
uint256The amount of LYX staked by (or for) account.

sharesOf

Get the number of shares held by account which correspond to the proportion of its stake inside the vault.

function sharesOf(address account) external view override returns (uint256);

Parameters

NameTypeDescription
accountaddressThe address to get the shares for.

Returns

NameTypeDescription
uint256The number of shares held by account.

totalClaimable

Total amount of pending withdrawals that can be claimed immediately. Updated when the vault oracle rebalances the vault and when a user withdraw staked LYX via the claim(...) function.

uint256 public totalClaimable;

Vault Write Functions

deposit

Stake a certain amount of LYX in the Stakingverse's vault for beneficiary.

To stake LYX in the vault for beneficiary, send the amount of LYX native tokens while calling this function.

function deposit(address beneficiary) public payable override whenNotPaused;

Parameters

NameTypeDescription
beneficiaryaddressThe address to stake LYX for in the vault.

withdraw

Withdraw a certain amount of LYX staked by msg.sender in the Stakingverse's vault and transfer this amount to beneficiary.

The amount to withdraw will reduce the staked balance (and therefore reduce its shares) of the address that called this function (caller / msg.sender).

function withdraw(uint256 amount, address beneficiary) external override nonReentrant whenNotPaused;

Parameters

NameTypeDescription
amountuint256The amount of staked LYX to withdraw.
beneficiaryaddressThe address to send the withdrawn amount to.

transferStake

Transfer amount of staked LYX from the caller to the to address with optional data.

This function is used to transfer staked LYX from one address to another. It increases the staked balance of the recipient, and decreases the staked balance of the sender. If the to is a smart contract that support the IVaultStakeRecipient interface, the onVaultStakeReceived(...) function will be called on the recipient (with the three parameters account, amount and data) to notify it that some staked LYX tokens were transferred to its address.

function transferStake(address to, uint256 amount, bytes calldata data) external override whenNotPaused nonReentrant;

Parameters

NameTypeDescription
toaddressThe address to transfer the staked LYX to.
amountuint256The amount of staked LYX to transfer.
databytesOptional data.