Skip to content

Conversation

@ElliotFriedman
Copy link
Collaborator

@ElliotFriedman ElliotFriedman commented Jan 10, 2023

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

@ElliotFriedman ElliotFriedman marked this pull request as ready for review January 18, 2023 23:14
Copy link
Collaborator

@eswak eswak left a 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

Comment on lines +58 to +60
/// @notice claim COMP rewards for supplying to Morpho.
/// Does not require reentrancy lock as no smart contract state is mutated
/// in this function.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update comment

Comment on lines +75 to +79
/// @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);
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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 {
Copy link
Collaborator

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

Comment on lines -20 to +25
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")
Copy link
Collaborator

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) {
Copy link
Collaborator

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(
Copy link
Collaborator

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) {
Copy link
Collaborator

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

@eswak
Copy link
Collaborator

eswak commented Jan 25, 2023

Another comment : IntegrationTestEulerPCVDeposit and IntegrationTestMorphoAavePCVDeposit can be moved to regular integration tests folder (and inherit Test instead of PostProposalCheck), they don't need to be post-proposal tests, because you're not testing the protocol, you're deploying new contracts and testing their standalone behavior (to validate the integration with 3rd party protocols). IntegrationTestMorphoCompoundPCVDeposit is a regular integration test for instance, and it's a very similar need. There is some post-proposal validation by using the PCVGuardian because you deploy these new venues as part of VIP16 and updated the post-proposal pcv guardian test 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants