From 081ca50fa9efcd8405db990aab0860ad26796080 Mon Sep 17 00:00:00 2001 From: jordydutch Date: Mon, 31 Mar 2025 21:33:20 +0200 Subject: [PATCH 1/2] chore: clean up contracts and add licenses --- src/ISLYX.sol | 2 +- src/IVault.sol | 24 ++++++++++++------------ src/IVaultStakeRecipient.sol | 2 +- src/SLYXErrors.sol | 2 +- src/StakingverseVault.sol | 23 +++++++++++------------ 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/ISLYX.sol b/src/ISLYX.sol index 5371529..2a67ef6 100644 --- a/src/ISLYX.sol +++ b/src/ISLYX.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: UNLICENSED +// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface ISLYX { diff --git a/src/IVault.sol b/src/IVault.sol index 28be149..46b312a 100644 --- a/src/IVault.sol +++ b/src/IVault.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: UNLICENSED +// SPDX-License-Identifier: BUSL-1.1 pragma solidity =0.8.22; interface IVault { @@ -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. @@ -46,25 +46,25 @@ 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; @@ -72,7 +72,7 @@ interface IVault { 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. diff --git a/src/IVaultStakeRecipient.sol b/src/IVaultStakeRecipient.sol index 440eb49..ae46873 100644 --- a/src/IVaultStakeRecipient.sol +++ b/src/IVaultStakeRecipient.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: UNLICENSED +// SPDX-License-Identifier: BUSL-1.1 pragma solidity =0.8.22; interface IVaultStakeRecipient { diff --git a/src/SLYXErrors.sol b/src/SLYXErrors.sol index 513b98b..0b3b463 100644 --- a/src/SLYXErrors.sol +++ b/src/SLYXErrors.sol @@ -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: diff --git a/src/StakingverseVault.sol b/src/StakingverseVault.sol index d7d641b..c38cbce 100755 --- a/src/StakingverseVault.sol +++ b/src/StakingverseVault.sol @@ -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 { @@ -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. @@ -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; @@ -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; @@ -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 @@ -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 From c67377b73245d3cfb7a0e824f1505d3a656e5613 Mon Sep 17 00:00:00 2001 From: jordydutch Date: Mon, 31 Mar 2025 22:11:09 +0200 Subject: [PATCH 2/2] feat: upgrade proxy to new `StakingverseVault` implementation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d35ddfc..aab4b87 100755 --- a/README.md +++ b/README.md @@ -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
(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_ |