Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BalancerDirectJoinStrategy.sol #216

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract BalancerDirectJoinStrategy is BalancerStrategy {
StrategySettings memory _strategySettings
) BalancerStrategy(_balancerStrategySettings, _settings, _strategySettings) {
dropBptAmountOnPoolJoin = _dropBptAmountOnPoolJoin;
bptIndex = IBalancerPool(address(depositToken)).getBptIndex();
bptIndex = dropBptAmountOnPoolJoin ? IBalancerPool(address(depositToken)).getBptIndex() : 0;
}

function _joinPool(uint256 _amountIn) internal override returns (uint256 amountOut) {
Expand Down
6 changes: 4 additions & 2 deletions contracts/strategies/crosschain/balancer/BalancerStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ abstract contract BalancerStrategy is BaseStrategy {
IBalMinter public immutable balMinter;
bytes32 public immutable poolId;
address public immutable balancerPoolTokenIn;
address public immutable gaugeFactory;

uint256 public boostFeeBips;
address public boostFeeReceiver;
Expand All @@ -37,6 +38,7 @@ abstract contract BalancerStrategy is BaseStrategy {
StrategySettings memory _strategySettings
) BaseStrategy(_settings, _strategySettings) {
stakingContract = IBalancerGauge(_balancerStrategySettings.stakingContract);
gaugeFactory = stakingContract.factory();
balancerVault = IBalancerVault(_balancerStrategySettings.balancerVault);
balancerPoolTokenIn = _balancerStrategySettings.balancerPoolTokenIn;
boostFeeBips = _balancerStrategySettings.boostFeeBips;
Expand Down Expand Up @@ -79,7 +81,7 @@ abstract contract BalancerStrategy is BaseStrategy {
}

function _pendingBalRewards() internal view returns (uint256 pendingBal) {
if (!balMinter.isValidGaugeFactory(address(stakingContract))) return 0;
if (!balMinter.isValidGaugeFactory(address(gaugeFactory))) return 0;

uint256 period = stakingContract.period();
uint256 periodTime = stakingContract.period_timestamp(period);
Expand Down Expand Up @@ -119,7 +121,7 @@ abstract contract BalancerStrategy is BaseStrategy {

function _getRewards() internal override {
stakingContract.claim_rewards();
if (balMinter.isValidGaugeFactory(address(stakingContract))) {
if (balMinter.isValidGaugeFactory(address(gaugeFactory))) {
balMinter.mint(address(stakingContract));
if (boostFeeReceiver > address(0)) {
uint256 boostFee = (IERC20(BAL).balanceOf(address(this)) * boostFeeBips) / BIPS_DIVISOR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ interface IBalancerGauge {
function working_supply() external view returns (uint256);
function inflation_rate(uint256 time) external view returns (uint256);
function bal_pseudo_minter() external view returns (address);
function factory() external view returns (address);
}