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

📜SQMF #126

Merged
merged 40 commits into from
Jul 15, 2024
Merged

📜SQMF #126

merged 40 commits into from
Jul 15, 2024

Conversation

OnlyForward0613
Copy link
Member

@OnlyForward0613 OnlyForward0613 commented May 8, 2024

  • integration interfaces
  • constants
  • farms
  • skeleton
  • universal test
  • implementation
  • cleanup, mitigate alerts
  • deploy script

@OnlyForward0613 OnlyForward0613 linked an issue May 8, 2024 that may be closed by this pull request
src/strategies/SteerQuickSwapMerklFarmStrategy.sol Dismissed Show dismissed Hide dismissed
src/strategies/SteerQuickSwapMerklFarmStrategy.sol Dismissed Show dismissed Hide dismissed
@a17 a17 changed the title 85 dev steer quickswap merkl farm SQMF May 9, 2024
Comment on lines 277 to 281
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

Comment on lines 277 to 281
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

Comment on lines 149 to 151
function extra() external pure returns (bytes32) {
return CommonLib.bytesToBytes32(abi.encodePacked(bytes3(0x3477ff), bytes3(0x000000)));
}

Check warning

Code scanning / Slither

Too many digits Warning

/// @inheritdoc IControllable
string public constant VERSION = "1.1.0";

address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

Check warning

Code scanning / Slither

Unused state variable Warning

Comment on lines 206 to 210
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;
}
@a17 a17 added the STRATEGY Strategy logic proposed for implementation label May 12, 2024
{
StrategyBaseStorage storage __$__ = _getStrategyBaseStorage();
IMultiPositionManager _underlying = IMultiPositionManager(__$__._underlying);
IMultiPositionManager.LiquidityPositions memory ticks_;

Check warning

Code scanning / Slither

Uninitialized local variables Medium

Comment on lines 281 to 315
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

Comment on lines 281 to 315
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);
Comment on lines 286 to 311
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);
}
Comment on lines 286 to 311
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);
}
src/strategies/SteerQuickSwapMerklFarmStrategy.sol Dismissed Show dismissed Hide dismissed

address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

address internal constant USD = address(840);

Check warning

Code scanning / Slither

Unused state variable Warning

OnlyForward0613 and others added 2 commits May 30, 2024 17:40
…teer-quickswap-merkl-farm

# Conflicts:
#	chains/PolygonLib.sol
#	script/libs/DeployStrategyLib.sol
@a17 a17 self-assigned this Jul 15, 2024
Copy link

codecov bot commented Jul 15, 2024

Codecov Report

Attention: Patch coverage is 95.55556% with 6 lines in your changes missing coverage. Please review.

Project coverage is 98.04%. Comparing base (43e38cc) to head (cb96c49).

Files Patch % Lines
src/strategies/SteerQuickSwapMerklFarmStrategy.sol 94.69% 4 Missing and 2 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

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

@a17 a17 changed the title SQMF 📜SQMF Jul 15, 2024
Copy link
Member

@a17 a17 left a 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.

@OnlyForward0613 OnlyForward0613 merged commit 8e0325b into main Jul 15, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STRATEGY Strategy logic proposed for implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

📜[DONE] Steer QuickSwap Merkl Farm
2 participants