-
Notifications
You must be signed in to change notification settings - Fork 8
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
EF, BWF #200
Conversation
if (farm.status == 0 && CommonLib.eq(farm.strategyLogicId, strategyLogicId())) { | ||
++localTtotal; | ||
} |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: rules.solidity.performance.use-nested-if Note
There are more advantages, such as easier to read code and better coverage reports.
if (farm.status == 0 && CommonLib.eq(farm.strategyLogicId, strategyLogicId())) { | ||
nums[localTtotal] = i; | ||
//slither-disable-next-line calls-loop | ||
variants[localTtotal] = _generateDescription(farm, _ammAdapter); | ||
++localTtotal; | ||
} |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: rules.solidity.performance.use-nested-if Note
There are more advantages, such as easier to read code and better coverage reports.
function _depositAssets(uint[] memory amounts, bool) internal override returns (uint value) { | ||
IFactory.Farm memory farm = _getFarm(); | ||
address[] memory _assets = assets(); | ||
bool stable = ISolidlyPool(farm.pool).stable(); | ||
(,, value) = IRouter(farm.addresses[1]).addLiquidity( | ||
_assets[0], _assets[1], stable, amounts[0], amounts[1], 0, 0, address(this), block.timestamp | ||
); | ||
StrategyBaseStorage storage $base = _getStrategyBaseStorage(); | ||
$base.total += value; | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
|
||
function _calcAssetsAmounts(uint shares) internal view returns (uint[] memory amounts_) { | ||
IFactory.Farm memory farm = _getFarm(); | ||
address pool = farm.pool; |
Check notice
Code scanning / Slither
Local variable shadowing Low
- LPStrategyBase.pool() (function)
- ILPStrategy.pool() (function)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #200 +/- ##
==========================================
+ Coverage 92.52% 92.86% +0.33%
==========================================
Files 75 77 +2
Lines 6610 6906 +296
Branches 585 598 +13
==========================================
+ Hits 6116 6413 +297
Misses 462 462
+ Partials 32 31 -1 ☔ View full report in Codecov by Sentry. |
if (farm.status == 0 && CommonLib.eq(farm.strategyLogicId, strategyLogicId())) { | ||
++localTtotal; | ||
} |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: rules.solidity.performance.use-nested-if Note
There are more advantages, such as easier to read code and better coverage reports.
if (farm.status == 0 && CommonLib.eq(farm.strategyLogicId, strategyLogicId())) { | ||
nums[localTtotal] = i; | ||
//slither-disable-next-line calls-loop | ||
variants[localTtotal] = _generateDescription(farm, _ammAdapter); | ||
++localTtotal; | ||
} |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: rules.solidity.performance.use-nested-if Note
There are more advantages, such as easier to read code and better coverage reports.
override(StrategyBase, LPStrategyBase) | ||
returns (uint[] memory, uint) | ||
{ | ||
revert("Not supported"); |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: rules.solidity.performance.use-custom-error-not-require Note
to describe the error in detail using NatSpec.
if (amountsToDeposit[0] > 2500 && amountsToDeposit[1] > 2500) { | ||
_depositAssets(amountsToDeposit, true); | ||
} |
Check notice
Code scanning / Semgrep OSS
Semgrep Finding: rules.solidity.performance.use-nested-if Note
There are more advantages, such as easier to read code and better coverage reports.
function _depositAssets(uint[] memory amounts, bool) internal override returns (uint value) { | ||
ILPStrategy.LPStrategyBaseStorage storage $lp = _getLPStrategyBaseStorage(); | ||
StrategyBaseStorage storage $base = _getStrategyBaseStorage(); | ||
IBWeightedPoolMinimal _pool = IBWeightedPoolMinimal($lp.pool); | ||
BalancerMethodVars memory v; | ||
|
||
v.poolId = _pool.getPoolId(); | ||
(v.poolTokens,,) = IBVault(_pool.getVault()).getPoolTokens(v.poolId); | ||
|
||
value = IERC20(address(_pool)).balanceOf(address(this)); | ||
|
||
IBVault(_pool.getVault()).joinPool( | ||
v.poolId, | ||
address(this), | ||
address(this), | ||
IBVault.JoinPoolRequest({ | ||
assets: v.poolTokens, | ||
maxAmountsIn: amounts, | ||
userData: abi.encode(IBVault.JoinKind.EXACT_TOKENS_IN_FOR_BPT_OUT, amounts, 0), | ||
fromInternalBalance: false | ||
}) | ||
); | ||
value = IERC20(address(_pool)).balanceOf(address(this)) - value; | ||
$base.total += value; | ||
|
||
IFactory.Farm memory farm = _getFarm(); | ||
IBalancerGauge(farm.addresses[0]).deposit(value); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
ILPStrategy.LPStrategyBaseStorage storage $lp = _getLPStrategyBaseStorage(); | ||
StrategyBaseStorage storage $base = _getStrategyBaseStorage(); | ||
IBWeightedPoolMinimal _pool = IBWeightedPoolMinimal($lp.pool); | ||
BalancerMethodVars memory v; |
Check warning
Code scanning / Slither
Uninitialized local variables Medium
function _withdrawAssets(uint value, address receiver) internal override returns (uint[] memory amountsOut) { | ||
IFactory.Farm memory farm = _getFarm(); | ||
IBWeightedPoolMinimal _pool = IBWeightedPoolMinimal(pool()); | ||
BalancerMethodVars memory v; | ||
|
||
(v.poolTokens,,) = IBVault(_pool.getVault()).getPoolTokens(_pool.getPoolId()); | ||
|
||
IBalancerGauge(farm.addresses[0]).withdraw(value); | ||
|
||
address[] memory __assets = assets(); | ||
v.len = __assets.length; | ||
amountsOut = new uint[](v.len); | ||
for (uint i; i < v.len; ++i) { | ||
amountsOut[i] = IERC20(__assets[i]).balanceOf(receiver); | ||
} | ||
|
||
IBVault(_pool.getVault()).exitPool( | ||
_pool.getPoolId(), | ||
address(this), | ||
payable(receiver), | ||
IBVault.ExitPoolRequest({ | ||
assets: v.poolTokens, | ||
minAmountsOut: new uint[](v.poolTokens.length), | ||
userData: abi.encode(1, value), | ||
toInternalBalance: false | ||
}) | ||
); | ||
|
||
for (uint i; i < v.len; ++i) { | ||
amountsOut[i] = IERC20(__assets[i]).balanceOf(receiver) - amountsOut[i]; | ||
} | ||
|
||
StrategyBaseStorage storage $base = _getStrategyBaseStorage(); | ||
$base.total -= value; | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
function _withdrawAssets(uint value, address receiver) internal override returns (uint[] memory amountsOut) { | ||
IFactory.Farm memory farm = _getFarm(); | ||
IBWeightedPoolMinimal _pool = IBWeightedPoolMinimal(pool()); | ||
BalancerMethodVars memory v; |
Check warning
Code scanning / Slither
Uninitialized local variables Medium
function _calcAssetsAmounts(uint shares) internal view returns (uint[] memory amounts_) { | ||
IBWeightedPoolMinimal _pool = IBWeightedPoolMinimal(pool()); | ||
(, uint[] memory balances,) = IBVault(_pool.getVault()).getPoolTokens(_pool.getPoolId()); | ||
uint supply = IERC20(address(_pool)).totalSupply(); | ||
uint len = balances.length; | ||
amounts_ = new uint[](len); | ||
for (uint i; i < len; ++i) { | ||
amounts_[i] = shares * balances[i] / supply; | ||
} | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
EF
Implementation
Deployment
0xE3374041F173FFCB0026A82C6EEf94409F713Cf9
0xA1f5Ce440fa7F05e303DD7a41fAd1C131bB5bB85
Bugs
0x9B093877eCe3232013516fAf0ca6297A8535141B
0x7146efaab12A083b9826c66162062c21eC70fe3c
BWF
Implementation
Deployment
0x8f59BB791Da8fb1E2FedbDeAc576F0f622479059