Skip to content

Commit 3fa94ff

Browse files
committed
feat: user can track which vaults or pool assets they have deposited into, in case the app disappears and they want to get their funds out with walletconnect + etherscan
1 parent d1ea868 commit 3fa94ff

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

packages/libs/contracts-sdk/contracts/fees/LibFeeStorage.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ library LibFeeStorage {
2727
EnumerableSet.AddressSet tokensWithCollectedFees;
2828
// aave pool contract address for this chain
2929
address aavePool;
30+
// maps user address to a set of vault or pool asset addresses
31+
// this means the user has deposited into this vault or pool
32+
// and if the vincent app disappears, the user can grab this set
33+
// and then call deposits(userAddress, addressFromThisSet) to find their deposits
34+
mapping(address => EnumerableSet.AddressSet) userVaultOrPoolAssetAddresses;
3035
}
3136

3237
function getStorage() internal pure returns (FeeStorage storage as_) {

packages/libs/contracts-sdk/contracts/fees/facets/AavePerfFeeFacet.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ contract AavePerfFeeFacet {
5555

5656
deposit.assetAmount += assetAmount;
5757
deposit.vaultProvider = VAULT_PROVIDER;
58+
59+
// add the pool asset address to the set of vault or pool asset addresses
60+
// so the user can find their deposits later
61+
LibFeeStorage.getStorage().userVaultOrPoolAssetAddresses[msg.sender].add(poolAsset);
5862
}
5963

6064
/**
@@ -74,6 +78,10 @@ contract AavePerfFeeFacet {
7478
// contracts to prevent reentrancy attacks
7579
delete LibFeeStorage.getStorage().deposits[msg.sender][poolAsset];
7680

81+
// remove the pool asset address from the set of vault or pool asset addresses
82+
// so the user can't find their deposits later
83+
LibFeeStorage.getStorage().userVaultOrPoolAssetAddresses[msg.sender].remove(poolAsset);
84+
7785
// get the aave pool contract and asset
7886
IPool aave = IPool(LibFeeStorage.getStorage().aavePool);
7987
IERC20 asset = IERC20(poolAsset);

packages/libs/contracts-sdk/contracts/fees/facets/MorphoPerfFeeFacet.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ contract MorphoPerfFeeFacet {
5656
deposit.assetAmount += assetAmount;
5757
deposit.vaultShares += vaultShares;
5858
deposit.vaultProvider = VAULT_PROVIDER;
59+
60+
// add the vault address to the set of vault or pool asset addresses
61+
// so the user can find their deposits later
62+
LibFeeStorage.getStorage().userVaultOrPoolAssetAddresses[msg.sender].add(vaultAddress);
5963
}
6064

6165
/**
@@ -76,6 +80,10 @@ contract MorphoPerfFeeFacet {
7680
// contracts to prevent reentrancy attacks
7781
delete LibFeeStorage.getStorage().deposits[msg.sender][vaultAddress];
7882

83+
// remove the vault address from the set of vault or pool asset addresses
84+
// so the user can't find their deposits later
85+
LibFeeStorage.getStorage().userVaultOrPoolAssetAddresses[msg.sender].remove(vaultAddress);
86+
7987
// get the vault and asset
8088
ERC4626 vault = ERC4626(vaultAddress);
8189
IERC20 asset = IERC20(vault.asset());

0 commit comments

Comments
 (0)