-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: various accounting bugs on migration to shares
- Loading branch information
1 parent
6f14ec7
commit 953f5e6
Showing
6 changed files
with
27 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,7 +235,7 @@ contract Dashboard is AccessControlEnumerable { | |
function _voluntaryDisconnect() internal { | ||
uint256 shares = sharesMinted(); | ||
if (shares > 0) { | ||
_rebalanceVault(STETH.getPooledEthByShares(shares)); | ||
_rebalanceVault(_getPooledEthFromSharesRoundingUp(shares)); | ||
} | ||
|
||
vaultHub.voluntaryDisconnect(address(stakingVault)); | ||
|
@@ -293,7 +293,7 @@ contract Dashboard is AccessControlEnumerable { | |
* @param _amountOfShares Amount of tokens to burn | ||
*/ | ||
function _burn(uint256 _amountOfShares) internal { | ||
STETH.transferFrom(msg.sender, address(vaultHub), _amountOfShares); | ||
STETH.transferSharesFrom(msg.sender, address(vaultHub), _amountOfShares); | ||
vaultHub.burnSharesBackedByVault(address(stakingVault), _amountOfShares); | ||
} | ||
Check warning Code scanning / Slither Unused return Medium
Dashboard._burn(uint256) ignores return value by STETH.transferSharesFrom(msg.sender,address(vaultHub),_amountOfShares)
|
||
|
||
|
@@ -305,6 +305,17 @@ contract Dashboard is AccessControlEnumerable { | |
stakingVault.rebalance(_ether); | ||
} | ||
|
||
function _getPooledEthFromSharesRoundingUp(uint256 _shares) internal view returns (uint256) { | ||
uint256 pooledEth = STETH.getPooledEthByShares(_shares); | ||
uint256 backToShares = STETH.getSharesByPooledEth(pooledEth); | ||
|
||
if (backToShares < _shares) { | ||
return pooledEth + 1; | ||
} | ||
|
||
return pooledEth; | ||
} | ||
|
||
// ==================== Events ==================== | ||
|
||
/// @notice Emitted when the contract is initialized | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters