Yearn: Partial deposits are not processed properly
The deposit is usually made with all the token balance of the contract:\\n```\\n// this will deposit full balance (for cases like not enough room in Vault)\\nreturn v.deposit();\\n```\\n\\nThe Yearn vault contract has a limit of how many tokens can be deposited there. If the deposit hits the limit, only part of the tokens is deposited (not to exceed the limit). That case is not handled properly, the shares are minted as if all the tokens are accepted, and the “change” is not transferred back to the caller:\\n```\\nfunction supplyTokenTo(uint256 \\_amount, address to) override external {\\n    uint256 shares = \\_tokenToShares(\\_amount);\\n\\n    \\_mint(to, shares);\\n\\n    // NOTE: we have to deposit after calculating shares to mint\\n    token.safeTransferFrom(msg.sender, address(this), \\_amount);\\n\\n    \\_depositInVault();\\n\\n    emit SuppliedTokenTo(msg.sender, shares, \\_amount, to);\\n}\\n```\\n
Handle the edge cases properly.
```\\n// this will deposit full balance (for cases like not enough room in Vault)\\nreturn v.deposit();\\n```\\n