Skip to content

Commit

Permalink
fix: no need to distributeRewards if balance is 0 (yearn#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
Macarse authored Nov 29, 2020
1 parent 99dcc2a commit a06f5b2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contracts/BaseStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,10 @@ abstract contract BaseStrategy {
*/
function distributeRewards() internal virtual {
// Transfer 100% of newly-minted shares awarded to this contract to the rewards address.
vault.transfer(rewards, vault.balanceOf(address(this)));
uint256 balance = vault.balanceOf(address(this));
if (balance > 0) {
vault.transfer(rewards, balance);
}
}

/*
Expand Down

0 comments on commit a06f5b2

Please sign in to comment.