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

Audit Fixes: QS-17 #44

Merged
merged 7 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/buyback/YieldReserve.sol
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ contract YieldReserve is ReentrancyGuard, Ownable {
IERC20(_srcToken).safeTransferFrom(msg.sender, address(this), _amountIn);
if (_srcToken != Helpers.USDS) {
// Mint USDs
IERC20(_srcToken).safeApprove(vault, _amountIn);
IERC20(_srcToken).forceApprove(vault, _amountIn);
IVault(vault).mint(_srcToken, _amountIn, 0, block.timestamp);
// No need to do slippage check as it is our contract
// and the vault does that.
Expand Down
2 changes: 1 addition & 1 deletion contracts/strategies/aave/AaveStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract AaveStrategy is InitializableAbstractStrategy {
allocatedAmount[_asset] += _amount;

IERC20(_asset).safeTransferFrom(msg.sender, address(this), _amount);
IERC20(_asset).safeApprove(address(aavePool), _amount);
IERC20(_asset).forceApprove(address(aavePool), _amount);
aavePool.supply(_asset, _amount, address(this), REFERRAL_CODE);

emit Deposit(_asset, _amount);
Expand Down
2 changes: 1 addition & 1 deletion contracts/strategies/compound/CompoundStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ contract CompoundStrategy is InitializableAbstractStrategy {
allocatedAmount[_asset] += _amount;

IERC20(_asset).safeTransferFrom(msg.sender, address(this), _amount);
IERC20(_asset).safeApprove(lpToken, _amount);
IERC20(_asset).forceApprove(lpToken, _amount);

// Supply Compound Strategy.
IComet(lpToken).supply(_asset, _amount);
Expand Down
4 changes: 2 additions & 2 deletions contracts/strategies/stargate/StargateStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ contract StargateStrategy is InitializableAbstractStrategy {
if (!supportsCollateral(_asset)) revert CollateralNotSupported(_asset);
address lpToken = assetToPToken[_asset];
IERC20(_asset).safeTransferFrom(msg.sender, address(this), _amount);
IERC20(_asset).safeApprove(router, _amount);
IERC20(_asset).forceApprove(router, _amount);

// Add liquidity in the stargate pool.
IStargateRouter(router).addLiquidity(assetInfo[_asset].pid, _amount, address(this));
Expand All @@ -103,7 +103,7 @@ contract StargateStrategy is InitializableAbstractStrategy {
// Update the allocated amount in the strategy
assetInfo[_asset].allocatedAmt += depositAmt;

IERC20(lpToken).safeApprove(farm, lpTokenBal);
IERC20(lpToken).forceApprove(farm, lpTokenBal);
ILPStaking(farm).deposit(assetInfo[_asset].rewardPID, lpTokenBal);
emit Deposit(_asset, depositAmt);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/vault/VaultCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ contract VaultCore is Initializable, OwnableUpgradeable, ReentrancyGuardUpgradea
if (!ICollateralManager(collateralManager).validateAllocation(_collateral, _strategy, _amount)) {
revert AllocationNotAllowed(_collateral, _strategy, _amount);
}
IERC20Upgradeable(_collateral).safeIncreaseAllowance(_strategy, _amount);
IERC20Upgradeable(_collateral).forceApprove(_strategy, _amount);
IStrategy(_strategy).deposit(_collateral, _amount);
emit Allocated(_collateral, _strategy, _amount);
}
Expand Down
11 changes: 2 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@
},
"dependencies": {
"@chainlink/contracts": "^0.5.1",
"@openzeppelin/contracts": "^4.8.3",
"@openzeppelin/contracts_v3.4.2": "npm:@openzeppelin/contracts@^3.4.2",
"@openzeppelin/contracts-upgradeable": "^4.9.0",
"@openzeppelin/contracts": "4.9.3",
"@openzeppelin/contracts-upgradeable": "4.9.3",
"@uniswap/v3-core": "^1.0.1",
"@uniswap/v3-periphery": "^1.4.3"
}
Expand Down