sherlock-audit / 2024-05-napier-update-judging

8 stars 7 forks source link

zzykxx - `_stake()` function in `PufEthAdapter` will always revert #63

Closed sherlock-admin3 closed 3 months ago

sherlock-admin3 commented 3 months ago

zzykxx

medium

_stake() function in PufEthAdapter will always revert

Summary

Vulnerability Detail

The PufETHAdapter::_stake() function deposits stETH into Puffer via the following call:

uint256 _pufETHAmt = PUFFER_DEPOSITOR.depositStETH(Permit(block.timestamp, _stETHAmt, 0, 0, 0));

This will always revert because the function depositStETH of PUFFER_DEPOSITOR takes two parameters as inputs: a Permit struct, and a receiver address. Only the first parameter is passed by Napier, this means Napier will attempt to call a function that doesn't exist making the whole transaction revert.

This can be verified by looking at the currently deployed PUFFER_DEPOSITOR. The address is hardcoded in the Constants.sol file.

Impact

The PufETHAdapter::_stake() will always revert and funds can't be deposited, rendering the contract useless.

Code Snippet

Tool used

Manual Review

Recommendation

Adjust the IPufferDepositor interface and pass address(this) as second parameter when calling depositStETH:

uint256 _pufETHAmt = PUFFER_DEPOSITOR.depositStETH(Permit(block.timestamp, _stETHAmt, 0, 0, 0), address(this));

PufETHAdapter.sol#L82

Duplicate of #21