Skip to content

Releases: stakewise/v3-core

v4.0.0

27 May 10:12
ad3ee57
Compare
Choose a tag to compare
v4.0.0 Pre-release
Pre-release

What's Changed

Base

  1. Extracted the EIP-712 domain separator calculation from the _computeDomainSeparator function in the ERC20Upgradeable contract into the EIP712Utils library to reduce the size of the vault contract.

Curators

  1. Added the BalancedCurator contract for the MetaVault. This contract calculates the amounts to deposit or withdraw from the sub-vaults, evenly distributing and allocating assets among them. The MetaVault should set this contract as its curator to apply the even distribution logic.
  2. Added the CuratorsRegistry contract, which keeps track of all registered curator contracts. Any new curator contract must be listed there to be used with the MetaVault.

Removed contracts

  1. Removed the CumulativeMerkleDrop contract, as it is not currently in use.
  2. Removed all restake functionality from the vaults, as it is not currently in use.
  3. Removed the XDaiExchange contract, as it has been replaced by the TokensConverter contract.

Vaults

  1. Extracted all constructor arguments for the vault implementation contracts into structs (e.g., EthErc20VaultConstructorArgs) to avoid 'stack too deep' errors during compilation.
  2. Added the setAdmin function to change the admin address of the vault. It can only be called by the current admin and emits an AdminUpdated event.
  3. Added the donateAssets function to the vault, allowing anyone to donate ETH/GNO. It can be used to distribute or refund extra ETH/GNO rewards to the vault and emits an AssetsDonated event.
  4. Added the setFeePercent function to update the vault's current fee. It can only be called by the vault admin. The fee can be updated once every 3 days and may only be increased by up to 20% at a time. If the initial fee is 0%, the first increase is limited to 1%.
  5. Replaced the queuedShares and totalExitingAssets functions with getExitQueueData, which returns all queuing data for the vault. This change reduces the vault contract's bytecode size.
  6. Added the fundValidators function to top up existing validators with ETH/GNO. It can only be called by an address with the validatorsManager role or by providing a valid validatorsManager signature. Top-ups are allowed only for validators that have been previously consolidated to a 0x02 validator or registered as a 0x02 validator. Emits a ValidatorFunded event.
  7. Added the consolidateValidators function for migrating 0x01 validators to 0x02 validators. It can only be called by an address with the validatorsManager role or by providing a valid validatorsManager signature. If the consolidation targets a validator that was not previously consolidated or registered with a 0x02 withdrawal prefix, oracle signatures must be provided. These signatures are verified using the new ConsolidationsChecker contract. ETH/xDAI must be sent along with the call to cover the consolidation fee, and any unused amount is refunded to the caller. Emits the ValidatorConsolidationSubmitted event. Note: a successful function call does not guarantee successful consolidation at the consensus level.
  8. Added the withdrawValidators function to trigger withdrawals from validators. It can only be called by an address with the validatorsManager role or by providing a valid validatorsManager signature. ETH/xDAI must be sent with the call to cover the withdrawal fee, and any unused amount is refunded to the caller. Emits the ValidatorWithdrawalSubmitted event. Note: a successful function call does not guarantee a successful withdrawal at the consensus level.
  9. Modified the registerValidators function to support registration of both 0x01 and 0x02 validators. It can only be called by an address with the validatorsManager role or by providing a valid validatorsManager signature. When registering a 0x02 validator, the amount in Gwei must be specified for each validator. Registration of a 0x01 validator emits a ValidatorRegistered event, while registration of a 0x02 validator emits a V2ValidatorRegistered event.
  10. Removed the swapXdaiToGno function and deprecated the XdaiSwapped event. During GnoVault initialization, a TokensConverter contract is created. Once GnoVault pulls accumulated xDAI from OwnMevEscrow or SharedMevEscrow, it transfers it to the TokensConverter, converts it to sDAI, and uses CowSwap to swap it for GNO. In updateState, all converted GNO is pulled back into the vault from the TokensConverter and accounted for using the donateAssets function.
  11. Migrated the exit queue for GnoVaults from the exitingAssets to the ExitQueue library, similar to the implementation used in ETH vaults.
  12. Extracted the calculateReceivedAssets function, used for calculating OsToken liquidation and redemption assets, into a separate OsTokenUtils library to reduce the vault contract's bytecode size.

