-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feat/harvester-swap #116
Feat/harvester-swap #116
Conversation
df6b9c6
to
29835f7
Compare
address vault, | ||
uint64 targetExposure, | ||
uint64 minExposureYieldAsset, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
address vault, | ||
uint64 targetExposure, | ||
uint64 minExposureYieldAsset, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
address vault, | ||
uint64 targetExposure, | ||
uint64 minExposureYieldAsset, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
function _swapToTokenIn( | ||
uint256 typeAction, | ||
address tokenIn, | ||
address tokenOut, | ||
uint256 amount, | ||
bytes memory callData | ||
) internal virtual returns (uint256) {} |
Check warning
Code scanning / Slither
Dead-code Warning
address asset, | ||
uint64 targetExposure, | ||
uint64 overrideExposures, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
address asset, | ||
uint64 targetExposure, | ||
uint64 overrideExposures, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
address asset, | ||
uint64 targetExposure, | ||
uint64 overrideExposures, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
address asset, | ||
uint64 targetExposure, | ||
uint64 overrideExposures, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
address vault, | ||
uint64 targetExposure, | ||
uint64 overrideExposures, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
address vault, | ||
uint64 targetExposure, | ||
uint64 overrideExposures, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
address vault, | ||
uint64 targetExposure, | ||
uint64 overrideExposures, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
address vault, | ||
uint64 targetExposure, | ||
uint64 overrideExposures, | ||
uint64 maxExposureYieldAsset, |
Check warning
Code scanning / Slither
Variable names too similar Warning
function _swapToTokenIn( | ||
uint256, | ||
address tokenIn, | ||
address tokenOut, | ||
uint256 amount, | ||
bytes memory callData | ||
) internal override returns (uint256) { | ||
uint256 balance = IERC20(tokenIn).balanceOf(address(this)); | ||
|
||
address[] memory tokens = new address[](1); | ||
tokens[0] = tokenOut; | ||
bytes[] memory callDatas = new bytes[](1); | ||
callDatas[0] = callData; | ||
uint256[] memory amounts = new uint256[](1); | ||
amounts[0] = amount; | ||
_swap(tokens, callDatas, amounts); | ||
|
||
uint256 amountOut = IERC20(tokenIn).balanceOf(address(this)) - balance; | ||
uint256 decimalsTokenOut = IERC20Metadata(tokenOut).decimals(); | ||
uint256 decimalsTokenIn = IERC20Metadata(tokenIn).decimals(); | ||
|
||
if (decimalsTokenOut > decimalsTokenIn) { | ||
amount /= 10 ** (decimalsTokenOut - decimalsTokenIn); | ||
} else if (decimalsTokenOut < decimalsTokenIn) { | ||
amount *= 10 ** (decimalsTokenIn - decimalsTokenOut); | ||
} | ||
if (amountOut < (amount * (BPS - maxSlippage)) / BPS) { | ||
revert SlippageTooHigh(); | ||
} | ||
return amountOut; | ||
} |
Check notice
Code scanning / Slither
Block timestamp Low
Dangerous comparisons:
- amountOut < (amount * (BPS - maxSlippage)) / BPS
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #116 +/- ##
==========================================
- Coverage 99.90% 99.53% -0.38%
==========================================
Files 26 29 +3
Lines 1034 1068 +34
==========================================
+ Hits 1033 1063 +30
- Misses 1 5 +4 ☔ View full report in Codecov by Sentry. |
No description provided.