-
Notifications
You must be signed in to change notification settings - Fork 11
PCV Deposit V2 #181
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
base: feat/core-coreref-cleanup
Are you sure you want to change the base?
PCV Deposit V2 #181
Conversation
…volt-protocol-core into feat/pcv-deposit-v2-base
…volt-protocol-core into feat/pcv-deposit-v2-base
eswak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very cool that pcv deposits will be so easy to add with this refactoring. I think you should consider doing a standard test suite for PCVDeposits (and inherit it in your venue-specific test files)
requested changes because I don't like the duplication of token state variable + rewards handling, but overall very excited by this PR
we should consider changing VIP17 to deposit a small amount in each venue
| /// @notice claim COMP rewards for supplying to Morpho. | ||
| /// Does not require reentrancy lock as no smart contract state is mutated | ||
| /// in this function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment
| /// @notice gets the token address in which this deposit returns its balance | ||
| function balanceReportedIn() external view returns (address); | ||
|
|
||
| /// @notice address of underlying token | ||
| function token() external view returns (address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the duplication ?
| using SafeERC20 for IERC20; | ||
| using SafeCast for *; | ||
|
|
||
| /// @notice reference to underlying token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment
| import {CoreRefV2} from "@voltprotocol/refs/CoreRefV2.sol"; | ||
| import {IPCVDepositV2} from "@voltprotocol/pcv/IPCVDepositV2.sol"; | ||
|
|
||
| /// @title abstract contract for withdrawing ERC-20 tokens using a PCV Controller |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment
| ); | ||
| } | ||
|
|
||
| function testWithdrawPCVGuardian() public { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed, there is already a post-proposal check that uses pcvGuardian to empty the deposits
| addresses.mainnet("PCV_DEPOSIT_MORPHO_DAI"), | ||
| addresses.mainnet("PCV_DEPOSIT_MORPHO_USDC") | ||
| addresses.mainnet("PCV_DEPOSIT_MORPHO_COMPOUND_DAI"), | ||
| addresses.mainnet("PCV_DEPOSIT_MORPHO_COMPOUND_USDC"), | ||
| addresses.mainnet("PCV_DEPOSIT_EULER_DAI"), | ||
| addresses.mainnet("PCV_DEPOSIT_EULER_USDC"), | ||
| addresses.mainnet("PCV_DEPOSIT_MORPHO_AAVE_DAI"), | ||
| addresses.mainnet("PCV_DEPOSIT_MORPHO_AAVE_DAI") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
| /// @notice withdraw all tokens from Morpho | ||
| /// non-reentrant as state changes and external calls are made | ||
| /// @param to the address PCV will be sent to | ||
| function withdrawAll(address to) external onlyPCVController globalLock(2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test that calls this, it's not covered
| /// profits and or last recorded balance. | ||
| /// If a deposit records PNL, only use this | ||
| /// function in an emergency. | ||
| function withdrawERC20( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test that calls this, it's not covered
| /// @notice this is a no-op | ||
| /// euler distributes tokens through a merkle drop, | ||
| /// no need for claim functionality | ||
| function _claim() internal pure override returns (uint256) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you don't remove it from PCVDeposit, add a (very small) test to call this, it's not covered
|
Another comment : |
Refactor PCV Deposit V2 to a cleaner architecture that speeds up integrations.
Create a Euler PCV Deposit
Create a Morpho Aave PCV Deposit
Wire both Euler and Aave PCV Deposits into the deployment script
Add integration tests for these new PCV Deposits