Submitted by ladboy233, also found by KIntern_NA and KIntern_NA
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/VaultImplementation.sol#L295
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/PublicVault.sol#L421
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/PublicVault.sol#L359
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/PublicVault.sol#L372
https://github.com/code-423n4/2023-01-astaria/blob/1bfc58b42109b839528ab1c21dc9803d663df898/src/PublicVault.sol#L384
The function transferWithdrawReserve in Public Vault has no access control.
If this function is called, the token balance is transfered to withdrawProxy
and
However, according to
https://github.com/d-xo/weird-erc20#revert-on-zero-value-transfers
Some tokens (e.g. LEND) revert when transfering a zero value amount.
If ERC20(asset()).balanceOf(address(this)) return 0, the transfer revert.
The impact is that transferWithdrawReserve is also used in the other place:
which calls:
which calls:
which calls transferWithdrawReserve() which revert in 0 amount transfer.
Consider the case below:
This revertion not only impacts commitToLien, but also impacts PublicVault.sol#updateVaultAfterLiquidation
Transaction can revert in above code when calling
If the address has no ERC20 token balance and the ERC20 token revert in 0 amount transfer after PublicVault#transferWithdrawReserve is called first.
We recommend the protocol just return and do nothing when PublicVault#transferWithdrawReserve is called if the address has no ERC20 token balance.
androolloyd (Astaria) confirmed
