The shares is calculated based on the total shares, total token amount. If the contract balance tokens is 0, then the input _tokenAmount is returned. So a user can transfer tokens directly to a newly deployed pool which will result in 0 shares.
And the deposit function will revert when share amount is 0.
saian
medium
Pool.deposit will revert if tokens are transferred directly to the pool
Summary
Pool.deposit will revert if tokens are transferred directly to the pool
Vulnerability Detail
In Pool.deposit share for the deposited amount is calculated in function
tokenToShares
.The shares is calculated based on the total shares, total token amount. If the contract balance tokens is 0, then the input
_tokenAmount
is returned. So a user can transfer tokens directly to a newly deployed pool which will result in 0 shares.And the deposit function will revert when share amount is 0.
Impact
User are prevented from deposited into the pool
Code Snippet
Tool used
Manual Review
Recommendation
Duplicate of #86