Skip to content

Commit

Permalink
Merge pull request #66 from superform-xyz/migrate-0.8.21
Browse files Browse the repository at this point in the history
chore: migrate to oz 5.0.0 and solidity 0.8.21
  • Loading branch information
0xTimepunk authored Oct 17, 2023
2 parents 52c600f + 675c9d1 commit 6ccf843
Show file tree
Hide file tree
Showing 107 changed files with 514 additions and 721 deletions.
4 changes: 2 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
src = 'src'
out = 'out'
libs = ['lib']
solc_version = "0.8.21" # Override for the solc version (setting this ignores `auto_detect_solc`)
evm_version = "paris" # to prevent usage of PUSH0, which is not supported on all chains
solc_version = "0.8.21" # Override for the solc version (setting this ignores `auto_detect_solc`)
evm_version = "paris" # to prevent usage of PUSH0, which is not supported on all chains


remappings = [
Expand Down
2 changes: 1 addition & 1 deletion lib/openzeppelin-contracts
6 changes: 3 additions & 3 deletions src/_global/swapUtils.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
import { ERC20 } from "solmate/tokens/ERC20.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";

interface IPair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
Expand Down
30 changes: 10 additions & 20 deletions src/aave-v2/AaveV2ERC4626Reinvest.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

import { ERC20 } from "solmate/tokens/ERC20.sol";
import { ERC4626 } from "solmate/mixins/ERC4626.sol";
import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";

import { ILendingPool } from "./aave/ILendingPool.sol";
import { IAaveMining } from "./aave/IAaveMining.sol";
import {ILendingPool} from "./aave/ILendingPool.sol";
import {IAaveMining} from "./aave/IAaveMining.sol";

import { DexSwap } from "../_global/swapUtils.sol";
import {DexSwap} from "../_global/swapUtils.sol";

/// @title AaveV2ERC4626Reinvest
/// @notice Extended implementation of yield-daddy's ERC4626
Expand Down Expand Up @@ -89,9 +89,7 @@ contract AaveV2ERC4626Reinvest is ERC4626 {
ILendingPool lendingPool_,
address rewardToken_,
address manager_
)
ERC4626(asset_, _vaultName(asset_), _vaultSymbol(asset_))
{
) ERC4626(asset_, _vaultName(asset_), _vaultSymbol(asset_)) {
aToken = aToken_;
rewards = rewards_;
lendingPool = lendingPool_;
Expand Down Expand Up @@ -188,11 +186,7 @@ contract AaveV2ERC4626Reinvest is ERC4626 {
///@param assets_ Amount of assets to withdraw
///@param receiver_ Address to send withdrawn assets to
///@param owner_ Address to burn shares from
function withdraw(
uint256 assets_,
address receiver_,
address owner_
)
function withdraw(uint256 assets_, address receiver_, address owner_)
public
virtual
override
Expand Down Expand Up @@ -222,11 +216,7 @@ contract AaveV2ERC4626Reinvest is ERC4626 {
///@param shares_ Amount of shares to redeem
///@param receiver_ Address to send redeemed assets to
///@param owner_ Address to burn shares from
function redeem(
uint256 shares_,
address receiver_,
address owner_
)
function redeem(uint256 shares_, address receiver_, address owner_)
public
virtual
override
Expand Down
12 changes: 6 additions & 6 deletions src/aave-v2/AaveV2ERC4626ReinvestFactory.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

import { ERC20 } from "solmate/tokens/ERC20.sol";
import { ERC4626 } from "solmate/mixins/ERC4626.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";

import { AaveV2ERC4626Reinvest } from "./AaveV2ERC4626Reinvest.sol";
import { IAaveMining } from "./aave/IAaveMining.sol";
import { ILendingPool } from "./aave/ILendingPool.sol";
import {AaveV2ERC4626Reinvest} from "./AaveV2ERC4626Reinvest.sol";
import {IAaveMining} from "./aave/IAaveMining.sol";
import {ILendingPool} from "./aave/ILendingPool.sol";

/// @title AaveV2ERC4626ReinvestFactory
/// @notice Factory for creating AaveV2ERC4626 contracts
Expand Down
30 changes: 10 additions & 20 deletions src/aave-v2/AaveV2ERC4626ReinvestIncentive.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

import { ERC20 } from "solmate/tokens/ERC20.sol";
import { ERC4626 } from "solmate/mixins/ERC4626.sol";
import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";

import { ILendingPool } from "./aave/ILendingPool.sol";
import { IAaveMining } from "./aave/IAaveMining.sol";
import {ILendingPool} from "./aave/ILendingPool.sol";
import {IAaveMining} from "./aave/IAaveMining.sol";

import { DexSwap } from "../_global/swapUtils.sol";
import {DexSwap} from "../_global/swapUtils.sol";

/// @title AaveV2ERC4626ReinvestIncentive
/// @notice Extended implementation of yield-daddy AaveV2 wrapper with reinvesting logic - with incentives to call
Expand Down Expand Up @@ -96,9 +96,7 @@ contract AaveV2ERC4626ReinvestIncentive is ERC4626 {
ILendingPool lendingPool_,
address rewardToken_,
address manager_
)
ERC4626(asset_, _vaultName(asset_), _vaultSymbol(asset_))
{
) ERC4626(asset_, _vaultName(asset_), _vaultSymbol(asset_)) {
aToken = aToken_;
rewards = rewards_;
lendingPool = lendingPool_;
Expand Down Expand Up @@ -165,11 +163,7 @@ contract AaveV2ERC4626ReinvestIncentive is ERC4626 {
ERC4626 OVERRIDE FUNCTIONS
//////////////////////////////////////////////////////////////*/

function withdraw(
uint256 assets_,
address receiver_,
address owner_
)
function withdraw(uint256 assets_, address receiver_, address owner_)
public
virtual
override
Expand All @@ -195,11 +189,7 @@ contract AaveV2ERC4626ReinvestIncentive is ERC4626 {
lendingPool.withdraw(address(asset), assets_, receiver_);
}

function redeem(
uint256 shares_,
address receiver_,
address owner_
)
function redeem(uint256 shares_, address receiver_, address owner_)
public
virtual
override
Expand Down
12 changes: 6 additions & 6 deletions src/aave-v2/AaveV2ERC4626ReinvestIncentiveFactory.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

import { ERC20 } from "solmate/tokens/ERC20.sol";
import { ERC4626 } from "solmate/mixins/ERC4626.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";

import { AaveV2ERC4626ReinvestIncentive } from "./AaveV2ERC4626ReinvestIncentive.sol";
import { IAaveMining } from "./aave/IAaveMining.sol";
import { ILendingPool } from "./aave/ILendingPool.sol";
import {AaveV2ERC4626ReinvestIncentive} from "./AaveV2ERC4626ReinvestIncentive.sol";
import {IAaveMining} from "./aave/IAaveMining.sol";
import {ILendingPool} from "./aave/ILendingPool.sol";

/// @title AaveV2ERC4626ReinvestFactory
/// @notice Factory for creating AaveV2ERC4626Reinvest contracts
Expand Down
2 changes: 1 addition & 1 deletion src/aave-v2/aave/IAaveMining.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

interface IAaveMining {
function claimRewards(address[] calldata assets, uint256 amount, address to) external returns (uint256);
Expand Down
2 changes: 1 addition & 1 deletion src/aave-v2/aave/ILendingPool.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

// Aave lending pool interface
// Documentation: https://docs.aave.com/developers/the-core-protocol/lendingpool/ilendingpool
Expand Down
16 changes: 8 additions & 8 deletions src/aave-v2/test/AaveV2ERC4626Reinvest.t.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

import "forge-std/Test.sol";
import { ERC20 } from "solmate/tokens/ERC20.sol";
import { ERC4626 } from "solmate/mixins/ERC4626.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";

import { AaveV2ERC4626Reinvest } from "../AaveV2ERC4626Reinvest.sol";
import { AaveV2ERC4626ReinvestFactory } from "../AaveV2ERC4626ReinvestFactory.sol";
import {AaveV2ERC4626Reinvest} from "../AaveV2ERC4626Reinvest.sol";
import {AaveV2ERC4626ReinvestFactory} from "../AaveV2ERC4626ReinvestFactory.sol";

import { ILendingPool } from "../aave/ILendingPool.sol";
import { IAaveMining } from "../aave/IAaveMining.sol";
import { DexSwap } from "../../_global/swapUtils.sol";
import {ILendingPool} from "../aave/ILendingPool.sol";
import {IAaveMining} from "../aave/IAaveMining.sol";
import {DexSwap} from "../../_global/swapUtils.sol";

contract AaveV2ERC4626ReinvestTest is Test {
////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/aave-v2/utils/ISwapRouter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;
pragma abicoder v2;

import "./IUniswapV3SwapCallback.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/aave-v2/utils/IUniswapV3SwapCallback.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
Expand Down
30 changes: 10 additions & 20 deletions src/aave-v3/AaveV3ERC4626Reinvest.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

import { ERC20 } from "solmate/tokens/ERC20.sol";
import { ERC4626 } from "solmate/mixins/ERC4626.sol";
import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";

import { IPool } from "./external/IPool.sol";
import { IRewardsController } from "./external/IRewardsController.sol";
import {IPool} from "./external/IPool.sol";
import {IRewardsController} from "./external/IRewardsController.sol";

import { DexSwap } from "../_global/swapUtils.sol";
import {DexSwap} from "../_global/swapUtils.sol";

/// @title AaveV3ERC4626Reinvest
/// @notice Extended implementation of yield-daddy's ERC4626 for Aave V3 with rewards reinvesting
Expand Down Expand Up @@ -101,9 +101,7 @@ contract AaveV3ERC4626Reinvest is ERC4626 {
IPool lendingPool_,
IRewardsController rewardsController_,
address manager_
)
ERC4626(asset_, _vaultName(asset_), _vaultSymbol(asset_))
{
) ERC4626(asset_, _vaultName(asset_), _vaultSymbol(asset_)) {
aToken = aToken_;
lendingPool = lendingPool_;
rewardsController = rewardsController_;
Expand Down Expand Up @@ -254,11 +252,7 @@ contract AaveV3ERC4626Reinvest is ERC4626 {
ERC4626 OVERRIDES
//////////////////////////////////////////////////////////////*/

function withdraw(
uint256 assets_,
address receiver_,
address owner_
)
function withdraw(uint256 assets_, address receiver_, address owner_)
public
virtual
override
Expand Down Expand Up @@ -286,11 +280,7 @@ contract AaveV3ERC4626Reinvest is ERC4626 {
lendingPool.withdraw(address(asset), assets_, receiver_);
}

function redeem(
uint256 shares_,
address receiver_,
address owner_
)
function redeem(uint256 shares_, address receiver_, address owner_)
public
virtual
override
Expand Down
18 changes: 8 additions & 10 deletions src/aave-v3/AaveV3ERC4626ReinvestFactory.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

import { ERC20 } from "solmate/tokens/ERC20.sol";
import { ERC4626 } from "solmate/mixins/ERC4626.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";

import { IPool } from "./external/IPool.sol";
import { AaveV3ERC4626Reinvest } from "./AaveV3ERC4626Reinvest.sol";
import { IRewardsController } from "./external/IRewardsController.sol";
import { Bytes32AddressLib } from "solmate/utils/Bytes32AddressLib.sol";
import {IPool} from "./external/IPool.sol";
import {AaveV3ERC4626Reinvest} from "./AaveV3ERC4626Reinvest.sol";
import {IRewardsController} from "./external/IRewardsController.sol";
import {Bytes32AddressLib} from "solmate/utils/Bytes32AddressLib.sol";

/// @title AaveV3ERC4626ReinvestFactory
/// @notice Factory for creating AaveV3ERC4626 contracts
Expand Down Expand Up @@ -129,9 +129,7 @@ contract AaveV3ERC4626ReinvestFactory {
address token_,
address pair1_,
address pair2_
)
external
{
) external {
if (msg.sender != manager) revert INVALID_ACCESS();
vault_.setRoutes(rewardToken_, token_, pair1_, pair2_);

Expand Down
30 changes: 10 additions & 20 deletions src/aave-v3/AaveV3ERC4626ReinvestIncentive.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.19;
pragma solidity ^0.8.21;

import { ERC20 } from "solmate/tokens/ERC20.sol";
import { ERC4626 } from "solmate/mixins/ERC4626.sol";
import { SafeTransferLib } from "solmate/utils/SafeTransferLib.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";

import { IPool } from "./external/IPool.sol";
import { IRewardsController } from "./external/IRewardsController.sol";
import {IPool} from "./external/IPool.sol";
import {IRewardsController} from "./external/IRewardsController.sol";

import { DexSwap } from "../_global/swapUtils.sol";
import {DexSwap} from "../_global/swapUtils.sol";

/// @title AaveV3ERC4626ReinvestIncentive
/// @notice Extended implementation of yield-daddy AaveV3 wrapper for Aave V3 with rewards reinvesting
Expand Down Expand Up @@ -103,9 +103,7 @@ contract AaveV3ERC4626ReinvestIncentive is ERC4626 {
IPool lendingPool_,
IRewardsController rewardsController_,
address manager_
)
ERC4626(asset_, _vaultName(asset_), _vaultSymbol(asset_))
{
) ERC4626(asset_, _vaultName(asset_), _vaultSymbol(asset_)) {
aToken = aToken_;
lendingPool = lendingPool_;
rewardsController = rewardsController_;
Expand Down Expand Up @@ -262,11 +260,7 @@ contract AaveV3ERC4626ReinvestIncentive is ERC4626 {
ERC4626 OVERRIDES
//////////////////////////////////////////////////////////////*/

function withdraw(
uint256 assets_,
address receiver_,
address owner_
)
function withdraw(uint256 assets_, address receiver_, address owner_)
public
virtual
override
Expand All @@ -292,11 +286,7 @@ contract AaveV3ERC4626ReinvestIncentive is ERC4626 {
lendingPool.withdraw(address(asset), assets_, receiver_);
}

function redeem(
uint256 shares_,
address receiver_,
address owner_
)
function redeem(uint256 shares_, address receiver_, address owner_)
public
virtual
override
Expand Down
Loading

0 comments on commit 6ccf843

Please sign in to comment.