Skip to content
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

integrate using Holeksy LSD Rate Provider #200

Merged
merged 20 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"editor.formatOnSave": false,
"editor.trimAutoWhitespace": false,
"files.insertFinalNewline": false,
"files.trimFinalNewlines": false,
"files.trimTrailingWhitespace": false,
"files.trimTrailingWhitespace": false
}
26 changes: 13 additions & 13 deletions test/integration/ynEIGEN/AssetRegistry.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
uint256 wstethAmount,
uint256 woethAmount,
uint256 rethAmount
) public {
) public skipOnHolesky {
Copy link
Contributor

Choose a reason for hiding this comment

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

we use both this skipnHolesky and

vm.skip(_isHolesky());

let's just do one variant to keep it consistent

vm.assume(
wstethAmount < 100 ether && wstethAmount >= 1 wei &&
woethAmount < 100 ether && woethAmount >= 1 wei &&
Expand Down Expand Up @@ -141,7 +141,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assertEq(convertedAmount, expectedConvertedAmount, "Converted amount should match expected value based on real rate");
}

function testsfrxETHConvertToUnitOfAccountFuzz(uint256 amount) public {
function testsfrxETHConvertToUnitOfAccountFuzz(uint256 amount) public skipOnHolesky {
vm.assume(amount < 1000000 ether);

// End of the Selection
Expand Down Expand Up @@ -184,7 +184,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assertEq(convertedAmount, expectedConvertedAmount, "Converted amount should match expected value based on real rate");
}

function testsfrxETHconvertFromUnitOfAccountFuzz(uint256 amount) public {
function testsfrxETHconvertFromUnitOfAccountFuzz(uint256 amount) public skipOnHolesky {
vm.assume(amount < 1000000 ether);

IERC20 asset = IERC20(chainAddresses.lsd.SFRXETH_ADDRESS); // Using wstETH as the asset
Expand Down Expand Up @@ -253,7 +253,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
// AssetRegistry.addAsset
// ============================================================================================

function testAddAsset() public {
function testAddAsset() public skipOnHolesky {
uint256 totalAssetsBefore = assetRegistry.totalAssets();

IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);
Expand All @@ -273,7 +273,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assertEq(totalAssetsBefore, totalAssetsAfter, "Total assets count should remain the same after adding an asset");
}

function testAddDuplicateAssetShouldFail() public {
function testAddDuplicateAssetShouldFail() public skipOnHolesky {

IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);

Expand Down Expand Up @@ -301,7 +301,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assetRegistry.addAsset(assetWithoutPriceFeed); // This should fail as there's no price feed for SWELL
}

function testAddDisabledAssetShouldFail() public {
function testAddDisabledAssetShouldFail() public skipOnHolesky {
IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);
IStrategy swellStrategy = IStrategy(chainAddresses.lsdStrategies.SWELL_STRATEGY_ADDRESS);

Expand Down Expand Up @@ -342,7 +342,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
// AssetRegistry.disableAsset
// ============================================================================================

function testDisableAsset() public {
function testDisableAsset() public skipOnHolesky {
IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);
IStrategy swellStrategy = IStrategy(chainAddresses.lsdStrategies.SWELL_STRATEGY_ADDRESS);

Expand Down Expand Up @@ -379,7 +379,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assetRegistry.disableAsset(nonexistentAsset); // This should fail as the asset does not exist
}

function testDisableAssetWithoutPermissionShouldFail() public {
function testDisableAssetWithoutPermissionShouldFail() public skipOnHolesky {
IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);
IStrategy swellStrategy = IStrategy(chainAddresses.lsdStrategies.SWELL_STRATEGY_ADDRESS);

Expand All @@ -393,7 +393,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assetRegistry.disableAsset(swellAsset);
}

function testDisableAlreadyDisabledAssetShouldFail() public {
function testDisableAlreadyDisabledAssetShouldFail() public skipOnHolesky {
IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);
IStrategy swellStrategy = IStrategy(chainAddresses.lsdStrategies.SWELL_STRATEGY_ADDRESS);

Expand All @@ -413,7 +413,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assetRegistry.disableAsset(swellAsset); // This should fail as the asset is already disabled
}

function testDeleteAsset() public {
function testDeleteAsset() public skipOnHolesky {
IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);
IStrategy swellStrategy = IStrategy(chainAddresses.lsdStrategies.SWELL_STRATEGY_ADDRESS);

Expand Down Expand Up @@ -455,7 +455,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assertFalse(assetFound, "Asset should not be found after deletion");
}

function testDeleteAssetWithBalanceShouldFail() public {
function testDeleteAssetWithBalanceShouldFail() public skipOnHolesky {
IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);
IStrategy swellStrategy = IStrategy(chainAddresses.lsdStrategies.SWELL_STRATEGY_ADDRESS);

Expand Down Expand Up @@ -485,7 +485,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assetRegistry.deleteAsset(swellAsset);
}

function testDeleteAssetNotDisabledShouldFail() public {
function testDeleteAssetNotDisabledShouldFail() public skipOnHolesky {
IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);
IStrategy swellStrategy = IStrategy(chainAddresses.lsdStrategies.SWELL_STRATEGY_ADDRESS);

Expand Down Expand Up @@ -528,7 +528,7 @@ contract AssetRegistryTest is ynEigenIntegrationBaseTest {
assetRegistry.deleteAsset(rETHAsset);
}

function testDeleteAssetWithoutPermissionShouldFail() public {
function testDeleteAssetWithoutPermissionShouldFail() public skipOnHolesky {
IERC20 swellAsset = IERC20(chainAddresses.lsd.SWELL_ADDRESS);
IStrategy swellStrategy = IStrategy(chainAddresses.lsdStrategies.SWELL_STRATEGY_ADDRESS);

Expand Down
19 changes: 18 additions & 1 deletion test/integration/ynEIGEN/ynEigenIntegrationBaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {Utils} from "script/Utils.sol";
import {ActorAddresses} from "script/Actors.sol";
import {TestAssetUtils} from "test/utils/TestAssetUtils.sol";
import {LSDRateProvider} from "src/ynEIGEN/LSDRateProvider.sol";
import {HoleskyLSDRateProvider} from "src/testnet/HoleksyLSDRateProvider.sol";
import {LSDWrapper} from "src/ynEIGEN/LSDWrapper.sol";
import {RedemptionAssetsVault} from "src/ynEIGEN/RedemptionAssetsVault.sol";
import {WithdrawalQueueManager} from "src/WithdrawalQueueManager.sol";
Expand Down Expand Up @@ -54,6 +55,7 @@ contract ynEigenIntegrationBaseTest is Test, Utils {
// Utils
ContractAddresses public contractAddresses;
ContractAddresses.ChainAddresses public chainAddresses;
ContractAddresses.ChainIds chainIds;
ActorAddresses public actorAddresses;
ActorAddresses.Actors public actors;

Expand Down Expand Up @@ -85,6 +87,11 @@ contract ynEigenIntegrationBaseTest is Test, Utils {
// LSD
IERC20[] public assets;

modifier skipOnHolesky() {
vm.skip(block.chainid == chainIds.holeksy, "Impossible to test on Holesky");

_;
}

function setUp() public virtual {

Expand All @@ -93,6 +100,9 @@ contract ynEigenIntegrationBaseTest is Test, Utils {
contractAddresses = new ContractAddresses();
actorAddresses = new ActorAddresses();

(uint256 mainnet, uint256 holeksy) = contractAddresses.chainIds();
chainIds = ContractAddresses.ChainIds(mainnet, holeksy);

// Setup Protocol
setupUtils();
setupYnEigenProxies();
Expand All @@ -115,7 +125,12 @@ contract ynEigenIntegrationBaseTest is Test, Utils {
eigenStrategyManager = new EigenStrategyManager();
tokenStakingNodesManager = new TokenStakingNodesManager();
assetRegistry = new AssetRegistry();
rateProvider = new LSDRateProvider();

if (block.chainid == chainIds.mainnet) {
rateProvider = new LSDRateProvider();
} else if (block.chainid == chainIds.holeksy) {
rateProvider = LSDRateProvider(address(new HoleskyLSDRateProvider()));
}
ynEigenDepositAdapterInstance = new ynEigenDepositAdapter();

ynEigenProxy = new TransparentUpgradeableProxy(address(ynEigenToken), actors.admin.PROXY_ADMIN_OWNER, "");
Expand All @@ -130,7 +145,9 @@ contract ynEigenIntegrationBaseTest is Test, Utils {
eigenStrategyManager = EigenStrategyManager(payable(eigenStrategyManagerProxy));
tokenStakingNodesManager = TokenStakingNodesManager(payable(tokenStakingNodesManagerProxy));
assetRegistry = AssetRegistry(payable(assetRegistryProxy));

rateProvider = LSDRateProvider(payable(rateProviderProxy));

ynEigenDepositAdapterInstance = ynEigenDepositAdapter(payable(ynEigenDepositAdapterProxy));

// Re-deploying ynEigen and creating its proxy again
Expand Down
12 changes: 11 additions & 1 deletion test/scenarios/ynEIGEN/ynLSDeScenarioBaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {RedemptionAssetsVault} from "src/ynEIGEN/RedemptionAssetsVault.sol";
import {WithdrawalQueueManager} from "src/WithdrawalQueueManager.sol";
import {LSDWrapper} from "src/ynEIGEN/LSDWrapper.sol";


import {Test} from "forge-std/Test.sol";

contract ynLSDeScenarioBaseTest is Test, Utils {
Expand Down Expand Up @@ -59,6 +58,14 @@ contract ynLSDeScenarioBaseTest is Test, Utils {

function setUp() public virtual {
assignContracts();

// Upgrade StakingNode implementation with EL slashing upgrade changes
if (_isHolesky()) {
address newStakingNodeImplementation = address(new TokenStakingNode());
vm.startPrank(chainAddresses.ynEigen.TIMELOCK_CONTROLLER_ADDRESS);
tokenStakingNodesManager.upgradeTokenStakingNode(newStakingNodeImplementation);
vm.stopPrank();
}
}

function assignContracts() internal {
Expand Down Expand Up @@ -89,6 +96,9 @@ contract ynLSDeScenarioBaseTest is Test, Utils {
redemptionAssetsVault = RedemptionAssetsVault(chainAddresses.ynEigen.REDEMPTION_ASSETS_VAULT_ADDRESS);
withdrawalQueueManager = WithdrawalQueueManager(chainAddresses.ynEigen.WITHDRAWAL_QUEUE_MANAGER_ADDRESS);
wrapper = LSDWrapper(chainAddresses.ynEigen.WRAPPER);
}

function _isHolesky() internal view returns (bool) {
return block.chainid == 17000;
}
}
Loading
Loading