Submitted by unforgiven, also found by hake, robee, and TrungOre
https://github.com/code-423n4/2022-06-yieldy/blob/524f3b83522125fb7d4677fa7a7e5ba5a2c0fe67/src/contracts/Staking.sol#L419-L445
https://github.com/code-423n4/2022-06-yieldy/blob/524f3b83522125fb7d4677fa7a7e5ba5a2c0fe67/src/contracts/LiquidityReserve.sol#L120-L126
If the token is deflationary then contract will receive less token that requested amount but contract dont check for the real transferred amount. because this is happening in receiving stacking_token in addLiquidity() of LiquidityReserve and stake() of Staking then those logics for minting YIELDY_TOKEN or LP token is wrong. (contract receive less than amount but mint or transfer amount to user). This can cause other users which staked to lose funds.
This is the related code where transfer happens (stake() and addLiquidity()):
As you can see contract transfers amount of STAKE_TOKEN and assumes it is going to receive that amount and then mint the same amount of YIELDY_TOKEN or LP token.
So user receive more funds which belongs to other users. protocol logics are not suitable for deflationary tokens and funds would be lost.
VIM
Check the real amount of tokens that the contract receives.
toshiSat (Yieldy) acknowledged and commented:
