Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/ERC4626WrapperBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ struct ForkState {
* @param minDeposit Some ERC4626 protocols require a minimum amount of underlying tokens to deposit
* @param underlyingToWrappedFactor Some ERC4626 protocols use a different amount of decimals between underlying and
* the wrapper. This factor scales underlying decimals to wrapper decimals
* @param skipTime How much time to skip during setup; defaults to 1 day. Tokens that read from an oracle with a
* tight staleness window may need a smaller value to keep the feed fresh
*/
struct ERC4626SetupState {
IERC4626 wrapper;
Expand All @@ -37,6 +39,7 @@ struct ERC4626SetupState {
uint256 minDeposit;
uint256 underlyingToWrappedFactor;
bool skipMaxTests;
uint256 skipTime;
}

/**
Expand Down Expand Up @@ -99,7 +102,7 @@ abstract contract ERC4626WrapperBaseTest is Test {

// Some tokens might have weird interest accrual mechanisms that get reset on transfers.
// Waiting some time might reveal inconsistencies in these tokens.
skip(1 days);
skip($.skipTime);
}

function _setupERC4626State() private {
Expand All @@ -119,6 +122,7 @@ abstract contract ERC4626WrapperBaseTest is Test {
$.underlyingToWrappedFactor = $.underlyingToWrappedFactor == 0
? 10 ** ($.wrapper.decimals() - IERC20Metadata(address($.underlyingToken)).decimals())
: $.underlyingToWrappedFactor;
$.skipTime = $.skipTime == 0 ? 1 days : $.skipTime;
}

/**
Expand Down
29 changes: 29 additions & 0 deletions test/mainnet/ERC4626MainnetHastraPrime.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity ^0.8.24;

import "forge-std/Test.sol";

import { IERC4626 } from "@openzeppelin/contracts/interfaces/IERC4626.sol";

import { ERC4626WrapperBaseTest, ERC4626SetupState, ForkState } from "../ERC4626WrapperBase.t.sol";

contract ERC4626MainnetHastraPrimeTest is ERC4626WrapperBaseTest {
function _setupFork() internal pure override returns (ForkState memory forkState) {
// Notice that when executing this function, the fork has not yet been created, so all chain states are empty.
forkState.network = "mainnet";
forkState.blockNumber = 25238060;
}

function _setUpForkTestVariables() internal pure override returns (ERC4626SetupState memory erc4626State) {
// PRIME
erc4626State.wrapper = IERC4626(0x19ebb35279A16207Ec4ba82799CC64715065F7F6);
// Donor of wYLDS tokens
erc4626State.underlyingDonor = 0x82E5871654b7635A5e3e8B9DDae019Dd3732e866;
erc4626State.amountToDonate = 1e4 * 1e6;
// PRIME reads its rate from a Hastra FeedVerifier backed by a Chainlink Data Streams feed with a 1-hour
// staleness window. The default 1-day skip pushes the cached report past that window, reverting the rate
// path; 30 minutes keeps the feed fresh.
erc4626State.skipTime = 30 minutes;
}
}
Loading