diff --git a/package.json b/package.json index 54a73d7..04996d5 100644 --- a/package.json +++ b/package.json @@ -45,13 +45,15 @@ "test/**/*.sol": "yarn lint:sol-tests", "package.json": "sort-package-json" }, - "dependencies": {}, "devDependencies": { "@aave/core-v3": "^1.19.3", + "@aave/v3-periphery": "github:aave/aave-v3-periphery", "@commitlint/cli": "19.3.0", "@commitlint/config-conventional": "19.2.2", "@defi-wonderland/natspec-smells": "1.1.1", "@openzeppelin/contracts": "^5.0.2", + "@openzeppelin/contracts-upgradeable": "github:OpenZeppelin/openzeppelin-contracts-upgradeable#7ec6d2a3117eb3487a5f9029203e80ceb89bd984", + "aave-vault": "github:0xChin/Aave-Vault#7f2bf8b", "forge-std": "github:foundry-rs/forge-std#1.8.2", "halmos-cheatcodes": "github:a16z/halmos-cheatcodes#c0d8655", "husky": ">=8", diff --git a/remappings.txt b/remappings.txt index d3b71e3..6ec474e 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,9 +1,15 @@ forge-std/=node_modules/forge-std/src halmos-cheatcodes=node_modules/halmos-cheatcodes +@openzeppelin-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/contracts openzeppelin-contracts/=node_modules/@openzeppelin/contracts +@openzeppelin/contracts/=node_modules/@openzeppelin/contracts +@openzeppelin/interfaces/=node_modules/@openzeppelin/contracts/interfaces aave/core-v3/=node_modules/@aave/core-v3/contracts +@aave-v3-core/=node_modules/@aave/core-v3/contracts +@aave-v3-periphery/=node_modules/@aave/v3-periphery/contracts yield-daddy/=node_modules/yield-daddy/src solmate/=node_modules/solmate/src +aave-vault/=node_modules/aave-vault/src contracts/=src/contracts script/=script diff --git a/script/Deploy.sol b/script/Deploy.sol index b399357..5736f07 100644 --- a/script/Deploy.sol +++ b/script/Deploy.sol @@ -5,6 +5,7 @@ import {Grateful} from "contracts/Grateful.sol"; import {AaveV3Vault} from "contracts/vaults/AaveV3Vault.sol"; import {Script} from "forge-std/Script.sol"; +import {ATokenVault, IPoolAddressesProvider} from "aave-vault/ATokenVault.sol"; import {console} from "forge-std/console.sol"; import {ERC20} from "solmate/tokens/ERC20.sol"; import {IPool, IRewardsController} from "yield-daddy/aave-v3/AaveV3ERC4626.sol"; @@ -311,6 +312,10 @@ contract Deploy is Script { address(grateful) // newOwner ); + // TODO: Use this vault instead of the other one + + ATokenVault aTokenVault = new ATokenVault(vaultParams.token, 0, IPoolAddressesProvider(address(_params.aavePool))); + // Add the vault to Grateful grateful.addVault(vaultParams.token, address(vault)); diff --git a/src/contracts/vaults/AaveV3VaultFee.sol b/src/contracts/vaults/AaveV3VaultFee.sol new file mode 100644 index 0000000..4803d92 --- /dev/null +++ b/src/contracts/vaults/AaveV3VaultFee.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.26; + +import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; +import {ATokenVault, IPoolAddressesProvider} from "aave-vault/ATokenVault.sol"; + +contract AaveV3VaultFee is ATokenVault { + constructor( + address asset_, + uint256 fee_, + IPoolAddressesProvider poolAddressesProvider_, + address newOwner + ) ATokenVault(asset_, 0, poolAddressesProvider_) { + // TODO: Stuff here, or add initializer? + } + + function deposit(uint256 assets, address receiver) public override onlyOwner returns (uint256 shares) { + return super.deposit(assets, receiver); + } + + function mint(uint256 shares, address receiver) public override onlyOwner returns (uint256 assets) { + return super.mint(shares, receiver); + } + + function withdraw( + uint256 assets, + address receiver, + address owner_ + ) public override onlyOwner returns (uint256 shares) { + return super.withdraw(assets, receiver, owner_); + } + + function redeem(uint256 shares, address receiver, address owner_) public override onlyOwner returns (uint256 assets) { + return super.redeem(shares, receiver, owner_); + } +} diff --git a/yarn.lock b/yarn.lock index aa5bbaf..bc613b0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,11 +2,17 @@ # yarn lockfile v1 -"@aave/core-v3@^1.19.3": +"@aave/core-v3@1.19.3", "@aave/core-v3@^1.19.3": version "1.19.3" resolved "https://registry.yarnpkg.com/@aave/core-v3/-/core-v3-1.19.3.tgz#513e886b37a8d84d9821a4041dceb5f014919669" integrity sha512-Xr7+VcoU5b4mPwM4IUCnskw3lciwrnL4Xloyad8GOddYeixnri2lZYobNmErm1LwE50vqjI0O+9QGNKY2TDkeQ== +"@aave/v3-periphery@github:aave/aave-v3-periphery": + version "2.5.2" + resolved "https://codeload.github.com/aave/aave-v3-periphery/tar.gz/803c3e7d6d1c6da8d91411f4d085494f7189ea0b" + dependencies: + "@aave/core-v3" "1.19.3" + "@babel/code-frame@^7.0.0": version "7.24.2" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" @@ -228,6 +234,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@openzeppelin/contracts-upgradeable@github:OpenZeppelin/openzeppelin-contracts-upgradeable#7ec6d2a3117eb3487a5f9029203e80ceb89bd984": + version "4.8.1" + resolved "https://codeload.github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/tar.gz/7ec6d2a3117eb3487a5f9029203e80ceb89bd984" + "@openzeppelin/contracts@^5.0.2": version "5.0.2" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.0.2.tgz#b1d03075e49290d06570b2fd42154d76c2a5d210" @@ -284,6 +294,10 @@ JSONStream@^1.3.5: jsonparse "^1.2.0" through ">=2.2.7 <3" +"aave-vault@github:0xChin/Aave-Vault#7f2bf8b": + version "1.0.0" + resolved "https://codeload.github.com/0xChin/Aave-Vault/tar.gz/7f2bf8bc1d84230abc67f31fc09c80927b5cf246" + abitype@0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.7.1.tgz#16db20abe67de80f6183cf75f3de1ff86453b745"