Skip to content

Commit

Permalink
add moonwell morpho vault integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
trmid committed Sep 4, 2024
1 parent 98ba77d commit f75bbb1
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions test/integration/morpho-vaults/MorphoMoonwellUsdcBase.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import { BaseIntegration, IERC20, IERC4626 } from "../BaseIntegration.t.sol";

contract MorphoMoonwellUsdcBaseIntegrationTest is BaseIntegration {
uint256 fork;
uint256 forkBlock = 19338195;
uint256 forkBlockTimestamp = 1725465737;

address internal _asset = address(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913);
address internal _assetWhale = address(0x3304E22DDaa22bCdC5fCa2269b418046aE7b566A);
address internal _yieldVault = address(0xc1256Ae5FF1cf2719D4937adb3bbCCab2E00A2Ca);

/* ============ setup ============ */

function setUpUnderlyingAsset() public virtual override returns (IERC20 asset, uint8 decimals, uint256 approxAssetUsdExchangeRate) {
return (IERC20(_asset), 6, 1e18);
}

function setUpYieldVault() public virtual override returns (IERC4626) {
return IERC4626(_yieldVault);
}

function setUpFork() public virtual override {
fork = vm.createFork(vm.rpcUrl("base"), forkBlock);
vm.selectFork(fork);
vm.warp(forkBlockTimestamp);
}

function beforeSetup() public virtual override {
lowGasPriceEstimate = 0.05 gwei;
}

function afterSetup() public virtual override { }

/* ============ helpers to override ============ */

/// @dev The max amount of assets than can be dealt.
function maxDeal() public virtual override returns (uint256) {
return underlyingAsset.balanceOf(_assetWhale);
}

/// @dev May revert if the amount requested exceeds the amount available to deal.
function dealAssets(address to, uint256 amount) public virtual override prankception(_assetWhale) {
underlyingAsset.transfer(to, amount);
}

/// @dev Accrues yield by letting some time pass
function _accrueYield() internal virtual override {
vm.warp(block.timestamp + 1 days);
}

/// @dev Simulates loss by sending yield vault tokens out of the prize vault
function _simulateLoss() internal virtual override prankception(address(prizeVault)) {
yieldVault.transfer(_assetWhale, yieldVault.balanceOf(address(prizeVault)) / 2);
}

}

0 comments on commit f75bbb1

Please sign in to comment.