Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions contracts/strategies/traderjoe/JoeVoterProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity 0.8.13;

import "../../lib/SafeERC20.sol";
import "../../lib/SafeMath.sol";

import "./interfaces/IJoeVoter.sol";
import "./interfaces/IJoeVoterProxy.sol";
Expand Down Expand Up @@ -32,7 +31,6 @@ library SafeProxy {
* use a new proxy.
*/
contract JoeVoterProxy is IJoeVoterProxy {
using SafeMath for uint256;
using SafeProxy for IJoeVoter;
using SafeERC20 for IERC20;

Expand Down Expand Up @@ -175,7 +173,7 @@ contract JoeVoterProxy is IJoeVoterProxy {
if (stakerFee > 0 && stakerFeeReceiver > address(0)) {
stakingFee = stakerFee;
}
return boostFee.add(stakingFee);
return boostFee + stakingFee;
}

/**
Expand Down Expand Up @@ -235,9 +233,9 @@ contract JoeVoterProxy is IJoeVoterProxy {
_pid,
address(voter)
);
uint256 reinvestFee = pendingJoe.mul(this.reinvestFeeBips()).div(BIPS_DIVISOR);
uint256 reinvestFee = (pendingJoe * this.reinvestFeeBips()) / BIPS_DIVISOR;

return (pendingJoe.sub(reinvestFee), bonusTokenAddress, pendingBonusToken);
return (pendingJoe - reinvestFee, bonusTokenAddress, pendingBonusToken);
}

function poolBalance(address _stakingContract, uint256 _pid) external view override returns (uint256 balance) {
Expand Down Expand Up @@ -284,31 +282,33 @@ contract JoeVoterProxy is IJoeVoterProxy {
}

function _distributeReward(address _extraToken) private {
if (_extraToken == WAVAX) {
voter.wrapAvaxBalance();
voter.wrapAvaxBalance();
uint256 wavaxBalance = IERC20(WAVAX).balanceOf(address(voter));
if (wavaxBalance > 0) {
voter.safeExecute(WAVAX, 0, abi.encodeWithSignature("transfer(address,uint256)", msg.sender, wavaxBalance));
}

uint256 pendingJoe = IERC20(JOE).balanceOf(address(voter));
uint256 pendingExtraToken = _extraToken > address(0) ? IERC20(_extraToken).balanceOf(address(voter)) : 0;
if (pendingJoe > 0) {
uint256 boostFee = 0;
if (boosterFee > 0 && boosterFeeReceiver > address(0) && voter.depositsEnabled()) {
boostFee = pendingJoe.mul(boosterFee).div(BIPS_DIVISOR);
boostFee = (pendingJoe * boosterFee) / BIPS_DIVISOR;
voter.depositFromBalance(boostFee);
IERC20(address(voter)).safeTransfer(boosterFeeReceiver, boostFee);
}

uint256 stakingFee = 0;
if (stakerFee > 0 && stakerFeeReceiver > address(0)) {
stakingFee = pendingJoe.mul(stakerFee).div(BIPS_DIVISOR);
stakingFee = (pendingJoe * stakerFee) / BIPS_DIVISOR;
voter.safeExecute(
JOE,
0,
abi.encodeWithSignature("transfer(address,uint256)", stakerFeeReceiver, stakingFee)
);
}

uint256 reward = pendingJoe.sub(boostFee).sub(stakingFee);
uint256 reward = pendingJoe - boostFee - stakingFee;
voter.safeExecute(JOE, 0, abi.encodeWithSignature("transfer(address,uint256)", msg.sender, reward));
}

Expand Down