Submitted by Udsen, also found by qpzm and saneryee
The Vault._deposit function is used by the users to deposit _assets to the vault and mint vault shares to the recipient address. The amount of _assets are transferred to the Vault as follows:
The Vault.deposit function uses this _assets amount to calculate the number of shares to be minted to the _recipient address.
The issue here is if the underlying _asset is a fee on transfer token then the actual received amount to the vault will be less than what is referred in the Vault.deposit function _assets input parameter. But the shares to mint is calculated using the entire _assets amount.
This issue could be further aggravated since the _asset is again deposited to the _yieldVault and when needing to be redeemed, will be withdrawn from the _yieldVault as well. These operations will again charge a fee if the _asset is a fee on transfer token. Hence, the actual _asset amount left for a particular user will be less than the amount they initially transferred in.
Hence, when the user redeems the minted shares back to the _assets, the contract will not have enough assets to transfer to the redeemer, thus reverting the transaction.
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L951-L956
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L959
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L1026-L1027
VSCode
It is recommended to compute the _assets amount balance of the contract before and after the safeTransferFrom call to get the difference between the two for the actually transferred amount to the Vault. Then, the actually transferred amount can be converted to shares and mint the correct amount of shares to the recipient.
asselstine (PoolTogether) confirmed
