Skip to content

Commit

Permalink
review coment
Browse files Browse the repository at this point in the history
  • Loading branch information
jankjr committed Nov 22, 2023
1 parent 1dd02d5 commit d4ebc67
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,18 @@ abstract contract MorphoTokenisedDeposit is RewardableERC4626Vault {
}

function _claimAssetRewards() internal override {
// First pay out any pendingBalances, over a 7200 block period
uint256 blockDelta = block.number - lastSync;
if (blockDelta == 0) {
return;
}

if (blockDelta > PAYOUT_PERIOD) {
blockDelta = PAYOUT_PERIOD;
}
uint112 amtToPayOut = uint112(
(uint256(pendingBalance) * ((blockDelta * 1e18) / PAYOUT_PERIOD)) / 1e18
);
if (pendingBalance > amtToPayOut) {
pendingBalance -= amtToPayOut;
} else {
pendingBalance = 0;
}
pendingBalance -= amtToPayOut;
availableBalance += amtToPayOut;

// If we detect any new balances add it to pending and reset payout period
Expand Down

0 comments on commit d4ebc67

Please sign in to comment.