Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Repository for the Stakingverse contracts. This repository includes the followin
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------- |
| Staking Vault Proxy | [`0x9F49a95b0c3c9e2A6c77a16C177928294c0F6F04`](https://explorer.lukso.network/address/0x9F49a95b0c3c9e2A6c77a16C177928294c0F6F04?tab=contract) |
| Staking Vault `Vault.sol` Implementation <br/> (commit [`33d1619` on Universal.Page repository](https://github.com/Universal-Page/contracts/tree/33d1619a19162444c870b8a5a4bf42eb4532818c)) | [`0x2Cb02ef26aDDAB15686ed634d70699ab64F195f4`](https://explorer.lukso.network/address/0x2Cb02ef26aDDAB15686ed634d70699ab64F195f4?tab=contract) |
| Staking Vault `StakingverseVault.sol` Implementation (upgraded) | _To be deployed_ |
| Staking Vault `StakingverseVault.sol` Implementation (upgraded) | [`0x1711b2e1b64F38ca33E51b717CFd27ACD1bd2E2D`](https://explorer.lukso.network/address/0x1711b2e1b64F38ca33E51b717CFd27ACD1bd2E2D?tab=contract) | |
| SLYX Token Proxy | [`0x8a3982f0a7d154d11a5f43eec7f50e52ebbc8f7d`](https://explorer.lukso.network/address/0x8a3982f0a7d154d11a5f43eec7f50e52ebbc8f7d?tab=contract) |
| SLYX Token Implementation | _To be deployed_ |

Expand Down
2 changes: 1 addition & 1 deletion src/ISLYX.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

interface ISLYX {
Expand Down
24 changes: 12 additions & 12 deletions src/IVault.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.22;

interface IVault {
Expand All @@ -25,16 +25,16 @@ interface IVault {
function totalAssets() external view returns (uint256);
function totalShares() external view returns (uint256);

/// @dev Total amount of active stake for the vault on the beacon chain.
/// @dev The total amount of active stake for the vault on the beacon chain.
/// Increased by 32 LYX every time a new validator is registered for the vault.
/// Updated when the vault oracle rebalances the vault.
///
/// @return The total amount (in wei) of active stake for the vault on the beacon chain.
function totalStaked() external view returns (uint256);

/// @dev Total amount of inactive stake for the vault on the execution layer.
/// Increased by the amount of LYX deposited by users to the vault.
/// Decreased when a user withdraws its staked LYX from the vault, or decreased by 32 LYX every time a new validator is registered for the vault.
/// @dev The total amount of inactive stake for the vault on the execution layer.
/// Increased by the amount of LYX deposited by users into the vault.
/// Decreased when a user withdraws their staked LYX from the vault or by 32 LYX every time a new validator is registered for the vault.
/// Updated when the vault oracle rebalances the vault.
///
/// @return The total amount (in wei) of inactive stake for the vault on the execution layer.
Expand All @@ -46,33 +46,33 @@ interface IVault {
function totalFees() external view returns (uint256);
function restricted() external view returns (bool);

/// @dev Get the total amount of staked LYX that was deposited by or for associated with `account`.
/// @dev Get the total amount of staked LYX deposited by or associated with `account`.
/// @param account The address to query the staked balance for.
/// @return The amount of LYX staked by (or for) `account`.
/// @return The amount of LYX staked by or for `account`.
function balanceOf(address account) external view returns (uint256);

/// @dev Get the number of shares held by `account` which correspond to the proportion of its stake inside the vault.
/// @dev Get the number of shares held by `account` which correspond to the proportion of their stake inside the vault.
/// @param account The address to get the shares for.
/// @return The number of shares held by `account`.
function sharesOf(address account) external view returns (uint256);
function pendingBalanceOf(address account) external view returns (uint256);
function claimableBalanceOf(address account) external view returns (uint256);

/// @notice Stake a certain amount of LYX in the Stakingverse's vault for `beneficiary`.
/// @notice Stake a certain amount of LYX in the vault for `beneficiary`.
/// @dev To stake LYX in the vault for `beneficiary`, send the amount of LYX native tokens while calling this function.
/// @param beneficiary The address to stake LYX for in the vault.
function deposit(address beneficiary) external payable;

/// @notice Withdraw a certain `amount` of LYX staked by `msg.sender` in the Stakingverse's vault and transfer this amount to `beneficiary`.
/// @dev The `amount` to withdraw will reduce the staked balance (and therefore reduce its shares) of the address that called this function (caller / `msg.sender`).
/// @notice Withdraw a certain `amount` of LYX staked by `msg.sender` in the vault and transfer this amount to `beneficiary`.
/// @dev The `amount` to withdraw will reduce the staked balance (and therefore reduce their shares) of the address that called this function (caller / `msg.sender`).
/// @param amount The amount of staked LYX to withdraw.
/// @param beneficiary The address to send the withdrawn amount to.
function withdraw(uint256 amount, address beneficiary) external;
function claim(uint256 amount, address beneficiary) external;
function claimFees(uint256 amount, address beneficiary) external;

/// @notice Transfer `amount` of staked LYX from the caller to the `to` address with optional `data`.
///
/// @dev The `amount` transferred will reduce the caller's staked balance and increase the staked balance of `to`, adjusting their respective shares accordingly.
/// @param to The address to transfer the staked LYX to.
/// @param amount The amount of staked LYX to transfer.
/// @param data Optional data.
Expand Down
2 changes: 1 addition & 1 deletion src/IVaultStakeRecipient.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.22;

interface IVaultStakeRecipient {
Expand Down
2 changes: 1 addition & 1 deletion src/SLYXErrors.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.22;

/// @dev Reverts when trying to transfer sLYX to one of these invalid recipient address:
Expand Down
23 changes: 11 additions & 12 deletions src/StakingverseVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ import {IVaultStakeRecipient} from "./IVaultStakeRecipient.sol";
///
/// @title Staking Vault for Stakingverse
///
/// @notice This contract is 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.
/// @notice This contract is designed to manage staking operations, including depositing, withdrawing, and claiming rewards on behalf of stakers.
/// Stakers can also query their staked balance, shares, claimable balance (including rewards), and pending withdrawals.
///
/// @dev 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.
/// @dev 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 performed periodically by an oracle.
///
/// @dev The contract implements reentrancy protection, pausable functionality and an upgradeable pattern using OpenZeppelin's upgradeable libraries,
/// ensuring safety and flexibility for future enhancements.
/// which ensures safety and flexibility for future enhancements.
///
// solhint-disable max-states-count
contract StakingverseVault is IVault, ERC165, OwnableUnset, ReentrancyGuardUpgradeable, PausableUpgradeable {
Expand All @@ -105,7 +105,6 @@ contract StakingverseVault is IVault, ERC165, OwnableUnset, ReentrancyGuardUpgra
error InvalidAddress(address account);
error ValidatorAlreadyRegistered(bytes pubkey);
error CallerNotOperator(address account);
error InvalidSignature();

// limit of total deposits in wei.
// This limits the total number of validators that can be registered.
Expand All @@ -117,7 +116,7 @@ contract StakingverseVault is IVault, ERC165, OwnableUnset, ReentrancyGuardUpgra
// total amount of inactive stake in wei on execution layer
uint256 public totalUnstaked;
// total amount of pending withdrawals in wei.
// This is the amount that is taken from staked balance and may not be immidiately available for withdrawal
// This is the amount that is taken from staked balance and may not be immediately available for withdrawal
uint256 public totalPendingWithdrawal;
// Total number of ever registered validators
uint256 public totalValidatorsRegistered;
Expand All @@ -136,8 +135,8 @@ contract StakingverseVault is IVault, ERC165, OwnableUnset, ReentrancyGuardUpgra
mapping(address => bool) private _allowlisted;
mapping(bytes => bool) private _registeredKeys;

/// @dev 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.
/// @dev The total amount of pending withdrawals that can be claimed immediately.
/// Updated when the vault oracle rebalances the vault and when a user withdraws staked LYX via the `claim(...)` function.
/// @return The total amount (in wei) of pending withdrawals that can be claimed immediately.
uint256 public totalClaimable;
address public operator;
Expand Down Expand Up @@ -434,7 +433,7 @@ contract StakingverseVault is IVault, ERC165, OwnableUnset, ReentrancyGuardUpgra
// The balance of the vault is the sum of:
// - totalStaked + totalUnstaked: the total amount of stake on beacon chain and execution layer
// - totalPendingWithdrawal: the total amount of pending withdrawals
// - totalClaimable: the total amount of pending withdrawals that can be claimed immidiately
// - totalClaimable: the total amount of pending withdrawals that can be claimed immediately
// - totalFees: the total amount of fees available for withdrawal
//
// Rebalancing is not accounting for potential validator penalties. It is assumed that the penalties
Expand Down Expand Up @@ -526,8 +525,8 @@ contract StakingverseVault is IVault, ERC165, OwnableUnset, ReentrancyGuardUpgra
/// @inheritdoc IVault
/// @dev 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.
/// If the `to` is a smart contract that supports 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
Expand Down
Loading