-
Notifications
You must be signed in to change notification settings - Fork 7
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
📜SQMF #126
📜SQMF #126
Conversation
OnlyForward0613
commented
May 8, 2024
•
edited by a17
Loading
edited by a17
- integration interfaces
- constants
- farms
- skeleton
- universal test
- implementation
- cleanup, mitigate alerts
- deploy script
function _computePositionKey(address owner, int24 bottomTick, int24 topTick) internal pure returns (bytes32 key) { | ||
assembly { | ||
key := or(shl(24, or(shl(24, owner), and(bottomTick, 0xFFFFFF))), and(topTick, 0xFFFFFF)) | ||
} | ||
} |
Check warning
Code scanning / Slither
Assembly usage Warning
function _computePositionKey(address owner, int24 bottomTick, int24 topTick) internal pure returns (bytes32 key) { | ||
assembly { | ||
key := or(shl(24, or(shl(24, owner), and(bottomTick, 0xFFFFFF))), and(topTick, 0xFFFFFF)) | ||
} | ||
} |
Check warning
Code scanning / Slither
Dead-code Warning
function extra() external pure returns (bytes32) { | ||
return CommonLib.bytesToBytes32(abi.encodePacked(bytes3(0x3477ff), bytes3(0x000000))); | ||
} |
Check warning
Code scanning / Slither
Too many digits Warning
- CommonLib.bytesToBytes32(abi.encodePacked(bytes3(0x3477ff),bytes3(0x000000)))
/// @inheritdoc IControllable | ||
string public constant VERSION = "1.1.0"; | ||
|
||
address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; |
Check warning
Code scanning / Slither
Unused state variable Warning
function _depositAssets(uint[] memory amounts, bool /*claimRevenue*/ ) internal override returns (uint value) { | ||
StrategyBaseStorage storage __$__ = _getStrategyBaseStorage(); | ||
(,, value) = IMultiPositionManager(__$__._underlying).deposit(amounts[0], amounts[1], 0, 0, address(0)); | ||
__$__.total += value; | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
{ | ||
StrategyBaseStorage storage __$__ = _getStrategyBaseStorage(); | ||
IMultiPositionManager _underlying = IMultiPositionManager(__$__._underlying); | ||
IMultiPositionManager.LiquidityPositions memory ticks_; |
Check warning
Code scanning / Slither
Uninitialized local variables Medium
function _previewDepositAssets(uint[] memory amountsMax) | ||
internal | ||
view | ||
override(StrategyBase, LPStrategyBase) | ||
returns (uint[] memory amountsConsumed, uint value) | ||
{ | ||
StrategyBaseStorage storage __$__ = _getStrategyBaseStorage(); | ||
IMultiPositionManager _underlying = IMultiPositionManager(__$__._underlying); | ||
IMultiPositionManager.LiquidityPositions memory ticks_; | ||
(ticks_.lowerTick, ticks_.upperTick, ) = _underlying.getPositions(); | ||
int24[] memory ticks = new int24[](2); | ||
ticks[0] = ticks_.lowerTick[0]; | ||
ticks[1] = ticks_.upperTick[0]; | ||
(, amountsConsumed) = ICAmmAdapter(address(ammAdapter())).getLiquidityForAmounts(pool(), amountsMax, ticks); | ||
|
||
uint[] memory totalAmounts; | ||
(totalAmounts[0], totalAmounts[1]) = _underlying.getTotalAmounts(); | ||
|
||
IMultiPositionManagerFactory factory = IMultiPositionManagerFactory(_underlying.vaultRegistry()); | ||
IFeedRegistryInterface chainlinkRegistry = IFeedRegistryInterface(factory.chainlinkRegistry()); | ||
bool[2] memory usdAsBase; | ||
usdAsBase[0] = false; | ||
usdAsBase[1] = false; | ||
value = _calculateShares( | ||
factory, | ||
chainlinkRegistry, | ||
ammAdapter().poolTokens(pool()), | ||
usdAsBase, | ||
amountsConsumed[0], | ||
amountsConsumed[1], | ||
totalAmounts[0], | ||
totalAmounts[1], | ||
_underlying.maxTotalSupply() | ||
); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
function _previewDepositAssets(uint[] memory amountsMax) | ||
internal | ||
view | ||
override(StrategyBase, LPStrategyBase) | ||
returns (uint[] memory amountsConsumed, uint value) | ||
{ | ||
StrategyBaseStorage storage __$__ = _getStrategyBaseStorage(); | ||
IMultiPositionManager _underlying = IMultiPositionManager(__$__._underlying); | ||
IMultiPositionManager.LiquidityPositions memory ticks_; | ||
(ticks_.lowerTick, ticks_.upperTick, ) = _underlying.getPositions(); | ||
int24[] memory ticks = new int24[](2); | ||
ticks[0] = ticks_.lowerTick[0]; | ||
ticks[1] = ticks_.upperTick[0]; | ||
(, amountsConsumed) = ICAmmAdapter(address(ammAdapter())).getLiquidityForAmounts(pool(), amountsMax, ticks); | ||
|
||
uint[] memory totalAmounts; | ||
(totalAmounts[0], totalAmounts[1]) = _underlying.getTotalAmounts(); | ||
|
||
IMultiPositionManagerFactory factory = IMultiPositionManagerFactory(_underlying.vaultRegistry()); | ||
IFeedRegistryInterface chainlinkRegistry = IFeedRegistryInterface(factory.chainlinkRegistry()); | ||
bool[2] memory usdAsBase; | ||
usdAsBase[0] = false; | ||
usdAsBase[1] = false; | ||
value = _calculateShares( | ||
factory, | ||
chainlinkRegistry, | ||
ammAdapter().poolTokens(pool()), | ||
usdAsBase, | ||
amountsConsumed[0], | ||
amountsConsumed[1], | ||
totalAmounts[0], | ||
totalAmounts[1], | ||
_underlying.maxTotalSupply() | ||
); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
returns (uint[] memory amountsConsumed, uint value) | ||
{ | ||
StrategyBaseStorage storage __$__ = _getStrategyBaseStorage(); | ||
IMultiPositionManager _underlying = IMultiPositionManager(__$__._underlying); |
Check warning
Code scanning / Slither
Variable names too similar Warning
function _previewDepositAssets(uint[] memory amountsMax) | ||
internal | ||
view | ||
override(StrategyBase, LPStrategyBase) | ||
returns (uint[] memory amountsConsumed, uint value) | ||
{ | ||
StrategyBaseStorage storage __$__ = _getStrategyBaseStorage(); | ||
IMultiPositionManager _underlying = IMultiPositionManager(__$__._underlying); | ||
IMultiPositionManager.LiquidityPositions memory ticks_; | ||
(ticks_.lowerTick, ticks_.upperTick,) = _underlying.getPositions(); | ||
int24[] memory ticks = new int24[](2); | ||
ticks[0] = ticks_.lowerTick[0]; | ||
ticks[1] = ticks_.upperTick[0]; | ||
(, amountsConsumed) = ICAmmAdapter(address(ammAdapter())).getLiquidityForAmounts(pool(), amountsMax, ticks); | ||
|
||
uint[] memory totalAmounts = new uint[](2); | ||
(totalAmounts[0], totalAmounts[1]) = _underlying.getTotalAmounts(); | ||
PriceReader priceReader; | ||
priceReader = PriceReader(IPlatform(platform()).priceReader()); | ||
(uint token0Price, ) = priceReader.getPrice(_underlying.token0()); | ||
(uint token1Price, ) = priceReader.getPrice(_underlying.token1()); | ||
uint numerator = token0Price * amountsConsumed[0] + token1Price * amountsConsumed[1]; | ||
uint denominator = token0Price * totalAmounts[0] + token1Price * totalAmounts[1]; | ||
amountsConsumed = amountsConsumed; | ||
value = UniswapV3MathLib.mulDiv(numerator, _underlying.totalSupply(), denominator); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
function _previewDepositAssets(uint[] memory amountsMax) | ||
internal | ||
view | ||
override(StrategyBase, LPStrategyBase) | ||
returns (uint[] memory amountsConsumed, uint value) | ||
{ | ||
StrategyBaseStorage storage __$__ = _getStrategyBaseStorage(); | ||
IMultiPositionManager _underlying = IMultiPositionManager(__$__._underlying); | ||
IMultiPositionManager.LiquidityPositions memory ticks_; | ||
(ticks_.lowerTick, ticks_.upperTick,) = _underlying.getPositions(); | ||
int24[] memory ticks = new int24[](2); | ||
ticks[0] = ticks_.lowerTick[0]; | ||
ticks[1] = ticks_.upperTick[0]; | ||
(, amountsConsumed) = ICAmmAdapter(address(ammAdapter())).getLiquidityForAmounts(pool(), amountsMax, ticks); | ||
|
||
uint[] memory totalAmounts = new uint[](2); | ||
(totalAmounts[0], totalAmounts[1]) = _underlying.getTotalAmounts(); | ||
PriceReader priceReader; | ||
priceReader = PriceReader(IPlatform(platform()).priceReader()); | ||
(uint token0Price, ) = priceReader.getPrice(_underlying.token0()); | ||
(uint token1Price, ) = priceReader.getPrice(_underlying.token1()); | ||
uint numerator = token0Price * amountsConsumed[0] + token1Price * amountsConsumed[1]; | ||
uint denominator = token0Price * totalAmounts[0] + token1Price * totalAmounts[1]; | ||
amountsConsumed = amountsConsumed; | ||
value = UniswapV3MathLib.mulDiv(numerator, _underlying.totalSupply(), denominator); | ||
} |
Check warning
Code scanning / Slither
Unused return Medium
|
||
address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; | ||
|
||
address internal constant USD = address(840); |
Check warning
Code scanning / Slither
Unused state variable Warning
…teer-quickswap-merkl-farm # Conflicts: # chains/PolygonLib.sol # script/libs/DeployStrategyLib.sol
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #126 +/- ##
==========================================
+ Coverage 94.76% 98.04% +3.28%
==========================================
Files 60 62 +2
Lines 4428 4562 +134
Branches 477 489 +12
==========================================
+ Hits 4196 4473 +277
- Misses 77 81 +4
+ Partials 155 8 -147 ☔ View full report in Codecov by Sentry. |
StrategyBaseStorage storage __$__ = _getStrategyBaseStorage(); | ||
//slither-disable-next-line similar-names | ||
IMultiPositionManager _underlying = IMultiPositionManager(__$__._underlying); | ||
IMultiPositionManager.LiquidityPositions memory ticks_; |
Check warning
Code scanning / Slither
Uninitialized local variables Medium
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add active farms with various steer vaults.