Skip to content

Commit

Permalink
feat: add Aave's aTokenVault
Browse files Browse the repository at this point in the history
  • Loading branch information
0xChin committed Dec 14, 2024
1 parent 528eff1 commit 39f4d2e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 2 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions script/Deploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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));

Expand Down
36 changes: 36 additions & 0 deletions src/contracts/vaults/AaveV3VaultFee.sol
Original file line number Diff line number Diff line change
@@ -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_);
}
}
16 changes: 15 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"

[email protected]:
version "0.7.1"
resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.7.1.tgz#16db20abe67de80f6183cf75f3de1ff86453b745"
Expand Down

0 comments on commit 39f4d2e

Please sign in to comment.