-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Certora][M-07] Vaibhav/certora/fix steth swap #163
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check the size of the contract after the additions? This contract is right on the cusp of being oversized
It also looks like your changes have causes some liquifier unit tests to fail:
|
src/Liquifier.sol
Outdated
if (_amount > liquidityPool.eETH().balanceOf(msg.sender)) revert NotEnoughBalance(); | ||
|
||
IERC20(address(liquidityPool.eETH())).safeTransferFrom(msg.sender, address(this), _amount); | ||
bool isWhitelistedSwapper = roleRegistry.hasRole(EETH_STETH_SWAPPER, msg.sender); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this line and include the hasRole
check in the if statement like so:
if (!roleRegistry.hasRole(EETH_STETH_SWAPPER, msg.sender)) {
fees = _amount * feeSwappingEETHToSTETH / 10**18;
}
This removes an unnecessary line of code and is consistent with the pattern we have already established in the codebase
Yes met the requirement |
src/Liquifier.sol
Outdated
@@ -242,7 +245,7 @@ contract Liquifier is Initializable, UUPSUpgradeable, OwnableUpgradeable, Pausab | |||
} | |||
|
|||
// Swap Liquifier's eETH for ETH from the liquidity pool and send it back to the liquidity pool | |||
function withdrawEEth(uint256 amount) external { | |||
function withdrawEEth(uint256 amount) public { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why public? i think you can leave it as external
? :)
src/Liquifier.sol
Outdated
|
||
IERC20(address(liquidityPool.eETH())).safeTransferFrom(msg.sender, address(this), _amount); | ||
IERC20(address(lido)).safeTransfer(msg.sender, _amount); | ||
liquidityPool.withdraw(address(liquidityPool), _amount-1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would be the clean way to handle -1
?
We can do diff of stETH balance before/after its transfer and transfer that amount
vm.startPrank(superAdmin); | ||
roleRegistry.grantRole(liquifierInstance.EETH_STETH_SWAPPER(), bob); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to test the case where it reverts without the role
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
No description provided.