Genesis Vault

  1. Deprecated the GenesisVaultCreated event, as it will no longer be emitted. Only one instance of the genesis vault exists, and it has already been created.
  2. Removed the acceptPoolEscrowOwnership function, as ownership of the PoolEscrow has already been transferred and the function will not be called in the future.
  3. Removed rewards splitting with the legacy rETH2 contract.

Meta Vault

Added a new type of vault called MetaVaults. Unlike other vaults, MetaVaults do not register validators directly - instead, they delegate accumulated assets to sub-vaults, which are managed by the vault admin. Each sub-vault must have at least one registered validator, and up to 50 sub-vaults can be added to a MetaVault.

When a sub-vault is removed, all assets allocated to it enter the exit queue. Once the assets exit successfully, they are returned to the MetaVault, and the sub-vault is removed from the list.

Calling the depositToSubVaults function deposits all available assets from the MetaVault into the sub-vaults. The deposit and withdrawal amounts for each sub-vault are determined by the Curator contract, which can be changed by the admin using the setSubVaultsCurator function. By default, the BalancedCurator is used to evenly distribute and withdraw assets across sub-vaults.

In the updateState function, the locked amounts in all sub-vaults are synchronized, and the reward delta is calculated. Before calling updateState on the MetaVault, all sub-vaults must be up-to-date (i.e., updateState must be called on each sub-vault first). During the MetaVault's updateState, assets queued for exit are submitted to the sub-vaults. The curator contract determines the amount to withdraw from each sub-vault.

If a sub-vault is in the process of being removed, the exiting assets will be prioritized to process its exit queue before submitting new exit requests to other sub-vaults. All exit requests to sub-vaults must be claimed using the claimSubVaultsExitedAssets function before calling updateState on the MetaVault.

MetaVaults can be deployed using the EthMetaVaultFactory contract, and currently, only the factory owner is permitted to deploy new MetaVaults.

Reward Splitter

  1. Added a claimer role that can trigger exits on behalf of splitter shareholders using the enterExitQueueOnBehalf function. The claimer is managed by the vault admin via the setClaimer function.
  2. Added the claimExitedAssetsOnBehalf function, which can be called by anyone to withdraw exited assets to the respective shareholder.
  3. Replaced the owner of the RewardSplitter with the admin of the vault.
  4. Added the enterExitQueueOnBehalf function, allowing anyone to enter the exit queue on behalf of a shareholder.

OsToken Redeemer

This contract is set as the redeemer in OsTokenConfig and can call redeemOsToken in the vault. The positionsManager within the contract is responsible for selecting redeemable positions and proposing them via the proposeRedeemablePositions function. The contract owner must then either accept the proposed positions using acceptRedeemablePositions or reject them using denyRedeemablePositions. A minimum of 3 days must pass between the proposal and acceptance of new redeemable positions.

Once positions are accepted, the oracles calculate the required exit amounts in the vaults and trigger validator exits. For vaults with Pectra support, oracles will wait one day to allow operators to submit the withdrawal transactions before proceeding with exits. After the validators exit and the assets are returned to the vault, the redeemer calls redeemOsTokenPositions to redeem the approved OsToken positions.

Full Changelog: v3.0.1...v4.0.0

v3.0.1

19 Feb 12:21
88c795f
Compare
Choose a tag to compare

What's Changed

Fix a corner case in the exit queue index calculation (SWIP-28) in #100

Full Changelog: v3.0.0...v3.0.1

v3.0.0

05 Dec 13:20
b25befb
Compare
Choose a tag to compare

What's Changed

  1. Added the EthOsTokenVaultEscrow and GnoOsTokenVaultEscrow contracts. These contracts allow users to request an exit for staked ETH/GNO without immediately burning osETH/osGNO. This feature supports certain DeFi integrations by enabling users to 1) request an exit from the vault without burning osETH/osGNO, and 2) once the unstaked ETH/GNO is ready to be claimed, burn osETH/osGNO and receive the unstaked ETH/GNO in a single transaction.
  2. Added OsTokenFlashLoans. This contract allows to mint and burn osETH in single transaction (up to 100k osETH). For example, leverage strategy uses OsTokenFlashLoans to mint osETH, supply to Aave, borrow ETH, mint osETH from the vault and return the flashloan.
  3. When user migrates from StakeWise Legacy, we always mint max amount of osTokens to the user in the Genesis Vault.
  4. Move back to the exit queue processing implemented in V1 vaults
  5. The enterExitQueue function will return max UINT256 as position ticket in case the vault has no validators and assets vault can be redeemed.
  6. The max possible osToken shares can be minted if max UINT256 is passed to the mintOsToken. If no osToken shares can be minted, 0 will be returned.

Audit report

The audit was performed by Sigma Prime and is available here.

New Contributors

  • @CJ42 made their first contribution in #98

Full Changelog: v2.0.1...v3.0.0

v2.0.1

30 Jul 08:51
f74e4c6
Compare
Choose a tag to compare

What's Changed

  • Fix gno genesis vault pool escrow assets by @tsudmi in #96

Full Changelog: v2.0.0...v2.0.1

v2.0.0

16 Jul 10:25
50293fb
Compare
Choose a tag to compare

What's Changed

Gnosis vaults

  • New Gnosis vaults were deployed to the Gnosis network. They use the new VaultGnoStaking module. The main differences from the Ethereum vaults are as follows:
    • Deposits are made in GNO tokens, and ERC-20 approval must be done before the call.
    • Partial and full withdrawals are stored in the contract used to register the validators. They are pulled by the vault during user withdrawals, validator registrations, and state updates.
    • 1 GNO, instead of 32 ETH, must be staked for the validator to activate.
    • Rewards from transaction fees are received in xDAI and must be swapped using the swapXdaiToGno function. This function performs the transaction through the Balancer pool (which can be updated by the DAO) and uses oracles to verify the correct swap price in the XdaiExchange contract.

Restake vaults

Blocklist vaults

  • New blocklist vaults were deployed to Ethereum and Gnosis. These vaults use the VaultBlocklist module, which keeps track of accounts that cannot stake to the vault. For example, you can block all sanctioned addresses from depositing to your vault.
  • The account with the blocklistManager role can manage the blocklist. This role is assigned to the vault admin by default. The vault admin can update the role using the setBlocklistManager function, which emits the BlocklistManagerUpdated event.
  • You can use blockedAccounts to check whether an account is blocked. The blocklistManager can update the list using the updateBlocklist function. Blocklist updates emit the BlocklistUpdated event.

Exit queue

  • The enterExitQueue function now locks the conversion rate between assets and shares at the time of the call, rather than during the updateState call. Shares are burned immediately. The locked assets will not receive rewards after the call but will incur penalties if the vault APY is negative. These penalties will be distributed proportionally to all assets in the vault. Exit positions created before the upgrade will be processed according to the Vault’s V1 logic.
  • All newly created exit positions now emit the V2ExitQueueEntered event.
  • The ExitingAssetsPenalized event is emitted during the updateState call if the vault incurs a penalty. The penalty will be proportionally distributed among all currently exiting assets.
  • The claimExitedAssets will not return anything after the upgrade.
  • The claimExitedAssets must be used for the exit positions created before and after the vault upgrade to V2.
  • The redeem function was removed. All the exits must be submitted using enterExitQueue.
  • The totalExitingAssets function was added to the vault. It returns the total amount of assets in the exit queue after the upgrade to V2.
  • For exit positions created after the upgrade, the getExitQueueIndex function is not needed. You can pass 0 to both the calculateExitedAssets and claimExitedAssets functions.

Validators management

Read more

v1.1.0

18 Jun 20:49
2db6ba9
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.0...v1.1.0

v1.0.0

28 Nov 11:49
b93337b
Compare
Choose a tag to compare

What's Changed

Full Changelog: https://github.com/stakewise/v3-core/commits/v1.0.0