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

Feat/harvester-swap #116

Merged
merged 12 commits into from
Sep 3, 2024
Merged

Feat/harvester-swap #116

merged 12 commits into from
Sep 3, 2024

Conversation

0xtekgrinder
Copy link
Contributor

No description provided.

@0xtekgrinder 0xtekgrinder self-assigned this Aug 20, 2024
contracts/helpers/RebalancerFlashloanSwap.sol Show resolved Hide resolved
contracts/helpers/RebalancerFlashloanSwap.sol Outdated Show resolved Hide resolved
contracts/helpers/HarvesterSwap.sol Show resolved Hide resolved
contracts/helpers/HarvesterSwap.sol Outdated Show resolved Hide resolved
@0xtekgrinder 0xtekgrinder marked this pull request as ready for review August 27, 2024 15:19
contracts/helpers/ARebalancerFlashloan.sol Fixed Show fixed Hide fixed
contracts/helpers/HarvesterSwap.sol Fixed Show fixed Hide fixed
contracts/helpers/HarvesterSwap.sol Fixed Show fixed Hide fixed
contracts/helpers/HarvesterSwap.sol Fixed Show fixed Hide fixed
contracts/helpers/HarvesterSwap.sol Fixed Show fixed Hide fixed
address vault,
uint64 targetExposure,
uint64 minExposureYieldAsset,
uint64 maxExposureYieldAsset,
address vault,
uint64 targetExposure,
uint64 minExposureYieldAsset,
uint64 maxExposureYieldAsset,
address vault,
uint64 targetExposure,
uint64 minExposureYieldAsset,
uint64 maxExposureYieldAsset,
contracts/helpers/RebalancerFlashloanSwap.sol Fixed Show fixed Hide fixed
contracts/helpers/RebalancerFlashloanSwap.sol Fixed Show fixed Hide fixed
Comment on lines +106 to +112
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,
address asset,
uint64 targetExposure,
uint64 overrideExposures,
uint64 maxExposureYieldAsset,
address asset,
uint64 targetExposure,
uint64 overrideExposures,
uint64 maxExposureYieldAsset,
address asset,
uint64 targetExposure,
uint64 overrideExposures,
uint64 maxExposureYieldAsset,
address vault,
uint64 targetExposure,
uint64 overrideExposures,
uint64 maxExposureYieldAsset,
address vault,
uint64 targetExposure,
uint64 overrideExposures,
uint64 maxExposureYieldAsset,
address vault,
uint64 targetExposure,
uint64 overrideExposures,
uint64 maxExposureYieldAsset,
address vault,
uint64 targetExposure,
uint64 overrideExposures,
uint64 maxExposureYieldAsset,
Comment on lines +63 to +93
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

@0xtekgrinder 0xtekgrinder merged commit 1c417c4 into main Sep 3, 2024
6 checks passed
@0xtekgrinder 0xtekgrinder deleted the feat/harvester-swap branch September 3, 2024 13:38
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 91.83673% with 4 lines in your changes missing coverage. Please review.

Project coverage is 99.53%. Comparing base (d592dd9) to head (68f13d8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
contracts/helpers/RebalancerFlashloanSwap.sol 86.36% 3 Missing ⚠️
contracts/helpers/BaseHarvester.sol 94.44% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants